Jump to content

[1.7.10] Crash when trying to run server with mod


Recommended Posts

I've been trying all day to get this mod to work for a server (it works fine in SP) but during startup it crashed with this:


Exception in server tick loop


cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP

at cpw.mods.fml.common.LoadController.transition(LoadController.java:162)

at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:515)

at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:88)

at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:314)

at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:117)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)

Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP

at apocalypse.gadgets.content.Jetpack.<init>(Jetpack.java:31)

at apocalypse.gadgets.main.Gadgets.preInit(Gadgets.java:62)



I've read that crash happens when trying to load a client mod on a server, but this is not a client mod since it adds items.

The line it points to isn't doing anything except loading the texture.


Class with the error:

public class Jetpack extends ItemArmor
int delay = 0;
public static Tab tab = Gadgets.tab;

public Jetpack(ArmorMaterial material, int renderIndex, int armourType)
	super(material, renderIndex, armourType);
	this.canRepair = true;

	if(armourType == 1)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer)
		return Tools.location("textures/items/jetpackWorn.png");
		return null;


public boolean hasFuel(EntityPlayer player)
	return player.inventory.hasItem(Items.coal);

public void consumeFuel(EntityPlayer player, int rate)
    this.delay += 1;
    if (this.delay > rate)
    	if (player.inventory.hasItem(Items.coal))
    	this.delay = 0;

    public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
	if (player == null)
	ItemStack item = player.inventory.armorItemInSlot(2);
    if (item != null)
        if ((item.getItem() instanceof Jetpack))
          ((Jetpack)item.getItem()).action(player, (int)player.posX, (int)player.posY, (int)player.posZ, true);
public void action(EntityPlayer player, int x, int y, int z, boolean key)
	Random rand = new Random();

	double velx = rand.nextDouble() * 0.05D - 0.025D;
	double vely = -0.2D;
	double velz = rand.nextDouble() * 0.05D - 0.025D;

    if ((Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindJump.getKeyCode())) && (hasFuel(player)))
    	player.motionY = 0.1D;
    	player.jumpMovementFactor = 0.05F;
    	player.worldObj.spawnParticle("flame", player.posX, player.posY-1, player.posZ, velx, vely, velz);
    	player.worldObj.spawnParticle("largesmoke", player.posX, player.posY-1, player.posZ, velx, vely, velz);
    	consumeFuel(player, 10);
    	player.fallDistance = 0.0F;


Main class:

@Mod(modid = Gadgets.MODID, version = Gadgets.VERSION)
public class Gadgets
    public static final String MODID = "gadgets";
    public static final String VERSION = "1.0";
public static Gadgets instance;

    @SidedProxy(clientSide = "apocalypse.gadgets.network.Client", serverSide = "apocalypse.gadgets.network.Server")
public static Server server;

public static final Tab tab = new Tab("tab");

public static int backpackID = 1;

public static Item jetpack, backpack, handgun, bomb, bullet, bullet2, heart;
public static Item harbinger, halsSword, swordOfAeons;
public static Block bin;

