Esempio n. 1
0
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetShort("xTile", (short)XTile);
     par1NBTTagCompound.SetShort("yTile", (short)YTile);
     par1NBTTagCompound.SetShort("zTile", (short)ZTile);
     par1NBTTagCompound.SetByte("inTile", (byte)InTile);
     par1NBTTagCompound.SetByte("inGround", (byte)(InGround ? 1 : 0));
 }
 /// <summary>
 /// write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities
 /// </summary>
 public override void WriteToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetByte("dimension", Dimension);
     par1NBTTagCompound.SetInteger("xCenter", XCenter);
     par1NBTTagCompound.SetInteger("zCenter", ZCenter);
     par1NBTTagCompound.SetByte("scale", Scale);
     par1NBTTagCompound.SetShort("width", (short)128);
     par1NBTTagCompound.SetShort("height", (short)128);
     par1NBTTagCompound.SetByteArray("colors", Colors);
 }
Esempio n. 3
0
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetShort("xTile", (short)XTile);
     par1NBTTagCompound.SetShort("yTile", (short)YTile);
     par1NBTTagCompound.SetShort("zTile", (short)ZTile);
     par1NBTTagCompound.SetByte("inTile", (byte)InTile);
     par1NBTTagCompound.SetByte("inData", (byte)InData);
     par1NBTTagCompound.SetByte("shake", (byte)ArrowShake);
     par1NBTTagCompound.SetByte("inGround", (byte)(InGround ? 1 : 0));
     par1NBTTagCompound.Setbool("player", DoesArrowBelongToPlayer);
     par1NBTTagCompound.SetDouble("damage", Damage);
 }
Esempio n. 4
0
        /// <summary>
        /// (abstract) Protected helper method to write subclass entity data to NBT.
        /// </summary>
        public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
        {
            par1NBTTagCompound.SetInteger("Type", MinecartType);

            if (MinecartType == 2)
            {
                par1NBTTagCompound.SetDouble("PushX", PushX);
                par1NBTTagCompound.SetDouble("PushZ", PushZ);
                par1NBTTagCompound.SetShort("Fuel", (short)Fuel);
            }
            else if (MinecartType == 1)
            {
                NBTTagList nbttaglist = new NBTTagList();

                for (int i = 0; i < CargoItems.Length; i++)
                {
                    if (CargoItems[i] != null)
                    {
                        NBTTagCompound nbttagcompound = new NBTTagCompound();
                        nbttagcompound.SetByte("Slot", (byte)i);
                        CargoItems[i].WriteToNBT(nbttagcompound);
                        nbttaglist.AppendTag(nbttagcompound);
                    }
                }

                par1NBTTagCompound.SetTag("Items", nbttaglist);
            }
        }
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetByte("Dir", (byte)Direction);
     par1NBTTagCompound.SetString("Motive", Art.Title);
     par1NBTTagCompound.SetInteger("TileX", XPosition);
     par1NBTTagCompound.SetInteger("TileY", YPosition);
     par1NBTTagCompound.SetInteger("TileZ", ZPosition);
 }
Esempio n. 6
0
        /// <summary>
        /// Write the stack fields to a NBT object. Return the new NBT object.
        /// </summary>
        public NBTTagCompound WriteToNBT(NBTTagCompound par1NBTTagCompound)
        {
            par1NBTTagCompound.SetShort("id", (short)ItemID);
            par1NBTTagCompound.SetByte("Count", (byte)StackSize);
            par1NBTTagCompound.SetShort("Damage", (short)ItemDamage);

            if (StackTagCompound != null)
            {
                par1NBTTagCompound.SetTag("tag", StackTagCompound);
            }

            return(par1NBTTagCompound);
        }
        /// <summary>
        /// Writes a tile entity to NBT.
        /// </summary>
        public override void WriteToNBT(NBTTagCompound par1NBTTagCompound)
        {
            base.WriteToNBT(par1NBTTagCompound);
            NBTTagList nbttaglist = new NBTTagList();

            for (int i = 0; i < DispenserContents.Length; i++)
            {
                if (DispenserContents[i] != null)
                {
                    NBTTagCompound nbttagcompound = new NBTTagCompound();
                    nbttagcompound.SetByte("Slot", (byte)i);
                    DispenserContents[i].WriteToNBT(nbttagcompound);
                    nbttaglist.AppendTag(nbttagcompound);
                }
            }

            par1NBTTagCompound.SetTag("Items", nbttaglist);
        }
Esempio n. 8
0
        /// <summary>
        /// Writes a tile entity to NBT.
        /// </summary>
        public override void WriteToNBT(NBTTagCompound par1NBTTagCompound)
        {
            base.WriteToNBT(par1NBTTagCompound);
            par1NBTTagCompound.SetShort("BrewTime", (short)BrewTime);
            NBTTagList nbttaglist = new NBTTagList();

            for (int i = 0; i < BrewingItemStacks.Length; i++)
            {
                if (BrewingItemStacks[i] != null)
                {
                    NBTTagCompound nbttagcompound = new NBTTagCompound();
                    nbttagcompound.SetByte("Slot", (byte)i);
                    BrewingItemStacks[i].WriteToNBT(nbttagcompound);
                    nbttaglist.AppendTag(nbttagcompound);
                }
            }

            par1NBTTagCompound.SetTag("Items", nbttaglist);
        }
