コード例 #1
0
  @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);
  }
コード例 #2
0
  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;
  }