Jump to content

[SOLVED] Modded server crashes: not referenced class not found exception


Recommended Posts

Posted

When i launch my mod on server, it crashes and i get this error:

al.jar) Unloaded->Constructed->Pre-initialized
        blocktoolsarmormod{alpha 1.1.2} [block Tools Armor Mod] (BTAM-1.1.2.jar)
Unloaded->Constructed->Errored
        InstantStructuresMod{1.0} [instant Structures Mod] (IS.jar) Unloaded->Co
nstructed->Pre-initialized
[12:38:41] [server thread/ERROR] [FML]: The following problems were captured dur
ing this phase
[12:38:41] [server thread/ERROR] [FML]: Caught exception from blocktoolsarmormod

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

        at code.blocktoolsarmormod.registry.RegistryHandler.preinit(RegistryHand
ler.java:32) ~[RegistryHandler.class:?]
        at code.blocktoolsarmormod.BaseBlockToolsArmorMod.preinit(BaseBlockTools
ArmorMod.java:30) ~[baseBlockToolsArmorMod.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContain
er.java:513) ~[FMLModContainer.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscribe
r.java:74) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(Sy
nchronizedEventSubscriber.java:47) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[min
ecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.jav
a:304) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecra
ft_server.1.7.10.jar:?]
        at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadContro
ller.java:208) ~[LoadController.class:?]
        at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadControll
er.java:187) ~[LoadController.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscribe
r.java:74) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(Sy
nchronizedEventSubscriber.java:47) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[min
ecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.jav
a:304) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecra
ft_server.1.7.10.jar:?]
        at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadControl
ler.java:118) [LoadController.class:?]
        at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) [Loader
.class:?]
        at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHand
ler.java:88) [FMLServerHandler.class:?]
        at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.j
ava:314) [FMLCommonHandler.class:?]
        at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(Dedicated
Server.java:117) [lt.class:?]
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387) [M
inecraftServer.class:?]
        at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)
[li.class:?]
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityC
lientPlayerMP
        at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLo
ader.java:191) ~[launchwrapper-1.11.jar:?]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
        ... 34 more
Caused by: java.lang.NullPointerException
        at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLo
ader.java:182) ~[launchwrapper-1.11.jar:?]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
        ... 34 more
[12:38:41] [server thread/ERROR]: Encountered an unexpected exception
cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecra
ft/client/entity/EntityClientPlayerMP
        at cpw.mods.fml.common.LoadController.transition(LoadController.java:162
) ~[LoadController.class:?]
        at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:515) ~[Loade
r.class:?]
        at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHand
ler.java:88) ~[FMLServerHandler.class:?]
        at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.j
ava:314) ~[FMLCommonHandler.class:?]
        at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(Dedicated
Server.java:117) ~[lt.class:?]
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387) [M
inecraftServer.class:?]
        at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)
[li.class:?]
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityCli
entPlayerMP
        at code.blocktoolsarmormod.registry.RegistryHandler.preinit(RegistryHand
ler.java:32) ~[RegistryHandler.class:?]
        at code.blocktoolsarmormod.BaseBlockToolsArmorMod.preinit(BaseBlockTools
ArmorMod.java:30) ~[baseBlockToolsArmorMod.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContain
er.java:513) ~[FMLModContainer.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscribe
r.java:74) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(Sy
nchronizedEventSubscriber.java:47) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[min
ecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.jav
a:304) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecra
ft_server.1.7.10.jar:?]
        at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadContro
ller.java:208) ~[LoadController.class:?]
        at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadControll
er.java:187) ~[LoadController.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscribe
r.java:74) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(Sy
nchronizedEventSubscriber.java:47) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[min
ecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.jav
a:304) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecra
ft_server.1.7.10.jar:?]
        at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadControl
ler.java:118) ~[LoadController.class:?]
        at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) ~[Loade
r.class:?]
        ... 5 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityC
lientPlayerMP
        at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLo
ader.java:191) ~[launchwrapper-1.11.jar:?]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
        at code.blocktoolsarmormod.registry.RegistryHandler.preinit(RegistryHand
ler.java:32) ~[RegistryHandler.class:?]
        at code.blocktoolsarmormod.BaseBlockToolsArmorMod.preinit(BaseBlockTools
ArmorMod.java:30) ~[baseBlockToolsArmorMod.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContain
er.java:513) ~[FMLModContainer.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscribe
r.java:74) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(Sy
nchronizedEventSubscriber.java:47) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[min
ecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.jav
a:304) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecra
ft_server.1.7.10.jar:?]
        at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadContro
