November 6, 201410 yr Author ok cool I got it to work. I changed my code to: package com.example.gammacraft.TileEntity; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class MultiToolModifierTileEntity extends TileEntity { public ItemStack[] inv; public MultiToolModifierTileEntity() { inv=new ItemStack[10]; } public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); this.writeToNBT(nbtTag); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag); } public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { readFromNBT(packet.func_148857_g()); } public void writeToNBT(NBTTagCompound nbt){ super.writeToNBT(nbt); for(int i =0;i!=inv.length;i++){ NBTTagCompound NBT = new NBTTagCompound(); if(inv[i]!=null){ inv[i].writeToNBT(NBT); nbt.setTag("ItemStack"+i,NBT); } System.out.println("saving:"+i); } this.markDirty(); } public void readFromNBT(NBTTagCompound nbt){ super.readFromNBT(nbt); for(int i =0;i!=inv.length;i++){ NBTTagCompound itemstack = nbt.getCompoundTag("ItemStack"+i); try{ inv[i]=ItemStack.loadItemStackFromNBT(itemstack); }catch(Exception e){ e.printStackTrace(); } System.out.println("reading:"+i); } } } The proud(ish) developer of Ancients
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.