samolego / GolfIV

An anti-exploit attempt for Fabric
https://modrinth.com/mod/golfiv
MIT License
49 stars 13 forks source link

`patchItemSave` clears all inventories on world save #57

Open Ampflower opened 2 years ago

Ampflower commented 2 years ago

Description

The configuration, patchItemSave, clears all items from the world on either manual save (i.e. pausing the world on the client, or running /save-all on the server), or periodically by the auto-save timer.

Steps to reproduce.

  1. /save-all, pause the game (client only), or wait for the auto-save timer. This may also apply when you stop and start the world on the client due to the potential of two save rounds occurring, one for pause, and one for server shutdown.
  2. Notice how all items and inventories that stayed after the save round has disappeared, or has been emptied.

Cause

Line 26, this.setCount(0) https://github.com/samolego/GolfIV/blob/354e9bf3cf89c93eff629392f8ae7d294cc868e8/src/main/java/org/samo_lego/golfiv/mixin/duplication/ItemStackMixin_SavePatch.java#L22-L37

Current Workarounds

Disable patchItemSave by setting the value in the config to false.

Possible fixes

samolego commented 2 years ago

I'm pretty sure I meant to implement this as if inventory would be destroyed afterwards, as you've mentioned in Possible fixes. I'll release a version without this as it's clearly not the intended thing