Lightman's Currency

Lightman's Currency

331k Downloads

Equipping the wallet and jumbling inventory deletion

Katsunsama opened this issue ยท 4 comments

commented

Minecraft 1.18.1 | Forge 39.0.6 | Lightman's Currency v1.0.1.7

If you are in Survival this has little to no downsides, it's just strange and potentially scary if you're unaware:
https://streamable.com/znmz9u

If you are in Creative this little inventory jumble will delete your entire inventory minus the top row:
https://streamable.com/yl3e59

Ive attached videos because it doesnt cause a crash, if any additional information is needed I can provide but this is a pretty straightforward and standalone issue.

commented

Thank you for the explanation, and the fix!

It's not hard to be thorough like this so I try to give as much info as possible :)

commented

Odd. It appears as though the client-side WalletMenu isn't updating it's slots to add the coin slots when the wallet is equipped, which is what's causing the jumble, as the server sends an update saying that the players inventory is in slot 2-37 (slot 1 is always the wallet slot), but since the coin slots that shouldn't be there are there slot some of slot 2-37 are the coin slots, and thus your inventory gets told that it's there. I'll look into why it's not properly updating client side, but I could probably at the least fix the inventory from ever being desynchronized by creating the inventory slots before the coin slots that may or may not be there, such that the inventory slots index's are constant and thus won't be scrambled in such a way.

Also thanks for being thorough with the videos & exact versions :) Doesn't happen as often as it should sadly.

commented

Fixed in v1.18-1.0.1.7a.

commented

After some quick testing, I've noticed that this only happens in on multiplayer server, not on a single-player world. No clue why, but my guess is it's because the WorldTick event doesn't get called client-side if you're on a server instead of in single-player (despite the event having a flag for checking whether it's the logical client or server). I should be able to fix it, by having the client-side init check called on the screen tick, but I'm still going to rearrange the slot order so that the inventory indexes are effectively constant to prevent any similar issues from happening in the future.
Fortunately I don't believe this issue should happen in the 1.16 version, as 1.16 reinitializes the container slots using a more convenient & instantaneous method, that sadly isn't possible in 1.18.