Quark icon indicating copy to clipboard operation
Quark copied to clipboard

[Bug][1.20.1] All items vanish from Storage Crate on world save (mod conflict)

Open mikkolukas opened this issue 9 months ago • 1 comments

edit: I have further narrowed the scope and can now consistently reproduce the bug in an dedicated server <-> client environment, but reducing the mod list.


Minecraft 1.20.1 Forge 47.3.25 (as latest Forgified Fabric API crashes on latest Forge 47.3.27 (link))

Mods

Install on Client and server

Quark 1.20.1-4.0-460 Quark Oddities 1.20.1

Dependencies Zeta 1.20.1-1.0-24

Install on Server only

Concurrent Chunk Management Engine (Fabric) (aka C2ME) 0.2.0+alpha.11.15+1.20.1 ~~Server Performance - Smooth Chunk Save (aka Smooth Chunk Mod) 1.20.1-4.0~~

Dependencies Sinytra Connector 1.0.0-beta.46+1.20.1 Forgified Fabric API 0.92.2+1.11.10+1.20.1 ~~Cupboard Utilities 1.20.1-2.7~~

Why am I posting this as a Quark issue?

Because it is ONLY the Quark Storage Crate that have this issue. Other interactive blocks (both Quark and vanilla) do not have this issue, leading me to suspect that the code for the Storage Crate could benefit of a small review.

~~I know the elephant in the room is that both C2ME and Smooth Chunk handles chunks and that the bug very well could be between those two, but then the issue would also exist for other interactive blocks.~~

Somehow quark handles it gracefully for other Quark interactive blocks. My hope is that the Storage Crate can have the same graceful behavior - even if the root of the problem should be a conflict between the other mods.

Quark do not have the responsibility to fix bugs for other mods, but it seems like Quark already have a working solution at hand in those other interactive blocks, so the fix is potentially easy to do (maybe? 😬)

How to reproduce

~~1. Launch a new instance as detailed above 2. Click Singleplayer 3. Click Create New World (making it a Creative one is probably a good idea) 4. Place a Storage Crate in the world 5. Put an item in the Storage Crate (I have used iron_axe in my testing) 6. Press [Escape] and click Save and Quit to Title 7. Click Singleplayer 8. Launch the saved world 9. Open the Storage Crate~~

  1. Launch a dedicated server as detailed above
  2. Launch a new client instance as detailed above
  3. Click Multiplayer
  4. Join the server
  5. Place a Storage Crate in the world
  6. Put an item in the Storage Crate (I have used iron_axe in my testing)
  7. Press [Escape] and click Disconnect
  8. Restart the server
  9. Join the server
  10. Open the Storage Crate

What was expected: The item to be in the Storage Crate
What happened: The Storage Crate is empty

Workaround: Removing ~~either~~ C2ME ~~or Smooth Chunk (or both)~~ makes the Storage Crate work as expected (it doesn't bring the item back though).

Observation: Even when items are placed in a world while C2ME was not installed, then as soon as one stops the server with C2ME installed (even without making any changes to the world) the items disappear from the Storage Crate.

Log: ~~mclo.gs/SY7kyek (and also to pastebin.com/hgnHbX7H as requested in CONTRIBUTING.md)~~

mikkolukas avatar Feb 02 '25 14:02 mikkolukas

I have reported the bug to C2ME too: github.com/RelativityMC/C2ME-fabric/issues/406

mikkolukas avatar Feb 02 '25 19:02 mikkolukas

Thank you for the detailed report. I think I agree with the maintainer of C2ME in that issue, C2ME over Sinytra Connector is just not going to end well.

This is how Quark finds its item handler to serialize the items.

https://github.com/VazkiiMods/Quark/blob/772bdfac2cd290d3c1d3c66a79e3790e99de1271/src/main/java/org/violetmoon/quark/addons/oddities/block/be/CrateBlockEntity.java#L76

https://github.com/VazkiiMods/Quark/blob/772bdfac2cd290d3c1d3c66a79e3790e99de1271/src/main/java/org/violetmoon/quark/addons/oddities/block/be/CrateBlockEntity.java#L86-L93

Unless something is going seriously pear-shaped with getCapability this should always work fine. Guess that "should never happen" is happening...

It might actually be more helpful to let it crash in this case and at least get a stacktrace.

quat1024 avatar Mar 16 '25 20:03 quat1024