public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); 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); } } par1NBTTagCompound.setTag("Items", nbttaglist); lava.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("Heat", heat); par1NBTTagCompound.setInteger("Pro", progress); }
public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); NBTBase nbttaglist = par1NBTTagCompound.getTag("Items"); this.inv = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < ((NBTTagList) nbttaglist).tagCount(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) ((Object) nbttaglist).tagAt(i); byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.inv.length) { this.inv[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } lava = lava.readFromNBT(par1NBTTagCompound); heat = par1NBTTagCompound.getInteger("Heat"); progress = par1NBTTagCompound.getInteger("Pro"); }
@Override public void updateEntity() { super.updateEntity(); if (worldObj.isRemote) { return; } if (heat > 1500) { if (inv[0] != null && inv[0].itemID == BaconItems.rawBacon.itemID && lava.getCapacity() - 100 >= lava.getFluidAmount()) { progress++; if (progress > 100) { progress = 0; lava.fill(new FluidStack(BaconItems.liquidBacon, 100), true); } } } pushFluidOut(); if (worldObj.isRemote) // || worldObj.getWorldTime() % 20 != 0) { return; } int HottestHeat = 20; for (int i = 0; i < 6; i++) { TileEntity tile = BaconWorld.getTileEntity(worldObj, xCoord, yCoord, zCoord, i); if (tile != null && tile instanceof Heater) { Heater heat = (Heater) tile; HottestHeat = Math.max(HottestHeat, heat.getHeat()); } } if (HottestHeat > heat) { heat++; } else if (HottestHeat == heat) { } else { heat--; } }