ller.java:208) ~[LoadController.class:?]
        at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadControll
er.java:187) ~[LoadController.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscribe
r.java:74) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(Sy
nchronizedEventSubscriber.java:47) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[min
ecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.jav
a:304) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecra
ft_server.1.7.10.jar:?]
        at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadControl
ler.java:118) ~[LoadController.class:?]
        at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) ~[Loade
r.class:?]
        ... 5 more
Caused by: java.lang.NullPointerException
        at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLo
ader.java:182) ~[launchwrapper-1.11.jar:?]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]
        at code.blocktoolsarmormod.registry.RegistryHandler.preinit(RegistryHand
ler.java:32) ~[RegistryHandler.class:?]
        at code.blocktoolsarmormod.BaseBlockToolsArmorMod.preinit(BaseBlockTools
ArmorMod.java:30) ~[baseBlockToolsArmorMod.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContain
er.java:513) ~[FMLModContainer.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscribe
r.java:74) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(Sy
nchronizedEventSubscriber.java:47) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[min
ecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.jav
a:304) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecra
ft_server.1.7.10.jar:?]
        at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadContro
ller.java:208) ~[LoadController.class:?]
        at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadControll
er.java:187) ~[LoadController.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscribe
r.java:74) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(Sy
nchronizedEventSubscriber.java:47) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[min
ecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.jav
a:304) ~[minecraft_server.1.7.10.jar:?]
        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecra
ft_server.1.7.10.jar:?]
        at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadControl
ler.java:118) ~[LoadController.class:?]
        at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) ~[Loade
r.class:?]
        ... 5 more
[12:38:41] [server thread/ERROR]: This crash report has been saved to: C:\my\pro
grams\minecraft\server-1.7-mods\.\crash-reports\crash-2014-11-09_12.38.41-server
.txt
[12:38:41] [server thread/WARN] [FML]: Can't revert to frozen GameData state wit
hout freezing first.
[12:38:41] [server thread/INFO] [FML]: Applying holder lookups
[12:38:41] [server thread/INFO] [FML]: Holder lookups applied
[12:38:41] [server thread/INFO] [FML]: The state engine was in incorrect state E
RRORED and forced into state SERVER_STOPPED. Errors may have been discarded.
[12:38:41] [server thread/INFO] [FML]: The state engine was in incorrect state E
RRORED and forced into state AVAILABLE. Errors may have been discarded.

C:\my\programs\minecraft\server-1.7-mods>

It says that class RegistryHandler is errored on EntityPlayerMP, but RegistryHandler has no any reference to EntityPlayerMP.

RegistryHandler.java:

package code.blocktoolsarmormod.registry;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import code.blocktoolsarmormod.world.worldgen.BlockToolsArmorModWorldGen;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

public class RegistryHandler {
//worldgen
static BlockToolsArmorModWorldGen eventWorldGen = new BlockToolsArmorModWorldGen();
//creative tabs
public static CreativeTabs blocktoolsarmortab;

public static void preinit(FMLPreInitializationEvent event)
{ //tabs
	blocktoolsarmortab = new CreativeTabs("blocktoolsarmortabtab"){
		public Item getTabIconItem() {
			return ItemBlockRegistry.bedrockpickaxe;
		}
	};
	//worldgen
	GameRegistry.registerWorldGenerator(eventWorldGen, 1);
	ItemBlockRegistry.preinit(event);
	ExplosivesRegistry.preinit(event);
	RecipesRegistry.preinit(event);
	BiomesRegistry.preinit(event);
	DimensionRegistry.preinit(event);
	FMLCommonHandler.instance().bus().register(new BTAMKeyRegistry());

}

public static void init(FMLInitializationEvent event)
{ 
	ItemBlockRegistry.init(event);
	ExplosivesRegistry.init(event);
	RecipesRegistry.init(event);
	BiomesRegistry.init(event);
	DimensionRegistry.init(event);

}

public static void postinit(FMLPostInitializationEvent event)
{ 
	ItemBlockRegistry.postinit(event);
	ExplosivesRegistry.postinit(event);
	RecipesRegistry.postinit(event);
	BiomesRegistry.postinit(event);
	DimensionRegistry.postinit(event);
}
}

Posted

