Jump to content

[1.7.2] [SOLVED] ClassNotFoundException


Bektor

Recommended Posts

Hello.

 

I have one problem, that everytime when I am on a server and then switch from surface to the nether, a ClassNotFoundException occurs, on Client in SP everything works fine.

 

I'm using Forge 1.7.2-10.12.1.1103.

 

Here is the error and the code:

 

Failed to handle packet for /62.227.178.175:24974
net.minecraft.util.ReportedException: Ticking player
at net.minecraft.entity.player.EntityPlayerMP.func_71127_g(EntityPlayerMP.java:355) ~[mm.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147347_a(NetHandlerPlayServer.java:300) ~[mx.class:?]
at net.minecraft.network.play.client.C03PacketPlayer.func_148833_a(SourceFile:137) ~[ir.class:?]
at net.minecraft.network.play.client.C03PacketPlayer.func_148833_a(SourceFile: ~[ir.class:?]
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:197) ~[ef.class:?]
at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165) [ms.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:643) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:326) [lj.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:531) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:669) [kx.class:?]
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/Minecraft
at minecraftplaye.primevalforest.event.PlayerDimensionEventHook.changeDimension(PlayerDimensionEventHook.java:31) ~[PlayerDimensionEventHook.class:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler_35_PlayerDimensionEventHook_changeDimension_PlayerChangedDimensionEvent.invoke(.dynamic) ~[?:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) ~[ASMEventHandler.class:?]
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) ~[EventBus.class:?]
at cpw.mods.fml.common.FMLCommonHandler.firePlayerChangedDimensionEvent(FMLCommonHandler.java:544) ~[FMLCommonHandler.class:?]
at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:468) ~[ld.class:?]
at net.minecraft.server.management.ServerConfigurationManager.func_72356_a(ServerConfigurationManager.java:443) ~[ld.class:?]
at net.minecraft.entity.player.EntityPlayerMP.func_71027_c(EntityPlayerMP.java:534) ~[mm.class:?]
at net.minecraft.entity.Entity.func_70030_z(Entity.java:363) ~[qn.class:?]
at net.minecraft.entity.EntityLivingBase.func_70030_z(EntityLivingBase.java:193) ~[rh.class:?]
at net.minecraft.entity.Entity.func_70071_h_(Entity.java:318) ~[qn.class:?]
at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:1558) ~[rh.class:?]
at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:289) ~[xl.class:?]
at net.minecraft.entity.player.EntityPlayerMP.func_71127_g(EntityPlayerMP.java:301) ~[mm.class:?]
... 10 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.Minecraft
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:99) ~[launchwrapper-1.9.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_05]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_05]
at minecraftplaye.primevalforest.event.PlayerDimensionEventHook.changeDimension(PlayerDimensionEventHook.java:31) ~[PlayerDimensionEventHook.class:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler_35_PlayerDimensionEventHook_changeDimension_PlayerChangedDimensionEvent.invoke(.dynamic) ~[?:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) ~[ASMEventHandler.class:?]
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) ~[EventBus.class:?]
at cpw.mods.fml.common.FMLCommonHandler.firePlayerChangedDimensionEvent(FMLCommonHandler.java:544) ~[FMLCommonHandler.class:?]
at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:468) ~[ld.class:?]
at net.minecraft.server.management.ServerConfigurationManager.func_72356_a(ServerConfigurationManager.java:443) ~[ld.class:?]
at net.minecraft.entity.player.EntityPlayerMP.func_71027_c(EntityPlayerMP.java:534) ~[mm.class:?]
at net.minecraft.entity.Entity.func_70030_z(Entity.java:363) ~[qn.class:?]
at net.minecraft.entity.EntityLivingBase.func_70030_z(EntityLivingBase.java:193) ~[rh.class:?]
at net.minecraft.entity.Entity.func_70071_h_(Entity.java:318) ~[qn.class:?]
at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:1558) ~[rh.class:?]
at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:289) ~[xl.class:?]
at net.minecraft.entity.player.EntityPlayerMP.func_71127_g(EntityPlFailed to handle packet for /62.227.178.175:26144
net.minecraft.util.ReportedException: Ticking player
at net.minecraft.entity.player.EntityPlayerMP.func_71127_g(EntityPlayerMP.java:355) ~[mm.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147347_a(NetHandlerPlayServer.java:300) ~[mx.class:?]
at net.minecraft.network.play.client.C03PacketPlayer.func_148833_a(SourceFile:137) ~[ir.class:?]
at net.minecraft.network.play.client.C03PacketPlayer.func_148833_a(SourceFile: ~[ir.class:?]
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:197) ~[ef.class:?]
at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165) [ms.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:643) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:326) [lj.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:531) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:669) [kx.class:?]
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/Minecraft
at minecraftplaye.primevalforest.event.PlayerDimensionEventHook.changeDimension(PlayerDimensionEventHook.java:31) ~[PlayerDimensionEventHook.class:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler_35_PlayerDimensionEventHook_changeDimension_PlayerChangedDimensionEvent.invoke(.dynamic) ~[?:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) ~[ASMEventHandler.class:?]
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) ~[EventBus.class:?]
at cpw.mods.fml.common.FMLCommonHandler.firePlayerChangedDimensionEvent(FMLCommonHandler.java:544) ~[FMLCommonHandler.class:?]
at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:468) ~[ld.class:?]
at net.minecraft.server.management.ServerConfigurationManager.func_72356_a(ServerConfigurationManager.java:443) ~[ld.class:?]
at net.minecraft.entity.player.EntityPlayerMP.func_71027_c(EntityPlayerMP.java:534) ~[mm.class:?]
at net.minecraft.entity.Entity.func_70030_z(Entity.java:363) ~[qn.class:?]
at net.minecraft.entity.EntityLivingBase.func_70030_z(EntityLivingBase.java:193) ~[rh.class:?]
at net.minecraft.entity.Entity.func_70071_h_(Entity.java:318) ~[qn.class:?]
at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:1558) ~[rh.class:?]
at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:289) ~[xl.class:?]
at net.minecraft.entity.player.EntityPlayerMP.func_71127_g(EntityPlayerMP.java:301) ~[mm.class:?]
... 10 more
[23:18:03] [server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking entity
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:626) ~[MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:326) ~[lj.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:531) ~[MinecraftServer.class:?]
at net.minecraft..

 

 

