Exemplo n.º 1
0
        public static Chunk loadChunkIntoWorldFromCompound(World world, NBTTagCompound nbttagcompound)
        {
            int i     = nbttagcompound.getInteger("xPos");
            int j     = nbttagcompound.getInteger("zPos");
            var chunk = new Chunk(world, i, j);

            chunk.blocks             = nbttagcompound.getByteArray("Blocks");
            chunk.data               = new NibbleArray(nbttagcompound.getByteArray("Data"));
            chunk.skylightMap        = new NibbleArray(nbttagcompound.getByteArray("SkyLight"));
            chunk.blocklightMap      = new NibbleArray(nbttagcompound.getByteArray("BlockLight"));
            chunk.heightMap          = nbttagcompound.getByteArray("HeightMap");
            chunk.isTerrainPopulated = nbttagcompound.getBoolean("TerrainPopulated");
            if (!chunk.data.isValid())
            {
                chunk.data = new NibbleArray(chunk.blocks.Length);
            }
            if (chunk.heightMap == null || !chunk.skylightMap.isValid())
            {
                chunk.heightMap   = new byte[256];
                chunk.skylightMap = new NibbleArray(chunk.blocks.Length);
                chunk.func_353_b();
            }
            if (!chunk.blocklightMap.isValid())
            {
                chunk.blocklightMap = new NibbleArray(chunk.blocks.Length);
                chunk.func_348_a();
            }
            NBTTagList nbttaglist = nbttagcompound.getTagList("Entities");

            if (nbttaglist != null)
            {
                for (int k = 0; k < nbttaglist.tagCount(); k++)
                {
                    var    nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(k);
                    Entity entity          = EntityList.createEntityFromNBT(nbttagcompound1, world);
                    chunk.hasEntities = true;
                    if (entity != null)
                    {
                        chunk.addEntity(entity);
                    }
                }
            }
            NBTTagList nbttaglist1 = nbttagcompound.getTagList("TileEntities");

            if (nbttaglist1 != null)
            {
                for (int l = 0; l < nbttaglist1.tagCount(); l++)
                {
                    var        nbttagcompound2 = (NBTTagCompound)nbttaglist1.tagAt(l);
                    TileEntity tileentity      = TileEntity.createAndLoadEntity(nbttagcompound2);
                    if (tileentity != null)
                    {
                        chunk.func_349_a(tileentity);
                    }
                }
            }
            return(chunk);
        }
Exemplo n.º 2
0
 public static Chunk loadChunkIntoWorldFromCompound(World world, NBTTagCompound nbttagcompound)
 {
     int i = nbttagcompound.getInteger("xPos");
     int j = nbttagcompound.getInteger("zPos");
     var chunk = new Chunk(world, i, j);
     chunk.blocks = nbttagcompound.getByteArray("Blocks");
     chunk.data = new NibbleArray(nbttagcompound.getByteArray("Data"));
     chunk.skylightMap = new NibbleArray(nbttagcompound.getByteArray("SkyLight"));
     chunk.blocklightMap = new NibbleArray(nbttagcompound.getByteArray("BlockLight"));
     chunk.heightMap = nbttagcompound.getByteArray("HeightMap");
     chunk.isTerrainPopulated = nbttagcompound.getBoolean("TerrainPopulated");
     if (!chunk.data.isValid())
     {
         chunk.data = new NibbleArray(chunk.blocks.Length);
     }
     if (chunk.heightMap == null || !chunk.skylightMap.isValid())
     {
         chunk.heightMap = new byte[256];
         chunk.skylightMap = new NibbleArray(chunk.blocks.Length);
         chunk.func_353_b();
     }
     if (!chunk.blocklightMap.isValid())
     {
         chunk.blocklightMap = new NibbleArray(chunk.blocks.Length);
         chunk.func_348_a();
     }
     NBTTagList nbttaglist = nbttagcompound.getTagList("Entities");
     if (nbttaglist != null)
     {
         for (int k = 0; k < nbttaglist.tagCount(); k++)
         {
             var nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(k);
             Entity entity = EntityList.createEntityFromNBT(nbttagcompound1, world);
             chunk.hasEntities = true;
             if (entity != null)
             {
                 chunk.addEntity(entity);
             }
         }
     }
     NBTTagList nbttaglist1 = nbttagcompound.getTagList("TileEntities");
     if (nbttaglist1 != null)
     {
         for (int l = 0; l < nbttaglist1.tagCount(); l++)
         {
             var nbttagcompound2 = (NBTTagCompound) nbttaglist1.tagAt(l);
             TileEntity tileentity = TileEntity.createAndLoadEntity(nbttagcompound2);
             if (tileentity != null)
             {
                 chunk.func_349_a(tileentity);
             }
         }
     }
     return chunk;
 }
Exemplo n.º 3
0
        public Chunk provideChunk(int i, int j)
        {
            rand.setSeed(i * 0x4f9939f508L + j * 0x1ef1565bd5L);
            var abyte0 = new byte[32768];
            var chunk  = new Chunk(worldObj, abyte0, i, j);

            biomesForGeneration = worldObj.getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, i * 16, j * 16,
                                                                                         16, 16);
            double[] ad = worldObj.getWorldChunkManager().temperature;
            generateTerrain(i, j, abyte0, biomesForGeneration, ad);
            replaceBlocksForBiome(i, j, abyte0, biomesForGeneration);
            field_695_u.func_667_a(this, worldObj, i, j, abyte0);
            chunk.func_353_b();
            return(chunk);
        }
Exemplo n.º 4
0
 public Chunk provideChunk(int i, int j)
 {
     rand.setSeed(i*0x4f9939f508L + j*0x1ef1565bd5L);
     var abyte0 = new byte[32768];
     var chunk = new Chunk(worldObj, abyte0, i, j);
     biomesForGeneration = worldObj.getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, i*16, j*16,
                                                                                  16, 16);
     double[] ad = worldObj.getWorldChunkManager().temperature;
     generateTerrain(i, j, abyte0, biomesForGeneration, ad);
     replaceBlocksForBiome(i, j, abyte0, biomesForGeneration);
     field_695_u.func_667_a(this, worldObj, i, j, abyte0);
     chunk.func_353_b();
     return chunk;
 }