@Override public void update() { super.update(); TileEntityPower powerSource = getPowerSource(); if (getStackInSlot(0) != null && !spinning.equals("spinning") && powerSource.getPower() > 600) { System.out.println("Attempting Spin"); grow(powerSource); } }
@Override public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); NBTTagList tagList = tagCompound.getTagList("Inventory", 10); for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); byte slot = tag.getByte("Slot"); if (slot >= 0 && slot < this.chestContents.length) this.chestContents[slot] = ItemStack.loadItemStackFromNBT(tag); } spinning = tagCompound.getString("Spinning"); }
@Override public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); NBTTagList itemList = new NBTTagList(); for (int i = 0; i < this.chestContents.length; i++) { ItemStack stack = this.chestContents[i]; if (stack != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); stack.writeToNBT(tag); itemList.appendTag(tag); } } tagCompound.setTag("Inventory", itemList); tagCompound.setString("Spinning", spinning); return tagCompound; }