protected void setRules() { ClimateControlRules newRules = new ClimateControlRules(); newRules = new ClimateControlRules(); for (BiomeSettings biomeSettings: settings().biomeSettings()) { biomeSettings.setRules(newRules); } List<Biome> villageSpawnBiomes = new ArrayList<Biome>(); for (int i = 0 ; i < 256;i++) { if (newRules.hasVillages(i)) { villageSpawnBiomes.add(Biome.getBiome(i)); } } VillageBiomes villageBiomes = new VillageBiomes(villageSpawnBiomes); villageBiomes.reportMembers(); if (settings.controlVillageBiomes.value()) { MapGenVillage.VILLAGE_SPAWN_BIOMES = villageBiomes; } rules = newRules; }
@SubscribeEvent public void onInitMapGenEvent(final InitMapGenEvent event) { // Hook village generation if (event.type == EventType.VILLAGE && event.newGen instanceof MapGenVillage) { final MapGenVillage village = (MapGenVillage) event.newGen; int t = ModOptions.getVillageDensity(); if (t > 0) village.field_82665_g = t; t = ModOptions.getMinimumVillageDistance(); if (t > 0) village.field_82666_h = t; ModLog.debug("Village parameters: %d density, %d distance", village.field_82665_g, village.field_82666_h); } }
public void postInit(final FMLPostInitializationEvent event) { Assets.initialize(); // Patch up the village biome list with the configured // settings. We need to create a new map because // the one that is there is immutable. final int[] additional = ModOptions.getAdditionalVillageBiomes(); if(additional.length > 0) { final List<BiomeGenBase> newList = new ArrayList<BiomeGenBase>(); newList.addAll(MapGenVillage.villageSpawnBiomes); for(final int biomeId: additional) { final BiomeGenBase biome = BiomeGenBase.getBiome(biomeId); if(biome != null) newList.add(biome); } MapGenVillage.villageSpawnBiomes = newList; } // Initialize themes if(ModOptions.getEnableTheming()) BlockThemes.initialize(); MobControl.initialize(); }
private static StructureComponent func_75077_d(ComponentVillageStartPiece p_75077_0_, List p_75077_1_, Random p_75077_2_, int p_75077_3_, int p_75077_4_, int p_75077_5_, int p_75077_6_, int p_75077_7_) { if(p_75077_7_ > 50) { return null; } else if(Math.abs(p_75077_3_ - p_75077_0_.func_74874_b().field_78897_a) <= 112 && Math.abs(p_75077_5_ - p_75077_0_.func_74874_b().field_78896_c) <= 112) { ComponentVillage var8 = func_75081_c(p_75077_0_, p_75077_1_, p_75077_2_, p_75077_3_, p_75077_4_, p_75077_5_, p_75077_6_, p_75077_7_ + 1); if(var8 != null) { int var9 = (var8.field_74887_e.field_78897_a + var8.field_74887_e.field_78893_d) / 2; int var10 = (var8.field_74887_e.field_78896_c + var8.field_74887_e.field_78892_f) / 2; int var11 = var8.field_74887_e.field_78893_d - var8.field_74887_e.field_78897_a; int var12 = var8.field_74887_e.field_78892_f - var8.field_74887_e.field_78896_c; int var13 = var11 > var12?var11:var12; if(p_75077_0_.func_74925_d().func_76940_a(var9, var10, var13 / 2 + 4, MapGenVillage.field_75055_e)) { p_75077_1_.add(var8); p_75077_0_.field_74932_i.add(var8); return var8; } } return null; } else { return null; } }
private static StructureComponent func_75080_e(ComponentVillageStartPiece p_75080_0_, List p_75080_1_, Random p_75080_2_, int p_75080_3_, int p_75080_4_, int p_75080_5_, int p_75080_6_, int p_75080_7_) { if(p_75080_7_ > 3 + p_75080_0_.field_74928_c) { return null; } else if(Math.abs(p_75080_3_ - p_75080_0_.func_74874_b().field_78897_a) <= 112 && Math.abs(p_75080_5_ - p_75080_0_.func_74874_b().field_78896_c) <= 112) { StructureBoundingBox var8 = ComponentVillagePathGen.func_74933_a(p_75080_0_, p_75080_1_, p_75080_2_, p_75080_3_, p_75080_4_, p_75080_5_, p_75080_6_); if(var8 != null && var8.field_78895_b > 10) { ComponentVillagePathGen var9 = new ComponentVillagePathGen(p_75080_0_, p_75080_7_, p_75080_2_, var8, p_75080_6_); int var10 = (var9.field_74887_e.field_78897_a + var9.field_74887_e.field_78893_d) / 2; int var11 = (var9.field_74887_e.field_78896_c + var9.field_74887_e.field_78892_f) / 2; int var12 = var9.field_74887_e.field_78893_d - var9.field_74887_e.field_78897_a; int var13 = var9.field_74887_e.field_78892_f - var9.field_74887_e.field_78896_c; int var14 = var12 > var13?var12:var13; if(p_75080_0_.func_74925_d().func_76940_a(var10, var11, var14 / 2 + 4, MapGenVillage.field_75055_e)) { p_75080_1_.add(var9); p_75080_0_.field_74930_j.add(var9); return var9; } } return null; } else { return null; } }
public static void addVillageBiome(Biome biome, boolean canSpawn) { if (!MapGenVillage.VILLAGE_SPAWN_BIOMES.contains(biome)) { ArrayList<Biome> biomes = new ArrayList<Biome>(MapGenVillage.VILLAGE_SPAWN_BIOMES); biomes.add(biome); MapGenVillage.VILLAGE_SPAWN_BIOMES = biomes; } }
public static void removeVillageBiome(Biome biome) { if (MapGenVillage.VILLAGE_SPAWN_BIOMES.contains(biome)) { ArrayList<Biome> biomes = new ArrayList<Biome>(MapGenVillage.VILLAGE_SPAWN_BIOMES); biomes.remove(biome); MapGenVillage.VILLAGE_SPAWN_BIOMES = biomes; } }
@SuppressWarnings("unchecked") public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn) { if (!MapGenVillage.field_75055_e.contains(biome)) { ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.field_75055_e); biomes.add(biome); MapGenVillage.field_75055_e = biomes; } }
@SuppressWarnings("unchecked") public static void removeVillageBiome(BiomeGenBase biome) { if (MapGenVillage.field_75055_e.contains(biome)) { ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.field_75055_e); biomes.remove(biome); MapGenVillage.field_75055_e = biomes; } }
/** Alters vanilla structure generation. */ @SubscribeEvent public void cancelVillage(InitMapGenEvent event) { // Cancel any village generation if (event.getType() == EventType.VILLAGE) { event.setNewGen(new MapGenVillage() { @Override public void generate(World world, int x, int z, ChunkPrimer primer) {} }); } }
/** * attempts to find a next Structure Component to be spawned, private Village function */ private static StructureComponent getNextVillageStructureComponent(StructureVillagePieces.Start p_75077_0_, List p_75077_1_, Random p_75077_2_, int p_75077_3_, int p_75077_4_, int p_75077_5_, int p_75077_6_, int p_75077_7_) { if (p_75077_7_ > 50) { return null; } else if (Math.abs(p_75077_3_ - p_75077_0_.getBoundingBox().minX) <= 112 && Math.abs(p_75077_5_ - p_75077_0_.getBoundingBox().minZ) <= 112) { StructureVillagePieces.Village village = getNextVillageComponent(p_75077_0_, p_75077_1_, p_75077_2_, p_75077_3_, p_75077_4_, p_75077_5_, p_75077_6_, p_75077_7_ + 1); if (village != null) { int j1 = (village.getBoundingBox().minX + village.getBoundingBox().maxX) / 2; int k1 = (village.getBoundingBox().minZ + village.getBoundingBox().maxZ) / 2; int l1 = village.getBoundingBox().maxX - village.getBoundingBox().minX; int i2 = village.getBoundingBox().maxZ - village.getBoundingBox().minZ; int j2 = l1 > i2 ? l1 : i2; if (p_75077_0_.getWorldChunkManager().areBiomesViable(j1, k1, j2 / 2 + 4, MapGenVillage.villageSpawnBiomes)) { p_75077_1_.add(village); p_75077_0_.field_74932_i.add(village); return village; } } return null; } else { return null; } }
private static StructureComponent getNextComponentVillagePath(StructureVillagePieces.Start p_75080_0_, List p_75080_1_, Random p_75080_2_, int p_75080_3_, int p_75080_4_, int p_75080_5_, int p_75080_6_, int p_75080_7_) { if (p_75080_7_ > 3 + p_75080_0_.terrainType) { return null; } else if (Math.abs(p_75080_3_ - p_75080_0_.getBoundingBox().minX) <= 112 && Math.abs(p_75080_5_ - p_75080_0_.getBoundingBox().minZ) <= 112) { StructureBoundingBox structureboundingbox = StructureVillagePieces.Path.func_74933_a(p_75080_0_, p_75080_1_, p_75080_2_, p_75080_3_, p_75080_4_, p_75080_5_, p_75080_6_); if (structureboundingbox != null && structureboundingbox.minY > 10) { StructureVillagePieces.Path path = new StructureVillagePieces.Path(p_75080_0_, p_75080_7_, p_75080_2_, structureboundingbox, p_75080_6_); int j1 = (path.getBoundingBox().minX + path.getBoundingBox().maxX) / 2; int k1 = (path.getBoundingBox().minZ + path.getBoundingBox().maxZ) / 2; int l1 = path.getBoundingBox().maxX - path.getBoundingBox().minX; int i2 = path.getBoundingBox().maxZ - path.getBoundingBox().minZ; int j2 = l1 > i2 ? l1 : i2; if (p_75080_0_.getWorldChunkManager().areBiomesViable(j1, k1, j2 / 2 + 4, MapGenVillage.villageSpawnBiomes)) { p_75080_1_.add(path); p_75080_0_.field_74930_j.add(path); return path; } } return null; } else { return null; } }
@SuppressWarnings("unchecked") public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn) { if (!MapGenVillage.villageSpawnBiomes.contains(biome)) { ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes); biomes.add(biome); MapGenVillage.villageSpawnBiomes = biomes; } }
@SuppressWarnings("unchecked") public static void removeVillageBiome(BiomeGenBase biome) { if (MapGenVillage.villageSpawnBiomes.contains(biome)) { ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes); biomes.remove(biome); MapGenVillage.villageSpawnBiomes = biomes; } }
public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn) { if (!MapGenVillage.villageSpawnBiomes.contains(biome)) { ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes); biomes.add(biome); MapGenVillage.villageSpawnBiomes = biomes; } }
public static void removeVillageBiome(BiomeGenBase biome) { if (MapGenVillage.villageSpawnBiomes.contains(biome)) { ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes); biomes.remove(biome); MapGenVillage.villageSpawnBiomes = biomes; } }
/** * Populates chunk with ores etc etc */ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { int i = p_73153_2_ * 16; int j = p_73153_3_ * 16; BlockPos blockpos = new BlockPos(i, 0, j); BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(new BlockPos(i + 16, 0, j + 16)); boolean flag = false; this.random.setSeed(this.worldObj.getSeed()); long k = this.random.nextLong() / 2L * 2L + 1L; long l = this.random.nextLong() / 2L * 2L + 1L; this.random.setSeed((long)p_73153_2_ * k + (long)p_73153_3_ * l ^ this.worldObj.getSeed()); ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); for (MapGenStructure mapgenstructure : this.structureGenerators) { boolean flag1 = mapgenstructure.generateStructure(this.worldObj, this.random, chunkcoordintpair); if (mapgenstructure instanceof MapGenVillage) { flag |= flag1; } } if (this.waterLakeGenerator != null && !flag && this.random.nextInt(4) == 0) { this.waterLakeGenerator.generate(this.worldObj, this.random, blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(256), this.random.nextInt(16) + 8)); } if (this.lavaLakeGenerator != null && !flag && this.random.nextInt(8) == 0) { BlockPos blockpos1 = blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(this.random.nextInt(248) + 8), this.random.nextInt(16) + 8); if (blockpos1.getY() < this.worldObj.func_181545_F() || this.random.nextInt(10) == 0) { this.lavaLakeGenerator.generate(this.worldObj, this.random, blockpos1); } } if (this.hasDungeons) { for (int i1 = 0; i1 < 8; ++i1) { (new WorldGenDungeons()).generate(this.worldObj, this.random, blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(256), this.random.nextInt(16) + 8)); } } if (this.hasDecoration) { biomegenbase.decorate(this.worldObj, this.random, blockpos); } }
public void populate(int x, int z) { int i = x * 16; int j = z * 16; BlockPos blockpos = new BlockPos(i, 0, j); Biome biome = this.worldObj.getBiome(new BlockPos(i + 16, 0, j + 16)); boolean flag = false; this.random.setSeed(this.worldObj.getSeed()); long k = this.random.nextLong() / 2L * 2L + 1L; long l = this.random.nextLong() / 2L * 2L + 1L; this.random.setSeed((long)x * k + (long)z * l ^ this.worldObj.getSeed()); ChunkPos chunkpos = new ChunkPos(x, z); for (MapGenStructure mapgenstructure : this.structureGenerators.values()) { boolean flag1 = mapgenstructure.generateStructure(this.worldObj, this.random, chunkpos); if (mapgenstructure instanceof MapGenVillage) { flag |= flag1; } } if (this.waterLakeGenerator != null && !flag && this.random.nextInt(4) == 0) { this.waterLakeGenerator.generate(this.worldObj, this.random, blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(256), this.random.nextInt(16) + 8)); } if (this.lavaLakeGenerator != null && !flag && this.random.nextInt(8) == 0) { BlockPos blockpos1 = blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(this.random.nextInt(248) + 8), this.random.nextInt(16) + 8); if (blockpos1.getY() < this.worldObj.getSeaLevel() || this.random.nextInt(10) == 0) { this.lavaLakeGenerator.generate(this.worldObj, this.random, blockpos1); } } if (this.hasDungeons) { for (int i1 = 0; i1 < 8; ++i1) { (new WorldGenDungeons()).generate(this.worldObj, this.random, blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(256), this.random.nextInt(16) + 8)); } } if (this.hasDecoration) { biome.decorate(this.worldObj, this.random, blockpos); } }
public void populate(int x, int z) { net.minecraft.block.BlockFalling.fallInstantly = true; int i = x * 16; int j = z * 16; BlockPos blockpos = new BlockPos(i, 0, j); Biome biome = this.worldObj.getBiome(new BlockPos(i + 16, 0, j + 16)); boolean flag = false; this.random.setSeed(this.worldObj.getSeed()); long k = this.random.nextLong() / 2L * 2L + 1L; long l = this.random.nextLong() / 2L * 2L + 1L; this.random.setSeed((long)x * k + (long)z * l ^ this.worldObj.getSeed()); ChunkPos chunkpos = new ChunkPos(x, z); net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.worldObj, this.random, x, z, flag); for (MapGenStructure mapgenstructure : this.structureGenerators) { boolean flag1 = mapgenstructure.generateStructure(this.worldObj, this.random, chunkpos); if (mapgenstructure instanceof MapGenVillage) { flag |= flag1; } } if (this.waterLakeGenerator != null && !flag && this.random.nextInt(4) == 0) { this.waterLakeGenerator.generate(this.worldObj, this.random, blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(256), this.random.nextInt(16) + 8)); } if (this.lavaLakeGenerator != null && !flag && this.random.nextInt(8) == 0) { BlockPos blockpos1 = blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(this.random.nextInt(248) + 8), this.random.nextInt(16) + 8); if (blockpos1.getY() < this.worldObj.getSeaLevel() || this.random.nextInt(10) == 0) { this.lavaLakeGenerator.generate(this.worldObj, this.random, blockpos1); } } if (this.hasDungeons) { for (int i1 = 0; i1 < 8; ++i1) { (new WorldGenDungeons()).generate(this.worldObj, this.random, blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(256), this.random.nextInt(16) + 8)); } } if (this.hasDecoration) { biome.decorate(this.worldObj, this.random, blockpos); } net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.worldObj, this.random, x, z, flag); net.minecraft.block.BlockFalling.fallInstantly = false; }
public ChunkProviderOverworld(World worldIn, long seed, boolean mapFeaturesEnabledIn, String p_i46668_5_) { { caveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(caveGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); strongholdGenerator = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(strongholdGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); villageGenerator = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(villageGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); mineshaftGenerator = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(mineshaftGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); scatteredFeatureGenerator = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(scatteredFeatureGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); ravineGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(ravineGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); oceanMonumentGenerator = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(oceanMonumentGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); } this.worldObj = worldIn; this.mapFeaturesEnabled = mapFeaturesEnabledIn; this.terrainType = worldIn.getWorldInfo().getTerrainType(); this.rand = new Random(seed); this.minLimitPerlinNoise = new NoiseGeneratorOctaves(this.rand, 16); this.maxLimitPerlinNoise = new NoiseGeneratorOctaves(this.rand, 16); this.mainPerlinNoise = new NoiseGeneratorOctaves(this.rand, 8); this.surfaceNoise = new NoiseGeneratorPerlin(this.rand, 4); this.scaleNoise = new NoiseGeneratorOctaves(this.rand, 10); this.depthNoise = new NoiseGeneratorOctaves(this.rand, 16); this.forestNoise = new NoiseGeneratorOctaves(this.rand, 8); this.heightMap = new double[825]; this.biomeWeights = new float[25]; for (int i = -2; i <= 2; ++i) { for (int j = -2; j <= 2; ++j) { float f = 10.0F / MathHelper.sqrt_float((float)(i * i + j * j) + 0.2F); this.biomeWeights[i + 2 + (j + 2) * 5] = f; } } if (p_i46668_5_ != null) { this.settings = ChunkProviderSettings.Factory.jsonToFactory(p_i46668_5_).build(); this.oceanBlock = this.settings.useLavaOceans ? Blocks.LAVA.getDefaultState() : Blocks.WATER.getDefaultState(); worldIn.setSeaLevel(this.settings.seaLevel); } net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld ctx = new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld(minLimitPerlinNoise, maxLimitPerlinNoise, mainPerlinNoise, surfaceNoise, scaleNoise, depthNoise, forestNoise); ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, ctx); this.minLimitPerlinNoise = ctx.getLPerlin1(); this.maxLimitPerlinNoise = ctx.getLPerlin2(); this.mainPerlinNoise = ctx.getPerlin(); this.surfaceNoise = ctx.getHeight(); this.scaleNoise = ctx.getScale(); this.depthNoise = ctx.getDepth(); this.forestNoise = ctx.getForest(); }
public void setTarget(String target, int type) { this.timeToLive = TimeUtil.secsToTicks(10); this.spiritType = type; try { if(target.equals("Village")) { IChunkProvider ex; for(ex = super.worldObj.getChunkProvider(); ex != null && ex instanceof ChunkProviderServer; ex = ((ChunkProviderServer)ex).currentChunkProvider) { ; } if(ex != null) { if(ex instanceof ChunkProviderFlat) { if(fieldStructureGenerators == null) { fieldStructureGenerators = ReflectionHelper.findField(ChunkProviderFlat.class, new String[]{"structureGenerators", "field_82696_f", "f"}); } Iterator iterator = ((List)fieldStructureGenerators.get((ChunkProviderFlat)ex)).iterator(); while(iterator.hasNext()) { if(this.setWaypointTo(iterator.next(), MapGenVillage.class)) { return; } } } else if(ex instanceof ChunkProviderGenerate) { if(fieldVillageGenerator == null) { fieldVillageGenerator = ReflectionHelper.findField(ChunkProviderGenerate.class, new String[]{"villageGenerator", "field_73224_v", "v"}); } if(fieldVillageGenerator != null) { this.setWaypointTo(fieldVillageGenerator.get((ChunkProviderGenerate)ex), MapGenVillage.class); } } else if(ex instanceof ChunkProviderHell) { this.setWaypointTo(((ChunkProviderHell)ex).genNetherBridge); } } } } catch (IllegalAccessException var5) { ; } }
public void impose(WorldServer world, MapGenVillage mapGen) { IChunkProvider provider = extractFrom(world); if (provider instanceof ChunkProviderOverworld) { villageGeneratorFromVillage.setField((ChunkProviderOverworld)provider, mapGen); } }
public MapGenVillageDeadzone(MapGenVillage base) { this.childGen = base; }
public ChunkProviderFlat(World par1World, long par2, boolean par4, String par5Str) { this.worldObj = par1World; this.random = new Random(par2); this.flatWorldGenInfo = FlatGeneratorInfo.createFlatGeneratorFromString(par5Str); if (par4) { Map var6 = this.flatWorldGenInfo.getWorldFeatures(); if (var6.containsKey("village")) { Map var7 = (Map)var6.get("village"); if (!var7.containsKey("size")) { var7.put("size", "1"); } this.structureGenerators.add(new MapGenVillage(var7)); } if (var6.containsKey("biome_1")) { this.structureGenerators.add(new MapGenScatteredFeature((Map)var6.get("biome_1"))); } if (var6.containsKey("mineshaft")) { this.structureGenerators.add(new MapGenMineshaft((Map)var6.get("mineshaft"))); } if (var6.containsKey("stronghold")) { this.structureGenerators.add(new MapGenStronghold((Map)var6.get("stronghold"))); } } this.hasDecoration = this.flatWorldGenInfo.getWorldFeatures().containsKey("decoration"); if (this.flatWorldGenInfo.getWorldFeatures().containsKey("lake")) { this.waterLakeGenerator = new WorldGenLakes(Blocks.water); } if (this.flatWorldGenInfo.getWorldFeatures().containsKey("lava_lake")) { this.lavaLakeGenerator = new WorldGenLakes(Blocks.lava); } this.hasDungeons = this.flatWorldGenInfo.getWorldFeatures().containsKey("dungeon"); Iterator var9 = this.flatWorldGenInfo.getFlatLayers().iterator(); while (var9.hasNext()) { FlatLayerInfo var10 = (FlatLayerInfo)var9.next(); for (int var8 = var10.getMinY(); var8 < var10.getMinY() + var10.getLayerCount(); ++var8) { this.cachedBlockIDs[var8] = var10.func_151536_b(); this.cachedBlockMetadata[var8] = (byte)var10.getFillBlockMeta(); } } }
/** * Populates chunk with ores etc etc */ public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { int var4 = par2 * 16; int var5 = par3 * 16; BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); boolean var7 = false; this.random.setSeed(this.worldObj.getSeed()); long var8 = this.random.nextLong() / 2L * 2L + 1L; long var10 = this.random.nextLong() / 2L * 2L + 1L; this.random.setSeed((long)par2 * var8 + (long)par3 * var10 ^ this.worldObj.getSeed()); Iterator var12 = this.structureGenerators.iterator(); while (var12.hasNext()) { MapGenStructure var13 = (MapGenStructure)var12.next(); boolean var14 = var13.generateStructuresInChunk(this.worldObj, this.random, par2, par3); if (var13 instanceof MapGenVillage) { var7 |= var14; } } int var17; int var16; int var18; if (this.waterLakeGenerator != null && !var7 && this.random.nextInt(4) == 0) { var16 = var4 + this.random.nextInt(16) + 8; var17 = this.random.nextInt(256); var18 = var5 + this.random.nextInt(16) + 8; this.waterLakeGenerator.generate(this.worldObj, this.random, var16, var17, var18); } if (this.lavaLakeGenerator != null && !var7 && this.random.nextInt(8) == 0) { var16 = var4 + this.random.nextInt(16) + 8; var17 = this.random.nextInt(this.random.nextInt(248) + 8); var18 = var5 + this.random.nextInt(16) + 8; if (var17 < 63 || this.random.nextInt(10) == 0) { this.lavaLakeGenerator.generate(this.worldObj, this.random, var16, var17, var18); } } if (this.hasDungeons) { for (var16 = 0; var16 < 8; ++var16) { var17 = var4 + this.random.nextInt(16) + 8; var18 = this.random.nextInt(256); int var15 = var5 + this.random.nextInt(16) + 8; (new WorldGenDungeons()).generate(this.worldObj, this.random, var17, var18, var15); } } if (this.hasDecoration) { var6.decorate(this.worldObj, this.random, var4, var5); } }
public ChunkProviderFlat(World p_i2004_1_, long p_i2004_2_, boolean p_i2004_4_, String p_i2004_5_) { this.worldObj = p_i2004_1_; this.random = new Random(p_i2004_2_); this.flatWorldGenInfo = FlatGeneratorInfo.createFlatGeneratorFromString(p_i2004_5_); if (p_i2004_4_) { Map map = this.flatWorldGenInfo.getWorldFeatures(); if (map.containsKey("village")) { Map map1 = (Map)map.get("village"); if (!map1.containsKey("size")) { map1.put("size", "1"); } this.structureGenerators.add(new MapGenVillage(map1)); } if (map.containsKey("biome_1")) { this.structureGenerators.add(new MapGenScatteredFeature((Map)map.get("biome_1"))); } if (map.containsKey("mineshaft")) { this.structureGenerators.add(new MapGenMineshaft((Map)map.get("mineshaft"))); } if (map.containsKey("stronghold")) { this.structureGenerators.add(new MapGenStronghold((Map)map.get("stronghold"))); } } this.hasDecoration = this.flatWorldGenInfo.getWorldFeatures().containsKey("decoration"); if (this.flatWorldGenInfo.getWorldFeatures().containsKey("lake")) { this.waterLakeGenerator = new WorldGenLakes(Blocks.water); } if (this.flatWorldGenInfo.getWorldFeatures().containsKey("lava_lake")) { this.lavaLakeGenerator = new WorldGenLakes(Blocks.lava); } this.hasDungeons = this.flatWorldGenInfo.getWorldFeatures().containsKey("dungeon"); Iterator iterator = this.flatWorldGenInfo.getFlatLayers().iterator(); while (iterator.hasNext()) { FlatLayerInfo flatlayerinfo = (FlatLayerInfo)iterator.next(); for (int j = flatlayerinfo.getMinY(); j < flatlayerinfo.getMinY() + flatlayerinfo.getLayerCount(); ++j) { this.cachedBlockIDs[j] = flatlayerinfo.func_151536_b(); this.cachedBlockMetadata[j] = (byte)flatlayerinfo.getFillBlockMeta(); } } }
public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { int k = p_73153_2_ * 16; int l = p_73153_3_ * 16; BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); boolean flag = false; this.random.setSeed(this.worldObj.getSeed()); long i1 = this.random.nextLong() / 2L * 2L + 1L; long j1 = this.random.nextLong() / 2L * 2L + 1L; this.random.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed()); Iterator iterator = this.structureGenerators.iterator(); while (iterator.hasNext()) { MapGenStructure mapgenstructure = (MapGenStructure)iterator.next(); boolean flag1 = mapgenstructure.generateStructuresInChunk(this.worldObj, this.random, p_73153_2_, p_73153_3_); if (mapgenstructure instanceof MapGenVillage) { flag |= flag1; } } int l1; int i2; int j2; if (this.waterLakeGenerator != null && !flag && this.random.nextInt(4) == 0) { l1 = k + this.random.nextInt(16) + 8; i2 = this.random.nextInt(256); j2 = l + this.random.nextInt(16) + 8; this.waterLakeGenerator.generate(this.worldObj, this.random, l1, i2, j2); } if (this.lavaLakeGenerator != null && !flag && this.random.nextInt(8) == 0) { l1 = k + this.random.nextInt(16) + 8; i2 = this.random.nextInt(this.random.nextInt(248) + 8); j2 = l + this.random.nextInt(16) + 8; if (i2 < 63 || this.random.nextInt(10) == 0) { this.lavaLakeGenerator.generate(this.worldObj, this.random, l1, i2, j2); } } if (this.hasDungeons) { for (l1 = 0; l1 < 8; ++l1) { i2 = k + this.random.nextInt(16) + 8; j2 = this.random.nextInt(256); int k1 = l + this.random.nextInt(16) + 8; (new WorldGenDungeons()).generate(this.worldObj, this.random, i2, j2, k1); } } if (this.hasDecoration) { biomegenbase.decorate(this.worldObj, this.random, k, l); } }