Posted March 27, 201312 yr I'm getting a strange error on my mod. It works in eclipse but when I reobfuscate it, it has this error: 2013-03-27 17:49:03 [iNFO] [sTDERR] Exception in thread "Minecraft main thread" java.lang.NoClassDefFoundError: mods/better_recipes_vtsman/shelfTE 2013-03-27 17:49:03 [iNFO] [sTDERR] at mods.better_recipes_vtsman.betterrecipes.<init>(betterrecipes.java:79) 2013-03-27 17:49:03 [iNFO] [sTDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 2013-03-27 17:49:03 [iNFO] [sTDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 2013-03-27 17:49:03 [iNFO] [sTDERR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.Class.newInstance0(Class.java:357) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.Class.newInstance(Class.java:310) 2013-03-27 17:49:03 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLModContainer$JavaAdapter.getNewInstance(FMLModContainer.java:129) 2013-03-27 17:49:03 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:487) 2013-03-27 17:49:03 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-03-27 17:49:03 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2013-03-27 17:49:03 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Method.java:597) 2013-03-27 17:49:03 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) 2013-03-27 17:49:03 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 2013-03-27 17:49:03 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) 2013-03-27 17:49:03 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) 2013-03-27 17:49:03 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267) 2013-03-27 17:49:03 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165) 2013-03-27 17:49:03 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-03-27 17:49:03 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2013-03-27 17:49:03 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Method.java:597) 2013-03-27 17:49:03 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) 2013-03-27 17:49:03 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 2013-03-27 17:49:03 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) 2013-03-27 17:49:03 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) 2013-03-27 17:49:03 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267) 2013-03-27 17:49:03 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98) 2013-03-27 17:49:03 [iNFO] [sTDERR] at cpw.mods.fml.common.Loader.loadMods(Loader.java:502) 2013-03-27 17:49:03 [iNFO] [sTDERR] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:160) 2013-03-27 17:49:03 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:407) 2013-03-27 17:49:03 [iNFO] [sTDERR] at net.minecraft.client.MinecraftAppletImpl.func_71384_a(SourceFile:56) 2013-03-27 17:49:03 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:729) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.Thread.run(Thread.java:680) 2013-03-27 17:49:03 [iNFO] [sTDERR] Caused by: java.lang.ClassNotFoundException: mods.better_recipes_vtsman.shelfTE 2013-03-27 17:49:03 [iNFO] [sTDERR] at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:211) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 2013-03-27 17:49:03 [iNFO] [sTDERR] ... 35 more 2013-03-27 17:49:03 [iNFO] [sTDERR] Caused by: java.lang.ClassFormatError: Duplicate method name&signature in class file mods/better_recipes_vtsman/shelfTE 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.ClassLoader.defineClass1(Native Method) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.lang.ClassLoader.defineClass(ClassLoader.java:615) 2013-03-27 17:49:03 [iNFO] [sTDERR] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) 2013-03-27 17:49:03 [iNFO] [sTDERR] at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:200) 2013-03-27 17:49:03 [iNFO] [sTDERR] ... 37 more
March 27, 201312 yr Author It's on 1.5.1 by the way, It was working in 1.4.7 and 1.5 but now 1.5.1, and it's all updated
March 27, 201312 yr 1.5.1 likely changed something that causes your mod, betterrecipes.java at line 79 to no longer work correctly. Likely a function name changed. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
March 27, 201312 yr Author The strange thing is my eclipse instance is running 1.5.1, It's only when I compile it that I get these errors
March 27, 201312 yr Author line 79 - 81 is pretty standard code: public final Block emptyShelf = new emptyShelf(500, 0, Material.wood) .setHardness(1.5F).setStepSound(Block.soundWoodFootstep) .setCreativeTab(CreativeTabs.tabDecorations); And the bookshelf is pretty simple too: //todo: add inventory package mods.better_recipes_vtsman; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.src.*; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.IFuelHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.item.ItemStack; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; public class emptyShelf extends BlockContainer { public emptyShelf (int id, int texture, Material material) { super(id, material); setUnlocalizedName("Empty Shelf"); } @Override public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("better_recipes_vtsman:emptyShelf"); } public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { return par1 != 1 && par1 != 0 ? super.getBlockTextureFromSideAndMetadata(par1, par2) : Block.planks.getBlockTextureFromSide(par1); } public int getBurnTime(ItemStack fuel) { return 300; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); if (tileEntity == null || player.isSneaking()) { return false; } //code to open gui explained later player.openGui(betterrecipes.instance, 0, world, x, y, z); return true; } @Override public void breakBlock(World world, int x, int y, int z, int par5, int par6) { dropItems(world, x, y, z); super.breakBlock(world, x, y, z, par5, par6); } private void dropItems(World world, int x, int y, int z){ Random rand = new Random(); TileEntity tileEntity = world.getBlockTileEntity(x, y, z); if (!(tileEntity instanceof IInventory)) { return; } IInventory inventory = (IInventory) tileEntity; for (int i = 0; i < inventory.getSizeInventory(); i++) { ItemStack item = inventory.getStackInSlot(i); if (item != null && item.stackSize > 0) { float rx = rand.nextFloat() * 0.8F + 0.1F; float ry = rand.nextFloat() * 0.8F + 0.1F; float rz = rand.nextFloat() * 0.8F + 0.1F; EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.itemID, item.stackSize, item.getItemDamage())); if (item.hasTagCompound()) { //entityItems.setTagCompound((NBTTagCompound) item.getTagCompound().copy()); } float factor = 0.05F; entityItem.motionX = rand.nextGaussian() * factor; entityItem.motionY = rand.nextGaussian() * factor + 0.2F; entityItem.motionZ = rand.nextGaussian() * factor; world.spawnEntityInWorld(entityItem); item.stackSize = 0; } } } @Override public TileEntity createNewTileEntity(World world) { return new shelfTE(); } }
March 27, 201312 yr Make sure your import.blah is all at the very top of the .class file. I am the current head modder for the Metroid Prime Suits mod. I have no other staff members, so I'm hiring! I also co-own the SkyTekkit server. http://i1276.photobucket.com/albums/y480/Sypher40/MPSbanner_zps9d50d86a.png[/img]
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.