ValkyrienSkies / Eureka

Basically Archimedes Ships, but with VS2 as the backend
Apache License 2.0
57 stars 33 forks source link

Item duplication with Sophisticated Storage chests on ships when assembling/disassembling #295

Open dwayn opened 9 months ago

dwayn commented 9 months ago

This issue occurs when only Valkyrien Skies and addons are installed and no other mods

Minecraft Version

1.19

Mod Loader

Forge

Issue description

When assembling or disassembling a ship with a Sophisticated Storage chest on the ship, if there are any items in the sophisticated chest, all of the items will be spit out into the world as if the chest had been broken, and the chest will also retain its contents. This appears to likely be related to these issues as well: #270 and #251

I will also open a corresponding issue on sophisticated storage's issue tracker to see if they can add compatibility by implementing clear class for their containers as mentioned in #270 comments

Note: this obviously involves interaction with another mod, but I could not file the bug without checking the "no other mods involved" checkbox, and I wasn't sure this is purely a compat issue, but feel free to recategorize it if it should be

Issue reproduction

Build any eureka ship, add a sophisticated storage chest to the ship, put some items in the chest and assemble or disassemble. You should see the items from the chest spit out into the world and the contents of the chest will also be preserved.

Logs

No response

dwayn commented 9 months ago

I did some digging and decided it looked not too bad to try and create a compatibility mod to patch the behavior, so for now I have created this: https://github.com/dwayn/ValkyrienSkiesSophisticatedStorageCompat to make sophisticated storage work with VS2. I have posted it to curse, so once it is approved, it will be available to whoever wants it. Effectively it just sets the packed state (same thing as applying packing tape from the same mod) on sophisticated storage chests/barrels when Clearable is called by VS2. The effect is that when VS2 calls relocate block, it clones the block and its metadata, calls the Clearable implementation I added to the Sophisticated container which sets itself as packed (only when it is called from VS2), so that when VS2 destroys the container block to relocate it to wherever the blocks are moved for physics simulation (i haven't figured out exactly where this is but it is not in the same place in the world where the ship was built), the container only drops itself and not its contents, allowing VS2 to place the cloned block in the new location.

I purposely added some protective code in my mod to ensure that the only calls that originate from somewhere in valkyrien skies mod would trigger this behavior because i was not sure if there were other implications of just implementing Clearable and leaving it open to all callers. It would be nice if Sophisticated Storage could just implement Clearable natively, assuming that it does not have ripple out effects of breaking other things.

WaffleDevs commented 8 months ago

Confimed on 1.18.2 1.4.0-beta.1