And here the code:

 

package minecraftplaye.primevalforest.event;

import minecraftplaye.primevalforest.achievement.PFAchievementPage;
import minecraftplaye.primevalforest.blocks.PFBlocks;
import minecraftplaye.primevalforest.configuration.PFConfigurationIDs;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.AchievementList;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent;

public class PlayerDimensionEventHook
{

    /**
     * Checks if the player changes the dimension!
     * 
     * @param event The MCForge PlayerChangedDimensionEvent
     */
@SubscribeEvent(priority = EventPriority.NORMAL)
    public void changeDimension(PlayerChangedDimensionEvent event)
    {
    	if(event.player != null)
    	{
    		if(event.player instanceof EntityPlayer) // neeeded?
    		{
    			EntityPlayer player = (EntityPlayer)event.player;
    			
    			if(Minecraft.getMinecraft().thePlayer.getStatFileWriter().hasAchievementUnlocked(AchievementList.portal))
    			{
    				if(event.fromDim == -1 && event.toDim == 0)
    				{
    					if(!(Minecraft.getMinecraft().thePlayer.getStatFileWriter().hasAchievementUnlocked(PFAchievementPage.forgottenSapling)))
    					{
    						player.inventory.addItemStackToInventory(new ItemStack(PFBlocks.portSapling));
    						player.addExperience(50);
    						player.triggerAchievement(PFAchievementPage.forgottenSapling);
    					}
    				}
    				else if(event.toDim == PFConfigurationIDs.primevalForestDimID)
    				{
    					if(!(Minecraft.getMinecraft().thePlayer.getStatFileWriter().hasAchievementUnlocked(PFAchievementPage.portalCreation)))
    					{
    						player.addExperienceLevel(10);
    						player.triggerAchievement(PFAchievementPage.portalCreation);
    					}
    				}
    			}
    		}
    	}
    }
}

 

 

Bektor

Developer of Primeval Forest.

Link to comment
Share on other sites

The ChangeDimensionEvent is server-side only.

To get the "StatisticsFile", which controls the achievements, from the player, cast to EntityPlayerMP (which is save, because its server-code) and call func_147099_x, which gives you the StatisticsFile.

Then you can call hasAchievementUnlocked on that.

Ok, thanks.

I think its now fixed. (Well I didn't test it yet, but I will test it today, so that if that doesn't fix this issue, I will reply here back...)

Developer of Primeval Forest.

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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