NyakoFox / VanitySlots-Legacy

GNU General Public License v3.0
0 stars 2 forks source link

Equipments in vanity slots may be obtained as equiped stacks while in server thread #17

Open Karashok-Leo opened 8 months ago

Karashok-Leo commented 8 months ago

Log file https://pastebin.com/KW3Dm9D7 No need to pay attention to taggen 1.0.0, which is the mod I use to output Player Health: xxx information.

In the game, I prepared a set of diamond armors and a set of iron armors. My max health is 20 when wearing diamond armors, and 22 when wearing iron armors. (This feature comes from TieredZ mod.) Then I discovered that when I put iron armors in the vanilla armor slots and diamond armors in the vanity slots, my max health may jump between 22 and 20, which happens occasionally, perhaps more frequently in modpack with lots of mods.

My debug information looks like this: [16:56:47] [Render thread/INFO]: Player Health: 22.0 [16:56:57] [Server thread/INFO]: Player Health: 22.0 [16:56:57] [Server thread/INFO]: Player Health: 20.0 [16:56:57] [Render thread/INFO]: Player Health: 20.0 [16:56:57] [Server thread/INFO]: Player Health: 22.0 [16:56:57] [Server thread/INFO]: Player Health: 22.0 [16:56:57] [Render thread/INFO]: Player Health: 22.0 [16:56:57] [Render thread/INFO]: Player Health: 22.0

I think the problem may have happened here. https://github.com/NyakoFox/VanitySlots/blob/a1779a93fbaf7f4e1d96393c901c050ff11e7474/src/main/java/gay/nyako/vanityslots/mixin/MixinPlayerEntity.java#L30

It is possible that while calling getEquipedStack in server thread, it outputs Player Health: 20.0, which means the return value is the diamond armors equipped in the vanity slots.

TheDiamondSquidy commented 3 months ago

This interferes with wearing a backpack and having it open, it just closes it