Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 ....

  • 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?

  • 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...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.