EntityPlayerMP is client class, i know. But in RegistryHandler there is no any reference at all to it.

package code.blocktoolsarmormod.registry;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import code.blocktoolsarmormod.world.worldgen.BlockToolsArmorModWorldGen;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

public class RegistryHandler {
//worldgen
static BlockToolsArmorModWorldGen eventWorldGen = new BlockToolsArmorModWorldGen();
//creative tabs
public static CreativeTabs blocktoolsarmortab;

public static void preinit(FMLPreInitializationEvent event)
{ //tabs
	blocktoolsarmortab = new CreativeTabs("blocktoolsarmortabtab"){
		public Item getTabIconItem() {
			return ItemBlockRegistry.bedrockpickaxe;
		}
	};
	//worldgen
	GameRegistry.registerWorldGenerator(eventWorldGen, 1);
	ItemBlockRegistry.preinit(event);
	ExplosivesRegistry.preinit(event);
	RecipesRegistry.preinit(event);
	BiomesRegistry.preinit(event);
	DimensionRegistry.preinit(event);
	FMLCommonHandler.instance().bus().register(new BTAMKeyRegistry());

}

public static void init(FMLInitializationEvent event)
{ 
	ItemBlockRegistry.init(event);
	ExplosivesRegistry.init(event);
	RecipesRegistry.init(event);
	BiomesRegistry.init(event);
	DimensionRegistry.init(event);

}

public static void postinit(FMLPostInitializationEvent event)
{ 
	ItemBlockRegistry.postinit(event);
	ExplosivesRegistry.postinit(event);
	RecipesRegistry.postinit(event);
	BiomesRegistry.postinit(event);
	DimensionRegistry.postinit(event);
}
}

Posted

BTAMKeyRegistry doesn't contain EntityPlayerMP too. How ever i'll try to register key bindings only on client side.

package code.blocktoolsarmormod.registry;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;

import org.lwjgl.input.Keyboard;

import code.blocktoolsarmormod.explosives.entities.EntityCTNTPrimed;
import code.blocktoolsarmormod.items.tools.Axes;
import code.blocktoolsarmormod.items.tools.Hoes;
import code.blocktoolsarmormod.items.tools.Pickaxes;
import code.blocktoolsarmormod.items.tools.Shovels;
import code.blocktoolsarmormod.items.tools.Swords;
import code.blocktoolsarmormod.items.tools.UltimateTools;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;

