LiquidBounce
LiquidBounce copied to clipboard
feat(invcleaner): keep the fullest block stack in the block slot
What
Makes InventoryCleaner keep the fullest block stack in the block slot, instead of a near-empty one.
Problem
BlockItemFacet used ModuleScaffold.BLOCK_COMPARATOR_FOR_INVENTORY, which prefers the smaller stack (PreferStackSize.PREFER_FEWER). So the cleaner could leave a nearly empty stack in the block slot while a full stack sat elsewhere in the inventory, and the choice between similar stacks felt random.
How
BlockItemFacet now has its own comparator chain:
- Block quality first (favourable / solid / full-cube / walkable / hardness) — unchanged, so a worse block never wins just by count.
- Among equally good blocks, prefer the one with more items.
- A small hysteresis: counts within 1 of each other are treated as equal and the tie is broken by hotbar preference — so the cleaner does not keep swapping between, say, a 63 and a 64 stack, but a clearly larger inventory stack will still replace a nearly empty one in hand.
Scaffold's own comparators are left untouched.
🤖 Generated with Claude Code
The code seems alright so far and makes sense, however, have you actually tested it in action?
yes, it works, tested with own compiled build