示例#1
0
        private Chunk Func_48444_a(World par1World, NBTTagCompound par2NBTTagCompound)
        {
            int   i     = par2NBTTagCompound.GetInteger("xPos");
            int   j     = par2NBTTagCompound.GetInteger("zPos");
            Chunk chunk = new Chunk(par1World, i, j);

            chunk.HeightMap          = par2NBTTagCompound.Func_48182_l("HeightMap");
            chunk.IsTerrainPopulated = par2NBTTagCompound.Getbool("TerrainPopulated");
            NBTTagList nbttaglist = par2NBTTagCompound.GetTagList("Sections");
            sbyte      byte0      = 16;

            ExtendedBlockStorage[] aextendedblockstorage = new ExtendedBlockStorage[byte0];

            for (int k = 0; k < nbttaglist.TagCount(); k++)
            {
                NBTTagCompound       nbttagcompound       = (NBTTagCompound)nbttaglist.TagAt(k);
                byte                 byte1                = nbttagcompound.GetByte("Y");
                ExtendedBlockStorage extendedblockstorage = new ExtendedBlockStorage(byte1 << 4);
                extendedblockstorage.SetBlockLSBArray(nbttagcompound.GetByteArray("Blocks"));

                if (nbttagcompound.HasKey("Add"))
                {
                    extendedblockstorage.SetBlockMSBArray(new NibbleArray(nbttagcompound.GetByteArray("Add"), 4));
                }

                extendedblockstorage.SetBlockMetadataArray(new NibbleArray(nbttagcompound.GetByteArray("Data"), 4));
                extendedblockstorage.SetSkylightArray(new NibbleArray(nbttagcompound.GetByteArray("SkyLight"), 4));
                extendedblockstorage.SetBlocklightArray(new NibbleArray(nbttagcompound.GetByteArray("BlockLight"), 4));
                extendedblockstorage.Func_48708_d();
                aextendedblockstorage[byte1] = extendedblockstorage;
            }

            chunk.SetStorageArrays(aextendedblockstorage);

            if (par2NBTTagCompound.HasKey("Biomes"))
            {
                chunk.SetBiomeArray(par2NBTTagCompound.GetByteArray("Biomes"));
            }

            NBTTagList nbttaglist1 = par2NBTTagCompound.GetTagList("Entities");

            if (nbttaglist1 != null)
            {
                for (int l = 0; l < nbttaglist1.TagCount(); l++)
                {
                    NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist1.TagAt(l);
                    Entity         entity          = EntityList.CreateEntityFromNBT(nbttagcompound1, par1World);
                    chunk.HasEntities = true;

                    if (entity != null)
                    {
                        chunk.AddEntity(entity);
                    }
                }
            }

            NBTTagList nbttaglist2 = par2NBTTagCompound.GetTagList("TileEntities");

            if (nbttaglist2 != null)
            {
                for (int i1 = 0; i1 < nbttaglist2.TagCount(); i1++)
                {
                    NBTTagCompound nbttagcompound2 = (NBTTagCompound)nbttaglist2.TagAt(i1);
                    TileEntity     tileentity      = TileEntity.CreateAndLoadEntity(nbttagcompound2);

                    if (tileentity != null)
                    {
                        chunk.AddTileEntity(tileentity);
                    }
                }
            }

            if (par2NBTTagCompound.HasKey("TileTicks"))
            {
                NBTTagList nbttaglist3 = par2NBTTagCompound.GetTagList("TileTicks");

                if (nbttaglist3 != null)
                {
                    for (int j1 = 0; j1 < nbttaglist3.TagCount(); j1++)
                    {
                        NBTTagCompound nbttagcompound3 = (NBTTagCompound)nbttaglist3.TagAt(j1);
                        par1World.ScheduleBlockUpdateFromLoad(nbttagcompound3.GetInteger("x"), nbttagcompound3.GetInteger("y"), nbttagcompound3.GetInteger("z"), nbttagcompound3.GetInteger("i"), nbttagcompound3.GetInteger("t"));
                    }
                }
            }

            return(chunk);
        }