MCPcopy Index your code
hub / github.com/2No2Name/hopperOptimizations

github.com/2No2Name/hopperOptimizations @v2.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.1 ↗ · + Follow
345 symbols 765 edges 44 files 46 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Hopper Optimizations Mod

This Mod optimizes hoppers interacting with inventories and item entities. Only modifications that only optimize the game without changing any behavior ingame are enabled by default. This branch of hopper optimizations requires installing 2No2Name's fork of Lithium.

Enabled Features (partially toggleable in the future)

Inventory Optimizer

Inventories keep extra data (modification counter, item type -> slot mask lookup table, empty & full slot masks) to be able to skip searching though the whole inventory

Entity Tracking

Hoppers use Lithium's entity tracker engine (adapted in 2No2Name's fork of Lithium) to avoid searching for entities (items + inventory minecarts)

Cache Inventories

Hoppers keep a reference to the inventory blocks (block entities or composters) they interact with to avoid retrieving them from the world all the time.

Fast Signal Strength

Comparators use the extra data from Inventory Optimizer (weighted item counter) to determine the signal strength of an inventory without accessing its slots.

Use cached empty state of Item stacks

Item stacks cache whether they are empty in vanilla, but at the same time the value is recalculated often for no reason. Instead always use the cached value.

Disabled Features (toggleable in the future)

These optimizations have effects that are detectable ingame, so they might break contraptions and are disabled until a toggle system is added.

simplifiedHopperPickupShape

Simplified hopper box shape when picking up items. This box contains the ring around the hopper's bowl. This change is barely detectable in gameplay (requires entity moving into the collision box, e.g. in item elevators with a hopper inside, the item may be picked up slightly earlier) but still non-vanilla behavior.

simplifiedItemElevatorCheck

Removes check whether item entities have to move out of another entity (boat, shulker), which causes item entities to lag less at the cost of no longer moving out of boats and shulkers. This change is easily detectable with redstone and therefore clearly non-vanilla behavior.

failedTransferNoComparatorUpdates

Removes comparator updates when item transfers fail. This change is detectable with redstone and therefore clearly non-vanilla behavior.

License

MIT

Extension points exported contracts — how you extend this code

OptimizedInventory (Interface)
(no doc) [9 implementers]
src/main/java/hopperOptimizations/utils/inventoryOptimizer/OptimizedInventory.java
IValidInventoryUntilBlockUpdate (Interface)
(no doc) [6 implementers]
src/main/java/hopperOptimizations/features/cacheInventories/IValidInventoryUntilBlockUpdate.java
IHopper (Interface)
(no doc) [4 implementers]
src/main/java/hopperOptimizations/utils/IHopper.java
HopperWithClearableCaches (Interface)
(no doc) [3 implementers]
src/main/java/hopperOptimizations/workarounds/HopperWithClearableCaches.java
INoExtractInventoryUntilBlockUpdate (Interface)
(no doc) [2 implementers]
src/main/java/hopperOptimizations/features/cacheInventories/INoExtractInventoryUntilBlockUpdate.java

Core symbols most depended-on inside this repo

getOptimizer
called by 19
src/main/java/hopperOptimizations/utils/inventoryOptimizer/OptimizedInventory.java
ofSize
called by 13
src/main/java/hopperOptimizations/utils/inventoryOptimizer/InventoryListOptimized.java
get
called by 13
src/main/java/hopperOptimizations/features/entityTracking/IteratorWrapperList.java
isEmpty
called by 11
src/main/java/hopperOptimizations/utils/inventoryOptimizer/InventoryOptimizer.java
getInventoryChangeCount
called by 9
src/main/java/hopperOptimizations/utils/inventoryOptimizer/InventoryOptimizer.java
size
called by 7
src/main/java/hopperOptimizations/utils/inventoryOptimizer/DoubleInventoryOptimizer.java
size
called by 7
src/main/java/hopperOptimizations/utils/inventoryOptimizer/InventoryOptimizer.java
remove
called by 7
src/main/java/hopperOptimizations/features/entityTracking/IteratorWrapperList.java

Shape

Method 296
Class 39
Interface 10

Languages

Java100%

Modules by API surface

src/main/java/hopperOptimizations/utils/inventoryOptimizer/InventoryOptimizer.java30 symbols
src/main/java/hopperOptimizations/utils/inventoryOptimizer/DoubleInventoryOptimizer.java25 symbols
src/main/java/hopperOptimizations/mixins/HopperBlockEntityMixin_Main.java23 symbols
src/main/java/hopperOptimizations/features/entityTracking/ListSingleItemWrapper.java22 symbols
src/main/java/hopperOptimizations/features/entityTracking/IteratorWrapperList.java22 symbols
src/main/java/hopperOptimizations/utils/inventoryOptimizer/InventoryListOptimized.java17 symbols
src/main/java/hopperOptimizations/mixins/cacheInventories/HopperBlockEntityMixin.java17 symbols
src/main/java/hopperOptimizations/features/entityTracking/NearbyHopperItemsTracker.java17 symbols
src/main/java/hopperOptimizations/utils/HopperHelper.java13 symbols
src/main/java/hopperOptimizations/features/entityTracking/NearbyEntityTrackerBox.java13 symbols
src/main/java/hopperOptimizations/mixins/entityTracking/HopperBlockEntityMixin.java12 symbols
src/main/java/hopperOptimizations/workarounds/Interfaces.java11 symbols

For agents

$ claude mcp add hopperOptimizations \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact