Ives
Members-
Posts
8 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
Ives's Achievements
Tree Puncher (2/8)
2
Reputation
-
Very nice find! Did you solve it without downgrading to IntelliJ 13 or is downgrading necessary to fix this problem?
-
[1.7.10] Using NBT to store items in a tileentity ?
Ives replied to Looke81's topic in Modder Support
Woops, just saw it too! Sorry! I hope it works now. -
[1.7.10] Using NBT to store items in a tileentity ?
Ives replied to Looke81's topic in Modder Support
Ah I see, this tutorial gives some insight in NBT http://www.minecraftforge.net/wiki/Tile_Entities Your whole code should be like this: public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.inv.length; ++i) { if (this.inv[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("slot", (byte)i); this.inv[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } } public void readFromNBT(NBTTagCompound p_145839_1_) { super.readFromNBT(p_145839_1_); NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("slot") & 255; if (j >= 0 && j < this.inv.length) { this.inv[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } } If that code doesn't work the problem lies elsewhere. Did you register the TileEntity in the GameRegistry? -
[1.7.10] Using NBT to store items in a tileentity ?
Ives replied to Looke81's topic in Modder Support
I looked at the code from the chest and that code did have brackets. -
[1.7.10] Using NBT to store items in a tileentity ?
Ives replied to Looke81's topic in Modder Support
I think you forgot to add brackets after inv sometimes. For example you have this: for (int i = 0; i < this.inv.length; ++i) { if (this.inv != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("slot", (byte)i); this.inv.writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } It should be this: for (int i = 0; i < this.inv.length; ++i) { if (this.inv[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("slot", (byte)i); this.inv[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } Do the same for readNBT and it should work -
[Solved] Help with New Bow Using Forge (1.5.2)
Ives replied to BlueGhast90's topic in Modder Support
I would use @SideOnly(Side.CLIENT) private Icon[] azulnow = new Icon[4]; @Override public void registerIcons(IconRegister iconRegister){ this.itemIcon = iconRegister.registerIcon((this.getUnlocalizedName().substring(5)) + "_0"); for (int N = 0; N < 4; N++){ this.azulbow[N] = iconRegister.registerIcon((this.getUnlocalizedName().substring(5)) + "_" + N); } }{ The Override is important, otherwise the texturer asks for the wrong textures.