Botania

Botania

133M Downloads

Corpoera sparks iterate storage views outside transaction

MattiDragon opened this issue ยท 0 comments

commented

Mod Loader

Fabric

Minecraft Version

1.19.2

Botania version

1.19.2-440-fabric

Modloader version

Not relevant

Modpack info

No response

The latest.log file

Not available

Issue description

The current implementation of transfer api corpoera sparks iterates over the views of the found storage and interacts with each of them in their own transaction. This works in most cases but doesn't work with extended drawers and other mods that modify views at the end of transactions.

Because the slots of drawers in extended drawers must stay in correct order I sort the slots in the drawer storage in an outer close callback (runs after top level transaction completes). This causes issues with botania because that mutates the list that botania is iterating over, causing a CME. This could easily be fixed on your end by wrapping the iteration in an outer transaction and creating nested transaction for each view. You might not even need the nested transactions as it seems like you commit all or none anyways.

Steps to reproduce

To reproduce the CME:

  1. Install botania (any version with transfer api support) and extended drawers (any version) on fabric
  2. Place a quad drawer down
  3. Attach a corpoera network to the drawer
  4. Attempt to remove items from the network
    --> crash

Other information

Originally reported here

I don't have access to my computer right now so I can't actually reproduce this, but I've read the code and believe that the bug is present