Ladysnake / Locki

A library for controlling access to the player's inventory
GNU Lesser General Public License v3.0
4 stars 3 forks source link

Incompatibility with Figura due to Locki #5

Open Eir-nya opened 1 year ago

Eir-nya commented 1 year ago

Figura has a method, player:getNbt(), usable by model creators, that fetches the player's NBT as json and converts it to a Lua table. Normally this works fine, but when using this with Requiem present as well, the method returns this error:

vm error: java.lang.IllegalStateException: Locks can only be managed serverside (check !world.isClient)

Stacktrace in Minecraft log

Version info: Minecraft: 1.19.2 Quilt: 0.18.2 Java: 18 (also on 17) Figura: 0.1.0 rc13 Requiem: 2.0.0 beta 16

Looking at the stack trace, I've managed to trace it back to these two methods in Locki:

From what I can understand, it seems like when Figura puts in a request to retrieve the player's NBT, it trips InventoryKeeperBase.writeToNbt, and since the call is coming from the minecraft client rather than server, PlayerInventoryKeeper.getLocks throws an error.

It seems a bit weird that just getting lock data on the client side rather than the server side is grounds to throw an error, and I imagine any other mod that fetches NBT on the client side would similarly encounter this error when run alongside Requiem/Locki.

Eman-3600 commented 1 year ago

Locki has its own issue tracker. You should probably post this there instead. https://github.com/Ladysnake/Locki/issues