@Override public BiomeGenerationSettings initPopulators(World world) { SpongeBiomeGenerationSettings gensettings = new SpongeBiomeGenerationSettings(); gensettings.getPopulators().clear(); gensettings.getGenerationPopulators().clear(); gensettings.getGroundCoverLayers().clear(); buildPopulators(world, gensettings); if (!getClass().getName().startsWith("net.minecraft")) { gensettings.getPopulators().add(new WrappedBiomeDecorator((BiomeGenBase) (Object) this)); } else if (!this.theBiomeDecorator.getClass().getName().startsWith("net.minecraft")) { gensettings.getPopulators().add(new WrappedBiomeDecorator(this.theBiomeDecorator)); } return gensettings; }
@Override public void buildPopulators(World world, SpongeBiomeGenerationSettings gensettings) { BiomeDecorator theBiomeDecorator = this.theBiomeDecorator; if (BiomeGenMutated.class.isAssignableFrom(this.getClass())) { theBiomeDecorator = ((BiomeGenMutated) (Object) this).baseBiome.theBiomeDecorator; } gensettings .getGroundCoverLayers() .add(new GroundCoverLayer((BlockState) this.topBlock, SeededVariableAmount.fixed(1))); gensettings .getGroundCoverLayers() .add( new GroundCoverLayer( (BlockState) this.fillerBlock, WorldGenConstants.GROUND_COVER_DEPTH)); String s = world.getWorldInfo().getGeneratorOptions(); ChunkProviderSettings settings; if (s != null) { settings = ChunkProviderSettings.Factory.jsonToFactory(s).func_177864_b(); } else { settings = ChunkProviderSettings.Factory.jsonToFactory("").func_177864_b(); } Ore dirt = Ore.builder() .ore((BlockState) Blocks.dirt.getDefaultState()) .size(settings.dirtSize) .perChunk(settings.dirtCount) .height( VariableAmount.baseWithRandomAddition( settings.dirtMinHeight, settings.dirtMaxHeight)) .build(); gensettings.getPopulators().add(dirt); Ore gravel = Ore.builder() .ore((BlockState) Blocks.gravel.getDefaultState()) .size(settings.gravelSize) .perChunk(settings.gravelCount) .height( VariableAmount.baseWithRandomAddition( settings.gravelMinHeight, settings.gravelMaxHeight)) .build(); gensettings.getPopulators().add(gravel); Ore diorite = Ore.builder() .ore( (BlockState) Blocks.stone .getDefaultState() .withProperty(BlockStone.VARIANT, BlockStone.EnumType.DIORITE)) .size(settings.dioriteSize) .perChunk(settings.dioriteCount) .height( VariableAmount.baseWithRandomAddition( settings.dioriteMinHeight, settings.dioriteMaxHeight)) .build(); gensettings.getPopulators().add(diorite); Ore granite = Ore.builder() .ore( (BlockState) Blocks.stone .getDefaultState() .withProperty(BlockStone.VARIANT, BlockStone.EnumType.GRANITE)) .size(settings.graniteSize) .perChunk(settings.graniteCount) .height( VariableAmount.baseWithRandomAddition( settings.graniteMinHeight, settings.graniteMaxHeight)) .build(); gensettings.getPopulators().add(granite); Ore andesite = Ore.builder() .ore( (BlockState) Blocks.stone .getDefaultState() .withProperty(BlockStone.VARIANT, BlockStone.EnumType.ANDESITE)) .size(settings.andesiteSize) .perChunk(settings.andesiteCount) .height( VariableAmount.baseWithRandomAddition( settings.andesiteMinHeight, settings.andesiteMaxHeight)) .build(); gensettings.getPopulators().add(andesite); Ore coal = Ore.builder() .ore((BlockState) Blocks.coal_ore.getDefaultState()) .size(settings.coalSize) .perChunk(settings.coalCount) .height( VariableAmount.baseWithRandomAddition( settings.coalMinHeight, settings.coalMaxHeight)) .build(); gensettings.getPopulators().add(coal); Ore iron = Ore.builder() .ore((BlockState) Blocks.iron_ore.getDefaultState()) .size(settings.ironSize) .perChunk(settings.ironCount) .height( VariableAmount.baseWithRandomAddition( settings.ironMinHeight, settings.ironMaxHeight)) .build(); gensettings.getPopulators().add(iron); Ore gold = Ore.builder() .ore((BlockState) Blocks.gold_ore.getDefaultState()) .size(settings.goldSize) .perChunk(settings.goldCount) .height( VariableAmount.baseWithRandomAddition( settings.goldMinHeight, settings.goldMaxHeight)) .build(); gensettings.getPopulators().add(gold); Ore redstone = Ore.builder() .ore((BlockState) Blocks.redstone_ore.getDefaultState()) .size(settings.redstoneSize) .perChunk(settings.redstoneCount) .height( VariableAmount.baseWithRandomAddition( settings.redstoneMinHeight, settings.redstoneMaxHeight)) .build(); gensettings.getPopulators().add(redstone); Ore diamond = Ore.builder() .ore((BlockState) Blocks.diamond_ore.getDefaultState()) .size(settings.diamondSize) .perChunk(settings.diamondCount) .height( VariableAmount.baseWithRandomAddition( settings.diamondMinHeight, settings.diamondMaxHeight)) .build(); gensettings.getPopulators().add(diamond); Ore lapis = Ore.builder() .ore((BlockState) Blocks.lapis_ore.getDefaultState()) .size(settings.lapisSize) .perChunk(settings.lapisCount) .height( VariableAmount.baseWithVariance(settings.lapisCenterHeight, settings.lapisSpread)) .build(); gensettings.getPopulators().add(lapis); if (theBiomeDecorator.sandPerChunk2 > 0) { SeaFloor sand = SeaFloor.builder() .block((BlockState) Blocks.sand.getDefaultState()) .radius(VariableAmount.baseWithRandomAddition(2, 5)) .depth(2) .perChunk(theBiomeDecorator.sandPerChunk2) .replace(WorldGenConstants.DIRT_OR_GRASS) .build(); gensettings.getPopulators().add(sand); } if (theBiomeDecorator.clayPerChunk > 0) { SeaFloor clay = SeaFloor.builder() .block((BlockState) Blocks.clay.getDefaultState()) .radius(VariableAmount.baseWithRandomAddition(2, 2)) .depth(1) .perChunk(theBiomeDecorator.clayPerChunk) .replace(WorldGenConstants.DIRT) .build(); gensettings.getPopulators().add(clay); } if (theBiomeDecorator.sandPerChunk > 0) { SeaFloor gravelSeaFloor = SeaFloor.builder() .block((BlockState) Blocks.gravel.getDefaultState()) .radius(VariableAmount.baseWithRandomAddition(2, 4)) .depth(2) .perChunk(theBiomeDecorator.sandPerChunk) .replace(WorldGenConstants.DIRT_OR_GRASS) .build(); gensettings.getPopulators().add(gravelSeaFloor); } Forest forest = Forest.builder() .type(BiomeTreeTypes.OAK.getPopulatorObject(), 9) .type(BiomeTreeTypes.OAK.getLargePopulatorObject().get(), 1) .perChunk( VariableAmount.baseWithOptionalAddition(theBiomeDecorator.treesPerChunk, 1, 0.1)) .build(); gensettings.getPopulators().add(forest); if (theBiomeDecorator.bigMushroomsPerChunk > 0) { BigMushroom mushroom = BigMushroom.builder() .mushroomsPerChunk(theBiomeDecorator.bigMushroomsPerChunk) .type(MushroomTypes.BROWN.getPopulatorObject(), 1) .type(MushroomTypes.RED.getPopulatorObject(), 1) .build(); gensettings.getPopulators().add(mushroom); } if (theBiomeDecorator.flowersPerChunk > 0) { Flower flower = Flower.builder() .perChunk(theBiomeDecorator.flowersPerChunk * 64) .type(PlantTypes.DANDELION, 2) .type(PlantTypes.POPPY, 1) .build(); gensettings.getPopulators().add(flower); } if (theBiomeDecorator.grassPerChunk > 0) { Shrub grass = Shrub.builder() .perChunk(theBiomeDecorator.grassPerChunk * 128) .type(ShrubTypes.TALL_GRASS, 1) .build(); gensettings.getPopulators().add(grass); } if (theBiomeDecorator.deadBushPerChunk > 0) { DeadBush deadBush = DeadBush.builder().perChunk(theBiomeDecorator.deadBushPerChunk).build(); gensettings.getPopulators().add(deadBush); } if (theBiomeDecorator.waterlilyPerChunk > 0) { WaterLily waterLily = WaterLily.builder().perChunk(theBiomeDecorator.waterlilyPerChunk * 10).build(); gensettings.getPopulators().add(waterLily); } ChanceTable<MushroomType> types = new ChanceTable<MushroomType>(); types.add(new WeightedObject<MushroomType>(MushroomTypes.BROWN, 2)); types.add(new WeightedObject<MushroomType>(MushroomTypes.RED, 1)); types.add(new EmptyObject<>(5)); Mushroom smallMushroom = Mushroom.builder() .types(types) .mushroomsPerChunk(theBiomeDecorator.mushroomsPerChunk + 1) .build(); gensettings.getPopulators().add(smallMushroom); Reed reed = Reed.builder() .perChunk(theBiomeDecorator.reedsPerChunk + 10) .reedHeight( VariableAmount.baseWithRandomAddition( 2, VariableAmount.baseWithRandomAddition(1, 3))) .build(); gensettings.getPopulators().add(reed); Pumpkin pumpkin = Pumpkin.builder().perChunk(64).chance(1 / 32d).build(); gensettings.getPopulators().add(pumpkin); if (theBiomeDecorator.cactiPerChunk > 0) { Cactus cactus = Cactus.builder() .cactiPerChunk( VariableAmount.baseWithOptionalAddition( 0, VariableAmount.baseWithRandomAddition( 1, VariableAmount.baseWithOptionalAddition(2, 3, 0.5)), 0.8)) .build(); gensettings.getPopulators().add(cactus); } if (theBiomeDecorator.generateLakes) { RandomBlock water = RandomBlock.builder() .block((BlockState) Blocks.flowing_water.getDefaultState()) .height( VariableAmount.baseWithRandomAddition( 0, VariableAmount.baseWithRandomAddition(8, 248))) .perChunk(50) .placementTarget(WorldGenConstants.CAVE_LIQUIDS) .build(); gensettings.getPopulators().add(water); RandomBlock lava = RandomBlock.builder() .block((BlockState) Blocks.flowing_lava.getDefaultState()) .height( VariableAmount.baseWithRandomAddition( 0, VariableAmount.baseWithRandomAddition( 8, VariableAmount.baseWithRandomAddition(8, 240)))) .perChunk(20) .placementTarget(WorldGenConstants.CAVE_LIQUIDS) .build(); gensettings.getPopulators().add(lava); } }