Пример #1
0
 protected internal override void ReadEntityFromNBT(net.minecraft.src.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)
         {
             net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Items");
             cargoItems = new net.minecraft.src.ItemStack[GetSizeInventory()];
             for (int i = 0; i < nbttaglist.TagCount(); i++)
             {
                 net.minecraft.src.NBTTagCompound nbttagcompound1 = (net.minecraft.src.NBTTagCompound
                                                                     )nbttaglist.TagAt(i);
                 int j = nbttagcompound1.GetByte("Slot");
                 if (j >= 0 && j < cargoItems.Length)
                 {
                     cargoItems[j] = new net.minecraft.src.ItemStack(nbttagcompound1);
                 }
             }
         }
     }
 }
Пример #2
0
 public virtual void ReadFromNBT(net.minecraft.src.NBTTagList nbttaglist)
 {
     mainInventory  = new net.minecraft.src.ItemStack[36];
     armorInventory = new net.minecraft.src.ItemStack[4];
     for (int i = 0; i < nbttaglist.TagCount(); i++)
     {
         net.minecraft.src.NBTTagCompound nbttagcompound = (net.minecraft.src.NBTTagCompound
                                                            )nbttaglist.TagAt(i);
         int j = nbttagcompound.GetByte("Slot");
         net.minecraft.src.ItemStack itemstack = new net.minecraft.src.ItemStack(nbttagcompound
                                                                                 );
         if (itemstack.GetItem() == null)
         {
             continue;
         }
         if (j >= 0 && j < mainInventory.Length)
         {
             mainInventory[j] = itemstack;
         }
         if (j >= 100 && j < armorInventory.Length + 100)
         {
             armorInventory[j - 100] = itemstack;
         }
     }
 }
Пример #3
0
 public override void ReadFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     base.ReadFromNBT(nbttagcompound);
     net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Items");
     items = new net.minecraft.src.ItemStack[GetSizeInventory()];
     for (int i = 0; i < nbttaglist.TagCount(); i++)
     {
         net.minecraft.src.NBTTagCompound nbttagcompound1 = (net.minecraft.src.NBTTagCompound
                                                             )nbttaglist.TagAt(i);
         int j = nbttagcompound1.GetByte("Slot");
         if (j >= 0 && j < items.Length)
         {
             items[j] = new net.minecraft.src.ItemStack(nbttagcompound1);
         }
     }
 }
Пример #4
0
 public override void ReadFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     base.ReadFromNBT(nbttagcompound);
     net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Items");
     furnaceItemStacks = new net.minecraft.src.ItemStack[GetSizeInventory()];
     for (int i = 0; i < nbttaglist.TagCount(); i++)
     {
         net.minecraft.src.NBTTagCompound nbttagcompound1 = (net.minecraft.src.NBTTagCompound
                                                             )nbttaglist.TagAt(i);
         byte byte0 = nbttagcompound1.GetByte("Slot");
         if (byte0 >= 0 && ((sbyte)byte0) < furnaceItemStacks.Length)
         {
             furnaceItemStacks[byte0] = new net.minecraft.src.ItemStack(nbttagcompound1);
         }
     }
     furnaceBurnTime     = nbttagcompound.GetShort("BurnTime");
     furnaceCookTime     = nbttagcompound.GetShort("CookTime");
     currentItemBurnTime = GetItemBurnTime(furnaceItemStacks[1]);
 }
Пример #5
0
        public static net.minecraft.src.Chunk LoadChunkIntoWorldFromCompound(net.minecraft.src.World
                                                                             world, net.minecraft.src.NBTTagCompound nbttagcompound)
        {
            int i = nbttagcompound.GetInteger("xPos");
            int j = nbttagcompound.GetInteger("zPos");

            net.minecraft.src.Chunk chunk = new net.minecraft.src.Chunk(world, i, j);
            chunk.blocks = nbttagcompound.GetByteArray("Blocks");
            chunk.data   = new net.minecraft.src.NibbleArray(nbttagcompound.GetByteArray("Data"
                                                                                         ));
            chunk.skylightMap = new net.minecraft.src.NibbleArray(nbttagcompound.GetByteArray
                                                                      ("SkyLight"));
            chunk.blocklightMap = new net.minecraft.src.NibbleArray(nbttagcompound.GetByteArray
                                                                        ("BlockLight"));
            chunk.heightMap          = nbttagcompound.GetByteArray("HeightMap");
            chunk.isTerrainPopulated = nbttagcompound.GetBoolean("TerrainPopulated");
            if (!chunk.data.IsValid())
            {
                chunk.data = new net.minecraft.src.NibbleArray(chunk.blocks.Length);
            }
            if (chunk.heightMap == null || !chunk.skylightMap.IsValid())
            {
                chunk.heightMap   = new byte[256];
                chunk.skylightMap = new net.minecraft.src.NibbleArray(chunk.blocks.Length);
                chunk.Func_353_b();
            }
            if (!chunk.blocklightMap.IsValid())
            {
                chunk.blocklightMap = new net.minecraft.src.NibbleArray(chunk.blocks.Length);
                chunk.Func_348_a();
            }
            net.minecraft.src.NBTTagList nbttaglist = nbttagcompound.GetTagList("Entities");
            if (nbttaglist != null)
            {
                for (int k = 0; k < nbttaglist.TagCount(); k++)
                {
                    net.minecraft.src.NBTTagCompound nbttagcompound1 = (net.minecraft.src.NBTTagCompound
                                                                        )nbttaglist.TagAt(k);
                    net.minecraft.src.Entity entity = net.minecraft.src.EntityList.CreateEntityFromNBT
                                                          (nbttagcompound1, world);
                    chunk.hasEntities = true;
                    if (entity != null)
                    {
                        chunk.AddEntity(entity);
                    }
                }
            }
            net.minecraft.src.NBTTagList nbttaglist1 = nbttagcompound.GetTagList("TileEntities"
                                                                                 );
            if (nbttaglist1 != null)
            {
                for (int l = 0; l < nbttaglist1.TagCount(); l++)
                {
                    net.minecraft.src.NBTTagCompound nbttagcompound2 = (net.minecraft.src.NBTTagCompound
                                                                        )nbttaglist1.TagAt(l);
                    net.minecraft.src.TileEntity tileentity = net.minecraft.src.TileEntity.CreateAndLoadEntity
                                                                  (nbttagcompound2);
                    if (tileentity != null)
                    {
                        chunk.AddTileEntity(tileentity);
                    }
                }
            }
            return(chunk);
        }