@Override public void readSyncData(NBTTagCompound tag) { super.readSyncData(tag); this.RCStorage = tag.getDouble("RCStorage"); this.batterySlots = new ItemStack[this.batterySlots.length]; NBTTagList nbttaglist = tag.getTagList("RCSlots", 10); for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.batterySlots.length) { this.batterySlots[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } }
@Override public void writeSyncData(NBTTagCompound tag) { super.writeSyncData(tag); tag.setDouble("RCStorage", this.RCStorage); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.batterySlots.length; ++i) { if (this.batterySlots[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); this.batterySlots[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } tag.setTag("RCSlots", nbttaglist); }
public void writeToNBT(NBTTagCompound packet) { super.writeToNBT(packet); }
public void readFromNBT(NBTTagCompound packet) { super.readFromNBT(packet); }