IlMusu / IlMusuEnchantmentsMod

Other
6 stars 2 forks source link

incompatible with switchy inventories #33

Closed mrcrashmer closed 6 months ago

mrcrashmer commented 6 months ago

when trying to enable the inventions module, the server spams with an error and disconnects the server. The enchantment of Pocketed is to blame image

sisby-folk commented 6 months ago

Switchy inventories creates PlayerInventory instances with a null player.

The line that causes the crash is CustomCallbacksMixins.java#L241

just change PlayerEquipCallback.ARMOR.invoker().handler(inventory.player, stack, equipmentSlot);

to

if (inventory.player != null) PlayerEquipCallback.ARMOR.invoker().handler(inventory.player, stack, equipmentSlot);

IlMusu commented 6 months ago

Hi @sisby-folk, I have a question... just to be sure about what is happening here. The PlayerInventories, with null player, that Switchy Inventories creates are not the real inventory of the player but a sort of template?

sisby-folk commented 6 months ago

Correct, they're not a real inventory of the player - more like a "backup" of the inventory that the player can swap back to later.