@Override public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); int i = 0; for (BPPart p : parts) { NBTTagCompound t = new NBTTagCompound(); p.save(t); tag.setString("partType" + i, p.getType()); tag.setTag("part" + i, t); i++; } tag.setInteger("partAmount", i); }
public NBTTagCompound getUpdatePacketData() { NBTTagCompound tag = new NBTTagCompound(); int i = 0; for (BPPart p : parts) { NBTTagCompound t = new NBTTagCompound(); p.save(t); tag.setString("partType" + i, p.getType()); tag.setString("partId" + i, partIds.get(p).toString()); tag.setTag("part" + i, t); i++; } tag.setInteger("partAmount", i); return tag; }