public void preInit(FMLPreInitializationEvent event)

	jetpack = new Jetpack(ArmorMaterial.IRON, 4, 1).setUnlocalizedName("jetpack").setTextureName(Tools.location("jetpack")).setCreativeTab(tab);
	GameRegistry.registerItem(jetpack, "jetpack");

	backpack = new Backpack().setUnlocalizedName("backpack").setTextureName(Tools.location("backpack")).setCreativeTab(tab);
	GameRegistry.registerItem(backpack, "backpack");
	handgun = new Handgun().setUnlocalizedName("handgun").setTextureName(Tools.location("handgun")).setCreativeTab(tab);
	GameRegistry.registerItem(handgun, "handgun");
	bomb = new Bomb().setUnlocalizedName("bomb").setTextureName(Tools.location("bomb")).setCreativeTab(tab);
	GameRegistry.registerItem(bomb, "bomb");
	bullet = new Item().setUnlocalizedName("bullet").setTextureName(Tools.location("bullet")).setCreativeTab(tab);
	GameRegistry.registerItem(bullet, "bullet");
	bullet2 = new Item().setUnlocalizedName("bullet2").setTextureName(Tools.location("bullet2"));
	GameRegistry.registerItem(bullet2, "bullet2");

	heart = new Item().setUnlocalizedName("heart").setTextureName(Tools.location("heart")).setCreativeTab(tab);
	GameRegistry.registerItem(heart, "heart");

	harbinger = new Sword("", 600, 8, true, true, Items.emerald, false).setUnlocalizedName("harbinger").setTextureName(Tools.location("harbinger")).setCreativeTab(tab);
	GameRegistry.registerItem(harbinger, "harbinger");
	halsSword = new EnergySword("", 20, 30, true, false, null, true).setUnlocalizedName("halsSword").setTextureName(Tools.location("halsSword")).setCreativeTab(tab);
	GameRegistry.registerItem(halsSword, "halsSword");
	swordOfAeons = new Sword("", 2000, 10, true, true, Items.nether_star, false).setUnlocalizedName("swordOfAeons").setTextureName(Tools.location("swordOfAeons")).setCreativeTab(tab);
	GameRegistry.registerItem(swordOfAeons, "swordOfAeons");

	bin = new TrashBin().setBlockName("bin").setBlockTextureName(Tools.location("bin")).setCreativeTab(tab);
	GameRegistry.registerBlock(bin, "bin");

	GameRegistry.addShapedRecipe(new ItemStack(Gadgets.swordOfAeons), new Object[]{"A  ", " B ", "  B",'A', Gadgets.harbinger,'B', Items.nether_star,});
	GameRegistry.addShapedRecipe(new ItemStack(Gadgets.jetpack), new Object[]{"ABA", "ADA", "CAC",'A', Items.iron_ingot,'B', Items.redstone,'C', Items.blaze_rod,'D', Items.gunpowder});
	GameRegistry.addShapedRecipe(new ItemStack(Gadgets.backpack), new Object[]{"AAA", "A A", "AAA",'A', Items.leather});
	GameRegistry.addShapedRecipe(new ItemStack(Gadgets.bomb), new Object[]{"AAB", "ACA", "AAA",'A', Items.iron_ingot,'B', Items.string,'C', Items.gunpowder});
	GameRegistry.addShapedRecipe(new ItemStack(Gadgets.handgun), new Object[]{"AAB", " CA", "  A",'A', Items.iron_ingot,'B', Blocks.lever,'C', Blocks.tripwire_hook});
	GameRegistry.addShapedRecipe(new ItemStack(Gadgets.bin), new Object[]{"ABA", "A A", "AAA",'A', Items.iron_ingot,'B', Blocks.trapdoor});
	GameRegistry.addSmelting(Items.iron_ingot, new ItemStack(Gadgets.bullet, 3), 0F);

	int id = Config.getEntityIdStart();
    EntityRegistry.registerModEntity(EntityBomb.class, "Bomb", id++, Gadgets.instance, 64, 10, true);
    EntityRegistry.registerModEntity(ProjectileBullet.class, "Bullet", id++, Gadgets.instance, 64, 10, true);
    public void init(FMLInitializationEvent event)
	NetworkRegistry.INSTANCE.registerGuiHandler(instance, server);
    public void postInit(FMLPostInitializationEvent event)
	MinecraftForge.addGrassSeed(new ItemStack(Gadgets.heart), 1);

	ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Gadgets.bomb), 1, 2, 3));
	ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Gadgets.bullet), 1, 6, 6));
	ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Gadgets.harbinger), 1, 1, 1));
	ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Gadgets.halsSword), 1, 1, 1));


Why is this happening?

Link to comment
Share on other sites

It crashes because you're trying to access a client class, EntityClientPlayerMP. Make sure any references to any client-only classes go through your proxy.


Side note: Minecraft is a client only class and that will also crash it on a server. To use keybindings on a server you need to create a packet that is sent to the server from the client when the space bar is pressed on the client.

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

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.

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.

  • Create New...

Important Information

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