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

Hello! When ever I go to run my mod on a server the tickhandler crashes when I go to join but it works perfectly fine on just a Client. Here is my code/crash report:

 

2013-11-28 12:35:53 [sEVERE] [Minecraft-Server] Reached end of stream for /127.0.0.1
2013-11-28 12:35:55 [iNFO] [ForgeModLoader] User Player414 connecting with mods [Wintercraft, EnchantedWoodlands, Forge]
2013-11-28 12:35:55 [iNFO] [Minecraft-Server] Player414[/127.0.0.1:53995] logged in with entity id 379 at (-197.5, 69.0, 238.5)
2013-11-28 12:35:55 [iNFO] [Minecraft-Server] Player414 joined the game
2013-11-28 12:35:56 [sEVERE] [ForgeModLoader] A critical server error occured handling a packet, kicking 379
net.minecraft.util.ReportedException: Ticking player
at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:374)
at net.minecraft.network.NetServerHandler.handleFlying(NetServerHandler.java:304)
at net.minecraft.network.packet.Packet10Flying.processPacket(Packet10Flying.java:51)
at net.minecraft.network.TcpConnection.processReadPackets(TcpConnection.java:462)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
at net.minecraft.server.dedicated.DedicatedServerListenThread.networkTick(DedicatedServerListenThread.java:34)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:276)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NoSuchMethodError: net.minecraft.entity.player.EntityPlayer.getSleepTimer()I
at wintercraft.helper.proxy.ServerTickHandler.onPlayerTick(ServerTickHandler.java:38)
at wintercraft.helper.proxy.ServerTickHandler.tickStart(ServerTickHandler.java:28)
at cpw.mods.fml.common.SingleIntervalHandler.tickStart(SingleIntervalHandler.java:28)
at cpw.mods.fml.common.FMLCommonHandler.tickStart(FMLCommonHandler.java:122)
at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:383)
at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:282)
at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:325)
... 11 more
2013-11-28 12:35:56 [WARNING] [Minecraft-Server] Failed to handle packet for Player414/127.0.0.1: net.minecraft.util.ReportedException: Ticking player
net.minecraft.util.ReportedException: Ticking player
at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:374)
at net.minecraft.network.NetServerHandler.handleFlying(NetServerHandler.java:304)
at net.minecraft.network.packet.Packet10Flying.processPacket(Packet10Flying.java:51)
at net.minecraft.network.TcpConnection.processReadPackets(TcpConnection.java:462)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
at net.minecraft.server.dedicated.DedicatedServerListenThread.networkTick(DedicatedServerListenThread.java:34)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:276)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NoSuchMethodError: net.minecraft.entity.player.EntityPlayer.getSleepTimer()I
at wintercraft.helper.proxy.ServerTickHandler.onPlayerTick(ServerTickHandler.java:38)
at wintercraft.helper.proxy.ServerTickHandler.tickStart(ServerTickHandler.java:28)
at cpw.mods.fml.common.SingleIntervalHandler.tickStart(SingleIntervalHandler.java:28)
at cpw.mods.fml.common.FMLCommonHandler.tickStart(FMLCommonHandler.java:122)
at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:383)
at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:282)
at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:325)
... 11 more
2013-11-28 12:35:56 [iNFO] [Minecraft-Server] Player414 left the game
2013-11-28 12:35:56 [sEVERE] [Minecraft-Server] Reached end of stream for /127.0.0.1

 

Main Mod Class:

