/** * creates a new world chunk manager for WorldProvider */ protected void registerWorldChunkManager() { WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); if (worldtype == WorldType.FLAT) { FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); } else if (worldtype == WorldType.DEBUG_WORLD) { this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); } else { this.worldChunkMgr = new WorldChunkManager(this.worldObj); } }
@Override public void decorateChunk(World world, Random rand, BiomeGenBase biome, int x, int z) { if (this.currentWorld != null) { throw new RuntimeException("Already decorating!!"); } else { this.currentWorld = world; this.randomGenerator = rand; this.chunk_X = x; this.chunk_Z = z; this.genDecorations(biome); this.currentWorld = null; this.randomGenerator = null; } }
private static void func_175354_a(String p_175354_0_, Item p_175354_1_, int p_175354_2_, BiomeGenBase p_175354_3_, List<String> p_175354_4_, FlatLayerInfo... p_175354_5_) { FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo(); for (int i = p_175354_5_.length - 1; i >= 0; --i) { flatgeneratorinfo.getFlatLayers().add(p_175354_5_[i]); } flatgeneratorinfo.setBiome(p_175354_3_.biomeID); flatgeneratorinfo.func_82645_d(); if (p_175354_4_ != null) { for (String s : p_175354_4_) { flatgeneratorinfo.getWorldFeatures().put(s, Maps.<String, String>newHashMap()); } } FLAT_WORLD_PRESETS.add(new GuiFlatPresets.LayerItem(p_175354_1_, p_175354_2_, p_175354_0_, flatgeneratorinfo.toString())); }
public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) { super(p_i45560_1_); this.parent = p_i45560_3_; if (p_i45560_4_ == WorldType.DEFAULT_1_1) { this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; this.field_175973_g = null; } else if (p_i45560_4_ == WorldType.CUSTOMIZED) { this.field_175973_g = ChunkProviderSettings.Factory.jsonToFactory(p_i45560_5_).func_177864_b(); } else { this.field_175973_g = null; } }
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { if (creatureType == EnumCreatureType.MONSTER) { if (this.genNetherBridge.func_175795_b(pos)) { return this.genNetherBridge.getSpawnList(); } if (this.genNetherBridge.func_175796_a(this.worldObj, pos) && this.worldObj.getBlockState(pos.down()).getBlock() == Blocks.nether_brick) { return this.genNetherBridge.getSpawnList(); } } BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); return biomegenbase.getSpawnableList(creatureType); }
public Start(World worldIn, Random p_i2060_2_, int p_i2060_3_, int p_i2060_4_) { super(p_i2060_3_, p_i2060_4_); BiomeGenBase biomegenbase = worldIn.getBiomeGenForCoords(new BlockPos(p_i2060_3_ * 16 + 8, 0, p_i2060_4_ * 16 + 8)); if (biomegenbase != BiomeGenBase.jungle && biomegenbase != BiomeGenBase.jungleHills) { if (biomegenbase == BiomeGenBase.swampland) { ComponentScatteredFeaturePieces.SwampHut componentscatteredfeaturepieces$swamphut = new ComponentScatteredFeaturePieces.SwampHut(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16); this.components.add(componentscatteredfeaturepieces$swamphut); } else if (biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills) { ComponentScatteredFeaturePieces.DesertPyramid componentscatteredfeaturepieces$desertpyramid = new ComponentScatteredFeaturePieces.DesertPyramid(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16); this.components.add(componentscatteredfeaturepieces$desertpyramid); } } else { ComponentScatteredFeaturePieces.JunglePyramid componentscatteredfeaturepieces$junglepyramid = new ComponentScatteredFeaturePieces.JunglePyramid(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16); this.components.add(componentscatteredfeaturepieces$junglepyramid); } this.updateBoundingBox(); }
public static boolean biome(BiomeGenBase p_biome_0_, BiomeGenBase[] p_biome_1_) { if (p_biome_1_ == null) { return true; } else { for (int i = 0; i < p_biome_1_.length; ++i) { if (p_biome_1_[i] == p_biome_0_) { return true; } } return false; } }
public boolean canLightningStrike(BlockPos strikePosition) { if (!this.isRaining()) { return false; } else if (!this.canSeeSky(strikePosition)) { return false; } else if (this.getPrecipitationHeight(strikePosition).getY() > strikePosition.getY()) { return false; } else { BiomeGenBase biomegenbase = this.getBiomeGenForCoords(strikePosition); return biomegenbase.getEnableSnow() ? false : (this.canSnowAt(strikePosition, false) ? false : biomegenbase.canSpawnLightningBolt()); } }
/** * 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 x, int z) { this.hellRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); this.func_180515_a(x, z, chunkprimer); this.func_180516_b(x, z, chunkprimer); this.netherCaveGenerator.generate(this, this.worldObj, x, z, chunkprimer); if (this.field_177466_i) { this.genNetherBridge.generate(this, this.worldObj, x, z, chunkprimer); } Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z); BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16); byte[] abyte = chunk.getBiomeArray(); for (int i = 0; i < abyte.length; ++i) { abyte[i] = (byte)abiomegenbase[i].biomeID; } chunk.resetRelightChecks(); return chunk; }
public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager) { int i = pos.getX() & 15; int j = pos.getZ() & 15; int k = this.blockBiomeArray[j << 4 | i] & 255; if (k == 255) { BiomeGenBase biomegenbase = chunkManager.getBiomeGenerator(pos, BiomeGenBase.plains); k = biomegenbase.biomeID; this.blockBiomeArray[j << 4 | i] = (byte)(k & 255); } BiomeGenBase biomegenbase1 = BiomeGenBase.getBiome(k); return biomegenbase1 == null ? BiomeGenBase.plains : biomegenbase1; }
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); if (this.mapFeaturesEnabled) { if (creatureType == EnumCreatureType.MONSTER && this.scatteredFeatureGenerator.func_175798_a(pos)) { return this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); } if (creatureType == EnumCreatureType.MONSTER && this.settings.useMonuments && this.oceanMonumentGenerator.func_175796_a(this.worldObj, pos)) { return this.oceanMonumentGenerator.func_175799_b(); } } return biomegenbase.getSpawnableList(creatureType); }
public boolean matches(EntityLiving p_matches_1_) { if (this.biomes != null) { BiomeGenBase biomegenbase = p_matches_1_.spawnBiome; boolean flag = false; for (int i = 0; i < this.biomes.length; ++i) { BiomeGenBase biomegenbase1 = this.biomes[i]; if (biomegenbase1 == biomegenbase) { flag = true; break; } } if (!flag) { return false; } } return this.heights != null && p_matches_1_.spawnPosition != null ? this.heights.isInRange(p_matches_1_.spawnPosition.getY()) : true; }
public static Biome biomeBaseToBiome(BiomeGenBase base) { if (base == null) { return null; } return BIOME_MAPPING[base.biomeID]; }
protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) { int i = chunkX; int j = chunkZ; if (chunkX < 0) { chunkX -= this.field_175800_f - 1; } if (chunkZ < 0) { chunkZ -= this.field_175800_f - 1; } int k = chunkX / this.field_175800_f; int l = chunkZ / this.field_175800_f; Random random = this.worldObj.setRandomSeed(k, l, 10387313); k = k * this.field_175800_f; l = l * this.field_175800_f; k = k + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2; l = l + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2; if (i == k && j == l) { if (this.worldObj.getWorldChunkManager().getBiomeGenerator(new BlockPos(i * 16 + 8, 64, j * 16 + 8), (BiomeGenBase)null) != BiomeGenBase.deepOcean) { return false; } boolean flag = this.worldObj.getWorldChunkManager().areBiomesViable(i * 16 + 8, j * 16 + 8, 29, field_175802_d); if (flag) { return true; } } return false; }
private int getColorVanilla(BiomeGenBase p_getColorVanilla_1_, BlockPos p_getColorVanilla_2_) { double d0 = (double)MathHelper.clamp_float(p_getColorVanilla_1_.getFloatTemperature(p_getColorVanilla_2_), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(p_getColorVanilla_1_.getFloatRainfall(), 0.0F, 1.0F); d1 = d1 * d0; int i = (int)((1.0D - d0) * (double)(this.width - 1)); int j = (int)((1.0D - d1) * (double)(this.height - 1)); return this.getColor(i, j); }
public MapGenStronghold() { this.structureCoords = new ChunkCoordIntPair[3]; this.field_82671_h = 32.0D; this.field_82672_i = 3; this.field_151546_e = Lists.<BiomeGenBase>newArrayList(); for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray()) { if (biomegenbase != null && biomegenbase.minHeight > 0.0F) { this.field_151546_e.add(biomegenbase); } } }
public MapGenNetherBridge() { this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityBlaze.class, 10, 2, 3)); this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 5, 4, 4)); this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 10, 4, 4)); this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityMagmaCube.class, 3, 4, 4)); }
public Start(WorldChunkManager chunkManagerIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureVillagePieces.PieceWeight> p_i2104_6_, int p_i2104_7_) { super((StructureVillagePieces.Start)null, 0, rand, p_i2104_4_, p_i2104_5_); this.worldChunkMngr = chunkManagerIn; this.structureVillageWeightedPieceList = p_i2104_6_; this.terrainType = p_i2104_7_; BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; this.func_175846_a(this.inDesert); }
private RandomMobsRule[] parseRules(Properties p_parseRules_1_, ResourceLocation p_parseRules_2_, ConnectedParser p_parseRules_3_) { List list = new ArrayList(); int i = p_parseRules_1_.size(); for (int j = 0; j < i; ++j) { int k = j + 1; String s = p_parseRules_1_.getProperty("skins." + k); if (s != null) { int[] aint = p_parseRules_3_.parseIntList(s); int[] aint1 = p_parseRules_3_.parseIntList(p_parseRules_1_.getProperty("weights." + k)); BiomeGenBase[] abiomegenbase = p_parseRules_3_.parseBiomes(p_parseRules_1_.getProperty("biomes." + k)); RangeListInt rangelistint = p_parseRules_3_.parseRangeListInt(p_parseRules_1_.getProperty("heights." + k)); if (rangelistint == null) { rangelistint = this.parseMinMaxHeight(p_parseRules_1_, k); } RandomMobsRule randommobsrule = new RandomMobsRule(p_parseRules_2_, aint, aint1, abiomegenbase, rangelistint); list.add(randommobsrule); } } RandomMobsRule[] arandommobsrule = (RandomMobsRule[])((RandomMobsRule[])list.toArray(new RandomMobsRule[list.size()])); return arandommobsrule; }
public void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) { double d0 = 0.03125D; this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) { BiomeGenBase biomegenbase = p_180517_4_[j + i * 16]; biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + i, p_180517_2_ * 16 + j, this.stoneNoise[j + i * 16]); } } }
/** * 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 x, int z) { ChunkPrimer chunkprimer = new ChunkPrimer(); for (int i = 0; i < this.cachedBlockIDs.length; ++i) { IBlockState iblockstate = this.cachedBlockIDs[i]; if (iblockstate != null) { for (int j = 0; j < 16; ++j) { for (int k = 0; k < 16; ++k) { chunkprimer.setBlockState(j, i, k, iblockstate); } } } } for (MapGenBase mapgenbase : this.structureGenerators) { mapgenbase.generate(this, this.worldObj, x, z, chunkprimer); } Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z); BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16); byte[] abyte = chunk.getBiomeArray(); for (int l = 0; l < abyte.length; ++l) { abyte[l] = (byte)abiomegenbase[l].biomeID; } chunk.generateSkylightMap(); return chunk; }
/** * 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 x, int z) { ChunkPrimer chunkprimer = new ChunkPrimer(); for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) { int k = x * 16 + i; int l = z * 16 + j; chunkprimer.setBlockState(i, 60, j, Blocks.barrier.getDefaultState()); IBlockState iblockstate = func_177461_b(k, l); if (iblockstate != null) { chunkprimer.setBlockState(i, 70, j, iblockstate); } } } Chunk chunk = new Chunk(this.world, chunkprimer, x, z); chunk.generateSkylightMap(); BiomeGenBase[] abiomegenbase = this.world.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16); byte[] abyte = chunk.getBiomeArray(); for (int i1 = 0; i1 < abyte.length; ++i1) { abyte[i1] = (byte)abiomegenbase[i1].biomeID; } chunk.generateSkylightMap(); return chunk; }
private static int getCustomColor(int[] p_getCustomColor_0_, IBlockAccess p_getCustomColor_1_, BlockPos p_getCustomColor_2_) { BiomeGenBase biomegenbase = p_getCustomColor_1_.getBiomeGenForCoords(p_getCustomColor_2_); double d0 = (double)MathHelper.clamp_float(biomegenbase.getFloatTemperature(p_getCustomColor_2_), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(biomegenbase.getFloatRainfall(), 0.0F, 1.0F); d1 = d1 * d0; int i = (int)((1.0D - d0) * 255.0D); int j = (int)((1.0D - d1) * 255.0D); return p_getCustomColor_0_[j << 8 | i] & 16777215; }
public RandomMobsRule(ResourceLocation p_i72_1_, int[] p_i72_2_, int[] p_i72_3_, BiomeGenBase[] p_i72_4_, RangeListInt p_i72_5_) { this.baseResLoc = p_i72_1_; this.skins = p_i72_2_; this.weights = p_i72_3_; this.biomes = p_i72_4_; this.heights = p_i72_5_; }
public BiomeGenBase findBiome(String p_findBiome_1_) { p_findBiome_1_ = p_findBiome_1_.toLowerCase(); if (p_findBiome_1_.equals("nether")) { return BiomeGenBase.hell; } else { BiomeGenBase[] abiomegenbase = BiomeGenBase.getBiomeGenArray(); for (int i = 0; i < abiomegenbase.length; ++i) { BiomeGenBase biomegenbase = abiomegenbase[i]; if (biomegenbase != null) { String s = biomegenbase.biomeName.replace(" ", "").toLowerCase(); if (s.equals(p_findBiome_1_)) { return biomegenbase; } } } return null; } }
public static FlatGeneratorInfo getDefaultFlatGenerator() { FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo(); flatgeneratorinfo.setBiome(BiomeGenBase.plains.biomeID); flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(1, Blocks.bedrock)); flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(2, Blocks.dirt)); flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(1, Blocks.grass)); flatgeneratorinfo.func_82645_d(); flatgeneratorinfo.getWorldFeatures().put("village", Maps.<String, String>newHashMap()); return flatgeneratorinfo; }
/** * Checks to see if a given block is both water and cold enough to freeze. */ public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) { BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); float f = biomegenbase.getFloatTemperature(pos); if (f > 0.15F) { return false; } else { if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10) { IBlockState iblockstate = this.getBlockState(pos); Block block = iblockstate.getBlock(); if ((block == Blocks.water || block == Blocks.flowing_water) && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0) { if (!noWaterAdj) { return true; } boolean flag = this.isWater(pos.west()) && this.isWater(pos.east()) && this.isWater(pos.north()) && this.isWater(pos.south()); if (!flag) { return true; } } } return false; } }