コード例 #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
ファイル: Entity.cs プロジェクト: AlphaDelta/SharpBukkit
 public virtual void ReadFromNBT(net.minecraft.src.NBTTagCompound nbttagcompound)
 {
     //TODO: Bukkit stuff???
     net.minecraft.src.NBTTagList nbttaglist  = nbttagcompound.GetTagList("Pos");
     net.minecraft.src.NBTTagList nbttaglist1 = nbttagcompound.GetTagList("Motion");
     net.minecraft.src.NBTTagList nbttaglist2 = nbttagcompound.GetTagList("Rotation");
     motionX = ((net.minecraft.src.NBTTagDouble)nbttaglist1.TagAt(0)).doubleValue;
     motionY = ((net.minecraft.src.NBTTagDouble)nbttaglist1.TagAt(1)).doubleValue;
     motionZ = ((net.minecraft.src.NBTTagDouble)nbttaglist1.TagAt(2)).doubleValue;
     if (System.Math.Abs(motionX) > 10D)
     {
         motionX = 0.0D;
     }
     if (System.Math.Abs(motionY) > 10D)
     {
         motionY = 0.0D;
     }
     if (System.Math.Abs(motionZ) > 10D)
     {
         motionZ = 0.0D;
     }
     prevPosX = lastTickPosX = posX = ((net.minecraft.src.NBTTagDouble)nbttaglist.TagAt
                                           (0)).doubleValue;
     prevPosY = lastTickPosY = posY = ((net.minecraft.src.NBTTagDouble)nbttaglist.TagAt
                                           (1)).doubleValue;
     prevPosZ = lastTickPosZ = posZ = ((net.minecraft.src.NBTTagDouble)nbttaglist.TagAt
                                           (2)).doubleValue;
     prevRotationYaw = rotationYaw = ((net.minecraft.src.NBTTagFloat)nbttaglist2.TagAt
                                          (0)).floatValue;
     prevRotationPitch = rotationPitch = ((net.minecraft.src.NBTTagFloat)nbttaglist2.TagAt
                                              (1)).floatValue;
     fallDistance = nbttagcompound.GetFloat("FallDistance");
     fire         = nbttagcompound.GetShort("Fire");
     air          = nbttagcompound.GetShort("Air");
     onGround     = nbttagcompound.GetBoolean("OnGround");
     SetPosition(posX, posY, posZ);
     SetRotation(rotationYaw, rotationPitch);
     ReadEntityFromNBT(nbttagcompound);
 }
コード例 #4
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);
         }
     }
 }
コード例 #5
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]);
 }
コード例 #6
0
ファイル: ChunkLoader.cs プロジェクト: AlphaDelta/SharpBukkit
        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);
        }