示例#1
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     minecartType = nbttagcompound.getInteger("Type");
     if (minecartType == 2)
     {
         pushX = nbttagcompound.getDouble("PushX");
         pushZ = nbttagcompound.getDouble("PushZ");
         fuel  = nbttagcompound.getShort("Fuel");
     }
     else if (minecartType == 1)
     {
         NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
         cargoItems = new ItemStack[getSizeInventory()];
         for (int i = 0; i < nbttaglist.tagCount(); i++)
         {
             var nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
             int j = nbttagcompound1.getByte("Slot") & 0xff;
             if (j >= 0 && j < cargoItems.Length)
             {
                 cargoItems[j] = new ItemStack(nbttagcompound1);
             }
         }
     }
 }
示例#2
0
 public override void readEntityFromNBT(NBTTagCompound nbttagcompound)
 {
     minecartType = nbttagcompound.getInteger("Type");
     if (minecartType == 2)
     {
         pushX = nbttagcompound.getDouble("PushX");
         pushZ = nbttagcompound.getDouble("PushZ");
         fuel = nbttagcompound.getShort("Fuel");
     }
     else if (minecartType == 1)
     {
         NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
         cargoItems = new ItemStack[getSizeInventory()];
         for (int i = 0; i < nbttaglist.tagCount(); i++)
         {
             var nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
             int j = nbttagcompound1.getByte("Slot") & 0xff;
             if (j >= 0 && j < cargoItems.Length)
             {
                 cargoItems[j] = new ItemStack(nbttagcompound1);
             }
         }
     }
 }