Posted February 11, 201510 yr Hi, When I run MC dedicaded Server with an eclipse project it crash on this line code: player.getFoodStats().setFoodLevel(food); but not in single player. Crash error: java.lang.NoSuchMethodError: net.minecraft.util.FoodStats.setFoodLevel(I)V at com.mymod.proxy.CommonProxy.teleportme(CommonProxy.java:179) ~[CommonProxy.class:?] at com.mymod.main.FMLEventHandler.onPlayerTick(FMLEventHandler.java:188) ~[FMLEventHandler.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_FMLEventHandler_onPlayerTick_PlayerTickEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?] at cpw.mods.fml.common.FMLCommonHandler.onPlayerPostTick(FMLCommonHandler.java:350) [FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:392) [EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) [EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) [NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) [C03PacketPlayer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:111) [C03PacketPlayer.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:349) [DedicatedServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [20:44:40] [server thread/ERROR] [FML]: Index: 2 Listeners: [20:44:40] [server thread/ERROR] [FML]: 0: NORMAL [20:44:40] [server thread/ERROR] [FML]: 1: ASM: com.portalgates.main.FMLEventHandler@5805d830 onEvent(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V [20:44:40] [server thread/ERROR] [FML]: 2: ASM: com.portalgates.main.FMLEventHandler@5805d830 onPlayerTick(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V [20:44:40] [server thread/WARN] [net.minecraft.network.NetworkSystem]: Failed to handle packet for /127.0.0.1:56567 net.minecraft.util.ReportedException: Ticking player at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:384) ~[EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) ~[C03PacketPlayer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:111) ~[C03PacketPlayer.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) ~[NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:349) [DedicatedServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Caused by: java.lang.NoSuchMethodError: net.minecraft.util.FoodStats.setFoodLevel(I)V at com.portalgates.proxy.CommonProxy.teleportme(CommonProxy.java:179) ~[CommonProxy.class:?] at com.portalgates.main.FMLEventHandler.onPlayerTick(FMLEventHandler.java:188) ~[FMLEventHandler.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_FMLEventHandler_onPlayerTick_PlayerTickEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?] at cpw.mods.fml.common.FMLCommonHandler.onPlayerPostTick(FMLCommonHandler.java:350) ~[FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:392) ~[EntityPlayer.class:?] at net.minecraft.entity.player Please help ....
February 11, 201510 yr Author setFoodLevel has @SideOnly(CLIENT), which means it cannot be used on a DedicatedServer. You will need to use reflection to access the field directly. Reflection? have you a sample?
February 11, 201510 yr Author http://docs.oracle.com/javase/tutorial/reflect/ oh thanks, but I'm sorry, I mean you have the specific sample regarding the "FoodStat"? After I'll study ALL oracle libriries I swaer....
February 11, 201510 yr Author No, I will not write the code for you. Feel free to choose any other reflection tutorial out there. There are plenty. YES, indeed I said "specific sample" aka tutorial. unfortunately looking on google I have not found anything about it...
February 11, 201510 yr Author "it was so difficult?" I suppose ... YES ahahahahaah so funny ... anyway thanks
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.