Samalot Posted April 8, 2016 Share Posted April 8, 2016 EDIT 2: I SOLVED IT!!! (changed the title of the post, so as not to mislead people. The original 'problem' was not the problem at all.. ) The problem was in my eventhandler, I had this: @SubscribeEvent public void openGui(GuiOpenEvent event) { /*No GUI*/ if(event.gui == null) { globalFlag_Token_Pouch_Open = 0; } /*Token Pouch opened*/ else if(event.gui.toString().contains("lazarus.container.token_pouch.GuiTokenPouch")) {globalFlag_Token_Pouch_Open = 1;} } I added @SideOnly(Side.CLIENT) and it works! (well, it doesn't crash..) @SubscribeEvent @SideOnly(Side.CLIENT) public void openGui(GuiOpenEvent event) { /*No GUI*/ if(event.gui == null){globalFlag_Token_Pouch_Open = 0;} /*Token Pouch opened*/ else if(event.gui.toString().contains("lazarus.container.token_pouch.GuiTokenPouch")) {globalFlag_Token_Pouch_Open = 1;} } EDIT: I have narrowed the problem down, it seems that it is my event handler that is causing the issue, NOT the proxies. java.lang.NoClassDefFoundError: net/minecraft/client/gui/GuiScreen /*Imports*/ package lazarus.utils.handlers; import lazarus.main.LazarusItems; import lazarus.utils.whispers.AmsollionWhispers; import lazarus.utils.whispers.ImbrasWhispers; import lazarus.utils.whispers.OsmodeusWhispers; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; /*Main*/ public class LazarusEventHandler { /*---------------------------------------- Global variables ----------------------------------------*/ public static int globalFlag_Token_Pouch_Open = 0; /*---------------------------------------- Listen for guiOpens ----------------------------------------*/ @SubscribeEvent public void openGui(GuiOpenEvent event) { /*No GUI*/ if(event.gui == null) { globalFlag_Token_Pouch_Open = 0; } /*Token Pouch opened*/ else if(event.gui.toString().contains("lazarus.container.token_pouch.GuiTokenPouch")) {globalFlag_Token_Pouch_Open = 1;} } /*---------------------------------------- Listen for item pickup ----------------------------------------*/ @SubscribeEvent public void onItemPickup(EntityItemPickupEvent event){ /*Amsollions Token*/ String whisperTextTemp = ""; boolean trigger = false; if(event.item.getDisplayName().toString().contains("item.item.gilded_token")){whisperTextTemp = AmsollionWhispers.randomWhsiper();trigger = true;} if(event.item.getDisplayName().toString().contains("item.item.waning_token")){whisperTextTemp = OsmodeusWhispers.randomWhsiper();trigger = true;} if(event.item.getDisplayName().toString().contains("item.item.amplifying_token")){whisperTextTemp = ImbrasWhispers.randomWhsiper();trigger = true;} if(trigger) { String whisperText = ""; String[] whisperTextSplit = whisperTextTemp.split(" "); for(String element : whisperTextSplit){whisperText += "§8§o";whisperText += element;whisperText+=" ";} IChatComponent whisper = new ChatComponentText(whisperText); SoundHandler.lazarusPlaySound("mob.wither.idle", 0.1F, 0.1F); event.entityPlayer.addChatMessage(whisper); } } /*---------------------------------------- Listen entity taking damage ----------------------------------------*/ @SubscribeEvent public void onEntityGetHurt(LivingHurtEvent event) { if(event.entity instanceof EntityPlayer) { /*Multiplied damgage taken by the player*/ EntityPlayer player = (EntityPlayer) event.entityLiving; if(player.inventory.hasItem(LazarusItems.amplifying_token)){event.ammount *= 100;} } else if(event.source.getEntity() instanceof EntityPlayer) { /*Multiplied damgage dealt by the player*/ EntityPlayer player = (EntityPlayer) event.source.getEntity(); if(player.inventory.hasItem(LazarusItems.amplifying_token)){event.ammount *= 100;} } } } ----------------------------------------------------------------------------------------------------------------- Original message: ----------------------------------------------------------------------------------------------------------------- Hello, I am making a mod that adds an item with an inventory. I struggled for a while, and still do not completely know what all the code does, however I was able to (following tutorials) make an item that does work in singleplayer! ...However, running a server instance crashes. java.lang.NoClassDefFoundError: net/minecraft/client/gui/GuiScreen After doing some digging, I was able to find that despite what the tutorial showed me, I should not be trying to access getClientGuiElement from my CommonProxy I can understand, to some extent, why my code is crashing... but I have zero idea how I can fix it: My common proxy extends IGuiHandler When I try to remove getClientGuiElement from the code, it throws an error As far as I can tell, I have to include getClientGuiElement in my Common proxy or it does not compile, however this is what causes my multiplayer server to crash? Here is my code: (GitHub link to full project - https://github.com/Samalot/Lazarus) item class relevant code: (not relevant, but if someone could explain to me why it is important to check if the player is not sneaking, I would be very thankful!) /*---------------------------------------- On right click ----------------------------------------*/ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer player) { if (!par2World.isRemote) { if (!player.isSneaking()) { player.openGui(LazarusMain.instance, LazarusMain.GUI_ITEM_INV, player.worldObj, 0, 0, 0); System.out.println(par1ItemStack.getTagCompound()); } else {new InventoryTokenPouch(player.getHeldItem());} } return par1ItemStack; } Common Proxy: /*Main*/ public class CommonProxy implements IGuiHandler{ /*Register the renders*/ public void registerRenders(){} @Override public Object getServerGuiElement(int guiId, EntityPlayer player, World world, int x, int y, int z) { if (guiId == LazarusMain.GUI_ITEM_INV) { return new ContainerTokenPouch(player, player.inventory, new InventoryTokenPouch(player.getHeldItem())); } else { return null; } } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; } Client Proxy /*Main*/ public class ClientProxy extends CommonProxy{ /*Register the renders*/ @Override public void registerRenders(){ LazarusItems.registerRenders(); } @Override public Object getClientGuiElement(int guiId, EntityPlayer player, World world, int x, int y, int z) { if (guiId == LazarusMain.GUI_ITEM_INV) { return new GuiTokenPouch(player, player.inventory, new InventoryTokenPouch(player.getHeldItem())); } else { return null; } } } Any help on this matter would be hugely appreciated! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.