public class BTAMKeyRegistry {

private static final String desc = "BTAM universal key";
private static final int keyValues = Keyboard.KEY_B ;
public static KeyBinding keys;

public BTAMKeyRegistry() {
	keys = new KeyBinding(desc, keyValues, "BTAM");
	ClientRegistry.registerKeyBinding(keys);
}

@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
	if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
		if (keys.isPressed()) {
			EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
			World world = entity.worldObj;
			boolean field_14256_a = true;

			if(entity.getHeldItem().getItem() == ItemBlockRegistry.ultimateunstablestar || entity.getHeldItem().getItem() == ItemBlockRegistry.bigultimateunstablestar){
				if(((UltimateTools) entity.getHeldItem().getItem()).mode == 0){
					((UltimateTools) entity.getHeldItem().getItem()).mode = 1;
				}
				if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD1)){
					((UltimateTools) entity.getHeldItem().getItem()).mode = 1;
				}
				if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD2)){
					((UltimateTools) entity.getHeldItem().getItem()).mode = 2;
				}
				if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD3)){
					((UltimateTools) entity.getHeldItem().getItem()).mode = 3;
				}
				if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD4)){
					((UltimateTools) entity.getHeldItem().getItem()).mode = 4;
				}
				if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5)){
					((UltimateTools) entity.getHeldItem().getItem()).mode = 5;
				}	
			} else if(entity.getHeldItem().getItem() == ItemBlockRegistry.unstablestaraxe || entity.getHeldItem().getItem() == ItemBlockRegistry.bigunstablestaraxe){
				if(((Axes) entity.getHeldItem().getItem()).mode == 0){
					((Axes) entity.getHeldItem().getItem()).mode = 1;
				}
				if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD1)){
					((Axes) entity.getHeldItem().getItem()).mode = 1;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD2)){
					((Axes) entity.getHeldItem().getItem()).mode = 2;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD3)){
					((Axes) entity.getHeldItem().getItem()).mode = 3;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD4)){
					((Axes) entity.getHeldItem().getItem()).mode = 4;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5)){
					((Axes) entity.getHeldItem().getItem()).mode = 5;
				}	
			}else if(entity.getHeldItem().getItem() == ItemBlockRegistry.unstablestarpickaxe || entity.getHeldItem().getItem() == ItemBlockRegistry.bigunstablestarpickaxe){
				if(((Pickaxes) entity.getHeldItem().getItem()).mode == 0){
					((Pickaxes) entity.getHeldItem().getItem()).mode = 1;
				}
				if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD1)){
					((Pickaxes) entity.getHeldItem().getItem()).mode = 1;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD2)){
					((Pickaxes) entity.getHeldItem().getItem()).mode = 2;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD3)){
					((Pickaxes) entity.getHeldItem().getItem()).mode = 3;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD4)){
					((Pickaxes) entity.getHeldItem().getItem()).mode = 4;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5)){
					((Pickaxes) entity.getHeldItem().getItem()).mode = 5;
				}	
			}else if(entity.getHeldItem().getItem() == ItemBlockRegistry.unstablestarshovel || entity.getHeldItem().getItem() == ItemBlockRegistry.bigunstablestarshovel){
				if(((Shovels) entity.getHeldItem().getItem()).mode == 0){
					((Shovels) entity.getHeldItem().getItem()).mode = 1;
				}
				if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD1)){
					((Shovels) entity.getHeldItem().getItem()).mode = 1;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD2)){
					((Shovels) entity.getHeldItem().getItem()).mode = 2;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD3)){
					((Shovels) entity.getHeldItem().getItem()).mode = 3;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD4)){
					((Shovels) entity.getHeldItem().getItem()).mode = 4;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5)){
					((Shovels) entity.getHeldItem().getItem()).mode = 5;
				}	
			}else if(entity.getHeldItem().getItem() == ItemBlockRegistry.unstablestarsword || entity.getHeldItem().getItem() == ItemBlockRegistry.bigunstablestarsword){
				if(((Swords) entity.getHeldItem().getItem()).mode == 0){
					((Swords) entity.getHeldItem().getItem()).mode = 1;
				}
				if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD1)){
					((Swords) entity.getHeldItem().getItem()).mode = 1;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD2)){
					((Swords) entity.getHeldItem().getItem()).mode = 2;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD3)){
					((Swords) entity.getHeldItem().getItem()).mode = 3;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD4)){
					((Swords) entity.getHeldItem().getItem()).mode = 4;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5)){
					((Swords) entity.getHeldItem().getItem()).mode = 5;
				}	
			}else if(entity.getHeldItem().getItem() == ItemBlockRegistry.unstablestarhoe || entity.getHeldItem().getItem() == ItemBlockRegistry.bigunstablestarhoe){
				if(((Hoes) entity.getHeldItem().getItem()).mode == 0){
					((Hoes) entity.getHeldItem().getItem()).mode = 1;
				}
				if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD1)){
					((Hoes) entity.getHeldItem().getItem()).mode = 1;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD2)){
					((Hoes) entity.getHeldItem().getItem()).mode = 2;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD3)){
					((Hoes) entity.getHeldItem().getItem()).mode = 3;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD4)){
					((Hoes) entity.getHeldItem().getItem()).mode = 4;
				} else if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5)){
					((Hoes) entity.getHeldItem().getItem()).mode = 5;
				}	
			}else if(entity.getHeldItem().getItem() == ItemBlockRegistry.lightsaber){
				world.playSound(entity.posX, entity.posY, entity.posZ, "blocktoolsarmormod:lightsaber_off", 1.0f, 1.0f, true);
				NBTTagCompound tag = new NBTTagCompound();
				entity.getHeldItem().writeToNBT(tag);
				tag.setShort("id", (short) Item.getIdFromItem(ItemBlockRegistry.lightsaberoff));
				entity.getHeldItem().readFromNBT(tag);
			} else if(entity.getHeldItem().getItem() == ItemBlockRegistry.lightsaberoff){
				world.playSound(entity.posX, entity.posY, entity.posZ, "blocktoolsarmormod:lightsaber_on", 1.0f, 1.0f, true);
				NBTTagCompound tag = new NBTTagCompound();
				entity.getHeldItem().writeToNBT(tag);
				tag.setShort("id", (short) Item.getIdFromItem(ItemBlockRegistry.lightsaber));
				entity.getHeldItem().readFromNBT(tag);
			} else {

			}
		}
	}
}

}

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.