コード例 #1
0
 @Override
 public void writeToNBT(NBTTagCompound compound) {
   super.writeToNBT(compound);
   NBTTagList list = new NBTTagList();
   for (int i = 0; i < contents.length; i++) {
     if (contents[i] == null) continue;
     NBTTagCompound item = new NBTTagCompound();
     item.setByte("Slot", (byte) i);
     contents[i].writeToNBT(item);
     list.appendTag(item);
   }
   compound.setTag("Items", list);
   if (lock != null) compound.setCompoundTag("lock", lock.writeToNBT(new NBTTagCompound("")));
 }
コード例 #2
0
 @Override
 public Packet getDescriptionPacket() {
   NBTTagCompound compound = new NBTTagCompound();
   if (lock != null) lock.writeToNBT(compound);
   return new Packet132TileEntityData(xCoord, yCoord, zCoord, 0, compound);
 }