Java Code Examples for net.minecraft.world.biome.Biome#getIdForBiome()
The following examples show how to use
net.minecraft.world.biome.Biome#getIdForBiome() .
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: GenLayerRiverMix.java From TofuCraftReload with MIT License | 6 votes |
/** * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ public int[] getInts(int par1, int par2, int par3, int par4) { int[] aint = this.biomePatternGeneratorChain.getInts(par1, par2, par3, par4); int[] aint1 = this.riverPatternGeneratorChain.getInts(par1, par2, par3, par4); int[] aint2 = IntCache.getIntCache(par3 * par4); for (int i1 = 0; i1 < par3 * par4; ++i1) { if (aint1[i1] == Biome.getIdForBiome(TofuBiomes.TOFU_RIVER)) { aint2[i1] = aint1[i1] & 255; } else { aint2[i1] = aint[i1]; } } return aint2; }
Example 2
Source File: GenLayerBiome.java From TofuCraftReload with MIT License | 6 votes |
/** * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ @Override public int[] getInts(int par1, int par2, int par3, int par4) { this.parent.getInts(par1, par2, par3, par4); int[] aint1 = IntCache.getIntCache(par3 * par4); for (int i1 = 0; i1 < par4; ++i1) { for (int j1 = 0; j1 < par3; ++j1) { this.initChunkSeed((j1 + par1), (i1 + par2)); int idx = this.nextInt(this.allowedBiomes.length); aint1[j1 + i1 * par3] = Biome.getIdForBiome(this.allowedBiomes[idx]); } } return aint1; }
Example 3
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 4
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 5
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 6
Source File: GenLayerBiomePlanet.java From AdvancedRocketry with MIT License | 6 votes |
/** * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. * @param properties */ @Override public int[] getInts(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_) { //int[] aint = this.parent.getInts(p_75904_1_, p_75904_2_, p_75904_3_, p_75904_4_); int[] aint1 = IntCache.getIntCache(p_75904_3_ * p_75904_4_); for (int i1 = 0; i1 < p_75904_4_; ++i1) { for (int j1 = 0; j1 < p_75904_3_; ++j1) { this.initChunkSeed((long)(j1 + p_75904_1_), (long)(i1 + p_75904_2_)); aint1[j1 + i1 * p_75904_3_] = Biome.getIdForBiome(getWeightedBiomeEntry().biome); } } //TODO: DEBUG: //Arrays.fill(aint1, BiomeGenBase.desert.biomeID); return aint1; }
Example 7
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 8
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 9
Source File: DimensionProperties.java From AdvancedRocketry with MIT License | 5 votes |
/** * Adds a biome to the list of biomes allowed to spawn on this planet * @param biome biome to be added as viable * @return true if the biome was added sucessfully, false otherwise */ public boolean addBiome(int biomeId) { Biome biome = Biome.getBiome(biomeId); if(biomeId == 0 || Biome.getIdForBiome(biome) != 0) { List<Biome> biomes = new ArrayList<Biome>(); biomes.add(biome); allowedBiomes.addAll(getBiomesEntries(biomes)); return true; } return false; }
Example 10
Source File: AdvancedRocketryBiomes.java From AdvancedRocketry with MIT License | 5 votes |
/** * Gets Biomes from Advanced Rocketry's biomes registry. If it does not exist attepts to retrieve from vanilla forge * @param id biome id * @return Biome retrieved from the biome ID */ public Biome getBiomeById(int id) { for(Biome biome : registeredBiomes) { if( Biome.getIdForBiome(biome) == id) return biome; } return Biome.getBiome(id); }
Example 11
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 12
Source File: TofuEventLoader.java From TofuCraftReload with MIT License | 5 votes |
@SubscribeEvent public void decorateBiome(DecorateBiomeEvent.Post event) { World worldObj = event.getWorld(); Random rand = event.getRand(); @SuppressWarnings("deprecation") BlockPos pos = event.getPos(); // Hellsoybeans if (rand.nextInt(600) < Math.min((Math.abs(pos.getX()) + Math.abs(pos.getZ())) / 2, 400) - 100) { if (Biome.getIdForBiome(worldObj.getBiome(pos)) == Biome.getIdForBiome(Biomes.HELL)) { int k = pos.getX(); int l = pos.getZ(); BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos(); for (int i = 0; i < 10; ++i) { int j1 = k + rand.nextInt(16) + 8; int k1 = rand.nextInt(128); int l1 = l + rand.nextInt(16) + 8; mutable.setPos(j1, k1, l1); (new WorldGenCrops((BlockBush)BlockLoader.SOYBEAN_NETHER) { @Override protected IBlockState getStateToPlace() { return this.plantBlock.getDefaultState().withProperty(BlockSoybeanNether.AGE, 7); } }) .generate(worldObj, rand, mutable); } } } }
Example 13
Source File: GenLayerRiver.java From TofuCraftReload with MIT License | 5 votes |
/** * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ @Override public int[] getInts(int par1, int par2, int par3, int par4) { int i1 = par1 - 1; int j1 = par2 - 1; int k1 = par3 + 2; int l1 = par4 + 2; int[] aint = this.parent.getInts(i1, j1, k1, l1); int[] aint1 = IntCache.getIntCache(par3 * par4); for (int i2 = 0; i2 < par4; ++i2) { for (int j2 = 0; j2 < par3; ++j2) { int k2 = this.func_151630_c(aint[j2 + 0 + (i2 + 1) * k1]); int l2 = this.func_151630_c(aint[j2 + 2 + (i2 + 1) * k1]); int i3 = this.func_151630_c(aint[j2 + 1 + (i2 + 0) * k1]); int j3 = this.func_151630_c(aint[j2 + 1 + (i2 + 2) * k1]); int k3 = this.func_151630_c(aint[j2 + 1 + (i2 + 1) * k1]); if (k3 == k2 && k3 == i3 && k3 == l2 && k3 == j3) { aint1[j2 + i2 * par3] = -1; } else { aint1[j2 + i2 * par3] = Biome.getIdForBiome(TofuBiomes.TOFU_RIVER); } } } return aint1; }
Example 14
Source File: GenLayerBiomesTofu.java From TofuCraftReload with MIT License | 5 votes |
@Override public int[] getInts(int x, int z, int width, int depth) { int[] dest = IntCache.getIntCache(width * depth); for (int dz = 0; dz < depth; dz++) { for (int dx = 0; dx < width; dx++) { this.initChunkSeed(dx + x, dz + z); dest[(dx + dz * width)] = Biome.getIdForBiome(this.allowedBiomes[nextInt(this.allowedBiomes.length)]); } } return dest; }
Example 15
Source File: GenLayerAddIsland.java From TofuCraftReload with MIT License | 4 votes |
/** * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ @Override public int[] getInts(int par1, int par2, int par3, int par4) { int i1 = par1 - 1; int j1 = par2 - 1; int k1 = par3 + 2; int l1 = par4 + 2; int[] aint = this.parent.getInts(i1, j1, k1, l1); int[] aint1 = IntCache.getIntCache(par3 * par4); for (int i2 = 0; i2 < par4; ++i2) { for (int j2 = 0; j2 < par3; ++j2) { int k2 = aint[j2 + 0 + (i2 + 0) * k1]; int l2 = aint[j2 + 2 + (i2 + 0) * k1]; int i3 = aint[j2 + 0 + (i2 + 2) * k1]; int j3 = aint[j2 + 2 + (i2 + 2) * k1]; int k3 = aint[j2 + 1 + (i2 + 1) * k1]; this.initChunkSeed((j2 + par1), (i2 + par2)); if (k3 == 0 && (k2 != 0 || l2 != 0 || i3 != 0 || j3 != 0)) { int l3 = 1; int i4 = 1; if (k2 != 0 && this.nextInt(l3++) == 0) { i4 = k2; } if (l2 != 0 && this.nextInt(l3++) == 0) { i4 = l2; } if (i3 != 0 && this.nextInt(l3++) == 0) { i4 = i3; } if (j3 != 0 && this.nextInt(l3++) == 0) { i4 = j3; } if (this.nextInt(3) == 0) { aint1[j2 + i2 * par3] = i4; } else if (i4 == Biome.getIdForBiome(Biomes.ICE_PLAINS)) { aint1[j2 + i2 * par3] = Biome.getIdForBiome(Biomes.FROZEN_OCEAN); } else { aint1[j2 + i2 * par3] = 0; } } else if (k3 > 0 && (k2 == 0 || l2 == 0 || i3 == 0 || j3 == 0)) { if (this.nextInt(5) == 0) { if (k3 == Biome.getIdForBiome(Biomes.ICE_PLAINS)) { aint1[j2 + i2 * par3] = Biome.getIdForBiome(Biomes.FROZEN_OCEAN); } else { aint1[j2 + i2 * par3] = 0; } } else { aint1[j2 + i2 * par3] = k3; } } else { aint1[j2 + i2 * par3] = k3; } } } return aint1; }
Example 16
Source File: GenLayerHills.java From TofuCraftReload with MIT License | 4 votes |
/** * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ @Override public int[] getInts(int par1, int par2, int par3, int par4) { int[] aint = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2); int[] aint1 = this.genLayer.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2); int[] aint2 = IntCache.getIntCache(par3 * par4); for (int i1 = 0; i1 < par4; ++i1) { for (int j1 = 0; j1 < par3; ++j1) { this.initChunkSeed((j1 + par1), (i1 + par2)); int k1 = aint[j1 + 1 + (i1 + 1) * (par3 + 2)]; int l1 = aint1[j1 + 1 + (i1 + 1) * (par3 + 2)]; if (l1 >= 2 && (l1 - 2) % 29 == 1) { aint2[j1 + i1 * par3] = k1; } else if (this.nextInt(3) != 0) { aint2[j1 + i1 * par3] = k1; } else { int i2 = k1; int j2; if (k1 == Biome.getIdForBiome(TofuBiomes.TOFU_PLAINS)) { i2 = Biome.getIdForBiome(TofuBiomes.TOFU_PLAIN_HILLS); } else if (k1 == Biome.getIdForBiome(TofuBiomes.TOFU_FOREST)) { i2 = Biome.getIdForBiome(TofuBiomes.TOFU_FOREST_HILLS); } if (i2 == k1) { aint2[j1 + i1 * par3] = k1; } else { j2 = aint[j1 + 1 + (i1 + 1 - 1) * (par3 + 2)]; int k2 = aint[j1 + 1 + 1 + (i1 + 1) * (par3 + 2)]; int l2 = aint[j1 + 1 - 1 + (i1 + 1) * (par3 + 2)]; int i3 = aint[j1 + 1 + (i1 + 1 + 1) * (par3 + 2)]; int j3 = 0; if (compareBiomesById(j2, k1)) { ++j3; } if (compareBiomesById(k2, k1)) { ++j3; } if (compareBiomesById(l2, k1)) { ++j3; } if (compareBiomesById(i3, k1)) { ++j3; } if (j3 >= 3) { aint2[j1 + i1 * par3] = i2; } else { aint2[j1 + i1 * par3] = k1; } } } } } return aint2; }
Example 17
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 18
Source File: GenLayerShore.java From TofuCraftReload with MIT License | 4 votes |
/** * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ @Override public int[] getInts(int par1, int par2, int par3, int par4) { int[] aint = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2); int[] aint1 = IntCache.getIntCache(par3 * par4); for (int i1 = 0; i1 < par4; ++i1) { for (int j1 = 0; j1 < par3; ++j1) { this.initChunkSeed((j1 + par1), (i1 + par2)); int k1 = aint[j1 + 1 + (i1 + 1) * (par3 + 2)]; int l1; int i2; int j2; int k2; if (k1 == Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS)) { l1 = aint[j1 + 1 + (i1 + 1 - 1) * (par3 + 2)]; i2 = aint[j1 + 1 + 1 + (i1 + 1) * (par3 + 2)]; j2 = aint[j1 + 1 - 1 + (i1 + 1) * (par3 + 2)]; k2 = aint[j1 + 1 + (i1 + 1 + 1) * (par3 + 2)]; if (l1 == Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS) && i2 == Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS) && j2 == Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS) && k2 == Biome.getIdForBiome(TofuBiomes.TOFU_EXTREME_HILLS)) { aint1[j1 + i1 * par3] = k1; } else { aint1[j1 + i1 * par3] = Biome.getIdForBiome(TofuBiomes.TOFU_HILLS_EDGE); } } else { aint1[j1 + i1 * par3] = k1; } } } return aint1; }