JamEngulfer221
Members-
Posts
5 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
JamEngulfer221's Achievements
Tree Puncher (2/8)
0
Reputation
-
Unable to set NBT Tag to an EntityItem
JamEngulfer221 replied to JamEngulfer221's topic in Modder Support
Scratch that. I've had it answered by someone in the IRC -
I am trying to create a container/tile entity for a block I am making. I have been following a tutorial that described it step by step. I followed the tutorial to the word and somehow I still have an error with setting an NBT tag to an item, even when in the tutorial, there are no errors. Here is the code for the method involved: private void dropItems(World world, int x, int y, int z){ Random rand = new Random(); TileEntity tile_entity = world.getBlockTileEntity(x, y, z); if(!(tile_entity instanceof IInventory)){ return; } IInventory inventory = (IInventory) tile_entity; for(int i = 0; i < inventory.getSizeInventory(); i++){ ItemStack item = inventory.getStackInSlot(i); if(item != null && item.stackSize > 0){ float rx = rand.nextFloat() * 0.6F + 0.1F; float ry = rand.nextFloat() * 0.6F + 0.1F; float rz = rand.nextFloat() * 0.6F + 0.1F; EntityItem entity_item = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.itemID, item.stackSize, item.getItemDamage())); if(item.hasTagCompound()){ entity_item.item.setTagCompound((NBTTagCompound) item.getTagCompound().copy()); } float factor = 0.5F; entity_item.motionX = rand.nextGaussian() * factor; entity_item.motionY = rand.nextGaussian() * factor + 0.2F; entity_item.motionZ = rand.nextGaussian() * factor; world.spawnEntityInWorld(entity_item); item.stackSize = 0; } } } The affected line is entity_item.item.setTagCompound((NBTTagCompound) item.getTagCompound().copy()); More specifically, there is an error in the .item. part saying "Item cannot be resolved or is not a field". I checked the Containers and GUIs tutorial on the wiki, but all they have in that place is .func_92014_d(). which is hardly helpful. Does anyone have any idea what to do? Thanks!
-
So, my mod works perfectly well Clientside, however when I try to run up the server version, I get this error: [sEVERE] Encountered an unexpected exception LoaderException cpw.mods.fml.common.LoaderException: cpw.mods.fml.common.LoaderException at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:69) at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:462) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83) at cpw.mods.fml.common.Loader.loadMods(Loader.java:479) at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:86) at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:345) at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:64) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:458) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) Caused by: cpw.mods.fml.common.LoaderException at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:62) ... 27 more My Proxy class, if it's anything to do with it: package com.crystals; public class CrystalProxy { public void registerRenderThings(){}; } Thanks!