Esempio n. 1
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);
            }
        }