Java Code Examples for net.minecraft.world.chunk.Chunk#getBiomeArray()
The following examples show how to use
net.minecraft.world.chunk.Chunk#getBiomeArray() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorldProviderEndVoid.java From YUNoMakeGoodMap with Apache License 2.0 | 6 votes |
@Override public Chunk generateChunk(int x, int z) { ChunkPrimer primer = new ChunkPrimer(); if (YUNoMakeGoodMap.instance.shouldGenerateEndCities(this.world)) this.endCityGen.generate(world, x, z, primer); else this.endCityGen.generate(world, x, z, null); Chunk ret = new Chunk(world, primer, x, z); Biome[] biomes = world.getBiomeProvider().getBiomes(null, x * 16, z * 16, 16, 16); byte[] ids = ret.getBiomeArray(); for (int i = 0; i < ids.length; ++i) { ids[i] = (byte)Biome.getIdForBiome(biomes[i]); } ret.generateSkylightMap(); return ret; }
Example 2
Source File: ChunkGeneratorTorikki.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@Nonnull @Override public Chunk generateChunk(int x, int z) { this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); generate(x, z, chunkprimer); Chunk chunk = new Chunk(world, chunkprimer, x, z); byte[] biomeArray = chunk.getBiomeArray(); for (int i = 0; i < biomeArray.length; ++i) { biomeArray[i] = (byte) 42; } chunk.generateSkylightMap(); return chunk; }
Example 3
Source File: WorldProviderHellVoid.java From YUNoMakeGoodMap with Apache License 2.0 | 6 votes |
@Override public Chunk generateChunk(int x, int z) { ChunkPrimer data = new ChunkPrimer(); if(YUNoMakeGoodMap.instance.shouldGenerateNetherFortress(world)) genNetherBridge.generate(world, x, z, data); else genNetherBridge.generate(world, x, z, null); Chunk ret = new Chunk(world, data, x, z); Biome[] biomes = world.getBiomeProvider().getBiomes(null, x * 16, z * 16, 16, 16); byte[] ids = ret.getBiomeArray(); for (int i = 0; i < ids.length; ++i) { ids[i] = (byte)Biome.getIdForBiome(biomes[i]); } ret.generateSkylightMap(); return ret; }
Example 4
Source File: ChunkProviderPlanet.java From AdvancedRocketry with MIT License | 6 votes |
/** * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the * specified chunk from the map seed and chunk seed */ @Override public Chunk generateChunk(int x, int z) { this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L); //ChunkExtendedBiome Chunk chunk = new Chunk(this.worldObj, getChunkPrimer(x, z), x, z); byte[] abyte = chunk.getBiomeArray(); for (int i = 0; i < abyte.length; ++i) { abyte[i] = (byte)Biome.getIdForBiome(this.biomesForGeneration[i]); } chunk.generateSkylightMap(); return chunk; }
Example 5
Source File: ChunkProviderSpace.java From AdvancedRocketry with MIT License | 6 votes |
@Override public Chunk generateChunk(int p_73154_1_, int p_73154_2_) { Block[] ablock = new Block[65536]; byte[] abyte = new byte[65536]; ChunkPrimer chunkprimer = new ChunkPrimer(); //ChunkExtendedBiome Chunk chunk = new Chunk(this.worldObj, chunkprimer, p_73154_1_, p_73154_2_);//new Chunk(this.worldObj, ablock, abyte, p_73154_1_, p_73154_2_); //TODO: convert back to int byte[] abyte1 = chunk.getBiomeArray(); Arrays.fill(abyte1, (byte)Biome.getIdForBiome(AdvancedRocketryBiomes.spaceBiome)); chunk.generateSkylightMap(); return chunk; }
Example 6
Source File: MoCChunkProviderWyvernLair.java From mocreaturesdev with GNU General Public License v3.0 | 5 votes |
/** * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the * specified chunk from the map seed and chunk seed */ public Chunk provideChunk(int par1, int par2) { //System.out.println("providing chunk " + par1 + ", " + par2); this.RNGa.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L); byte[] var3 = new byte[32768]; this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16); this.generateTerrain(par1, par2, var3, this.biomesForGeneration); this.replaceBlocksForBiome(par1, par2, var3, this.biomesForGeneration); //to add metadata specific dimension info, used to reduce the number of block IDs with multiBLocks byte[] metadat = new byte[32768]; for (int i = 0; i<32768; i++) { metadat[i] = (byte)metaData; } //changed constructor to add metadata Chunk var4 = new Chunk(this.worldObj, var3, metadat, par1, par2); byte[] var5 = var4.getBiomeArray(); for (int var6 = 0; var6 < var5.length; ++var6) { var5[var6] = (byte)this.biomesForGeneration[var6].biomeID; } var4.generateSkylightMap(); return var4; }
Example 7
Source File: BiomeHandler.java From AdvancedRocketry with MIT License | 5 votes |
public static void changeBiome(World world, int biomeId, BlockPos pos) { Chunk chunk = world.getChunkFromBlockCoords(pos); Biome biome = world.getBiome(pos); Biome biomeTo = Biome.getBiome(biomeId); if(biome == biomeTo) return; int y = 60; if(biome.topBlock != biomeTo.topBlock) { BlockPos yy = world.getHeight(pos); while(!world.getBlockState(yy.down()).isOpaqueCube() && yy.getY() > 0) yy = yy.down(); if(world.getBlockState(yy.down()) == biome.topBlock) world.setBlockState(yy.down(), biomeTo.topBlock); } byte[] biomeArr = chunk.getBiomeArray(); try { biomeArr[(pos.getX() & 15) + (pos.getZ() & 15)*16] = (byte)biomeId; } catch (IndexOutOfBoundsException e) { e.printStackTrace(); } PacketHandler.sendToNearby(new PacketBiomeIDChange(chunk, world, new HashedBlockPosition(pos)), world.provider.getDimension(), pos, 256); }
Example 8
Source File: ChunkProviderCavePlanet.java From AdvancedRocketry with MIT License | 5 votes |
/** * Generates the chunk at the specified position, from scratch */ public Chunk generateChunk(int x, int z) { this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L); ChunkPrimer chunkprimer = super.getChunkPrimer(x, z); for(int i = 16; i < 128; i++) { for(int xx = 0; xx < 16; xx++) for(int zz = 0; zz < 16; zz++) chunkprimer.setBlockState(xx, i + 128 - 16, zz, chunkprimer.getBlockState(xx, i, zz)); } this.prepareHeights(x, z, chunkprimer); this.buildSurfaces(x, z, chunkprimer); this.genNetherCaves.generate(this.world, x, z, chunkprimer); this.genHighCaves.generate(this.world, x, z, chunkprimer); this.genRavines.generate(this.world, x, z, chunkprimer); if (this.generateStructures) { } Chunk chunk = new Chunk(this.world, chunkprimer, x, z); Biome[] abiome = this.world.getBiomeProvider().getBiomes((Biome[])null, x * 16, z * 16, 16, 16); byte[] abyte = chunk.getBiomeArray(); for (int i = 0; i < abyte.length; ++i) { abyte[i] = (byte)Biome.getIdForBiome(abiome[i]); } chunk.setLightPopulated(true); return chunk; }
Example 9
Source File: ChunkGeneratorFlatVoid.java From YUNoMakeGoodMap with Apache License 2.0 | 5 votes |
@Override public Chunk generateChunk(int x, int z) { Chunk ret = new Chunk(world, new ChunkPrimer(), x, z); Biome[] biomes = world.getBiomeProvider().getBiomes(null, x * 16, z * 16, 16, 16); byte[] ids = ret.getBiomeArray(); for (int i = 0; i < ids.length; ++i) { ids[i] = (byte)Biome.getIdForBiome(biomes[i]); } ret.generateSkylightMap(); return ret; }
Example 10
Source File: ChunkProviderTofu.java From TofuCraftReload with MIT License | 5 votes |
@Override public Chunk generateChunk(int x, int z) { this.chunkX = x; this.chunkZ = z; this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); this.biomesForGeneration = this.world.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16); this.setBlocksInChunk(x, z, chunkprimer); this.buildSurfaces(chunkprimer); this.setBedRock(chunkprimer); this.caveGenerator.generate(this.world, x, z, chunkprimer); if (this.mapFeaturesEnabled) { this.mineshaft.generate(this.world, x, z, chunkprimer); this.villageGenerator.generate(this.world, x, z, chunkprimer); this.tofuCastle.generate(this.world, x, z, chunkprimer); } Chunk chunk = new Chunk(this.world, chunkprimer, x, z); byte[] abyte = chunk.getBiomeArray(); for (int i = 0; i < abyte.length; ++i) { abyte[i] = (byte) Biome.getIdForBiome(this.biomesForGeneration[i]); } chunk.generateSkylightMap(); return chunk; }
Example 11
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getBiome(Chunk chunk, int x, int z) { return chunk.getBiomeArray()[((z & 15) << 4) + (x & 15)]; }
Example 12
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getBiome(Chunk chunk, int x, int z) { return chunk.getBiomeArray()[((z & 15) << 4) + (x & 15)]; }
Example 13
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getBiome(Chunk chunk, int x, int z) { return chunk.getBiomeArray()[((z & 15) << 4) + (x & 15)]; }
Example 14
Source File: SpongeQueue_1_12.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getBiome(Chunk chunk, int x, int z) { return chunk.getBiomeArray()[((z & 15) << 4) + (x & 15)]; }
Example 15
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getBiome(Chunk chunk, int x, int z) { return chunk.getBiomeArray()[((z & 15) << 4) + (x & 15)]; }
Example 16
Source File: SpongeQueue_1_11.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getBiome(Chunk chunk, int x, int z) { return chunk.getBiomeArray()[((z & 15) << 4) + (x & 15)]; }
Example 17
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getBiome(Chunk chunk, int x, int z) { return chunk.getBiomeArray()[((z & 15) << 4) + (x & 15)]; }
Example 18
Source File: ChunkProviderSurface.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Override public Chunk provideChunk(int chunkX, int chunkZ) { centerCache = new Center[48][48]; elevationMap = new int[256]; this.chunkX = chunkX; this.chunkZ = chunkZ; worldX = chunkX * 16; worldZ = chunkZ * 16; islandChunkX = worldX % MAP_SIZE; islandChunkZ = worldZ % MAP_SIZE; mapX = (chunkX >> 8); mapZ = (chunkZ >> 8); islandMap = WorldGen.getInstance().getIslandMap(mapX, mapZ); centersInChunk = new Vector<Center>(); for(int x = -16; x < 32; x++) { for(int z = -16; z < 32; z++) { getHex(new Point(x,z)); } } this.rand.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); generateTerrain(chunkprimer, chunkX, chunkZ); decorate(chunkprimer, chunkX, chunkZ); carveRiverSpline(chunkprimer); carveCaves(chunkprimer); placeOreSeams(chunkprimer); placeOreLayers(chunkprimer); createDungeons(chunkprimer); if(TFCOptions.shouldStripChunks) stripChunk(chunkprimer); Chunk chunk = new Chunk(this.worldObj, chunkprimer, chunkX, chunkZ); chunk.setHeightMap(elevationMap); byte[] biomeArray = chunk.getBiomeArray(); Point p = new Point(0, 0); for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { Center c = getHex(p.plus(x, z)); biomeArray[z << 4 | x] = (byte) Biome.getIdForBiome(c.biome.biome); } } chunk.setBiomeArray(biomeArray); chunk.generateSkylightMap(); return chunk; }
Example 19
Source File: PacketChunkInfo.java From LookingGlass with GNU General Public License v3.0 | 4 votes |
public static Extracted getMapChunkData(Chunk chunk, boolean includeinit, int subid) { int j = 0; ExtendedBlockStorage[] aextendedblockstorage = chunk.getBlockStorageArray(); int k = 0; S21PacketChunkData.Extracted extracted = new S21PacketChunkData.Extracted(); if (dataarray == null || dataarray.length < 196864) { dataarray = new byte[196864]; } byte[] abyte = dataarray; if (includeinit) { chunk.sendUpdates = true; } int l; for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && (subid & 1 << l) != 0) { extracted.field_150280_b |= 1 << l; if (aextendedblockstorage[l].getBlockMSBArray() != null) { extracted.field_150281_c |= 1 << l; ++k; } } } for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && (subid & 1 << l) != 0) { byte[] abyte1 = aextendedblockstorage[l].getBlockLSBArray(); System.arraycopy(abyte1, 0, abyte, j, abyte1.length); j += abyte1.length; } } NibbleArray nibblearray; for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && (subid & 1 << l) != 0) { nibblearray = aextendedblockstorage[l].getMetadataArray(); System.arraycopy(nibblearray.data, 0, abyte, j, nibblearray.data.length); j += nibblearray.data.length; } } for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && (subid & 1 << l) != 0) { nibblearray = aextendedblockstorage[l].getBlocklightArray(); System.arraycopy(nibblearray.data, 0, abyte, j, nibblearray.data.length); j += nibblearray.data.length; } } if (!chunk.worldObj.provider.hasNoSky) { for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && (subid & 1 << l) != 0) { nibblearray = aextendedblockstorage[l].getSkylightArray(); System.arraycopy(nibblearray.data, 0, abyte, j, nibblearray.data.length); j += nibblearray.data.length; } } } if (k > 0) { for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && aextendedblockstorage[l].getBlockMSBArray() != null && (subid & 1 << l) != 0) { nibblearray = aextendedblockstorage[l].getBlockMSBArray(); System.arraycopy(nibblearray.data, 0, abyte, j, nibblearray.data.length); j += nibblearray.data.length; } } } if (includeinit) { byte[] abyte2 = chunk.getBiomeArray(); System.arraycopy(abyte2, 0, abyte, j, abyte2.length); j += abyte2.length; } extracted.field_150282_a = new byte[j]; System.arraycopy(abyte, 0, extracted.field_150282_a, 0, j); return extracted; }
Example 20
Source File: BiomeHandler.java From AdvancedRocketry with MIT License | 3 votes |
public static void changeBiome(World world, int biomeId, Chunk chunk, BlockPos pos) { Biome biome = world.getBiome(pos); Biome biomeTo = Biome.getBiome(biomeId); int x = pos.getX(); int z = pos.getZ(); if(biome == biomeTo) return; int y = 60; if(biome.topBlock != biomeTo.topBlock) { int yy = chunk.getHeightValue(x & 15, z & 15); while(!world.getBlockState(new BlockPos(x, yy - 1, z)).isOpaqueCube() && yy > 0) yy--; if(yy == 0) return; if(chunk.getBlockState(x & 15, yy - 1, z & 15) == biome.topBlock) chunk.setBlockState(new BlockPos(x & 15, yy - 1, z & 15), biomeTo.topBlock); y = (short)yy; } byte[] biomeArr = chunk.getBiomeArray(); biomeArr[(x & 15) + (z & 15)*16] = (byte)biomeId; //PacketHandler.sendToNearby(new PacketBiomeIDChange(chunk, world, new BlockPosition(x, y, z)), world.provider.dimensionId, x, y, z, 256); }