Esempio n. 9
0
        private void Func_48445_a(Chunk par1Chunk, World par2World, NBTTagCompound par3NBTTagCompound)
        {
            par2World.CheckSessionLock();
            par3NBTTagCompound.SetInteger("xPos", par1Chunk.XPosition);
            par3NBTTagCompound.SetInteger("zPos", par1Chunk.ZPosition);
            par3NBTTagCompound.SetLong("LastUpdate", par2World.GetWorldTime());
            par3NBTTagCompound.Func_48183_a("HeightMap", par1Chunk.HeightMap);
            par3NBTTagCompound.Setbool("TerrainPopulated", par1Chunk.IsTerrainPopulated);
            ExtendedBlockStorage[] aextendedblockstorage = par1Chunk.GetBlockStorageArray();
            NBTTagList             nbttaglist            = new NBTTagList("Sections");

            ExtendedBlockStorage[] aextendedblockstorage1 = aextendedblockstorage;
            int i = aextendedblockstorage1.Length;

            for (int k = 0; k < i; k++)
            {
                ExtendedBlockStorage extendedblockstorage = aextendedblockstorage1[k];

                if (extendedblockstorage == null || extendedblockstorage.Func_48700_f() == 0)
                {
                    continue;
                }

                NBTTagCompound nbttagcompound = new NBTTagCompound();
                nbttagcompound.SetByte("Y", (byte)(extendedblockstorage.GetYLocation() >> 4 & 0xff));
                nbttagcompound.SetByteArray("Blocks", extendedblockstorage.Func_48692_g());

                if (extendedblockstorage.GetBlockMSBArray() != null)
                {
                    nbttagcompound.SetByteArray("Add", extendedblockstorage.GetBlockMSBArray().Data);
                }

                nbttagcompound.SetByteArray("Data", extendedblockstorage.Func_48697_j().Data);
                nbttagcompound.SetByteArray("SkyLight", extendedblockstorage.GetSkylightArray().Data);
                nbttagcompound.SetByteArray("BlockLight", extendedblockstorage.GetBlocklightArray().Data);
                nbttaglist.AppendTag(nbttagcompound);
            }

            par3NBTTagCompound.SetTag("Sections", nbttaglist);
            par3NBTTagCompound.SetByteArray("Biomes", par1Chunk.GetBiomeArray());
            par1Chunk.HasEntities = false;
            NBTTagList nbttaglist1 = new NBTTagList();

label0:

            for (int j = 0; j < par1Chunk.EntityLists.Length; j++)
            {
                IEnumerator <Entity> iterator = par1Chunk.EntityLists[j].GetEnumerator();

                do
                {
                    if (!iterator.MoveNext())
                    {
                        goto label0;
                    }

                    Entity entity = iterator.Current;
                    par1Chunk.HasEntities = true;
                    NBTTagCompound nbttagcompound1 = new NBTTagCompound();

                    if (entity.AddEntityID(nbttagcompound1))
                    {
                        nbttaglist1.AppendTag(nbttagcompound1);
                    }
                }while (true);
            }

            par3NBTTagCompound.SetTag("Entities", nbttaglist1);
            NBTTagList     nbttaglist2 = new NBTTagList();
            NBTTagCompound nbttagcompound2;

            for (IEnumerator <TileEntity> iterator1 = par1Chunk.ChunkTileEntityMap.Values.GetEnumerator(); iterator1.MoveNext(); nbttaglist2.AppendTag(nbttagcompound2))
            {
                TileEntity tileentity = iterator1.Current;
                nbttagcompound2 = new NBTTagCompound();
                tileentity.WriteToNBT(nbttagcompound2);
            }

            par3NBTTagCompound.SetTag("TileEntities", nbttaglist2);
            List <NextTickListEntry> list = par2World.GetPendingBlockUpdates(par1Chunk, false);

            if (list != null)
            {
                long           l           = par2World.GetWorldTime();
                NBTTagList     nbttaglist3 = new NBTTagList();
                NBTTagCompound nbttagcompound3;

                for (IEnumerator <NextTickListEntry> iterator2 = list.GetEnumerator(); iterator2.MoveNext(); nbttaglist3.AppendTag(nbttagcompound3))
                {
                    NextTickListEntry nextticklistentry = iterator2.Current;
                    nbttagcompound3 = new NBTTagCompound();
                    nbttagcompound3.SetInteger("i", nextticklistentry.BlockID);
                    nbttagcompound3.SetInteger("x", nextticklistentry.XCoord);
                    nbttagcompound3.SetInteger("y", nextticklistentry.YCoord);
                    nbttagcompound3.SetInteger("z", nextticklistentry.ZCoord);
                    nbttagcompound3.SetInteger("t", (int)(nextticklistentry.ScheduledTime - l));
                }

                par3NBTTagCompound.SetTag("TileTicks", nbttaglist3);
            }
        }
Esempio n. 10
0
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     par1NBTTagCompound.SetByte("Fuse", (byte)Fuse);
 }
 /// <summary>
 /// (abstract) Protected helper method to write subclass entity data to NBT.
 /// </summary>
 public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound)
 {
     base.WriteEntityToNBT(par1NBTTagCompound);
     par1NBTTagCompound.Setbool("Sheared", GetSheared());
     par1NBTTagCompound.SetByte("Color", (byte)GetFleeceColor());
 }