Vanilla Inventory Doesn't Update Comparator Output After Being Extracted or Inserted.
Phoupraw opened this issue · 5 comments
I get ItemExtractable
and ItemInsertable
by invoking ItemAttributes.EXTRACTABLE.get
and ItemAttributes.INSERTABLE.get
. I move ItemStack
by invoking ItemInvUtil.move
. And then I found that vanilla inventory doesn't update comparator output after being extracted or inserted. If I insert something into an ItemInsertable
, its comparator output keeps zero. If I extract an ItemInsertable
until it's empty, its comparator output keeps non-zero.
That's strange. Simple pipes seems to work correctly when moving items from one chest to another, which invokes ItemInsertable.attemptInsertion
directly - however that's all that ItemInvUtil.move
does internally, so I'm not sure if that's the issue.
What vanilla block(s) are you extracting from / inserting into?
Ok. I seem to have wrongly assumed that Inventory.setStack()
always calls Inventory.markDirty()
internally - even though most inventories do this, not all of them do. I'll add a call to markDirty()
after calling Inventory.setStack()
.
Ok, can you retry with 0.10.1-rc.2
? That should fix this bug. (If you're not using 1.18 then I can push a bugfix to other branches too).
That's strange. Simple pipes seems to work correctly when moving items from one chest to another, which invokes
ItemInsertable.attemptInsertion
directly - however that's all thatItemInvUtil.move
does internally, so I'm not sure if that's the issue.What vanilla block(s) are you extracting from / inserting into?
Hopper. And I found other vanilla inventories are all normal. The following picture shows my test. The "white hopper" is my custom block, and it is its block entity which invokes ItemInvUtil.move
.