@Override public void writeToNBT(NBTTagCompound tags) { super.writeToNBT(tags); tags.setInteger("fuel", fuel); tags.setInteger("temperature", temperature); tags.setBoolean("needsFuel", needsFuel); tags.setIntArray("itemTemperatures", itemTemperatures); tags.setIntArray("itemTempRequired", itemTempRequired); }
@Override public void readFromNBT(NBTTagCompound tags) { super.readFromNBT(tags); fuel = tags.getInteger("fuel"); temperature = tags.getInteger("temperature"); needsFuel = tags.getBoolean("needsFuel"); itemTemperatures = tags.getIntArray("itemTemperatures"); itemTempRequired = tags.getIntArray("itemTempRequired"); }
@Override public void setInventorySlotContents(int slot, ItemStack itemstack) { // reset heat if set to null or a different item if (itemstack == null || (getStackInSlot(slot) != null && !ItemStack.areItemStacksEqual(itemstack, getStackInSlot(slot)))) { itemTemperatures[slot] = 0; } super.setInventorySlotContents(slot, itemstack); // when an item gets added, check for its heat required updateHeatRequired(slot); }
@Override public void resize(int size) { super.resize(size); this.itemTemperatures = Arrays.copyOf(itemTemperatures, size); this.itemTempRequired = Arrays.copyOf(itemTempRequired, size); }