コード例 #1
0
ファイル: TEBarrel.java プロジェクト: rjdunlap/TFCraft
 @Override
 public void readFromNBT(NBTTagCompound nbt) {
   super.readFromNBT(nbt);
   fluid = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("fluidNBT"));
   sealed = nbt.getBoolean("Sealed");
   sealtime = nbt.getInteger("SealTime");
   barrelType = nbt.getInteger("barrelType");
   // mode = nbt.getInteger("mode");
   rotation = nbt.getByte("rotation");
   NBTTagList nbttaglist = nbt.getTagList("Items", 10);
   storage = new ItemStack[getSizeInventory()];
   for (int i = 0; i < nbttaglist.tagCount(); i++) {
     NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
     byte byte0 = nbttagcompound1.getByte("Slot");
     if (byte0 >= 0 && byte0 < storage.length)
       storage[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
   }
 }
コード例 #2
0
ファイル: TEBarrel.java プロジェクト: rjdunlap/TFCraft
 @Override
 public void writeToNBT(NBTTagCompound nbt) {
   super.writeToNBT(nbt);
   nbt.setBoolean("Sealed", sealed);
   nbt.setInteger("SealTime", sealtime);
   nbt.setInteger("barrelType", barrelType);
   // nbt.setInteger("mode", mode);
   NBTTagCompound fluidNBT = new NBTTagCompound();
   if (fluid != null) fluid.writeToNBT(fluidNBT);
   nbt.setTag("fluidNBT", fluidNBT);
   nbt.setByte("rotation", rotation);
   NBTTagList nbttaglist = new NBTTagList();
   for (int i = 0; i < storage.length; i++) {
     if (storage[i] != null) {
       NBTTagCompound nbttagcompound1 = new NBTTagCompound();
       nbttagcompound1.setByte("Slot", (byte) i);
       storage[i].writeToNBT(nbttagcompound1);
       nbttaglist.appendTag(nbttagcompound1);
     }
   }
   nbt.setTag("Items", nbttaglist);
 }