FabricMC / fabric

Essential hooks for modding with Fabric.
Apache License 2.0
2.38k stars 418 forks source link

Chest Neighbor Update triggers during uncomitted Transfer-API Transactions #1912

Closed shartte closed 2 years ago

shartte commented 2 years ago

When items are being extracted from or inserted into a chest via the Fabric transfer API, the chest will notify its neighbors about the changed comparator signal due to the changed storage. It does this before the transaction is comitted.

This may cause adjacent blocks to react continuously to attempted ("simulated") extracts even though no transaction is ever being comitted. Additionally, blocks that perform any inventory action in the neighbor update will actually crash the game when they try to create a Transaction of their own, since a transaction is already ongoing, but they do not have access to this transaction.

Technici4n commented 2 years ago

I blame AE2 sending a change notification when markDirty is called, which is forge behavior but NOT vanilla or default fabric behavior.

Technici4n commented 2 years ago

However the issue is still relevant since a comparator update in an unwanted markDirty could send a neighbor update with potential consequences (on top of the markDirty performance hit).