@Mod(modid="Wintercraft", name="Wintercraft", version="1.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)

public class Wintercraft {
@SidedProxy(clientSide = "wintercraft.helper.proxy.ClientProxy", serverSide = "wintercraft.helper.proxy.CommonProxy")
 public static CommonProxy proxy;
@Instance("Wintercraft")
public static Wintercraft instance;

public static final String modid = "Wintercraft";
public static final String version = "1.0.0";
public static CreativeTabs WintercraftTab = new WintercraftTab(CreativeTabs.getNextID(), "Wintercraft");

private GuiHandler guiInputHandler = new GuiHandler();
private static int modEntityID = 0;

@EventHandler
public static void PreInit(FMLPreInitializationEvent event)
	{
		BlocksConfig.PreInit(event);
		ItemsConfig.PreInit(event);
	}


@EventHandler
public void Init(FMLInitializationEvent event)
	{
		Blocks.Init(event);
		Items.Init(event);
		Recipes.Init(event);
		BiomeControl.Init(event);
		EntityBase.Init();
		Generation.Init(event);
		TileEntity.addMapping(TileEntityCandle.class, "Red-Candle");
		TileEntity.addMapping(TileEntityCandleGreen.class, "Green-Candle");
		TileEntity.addMapping(TileEntityOrnament.class, "Ornament");
		TileEntity.addMapping(TileEntityOrnamentGreen.class, "Green Ornament");
		proxy.registerRenderThings();
		GameRegistry.registerTileEntity(TileEntityFreezer.class,"tileEntityFreezer");
		NetworkRegistry.instance().registerGuiHandler(this, guiInputHandler);
		NetworkRegistry.instance().registerConnectionHandler(new ConnectionHandler());
		EntityRegistry.registerModEntity(EntityIceball.class, "Iceball", ++modEntityID, this, 64, 10, true);
		EntityRegistry.registerModEntity(EntityRockySnowball.class, "Rocky Snowball", ++modEntityID, this, 64, 10, true);
		MinecraftForge.EVENT_BUS.register(new EventHookContainerClass());
		TickRegistry.registerTickHandler(new ServerTickHandler(), Side.SERVER); //Here's the Tick Handler
	}


@cpw.mods.fml.common.Mod.PostInit
public void PostInit(FMLPostInitializationEvent event)
{
Item.itemsList[blocks.singleSnowSlab.blockID] = (new ItemSlab(Blocks.singleSnowSlab.blockID - 256, (BlockHalfSlab)Blocks.singleSnowSlab, (BlockHalfSlab)Blocks.doubleSnowSlab, false));
}
}

 

ServerTickHandler class:

public class ServerTickHandler implements ITickHandler {


Random generator = new Random();
World par1World;
public static boolean presentTimer;

@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
	if (type.equals(EnumSet.of(TickType.PLAYER))){

	onPlayerTick((EntityPlayer)tickData[0]);

		}
}


private void onPlayerTick(EntityPlayer player)
{


	int sleepTicks = player.getSleepTimer();
	int month = Calendar.getInstance().get(Calendar.MONTH);
	int day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
	int randomItem = generator.nextInt(2);
	if(month == 11 && day == 25 && sleepTicks == 90 && presentTimer == true && player.inventory.hasItem(Item.bucketMilk.itemID) && player.inventory.hasItem(Item.cookie.itemID)){

		if(!par1World.isRemote){

		player.addChatMessage("\u00a7aMerry \u00a7cChristmas!");
		player.inventory.clearInventory(Item.bucketMilk.itemID, 0);
		player.inventory.clearInventory(Item.cookie.itemID, 0);
		player.inventory.addItemStackToInventory(new ItemStack(Blocks.christmasPresent, 6));
		player.inventory.addItemStackToInventory(new ItemStack(Blocks.present, 6));
		presentTimer = false;
		}
	}

	else if(sleepTicks == 90 && presentTimer == true && player.inventory.hasItem(Item.bucketMilk.itemID) && player.inventory.hasItem(Item.cookie.itemID)){


		System.out.println("Sleepy time!");
		player.addChatMessage("\u00a77\u00a7oHohoho....");
		player.inventory.clearInventory(Item.bucketMilk.itemID, 0);
		player.inventory.clearInventory(Item.cookie.itemID, 0);
		player.inventory.addItemStackToInventory(new ItemStack(Blocks.christmasPresent, 4));
		player.inventory.addItemStackToInventory(new ItemStack(Blocks.present, 4));
		presentTimer = false;

	}

}



@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
	// TODO Auto-generated method stub

}

@Override
public EnumSet<TickType> ticks() {

	return EnumSet.of(TickType.PLAYER, TickType.SERVER);
}

@Override
public String getLabel() {
	// TODO Auto-generated method stub
	return null;
}

}

 

Any ideas? Thanks!

NoSuchMethodError: net.minecraft.entity.player.EntityPlayer.getSleepTimer()

Client-side only method.

  • Author

NoSuchMethodError: net.minecraft.entity.player.EntityPlayer.getSleepTimer()

Client-side only method.

 

So, does that mean I cannot use it at all? If so are there any alternatives?

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.