Lib Block Attributes

Lib Block Attributes

853k Downloads

Vanilla Inventory Doesn't Update Comparator Output After Being Extracted or Inserted.

Phoupraw opened this issue · 5 comments

commented

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.

commented

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?

commented

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().

commented

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).

commented

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?

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.
issue截图

commented

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).

Yes. I tried just now, and found that hoppers were normally updating comparator power. Thank you for your fixing.