shadowfacts / UnderwaterUtilities

Helpful utilities for working underwater.
https://rtfm.shadowfacts.net/underwater-utilities/info/
GNU Lesser General Public License v3.0
5 stars 1 forks source link

Calling client-side methods in a server context leads to NoSuchMethodError #11

Closed srs-bsns closed 7 years ago

srs-bsns commented 7 years ago

https://github.com/shadowfacts/UnderwaterUtilities/blob/1.11/src/main/kotlin/net/shadowfacts/underwaterutilities/event/EventHandler.kt#L20 https://github.com/shadowfacts/UnderwaterUtilities/blob/1.11/src/main/kotlin/net/shadowfacts/underwaterutilities/event/EventHandler.kt#L34

net.minecraft.entity.player.InventoryPlayer#armorItemInSlot is annotated @SideOnly(Side.CLIENT) and cannot be called from a server context. This leads to:

05.01 06:26:29 [Server] Server thread/ERROR [FML]: Exception caught during firing event net.minecraftforge.event.entity.living.LivingEvent$LivingUpdateEvent@62ca2e07:
05.01 06:26:29 [Server] INFO java.lang.NoSuchMethodError: net.minecraft.entity.player.InventoryPlayer.func_70440_f(I)Lnet/minecraft/item/ItemStack;
05.01 06:26:29 [Server] INFO at net.shadowfacts.underwaterutilities.event.EventHandler.onLivingUpdate(EventHandler.kt:20) ~[EventHandler.class:?]

http://pastebin.com/GZTKQ7Ui

shadowfacts commented 7 years ago

Fixed for 1.11 in version 1.2.1 and 1.10.2 in version 1.1.1.