From 4c7e87370337814d725f090d71691a909582f3c2 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 9 Jan 2014 17:51:18 +1100 Subject: [PATCH] Readded the Bayou, Bog, Snowy Coniferous Forest, Dead Swamp, Heathland, Lush Desert & Lush Swamp --- .../common/biomes/BiomeGenBayou.java | 72 +++-- .../common/biomes/BiomeGenBog.java | 194 +++++------ .../biomes/BiomeGenConiferousForestSnow.java | 148 +++++---- .../common/biomes/BiomeGenDeadSwamp.java | 204 ++++++------ .../common/biomes/BiomeGenHeathland.java | 159 +++++---- .../common/biomes/BiomeGenLushDesert.java | 180 +++++++---- .../common/biomes/BiomeGenLushSwamp.java | 150 +++++---- .../biomesoplenty/common/core/BOPBiomes.java | 21 +- .../world/decoration/BOPWorldFeatures.java | 4 + .../common/world/features/WorldGenMarsh.java | 144 +++++++++ .../world/features/WorldGenSplotches.java | 36 ++- .../world/features/WorldGenWaterside.java | 82 +++++ .../features/trees/WorldGenBOPShrub.java | 2 +- .../features/trees/WorldGenBOPSwampTree.java | 16 +- .../features/trees/WorldGenBOPTaiga3.java | 8 +- .../world/features/trees/WorldGenBayou1.java | 306 ++++++++---------- .../world/features/trees/WorldGenBayou2.java | 235 ++++++++++++++ .../world/features/trees/WorldGenBayou3.java | 157 +++++++++ .../world/features/trees/WorldGenBogBush.java | 50 +++ .../world/features/trees/WorldGenCypress.java | 198 ++++++++++++ .../generation/WorldGenFieldAssociation.java | 14 +- .../world/generation/WorldGeneratorBOP.java | 12 +- 22 files changed, 1721 insertions(+), 671 deletions(-) create mode 100644 src/main/java/biomesoplenty/common/world/features/WorldGenMarsh.java create mode 100644 src/main/java/biomesoplenty/common/world/features/WorldGenWaterside.java create mode 100644 src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou2.java create mode 100644 src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou3.java create mode 100644 src/main/java/biomesoplenty/common/world/features/trees/WorldGenBogBush.java create mode 100644 src/main/java/biomesoplenty/common/world/features/trees/WorldGenCypress.java diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenBayou.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenBayou.java index f536b92de..379111b52 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenBayou.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenBayou.java @@ -1,26 +1,41 @@ package biomesoplenty.common.biomes; +import java.util.HashMap; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.monster.EntitySlime; import net.minecraft.init.Blocks; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenerator; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.configuration.BOPConfigurationMisc; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; import biomesoplenty.common.world.features.WorldGenMoss; +import biomesoplenty.common.world.features.trees.WorldGenBayou1; +import biomesoplenty.common.world.features.trees.WorldGenBayou2; +import biomesoplenty.common.world.features.trees.WorldGenBayou3; public class BiomeGenBayou extends BOPBiome { + private static final Height biomeHeight = new Height(0.1F, 0.3F); public BiomeGenBayou(int id) { super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(9154411); + this.setTemperatureRainfall(0.5F, 0.9F); - spawnableWaterCreatureList.clear(); - spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 1, 3)); + this.spawnableWaterCreatureList.clear(); + this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 1, 3)); - waterColorMultiplier = 16767282; + this.waterColorMultiplier = 16767282; this.theBiomeDecorator.treesPerChunk = 15; this.theBiomeDecorator.grassPerChunk = 15; @@ -29,28 +44,39 @@ public class BiomeGenBayou extends BOPBiome this.theBiomeDecorator.mushroomsPerChunk = 4; this.theBiomeDecorator.sandPerChunk = -999; this.theBiomeDecorator.sandPerChunk2 = -999; - //this.theBiomeDecorator.waterLakesPerChunk = 5; - - /*customBiomeDecorator.mudPerChunk = 1; - customBiomeDecorator.mudPerChunk2 = 1; - customBiomeDecorator.toadstoolsPerChunk = 2; - - customBiomeDecorator.waterlilyPerChunk = 2; - customBiomeDecorator.cattailsPerChunk = 1; - customBiomeDecorator.highCattailsPerChunk = 1; - customBiomeDecorator.algaePerChunk = 1; - customBiomeDecorator.shrubsPerChunk = 2; - customBiomeDecorator.wheatGrassPerChunk = 7; - customBiomeDecorator.waterReedsPerChunk = 4; - customBiomeDecorator.koruPerChunk = 1;*/ - //TODO: FEATURE ? customBiomeDecorator.generatePumpkins = false; + + this.bopWorldFeatures.waterLakesPerChunk = 5; + this.bopWorldFeatures.mudPerChunk = 1; + this.bopWorldFeatures.toadstoolsPerChunk = 2; + this.bopWorldFeatures.cattailsPerChunk = 1; + this.bopWorldFeatures.highCattailsPerChunk = 1; + this.bopWorldFeatures.algaePerChunk = 1; + this.bopWorldFeatures.shrubsPerChunk = 2; + this.bopWorldFeatures.waterReedsPerChunk = 4; + this.bopWorldFeatures.koruPerChunk = 1; + this.bopWorldFeatures.generatePumpkins = false; } - /*@Override - public WorldGenAbstractTree getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(8) == 0 ? new WorldGenBayou3() : (par1Random.nextInt(2) == 0 ? new WorldGenBayou1() : new WorldGenBayou2()); - }*/ + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(8) == 0 ? new WorldGenBayou3(BOPBlockHelper.get("logs3"), 1) : + (random.nextInt(2) == 0 ? new WorldGenBayou1(BOPBlockHelper.get("logs3"), BOPBlockHelper.get("colorizedLeaves2"), 1, 0) : + new WorldGenBayou2(BOPBlockHelper.get("logs3"), BOPBlockHelper.get("colorizedLeaves2"), 1, 0)); + } + + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 1D); + + return grassMap; + } @Override public void decorate(World world, Random random, int chunkX, int chunkZ) diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenBog.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenBog.java index 13f3ffec6..a53371af3 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenBog.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenBog.java @@ -1,113 +1,121 @@ package biomesoplenty.common.biomes; -import net.minecraft.world.biome.BiomeGenBase; +import java.util.HashMap; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.WorldGenMarsh; +import biomesoplenty.common.world.features.trees.WorldGenBogBush; +import biomesoplenty.common.world.features.trees.WorldGenCypress; public class BiomeGenBog extends BOPBiome { - public BiomeGenBog(int par1) - { - super(par1); - /* - spawnableCreatureList.clear(); - spawnableWaterCreatureList.clear(); - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 12; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.mushroomsPerChunk = 8; - customBiomeDecorator.grassPerChunk = 5; - customBiomeDecorator.bushesPerChunk = 6; - customBiomeDecorator.mudPerChunk = 2; - customBiomeDecorator.mudPerChunk2 = 2; - customBiomeDecorator.sandPerChunk = -999; - customBiomeDecorator.sandPerChunk2 = -999; - customBiomeDecorator.algaePerChunk = 2; - customBiomeDecorator.waterlilyPerChunk = 4; - customBiomeDecorator.reedsBOPPerChunk = 8; - customBiomeDecorator.blueMilksPerChunk = 1; - customBiomeDecorator.waterLakesPerChunk = 6; - customBiomeDecorator.wheatGrassPerChunk = 3; - customBiomeDecorator.poisonWaterPerChunk = 2; - customBiomeDecorator.waterReedsPerChunk = 8; - customBiomeDecorator.koruPerChunk = 1; - customBiomeDecorator.shrubsPerChunk = 10; - customBiomeDecorator.generatePumpkins = false; - */ - } + private static final Height biomeHeight = new Height(0.3F, 0.3F); + + public BiomeGenBog(int id) + { + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(14193503); + this.setTemperatureRainfall(0.8F, 0.9F); + + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + + this.theBiomeDecorator.treesPerChunk = 12; + this.theBiomeDecorator.flowersPerChunk = -999; + this.theBiomeDecorator.mushroomsPerChunk = 8; + this.theBiomeDecorator.grassPerChunk = 5; + this.theBiomeDecorator.sandPerChunk = -999; + this.theBiomeDecorator.sandPerChunk2 = -999; + + this.bopWorldFeatures.bushesPerChunk = 6; + this.bopWorldFeatures.mudPerChunk = 2; + this.bopWorldFeatures.algaePerChunk = 2; + this.bopWorldFeatures.riverCanePerChunk = 8; + this.bopWorldFeatures.blueMilksPerChunk = 1; + this.bopWorldFeatures.waterLakesPerChunk = 6; + //TODO: FEATURE this.bopWorldFeatures.poisonWaterPerChunk = 2; + this.bopWorldFeatures.waterReedsPerChunk = 8; + this.bopWorldFeatures.koruPerChunk = 1; + this.bopWorldFeatures.shrubsPerChunk = 10; + this.bopWorldFeatures.generatePumpkins = false; + } - /* @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) + public void decorate(World world, Random random, int chunkX, int chunkZ) { - super.decorate(par1World, par2Random, par3, par4); - WorldGenMarsh var5 = new WorldGenMarsh(); - - int var55 = 12 + par2Random.nextInt(6); + super.decorate(world, random, chunkX, chunkZ); - for (int var66 = 0; var66 < var55; ++var66) - { - int var77 = par3 + par2Random.nextInt(16); - int var88 = par2Random.nextInt(28) + 4; - int var99 = par4 + par2Random.nextInt(16); - int var100 = par1World.getBlockId(var77, var88, var99); + int var5 = 12 + random.nextInt(6); - if (var100 == Block.stone.blockID) - { - par1World.setBlock(var77, var88, var99, Blocks.amethystOre.get().blockID, 10, 2); - } - } + for (int var6 = 0; var6 < var5; ++var6) + { + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 6, 2); + } + } for (int var6 = 0; var6 < 10; ++var6) { - int var7 = par3 + par2Random.nextInt(16) + 8; - byte var8 = 62; - int var9 = par4 + par2Random.nextInt(16) + 8; - var5.generate(par1World, par2Random, var7, var8, var9); + int var7 = chunkX + random.nextInt(16) + 8; + short var8 = 62; + int var9 = chunkZ + random.nextInt(16) + 8; + + new WorldGenMarsh().generate(world, random, var7, var8, var9); } } - */ - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(3) == 0 ? new WorldGenCypress1(false) : (par1Random.nextInt(6) == 0 ? new WorldGenCypress2(false) : new WorldGenBogBush()); - } - */ + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(3) == 0 ? new WorldGenCypress(Blocks.log, Blocks.leaves, 0, 0, false, 8, 5, 0) : (random.nextInt(6) == 0 ? new WorldGenCypress(Blocks.log, Blocks.leaves, 2, 2, false, 4, 4, 1) : new WorldGenBogBush()); + } - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new WorldGenTallGrass(Block.tallGrass.blockID, 1) : new WorldGenTallGrass(Blocks.foliage.get().blockID, 2); - } - */ + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 2), 1D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + + return grassMap; + } - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - /* - @Override - public int getBiomeGrassColor() - { - return 14193503; - } - */ + @Override + //TODO: getBiomeGrassColor() + public int func_150558_b(int p_150558_1_, int p_150558_2_, int p_150558_3_) + { + return 14193503; + } - /** - * Provides the basic foliage color based on the biome temperature and rainfall - */ - /* - @Override - public int getBiomeFoliageColor() - { - return 14345593; - } - */ + @Override + //TODO: getBiomeFoliageColor() + public int func_150571_c(int x, int y, int z) + { + return 14345593; + } } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenConiferousForestSnow.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenConiferousForestSnow.java index cad6cbf89..fb979adba 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenConiferousForestSnow.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenConiferousForestSnow.java @@ -1,72 +1,100 @@ package biomesoplenty.common.biomes; +import java.util.HashMap; +import java.util.Random; + +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPFlora; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2; +import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga3; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenerator; public class BiomeGenConiferousForestSnow extends BOPBiome { + private static final Height biomeHeight = new Height(0.3F, 0.6F); + + public BiomeGenConiferousForestSnow(int id) + { + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(16777215); + this.setTemperatureRainfall(0.0F, 0.5F); - public BiomeGenConiferousForestSnow(int par1) - { - super(par1); - /* - spawnableCreatureList.clear(); - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 2; - customBiomeDecorator.mushroomsPerChunk = 4; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.shrubsPerChunk = 4; - customBiomeDecorator.wheatGrassPerChunk = 1; - customBiomeDecorator.violetsPerChunk = 3; - customBiomeDecorator.sandPerChunk = -999; - customBiomeDecorator.sandPerChunk2 = -999; - customBiomeDecorator.gravelPerChunk = 1; - customBiomeDecorator.gravelPerChunk2 = 1; - */ - } - - /* - @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 12 + par2Random.nextInt(6); + this.spawnableCreatureList.clear(); - for (int var6 = 0; var6 < var5; ++var6) - { - int var7 = par3 + par2Random.nextInt(16); - int var8 = par2Random.nextInt(28) + 4; - int var9 = par4 + par2Random.nextInt(16); - int var10 = par1World.getBlockId(var7, var8, var9); + this.theBiomeDecorator.treesPerChunk = 2; + this.theBiomeDecorator.mushroomsPerChunk = 4; + this.theBiomeDecorator.flowersPerChunk = -999; + // gravelPerChunk + this.theBiomeDecorator.sandPerChunk = -999; + this.theBiomeDecorator.sandPerChunk2 = -999; - Block block = Block.blocksList[var10]; - if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID)) - { - par1World.setBlock(var7, var8, var9, Blocks.amethystOre.get().blockID, 8, 2); - } - } - } - */ + this.bopWorldFeatures.bopFlowersPerChunk = 3; + this.bopWorldFeatures.shrubsPerChunk = 4; + } - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(5) == 0 ? new WorldGenTaiga3(false) : (par1Random.nextInt(3) == 0 ? new WorldGenTaiga4(false) : new WorldGenTaiga9(false)); - } - */ + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(5) == 0 ? new WorldGenBOPTaiga3(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves2"), 3, 1, false, 35, 10, 0) : + (random.nextInt(3) == 0 ? new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves2"), 3, 1, false, 20, 15, 4) : + new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves2"), 3, 1, false, 10, 10, 5)); + } + + @Override + public HashMap getWeightedWorldGenForBOPFlowers() + { + HashMap flowerMap = new HashMap(); + + flowerMap.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 8), 1D); + + return flowerMap; + } - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new WorldGenTallGrass(Blocks.foliage.get().blockID, 2) : new WorldGenTallGrass(Blocks.foliage.get().blockID, 1); - } - */ + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 2), 1D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + + return grassMap; + } + + @Override + public void decorate(World world, Random random, int chunkX, int chunkZ) + { + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.nextInt(6); + + for (int var6 = 0; var6 < var5; ++var6) + { + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 8, 2); + } + } + } } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenDeadSwamp.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenDeadSwamp.java index 2e9348c17..f8a976437 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenDeadSwamp.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenDeadSwamp.java @@ -1,97 +1,117 @@ package biomesoplenty.common.biomes; -import net.minecraft.world.biome.BiomeGenBase; +import java.util.HashMap; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.configuration.BOPConfigurationMisc; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; public class BiomeGenDeadSwamp extends BOPBiome { - - public BiomeGenDeadSwamp(int par1) + private static final Height biomeHeight = new Height(0.1F, 0.2F); + + public BiomeGenDeadSwamp(int id) { - super(par1); - /* - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 2; - customBiomeDecorator.grassPerChunk = 25; - customBiomeDecorator.highGrassPerChunk = 1; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.reedsPerChunk = -999; - customBiomeDecorator.mudPerChunk = 3; - customBiomeDecorator.mudPerChunk2 = 3; - customBiomeDecorator.sandPerChunk = -999; - customBiomeDecorator.sandPerChunk2 = -999; - customBiomeDecorator.reedsBOPPerChunk = 2; - customBiomeDecorator.wheatGrassPerChunk = 10; - customBiomeDecorator.waterReedsPerChunk = 4; - customBiomeDecorator.koruPerChunk = 1; - spawnableCreatureList.clear(); - spawnableWaterCreatureList.clear(); - waterColorMultiplier = 10661201; - */ + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(9154376); + this.setTemperatureRainfall(0.8F, 0.9F); + + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + + this.waterColorMultiplier = 10661201; + + this.theBiomeDecorator.treesPerChunk = 2; + this.theBiomeDecorator.grassPerChunk = 25; + this.theBiomeDecorator.flowersPerChunk = -999; + this.theBiomeDecorator.reedsPerChunk = -999; + this.theBiomeDecorator.sandPerChunk = -999; + this.theBiomeDecorator.sandPerChunk2 = -999; + + this.bopWorldFeatures.mudPerChunk = 3; + this.bopWorldFeatures.doubleTallGrassPerChunk = 1; + this.bopWorldFeatures.riverCanePerChunk = 2; + this.bopWorldFeatures.waterReedsPerChunk = 4; + this.bopWorldFeatures.koruPerChunk = 1; } + + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 2), 1D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + + return grassMap; + } + + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("mud")); + } - /* + @Override + public void decorate(World world, Random random, int chunkX, int chunkZ) + { + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.nextInt(6); + + for (int var6 = 0; var6 < var5; ++var6) + { + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 10, 2); + } + } + } + @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 12 + par2Random.nextInt(6); - - for (int var6 = 0; var6 < var5; ++var6) - { - int var7 = par3 + par2Random.nextInt(16); - int var8 = par2Random.nextInt(28) + 4; - int var9 = par4 + par2Random.nextInt(16); - int var10 = par1World.getBlockId(var7, var8, var9); - - Block block = Block.blocksList[var10]; - if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID)) - { - par1World.setBlock(var7, var8, var9, Blocks.amethystOre.get().blockID, 10, 2); - } - } - } - */ - - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(9) == 0 ? new WorldGenTallGrass(Block.tallGrass.blockID, 1) : new WorldGenTallGrass(Blocks.foliage.get().blockID, 2); - } - */ - - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return new WorldGenDeadTree(false); - } - */ - - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - /* - @Override - public int getBiomeGrassColor() - { + //TODO: getBiomeGrassColor() + public int func_150558_b(int p_150558_1_, int p_150558_2_, int p_150558_3_) + { return 6713420; } @Override - public int getBiomeFoliageColor() - { + //TODO: getBiomeFoliageColor() + public int func_150571_c(int x, int y, int z) + { return 6713420; } - @Override + @Override + public int getSkyColorByTemp(float par1) + { + if (BOPConfigurationMisc.skyColors) return 6451816; + else return super.getSkyColorByTemp(par1); + } + + /*@Override public int getFogColour() { return 9219993; @@ -104,32 +124,4 @@ public class BiomeGenDeadSwamp extends BOPBiome return 0.6F; } */ - - /** - * takes temperature, returns color - */ - /* - @Override - public int getSkyColorByTemp(float par1) - { - if (BOPConfigurationMisc.skyColors) - return 6451816; - else - { - par1 /= 3.0F; - - if (par1 < -1.0F) - { - par1 = -1.0F; - } - - if (par1 > 1.0F) - { - par1 = 1.0F; - } - - return Color.getHSBColor(0.62222224F - par1 * 0.05F, 0.5F + par1 * 0.1F, 1.0F).getRGB(); - } - } - */ } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenHeathland.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenHeathland.java index d156c7807..358aba1fe 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenHeathland.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenHeathland.java @@ -1,82 +1,111 @@ package biomesoplenty.common.biomes; -import net.minecraft.world.biome.BiomeGenBase; +import java.util.HashMap; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenShrub; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPFlora; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenBOPShrub; public class BiomeGenHeathland extends BOPBiome { + private static final Height biomeHeight = new Height(0.3F, 0.4F); - public BiomeGenHeathland(int par1) + public BiomeGenHeathland(int id) { - super(par1); - /* - spawnableCreatureList.clear(); - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 3; - customBiomeDecorator.grassPerChunk = 10; - customBiomeDecorator.wheatGrassPerChunk = 5; - customBiomeDecorator.purpleFlowersPerChunk = 30; - customBiomeDecorator.deadBushPerChunk = 2; - customBiomeDecorator.berryBushesPerChunk = 1; - customBiomeDecorator.shrubsPerChunk = 5; - customBiomeDecorator.generatePumpkins = false; - spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 6)); - */ + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(13550967); + this.setTemperatureRainfall(0.8F, 0.1F); + + this.spawnableCreatureList.clear(); + + this.spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 6)); + + this.theBiomeDecorator.treesPerChunk = 3; + this.theBiomeDecorator.grassPerChunk = 10; + this.theBiomeDecorator.deadBushPerChunk = 2; + + this.bopWorldFeatures.bopFlowersPerChunk = 30; + this.bopWorldFeatures.berryBushesPerChunk = 1; + this.bopWorldFeatures.shrubsPerChunk = 5; + this.bopWorldFeatures.generatePumpkins = false; } - /* + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(3) == 0 ? new WorldGenBOPShrub(BOPBlockHelper.get("logs4"), BOPBlockHelper.get("leaves4"), 2, 1, Blocks.grass) : (random.nextInt(2) == 0 ? new WorldGenShrub(0, 0) : worldGeneratorTrees); + } + + @Override + public HashMap getWeightedWorldGenForBOPFlowers() + { + HashMap flowerMap = new HashMap(); + + flowerMap.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 7), 1D); + + return flowerMap; + } + + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 1D); + + return grassMap; + } + + @Override + public void decorate(World world, Random random, int chunkX, int chunkZ) + { + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.nextInt(6); + + for (int var6 = 0; var6 < var5; ++var6) + { + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 4, 2); + } + } + } + @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 12 + par2Random.nextInt(6); - - for (int var6 = 0; var6 < var5; ++var6) - { - int var7 = par3 + par2Random.nextInt(16); - int var8 = par2Random.nextInt(28) + 4; - int var9 = par4 + par2Random.nextInt(16); - int var10 = par1World.getBlockId(var7, var8, var9); - - Block block = Block.blocksList[var10]; - if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID)) - { - par1World.setBlock(var7, var8, var9, Blocks.amethystOre.get().blockID, 4, 2); - } - } - } - */ - - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(3) == 0 ? new WorldGenJacarandaShrub(0, 0) : (par1Random.nextInt(2) == 0 ? new WorldGenShrub(0, 0) : worldGeneratorTrees); - } - */ - - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - /* - @Override - public int getBiomeGrassColor() - { + //TODO: getBiomeGrassColor() + public int func_150558_b(int p_150558_1_, int p_150558_2_, int p_150558_3_) + { return 13550967; } - */ - /** - * Provides the basic foliage color based on the biome temperature and rainfall - */ - /* @Override - public int getBiomeFoliageColor() - { + //TODO: getBiomeFoliageColor() + public int func_150571_c(int x, int y, int z) + { return 11454081; } - */ } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenLushDesert.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenLushDesert.java index c4a325e05..9d076903a 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenLushDesert.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenLushDesert.java @@ -1,80 +1,126 @@ package biomesoplenty.common.biomes; -import net.minecraft.world.biome.BiomeGenBase; +import java.util.HashMap; +import java.util.Random; + +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPFlora; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; + +import net.minecraft.block.Block; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenSavannaTree; +import net.minecraft.world.gen.feature.WorldGenShrub; +import net.minecraft.world.gen.feature.WorldGenerator; public class BiomeGenLushDesert extends BOPBiome { + private static final Height biomeHeight = new Height(0.2F, 0.4F); + + public BiomeGenLushDesert(int id) + { + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(10739795); + this.setTemperatureRainfall(1.2F, 0.9F); - public BiomeGenLushDesert(int par1) - { - super(par1); - /* - topBlock = (byte)Blocks.redRock.get().blockID; - fillerBlock = (byte)Blocks.redRock.get().blockID; - customBiomeDecorator.treesPerChunk = 12; - customBiomeDecorator.grassPerChunk = 8; - customBiomeDecorator.shrubsPerChunk = 10; - customBiomeDecorator.wheatGrassPerChunk = 4; - customBiomeDecorator.oasesPerChunk = 999; - customBiomeDecorator.oasesPerChunk2 = 999; - customBiomeDecorator.deadBushPerChunk = 2; - customBiomeDecorator.purpleFlowersPerChunk = 5; - customBiomeDecorator.desertGrassPerChunk = 10; - customBiomeDecorator.cactiPerChunk = 20; - customBiomeDecorator.tinyCactiPerChunk = 5; - customBiomeDecorator.waterLakesPerChunk = 5; - customBiomeDecorator.waterReedsPerChunk = 4; - customBiomeDecorator.aloePerChunk = 3; - customBiomeDecorator.generateGrass = true; - customBiomeDecorator.generateSand = true; - customBiomeDecorator.generatePumpkins = false; - spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 6)); - */ - } + this.spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 6)); - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(4) == 0 ? new WorldGenAcacia(false) : (par1Random.nextInt(24) == 0 ? new WorldGenDeadTree3(false) : (par1Random.nextInt(2) == 0 ? worldGeneratorTrees : new WorldGenShrub(0,0))); - } + this.topBlock = BOPBlockHelper.get("redRock"); + this.fillerBlock = BOPBlockHelper.get("redRock"); - @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); - int var5 = par2Random.nextInt(50); - - int var55 = 12 + par2Random.nextInt(6); + this.theBiomeDecorator.treesPerChunk = 12; + this.theBiomeDecorator.grassPerChunk = 8; + this.theBiomeDecorator.cactiPerChunk = 20; + this.theBiomeDecorator.deadBushPerChunk = 2; - for (int var66 = 0; var66 < var55; ++var66) - { - int var77 = par3 + par2Random.nextInt(16); - int var88 = par2Random.nextInt(28) + 4; - int var99 = par4 + par2Random.nextInt(16); - int var100 = par1World.getBlockId(var77, var88, var99); + this.bopWorldFeatures.shrubsPerChunk = 10; + this.bopWorldFeatures.oasesPerChunk = 999; + this.bopWorldFeatures.bopFlowersPerChunk = 5; + this.bopWorldFeatures.tinyCactiPerChunk = 5; + this.bopWorldFeatures.waterLakesPerChunk = 5; + this.bopWorldFeatures.waterReedsPerChunk = 4; + this.bopWorldFeatures.bromeliadsPerChunk = 3; + this.bopWorldFeatures.generateGrass = true; + this.bopWorldFeatures.generateSand = true; + this.bopWorldFeatures.generatePumpkins = false; + } - if (var100 == Block.stone.blockID) - { - par1World.setBlock(var77, var88, var99, Blocks.amethystOre.get().blockID, 2, 2); - } - } + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(4) == 0 ? new WorldGenSavannaTree(false) : + (random.nextInt(24) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("holyGrass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock")) : + (random.nextInt(2) == 0 ? worldGeneratorTrees : new WorldGenShrub(0,0))); + } + + @Override + public HashMap getWeightedWorldGenForBOPFlowers() + { + HashMap flowerMap = new HashMap(); + + flowerMap.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 7), 1D); + + return flowerMap; + } + + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("plants"), 1), 1D); + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 1D); + + return grassMap; + } - for (int var6 = 0; var6 < var5; ++var6) - { - int var7 = par3 + par2Random.nextInt(16); - int var8 = par2Random.nextInt(53) + 75; - int var9 = par4 + par2Random.nextInt(16); - int var10 = par1World.getBlockId(var7, var8, var9); + @Override + public void decorate(World world, Random random, int chunkX, int chunkZ) + { + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.nextInt(6); - if (var10 == Block.stone.blockID || var10 == Blocks.redRock.get().blockID) - { - par1World.setBlock(var7, var8, var9, Block.waterMoving.blockID, 0, 2); - } - } - } - */ + for (int var6 = 0; var6 < var5; ++var6) + { + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 2, 2); + } + } + + for (int var6 = 0; var6 < var5; ++var6) + { + int x = chunkX + random.nextInt(16); + int y = random.nextInt(53) + 75; + int z = chunkZ + random.nextInt(16); + + Block block= world.func_147439_a(x, y, z); + + if (block != null && (block.isReplaceableOreGen(world, x, y, z, Blocks.stone) || block == BOPBlockHelper.get("redRock"))) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, Blocks.flowing_water, 0, 2); + } + } + } } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenLushSwamp.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenLushSwamp.java index df386cc8e..85e40c93d 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenLushSwamp.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenLushSwamp.java @@ -1,68 +1,102 @@ package biomesoplenty.common.biomes; -import net.minecraft.world.biome.BiomeGenBase; +import java.util.HashMap; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPFlora; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenBOPSwampTree; public class BiomeGenLushSwamp extends BOPBiome { + private static final Height biomeHeight = new Height(0.2F, 0.3F); - @SuppressWarnings("unchecked") - public BiomeGenLushSwamp(int par1) - { - super(par1); - /* - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 10; - customBiomeDecorator.grassPerChunk = 4; - customBiomeDecorator.wheatGrassPerChunk = 4; - customBiomeDecorator.mushroomsPerChunk = 8; - customBiomeDecorator.reedsPerChunk = 16; - customBiomeDecorator.cattailsPerChunk = 10; - customBiomeDecorator.highCattailsPerChunk = 5; - customBiomeDecorator.waterlilyPerChunk = 3; - customBiomeDecorator.hydrangeasPerChunk = 1; - customBiomeDecorator.reedsBOPPerChunk = 5; - customBiomeDecorator.poisonWaterPerChunk = 2; - customBiomeDecorator.carrotsPerChunk = 1; - customBiomeDecorator.shrubsPerChunk = 5; - customBiomeDecorator.koruPerChunk = 1; - customBiomeDecorator.waterReedsPerChunk = 6; - customBiomeDecorator.cloverPatchesPerChunk = 10; - spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 1, 1, 1)); - */ - } - - /* - @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 12 + par2Random.nextInt(6); + public BiomeGenLushSwamp(int id) + { + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(5746228); + this.setTemperatureRainfall(0.7F, 1.0F); + + this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 1, 1, 1)); + + this.theBiomeDecorator.treesPerChunk = 10; + this.theBiomeDecorator.grassPerChunk = 4; + this.theBiomeDecorator.mushroomsPerChunk = 8; + this.theBiomeDecorator.reedsPerChunk = 16; + + this.bopWorldFeatures.bopFlowersPerChunk = 1; + this.bopWorldFeatures.cattailsPerChunk = 10; + this.bopWorldFeatures.highCattailsPerChunk = 5; + this.bopWorldFeatures.riverCanePerChunk = 5; + //TODO: FEATURE this.bopWorldFeatures.poisonWaterPerChunk = 2; + this.bopWorldFeatures.wildCarrotsPerChunk = 1; + this.bopWorldFeatures.shrubsPerChunk = 5; + this.bopWorldFeatures.koruPerChunk = 1; + this.bopWorldFeatures.waterReedsPerChunk = 6; + this.bopWorldFeatures.cloverPatchesPerChunk = 10; + } - for (int var6 = 0; var6 < var5; ++var6) - { - int var7 = par3 + par2Random.nextInt(16); - int var8 = par2Random.nextInt(28) + 4; - int var9 = par4 + par2Random.nextInt(16); - int var10 = par1World.getBlockId(var7, var8, var9); + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return new WorldGenBOPSwampTree(Blocks.log, Blocks.leaves, 0, 0, 8, 6, BOPBlockHelper.get("ivy")); + } + + @Override + public HashMap getWeightedWorldGenForBOPFlowers() + { + HashMap flowerMap = new HashMap(); + + flowerMap.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 4), 1D); + + return flowerMap; + } + + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 1D); + + return grassMap; + } - Block block = Block.blocksList[var10]; - if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID)) - { - par1World.setBlock(var7, var8, var9, Blocks.amethystOre.get().blockID, 10, 2); - } - } - } - */ + @Override + public void decorate(World world, Random random, int chunkX, int chunkZ) + { + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.nextInt(6); - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return new WorldGenSwampTall(); - } - */ + for (int var6 = 0; var6 < var5; ++var6) + { + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 10, 2); + } + } + } } diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index dfaec739d..aca5b04ce 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -7,14 +7,18 @@ import biomesoplenty.api.BOPBiomeHelper.BOPBiomeTemperatureType; import biomesoplenty.common.biomes.BiomeGenAlps; import biomesoplenty.common.biomes.BiomeGenArctic; import biomesoplenty.common.biomes.BiomeGenBambooForest; +import biomesoplenty.common.biomes.BiomeGenBayou; +import biomesoplenty.common.biomes.BiomeGenBog; import biomesoplenty.common.biomes.BiomeGenBorealForest; import biomesoplenty.common.biomes.BiomeGenBrushland; import biomesoplenty.common.biomes.BiomeGenCanyon; import biomesoplenty.common.biomes.BiomeGenChaparral; import biomesoplenty.common.biomes.BiomeGenCherryBlossomGrove; import biomesoplenty.common.biomes.BiomeGenConiferousForest; +import biomesoplenty.common.biomes.BiomeGenConiferousForestSnow; import biomesoplenty.common.biomes.BiomeGenCrag; import biomesoplenty.common.biomes.BiomeGenDeadForest; +import biomesoplenty.common.biomes.BiomeGenDeadSwamp; import biomesoplenty.common.biomes.BiomeGenDeciduousForest; import biomesoplenty.common.biomes.BiomeGenDunes; import biomesoplenty.common.biomes.BiomeGenFen; @@ -22,9 +26,12 @@ import biomesoplenty.common.biomes.BiomeGenFlowerField; import biomesoplenty.common.biomes.BiomeGenFrostForest; import biomesoplenty.common.biomes.BiomeGenGrassland; import biomesoplenty.common.biomes.BiomeGenGrove; +import biomesoplenty.common.biomes.BiomeGenHeathland; import biomesoplenty.common.biomes.BiomeGenHighland; import biomesoplenty.common.biomes.BiomeGenJadeCliffs; import biomesoplenty.common.biomes.BiomeGenLavenderFields; +import biomesoplenty.common.biomes.BiomeGenLushDesert; +import biomesoplenty.common.biomes.BiomeGenLushSwamp; import biomesoplenty.common.biomes.BiomeGenMarsh; import biomesoplenty.common.biomes.BiomeGenMountain; import biomesoplenty.common.biomes.BiomeGenOminousWoods; @@ -77,18 +84,18 @@ public class BOPBiomes registerBiome(new BOPBiomeListEntry(new BiomeGenAlps(BOPConfigurationIDs.alpsID).setBiomeName("Alps"), BOPBiomeTemperatureType.ICY)); registerBiome(new BOPBiomeListEntry(new BiomeGenArctic(BOPConfigurationIDs.arcticID).setBiomeName("Arctic"), BOPBiomeTemperatureType.ICY)); registerBiome(new BOPBiomeListEntry(new BiomeGenBambooForest(BOPConfigurationIDs.bambooForestID).setBiomeName("Bamboo Forest"), BOPBiomeTemperatureType.WARM)); - //registerBiome(new BOPBiomeListEntry(new BiomeGenBayou(BOPConfigurationIDs.bayouID).setBiomeName("Bayou"), BOPBiomeTemperatureType.WARM)); - /*registerBiome(new BOPBiomeListEntry(new BiomeGenBog(BOPConfigurationIDs.bogID).setBiomeName("Bog"), BOPBiomeTemperatureType.WARM));*/ + registerBiome(new BOPBiomeListEntry(new BiomeGenBayou(BOPConfigurationIDs.bayouID).setBiomeName("Bayou"), BOPBiomeTemperatureType.WARM)); + registerBiome(new BOPBiomeListEntry(new BiomeGenBog(BOPConfigurationIDs.bogID).setBiomeName("Bog"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenBorealForest(BOPConfigurationIDs.borealForestID).setBiomeName("Boreal Forest"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenBrushland(BOPConfigurationIDs.brushlandID).setBiomeName("Brushland"), BOPBiomeTemperatureType.HOT)); registerBiome(new BOPBiomeListEntry(new BiomeGenCanyon(BOPConfigurationIDs.canyonID).setBiomeName("Canyon"), BOPBiomeTemperatureType.HOT)); registerBiome(new BOPBiomeListEntry(new BiomeGenChaparral(BOPConfigurationIDs.chaparralID).setBiomeName("Chaparral"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenCherryBlossomGrove(BOPConfigurationIDs.cherryBlossomGroveID).setBiomeName("Cherry Blossom Grove"), BOPBiomeTemperatureType.COOL)); registerBiome(new BOPBiomeListEntry(new BiomeGenConiferousForest(BOPConfigurationIDs.coniferousForestID).setBiomeName("Coniferous Forest"), BOPBiomeTemperatureType.WARM)); - //registerBiome(new BOPBiomeListEntry(new BiomeGenConiferousForestSnow(BOPConfigurationIDs.coniferousForestSnowID).setBiomeName("Snowy Coniferous Forest"), BOPBiomeTemperatureType.ICY));*/ + registerBiome(new BOPBiomeListEntry(new BiomeGenConiferousForestSnow(BOPConfigurationIDs.coniferousForestSnowID).setBiomeName("Snowy Coniferous Forest"), BOPBiomeTemperatureType.ICY)); registerBiome(new BOPBiomeListEntry(new BiomeGenCrag(BOPConfigurationIDs.cragID).setBiomeName("Crag"), BOPBiomeTemperatureType.HOT)); registerBiome(new BOPBiomeListEntry(new BiomeGenDeadForest(BOPConfigurationIDs.deadForestID).setBiomeName("Dead Forest"), BOPBiomeTemperatureType.COOL)); - //registerBiome(new BOPBiomeListEntry(new BiomeGenDeadSwamp(BOPConfigurationIDs.deadSwampID).setBiomeName("Dead Swamp"), BOPBiomeTemperatureType.WARM));*/ + registerBiome(new BOPBiomeListEntry(new BiomeGenDeadSwamp(BOPConfigurationIDs.deadSwampID).setBiomeName("Dead Swamp"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenDeciduousForest(BOPConfigurationIDs.deciduousForestID).setBiomeName("Deciduous Forest"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenDunes(BOPConfigurationIDs.dunesID).setBiomeName("Dunes"), BOPBiomeTemperatureType.HOT)); registerBiome(new BOPBiomeListEntry(new BiomeGenFen(BOPConfigurationIDs.fenID).setBiomeName("Fen"), BOPBiomeTemperatureType.WARM)); @@ -96,13 +103,13 @@ public class BOPBiomes registerBiome(new BOPBiomeListEntry(new BiomeGenFrostForest(BOPConfigurationIDs.frostForestID).setBiomeName("Frost Forest"), BOPBiomeTemperatureType.ICY)); registerBiome(new BOPBiomeListEntry(new BiomeGenGrassland(BOPConfigurationIDs.grasslandID).setBiomeName("Grassland"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenGrove(BOPConfigurationIDs.groveID).setBiomeName("Grove"), BOPBiomeTemperatureType.WARM)); - /*registerBiome(new BOPBiomeListEntry(new BiomeGenHeathland(BOPConfigurationIDs.heathlandID).setBiomeName("Heathland"), BOPBiomeTemperatureType.WARM));*/ + registerBiome(new BOPBiomeListEntry(new BiomeGenHeathland(BOPConfigurationIDs.heathlandID).setBiomeName("Heathland"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenHighland(BOPConfigurationIDs.highlandID).setBiomeName("Highland"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenJadeCliffs(BOPConfigurationIDs.jadeCliffsID).setBiomeName("Jade Cliffs"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenLavenderFields(BOPConfigurationIDs.lavenderFieldsID).setBiomeName("Lavender Fields"), BOPBiomeTemperatureType.WARM)); - /*registerBiome(new BOPBiomeListEntry(new BiomeGenLushDesert(BOPConfigurationIDs.lushDesertID).setBiomeName("Lush Desert"), BOPBiomeTemperatureType.HOT)); + registerOnlyBiome(new BOPBiomeListEntry(new BiomeGenLushDesert(BOPConfigurationIDs.lushDesertID).setBiomeName("Lush Desert"), BOPBiomeTemperatureType.HOT)); registerBiome(new BOPBiomeListEntry(new BiomeGenLushSwamp(BOPConfigurationIDs.lushSwampID).setBiomeName("Lush Swamp"), BOPBiomeTemperatureType.WARM)); - registerBiome(new BOPBiomeListEntry(new BiomeGenMapleWoods(BOPConfigurationIDs.mapleWoodsID).setBiomeName("Maple Woods"), BOPBiomeTemperatureType.COOL));*/ + //registerBiome(new BOPBiomeListEntry(new BiomeGenMapleWoods(BOPConfigurationIDs.mapleWoodsID).setBiomeName("Maple Woods"), BOPBiomeTemperatureType.COOL)); registerBiome(new BOPBiomeListEntry(new BiomeGenMarsh(BOPConfigurationIDs.marshID).setBiomeName("Marsh"), BOPBiomeTemperatureType.WARM)); //registerBiome(new BOPBiomeListEntry(new BiomeGenMeadow(BOPConfigurationIDs.meadowID).setBiomeName("Meadow"), BOPBiomeTemperatureType.COOL)); //registerBiome(new BOPBiomeListEntry(new BiomeGenMoor(BOPConfigurationIDs.moorID).setBiomeName("Moor"), BOPBiomeTemperatureType.COOL)); diff --git a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java index dc8f64dc3..192ad3a1b 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -6,6 +6,8 @@ public class BOPWorldFeatures public boolean generateQuicksand = false; public boolean generateCanyon = false; public boolean generateStoneInGrass = false; + public boolean generateGrass = false; + public boolean generateSand = false; public int waterPoolsPerChunk = 0; public int lavaPoolsPerChunk = 0; @@ -37,6 +39,8 @@ public class BOPWorldFeatures public int highCattailsPerChunk = 0; public int algaePerChunk = 0; public int sproutsPerChunk = 0; + public int tinyCactiPerChunk = 0; + public int oasesPerChunk = 0; public int bopFlowersPerChunk = 0; } diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenMarsh.java b/src/main/java/biomesoplenty/common/world/features/WorldGenMarsh.java new file mode 100644 index 000000000..a90941e11 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenMarsh.java @@ -0,0 +1,144 @@ +package biomesoplenty.common.world.features; + +import java.util.Random; + +import biomesoplenty.api.BOPBlockHelper; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class WorldGenMarsh extends WorldGenerator +{ + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + int var6 = x; + + for (int var7 = z; y < 63; ++y) + { + //TODO: getBlock() + Block block = world.func_147439_a(x, y - 1, z); + + if ((block == Blocks.water) && y < 256 - var6 - 1) + { + for (int var8 = 2; var8 <= 5; ++var8) + { + //TODO: setBlock() + world.func_147449_b(x, y, z, Blocks.grass); + world.func_147449_b(x - 1, y, z, Blocks.grass); + world.func_147449_b(x + 1, y, z, Blocks.grass); + world.func_147449_b(x, y, z - 1, Blocks.grass); + world.func_147449_b(x, y, z + 1, Blocks.grass); + world.func_147449_b(x, y - 1, z, Blocks.dirt); + world.func_147449_b(x, y - 2, z, Blocks.dirt); + world.func_147449_b(x, y - 3, z, Blocks.dirt); + world.func_147449_b(x, y - 4, z, Blocks.dirt); + world.func_147449_b(x, y - 5, z, Blocks.dirt); + world.func_147449_b(x, y - 6, z, Blocks.dirt); + world.func_147449_b(x, y - 7, z, Blocks.dirt); + world.func_147449_b(x, y - 8, z, Blocks.dirt); + world.func_147449_b(x, y - 9, z, Blocks.dirt); + world.func_147449_b(x, y - 10, z, Blocks.dirt); + world.func_147449_b(x, y - 11, z, Blocks.dirt); + world.func_147449_b(x, y - 12, z, Blocks.dirt); + world.func_147449_b(x, y - 13, z, Blocks.dirt); + world.func_147449_b(x, y - 14, z, Blocks.dirt); + world.func_147449_b(x, y - 15, z, Blocks.dirt); + world.func_147449_b(x, y - 16, z, Blocks.dirt); + world.func_147449_b(x, y - 17, z, Blocks.dirt); + world.func_147449_b(x - 1, y - 1, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 1, z, Blocks.dirt); + world.func_147449_b(x, y - 1, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 1, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 2, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 2, z, Blocks.dirt); + world.func_147449_b(x, y - 2, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 2, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 3, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 3, z, Blocks.dirt); + world.func_147449_b(x, y - 3, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 3, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 4, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 4, z, Blocks.dirt); + world.func_147449_b(x, y - 4, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 4, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 5, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 5, z, Blocks.dirt); + world.func_147449_b(x, y - 5, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 5, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 6, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 6, z, Blocks.dirt); + world.func_147449_b(x, y - 6, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 6, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 7, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 7, z, Blocks.dirt); + world.func_147449_b(x, y - 7, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 7, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 8, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 8, z, Blocks.dirt); + world.func_147449_b(x, y - 8, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 8, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 9, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 9, z, Blocks.dirt); + world.func_147449_b(x, y - 9, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 9, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 10, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 10, z, Blocks.dirt); + world.func_147449_b(x, y - 10, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 10, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 11, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 11, z, Blocks.dirt); + world.func_147449_b(x, y - 11, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 11, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 12, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 12, z, Blocks.dirt); + world.func_147449_b(x, y - 12, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 12, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 13, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 13, z, Blocks.dirt); + world.func_147449_b(x, y - 13, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 13, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 14, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 14, z, Blocks.dirt); + world.func_147449_b(x, y - 14, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 14, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 15, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 15, z, Blocks.dirt); + world.func_147449_b(x, y - 15, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 15, z + 1, Blocks.dirt); + world.func_147449_b(x - 1, y - 16, z, Blocks.dirt); + world.func_147449_b(x + 1, y - 16, z, Blocks.dirt); + world.func_147449_b(x, y - 16, z - 1, Blocks.dirt); + world.func_147449_b(x, y - 16, z + 1, Blocks.dirt); + + if (random.nextInt(3) == 0) + { + Blocks.double_plant.func_149889_c(world, x, y + 1, z, 2, 2); + Blocks.double_plant.func_149889_c(world, x - 1 , y + 1, z, 2, 2); + Blocks.double_plant.func_149889_c(world, x + 1, y + 1, z, 2, 2); + Blocks.double_plant.func_149889_c(world, x, y + 1, z - 1, 2, 2); + Blocks.double_plant.func_149889_c(world, x, y + 1, z + 1, 2, 2); + } + else + { + world.func_147465_d(x, y + 1, z, Blocks.tallgrass, 1, 2); + world.func_147465_d(x - 1, y + 1, z, Blocks.tallgrass, 1, 2); + world.func_147465_d(x + 1, y + 1, z, Blocks.tallgrass, 1, 2); + world.func_147465_d(x, y + 1, z - 1, Blocks.tallgrass, 1, 2); + world.func_147465_d(x, y + 1, z + 1, Blocks.tallgrass, 1, 2); + } + break; + } + } + else + { + x = var6 + random.nextInt(4) - random.nextInt(4); + z = var7 + random.nextInt(4) - random.nextInt(4); + } + } + + return true; + } +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java b/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java index af1ed9605..bfabbd920 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java @@ -1,6 +1,8 @@ package biomesoplenty.common.world.features; import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.List; import java.util.Random; import net.minecraft.block.Block; @@ -18,12 +20,18 @@ public class WorldGenSplotches extends WorldGeneratorBOP private int splotchBlockMeta; private int numberOfBlocks; + + private List blockList; - public WorldGenSplotches(Block quicksandBlock, int quicksandBlockMeta, int numberOfBlocks) + public WorldGenSplotches(Block quicksandBlock, int quicksandBlockMeta, int numberOfBlocks, Block... blockList) { + super(true); + this.splotchBlock = quicksandBlock; this.splotchBlockMeta = quicksandBlockMeta; this.numberOfBlocks = numberOfBlocks; + + this.blockList = Arrays.asList(blockList); } @Override @@ -68,8 +76,8 @@ public class WorldGenSplotches extends WorldGeneratorBOP { double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D); - //TODO: getBlock() getBlock() getBlock() - if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (world.func_147439_a(var38, var41, var44) == Blocks.grass || world.func_147439_a(var38, var41, var44) == Blocks.dirt || world.func_147439_a(var38, var41, var44) == Blocks.sand)) + //TODO: getBlock() + if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (blockList.contains(world.func_147439_a(var38, var41, var44)))) { //TODO: setBlockAndMetadata() this.func_150516_a(world, var38, var41, var44, splotchBlock, splotchBlockMeta); @@ -119,6 +127,28 @@ public class WorldGenSplotches extends WorldGeneratorBOP int randY = random.nextInt(64) + 64; int randZ = z + random.nextInt(16); + worldGenerator.generate(world, random, randX, randY, randZ); + } + } + else if (fieldName.equals("generateGrass") && bopDecoration.getWorldFeatures().generateGrass) + { + for (int i = 0; i < 15; ++i) + { + int randX = x + random.nextInt(16); + int randY = random.nextInt(128); + int randZ = z + random.nextInt(16); + + worldGenerator.generate(world, random, randX, randY, randZ); + } + } + else if (fieldName.equals("generateSand") && bopDecoration.getWorldFeatures().generateGrass) + { + for (int i = 0; i < 15; ++i) + { + int randX = x + random.nextInt(16); + int randY = random.nextInt(128); + int randZ = z + random.nextInt(16); + worldGenerator.generate(world, random, randX, randY, randZ); } } diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenWaterside.java b/src/main/java/biomesoplenty/common/world/features/WorldGenWaterside.java new file mode 100644 index 000000000..4c81a4599 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenWaterside.java @@ -0,0 +1,82 @@ +package biomesoplenty.common.world.features; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.common.world.decoration.IBOPDecoration; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; + +public class WorldGenWaterside extends WorldGeneratorBOP +{ + private List sideBlocks; + + private Block watersideBlock; + private int radius; + + public WorldGenWaterside(Block watersideBlock, int radius, Block... sideBlocks) + { + super(true); + + this.watersideBlock = watersideBlock; + this.radius = radius; + + this.sideBlocks = Arrays.asList(sideBlocks); + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + if (world.func_147439_a(x, y, z).func_149688_o() != Material.field_151586_h) + { + return false; + } + else + { + int l = random.nextInt(this.radius - 2) + 2; + byte b0 = 2; + + for (int i1 = x - l; i1 <= x + l; ++i1) + { + for (int j1 = z - l; j1 <= z + l; ++j1) + { + int k1 = i1 - x; + int l1 = j1 - z; + + if (k1 * k1 + l1 * l1 <= l * l) + { + for (int i2 = y - b0; i2 <= y + b0; ++i2) + { + Block block = world.func_147439_a(i1, i2, j1); + + if (sideBlocks.contains(block)) + { + world.func_147465_d(i1, i2, j1, this.watersideBlock, 0, 2); + } + } + } + } + } + + return true; + } + } + + @Override + public void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int x, int z) throws Exception + { + for (int i = 0; i < worldGeneratorField.getInt(bopDecoration.getWorldFeatures()); i++) + { + int randX = x + random.nextInt(16) + 8; + int randZ = z + random.nextInt(16) + 8; + + worldGenerator.generate(world, random, randX, world.getTopSolidOrLiquidBlock(randX, randZ), randZ); + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPShrub.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPShrub.java index 367f4d681..b1179c4bf 100644 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPShrub.java +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPShrub.java @@ -27,7 +27,7 @@ public class WorldGenBOPShrub extends WorldGenTrees this(wood, leaves, metaWood, metaLeaves, 0, 256, soilBlocks); } - public WorldGenBOPShrub(Block wood, Block leaves, int metaWood, int metaLevaes, int minHeight, int maxHeight, Block... soilBlocks) + public WorldGenBOPShrub(Block wood, Block leaves, int metaWood, int metaLeaves, int minHeight, int maxHeight, Block... soilBlocks) { super(false); diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPSwampTree.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPSwampTree.java index 622f0326a..93a20749e 100644 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPSwampTree.java +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPSwampTree.java @@ -21,7 +21,14 @@ public class WorldGenBOPSwampTree extends WorldGenAbstractTree private int minTreeHeight; private int randomTreeHeight; + private Block vineBlock; + public WorldGenBOPSwampTree(Block wood, Block leaves, int woodMeta, int leavesMeta, int minTreeHeight, int randomTreeHeight) + { + this(wood, leaves, woodMeta, leavesMeta, minTreeHeight, randomTreeHeight, Blocks.vine); + } + + public WorldGenBOPSwampTree(Block wood, Block leaves, int woodMeta, int leavesMeta, int minTreeHeight, int randomTreeHeight, Block vineBlock) { super(false); @@ -33,6 +40,8 @@ public class WorldGenBOPSwampTree extends WorldGenAbstractTree this.minTreeHeight = minTreeHeight; this.randomTreeHeight = randomTreeHeight; + + this.vineBlock = vineBlock; } @Override @@ -40,7 +49,7 @@ public class WorldGenBOPSwampTree extends WorldGenAbstractTree { int l; - for (l = random.nextInt(4) + 5; world.func_147439_a(x, y - 1, z).func_149688_o() == Material.field_151586_h; --y) + for (l = random.nextInt(randomTreeHeight) + minTreeHeight; world.func_147439_a(x, y - 1, z).func_149688_o() == Material.field_151586_h; --y) { ; } @@ -192,10 +201,9 @@ public class WorldGenBOPSwampTree extends WorldGenAbstractTree } } - // JAVADOC METHOD $$ func_76536_b private void generateVines(World par1World, int par2, int par3, int par4, int par5) { - this.func_150516_a(par1World, par2, par3, par4, Blocks.vine, par5); + this.func_150516_a(par1World, par2, par3, par4, vineBlock, par5); int i1 = 4; while (true) @@ -207,7 +215,7 @@ public class WorldGenBOPSwampTree extends WorldGenAbstractTree return; } - this.func_150516_a(par1World, par2, par3, par4, Blocks.vine, par5); + this.func_150516_a(par1World, par2, par3, par4, vineBlock, par5); --i1; } } diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPTaiga3.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPTaiga3.java index e4b15b80e..b070e7a16 100644 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPTaiga3.java +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPTaiga3.java @@ -116,10 +116,10 @@ public class WorldGenBOPTaiga3 extends WorldGenAbstractTree if (isSoil && y < 256 - l - 1) { block1.onPlantGrow(world, x, y - 1, z, x, y, z); - block1.onPlantGrow(world, x + 1, y - 1, z, x + 1, y, z); - block1.onPlantGrow(world, x - 1, y - 1, z, x - 1, y, z); - block1.onPlantGrow(world, x, y - 1, z + 1, x, y, z + 1); - block1.onPlantGrow(world, x, y - 1, z - 1, x, y, z - 1); + block2.onPlantGrow(world, x + 1, y - 1, z, x + 1, y, z); + block3.onPlantGrow(world, x - 1, y - 1, z, x - 1, y, z); + block4.onPlantGrow(world, x, y - 1, z + 1, x, y, z + 1); + block5.onPlantGrow(world, x, y - 1, z - 1, x, y, z - 1); l3 = random.nextInt(2); i2 = 1; byte b0 = 0; diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou1.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou1.java index a3971d7fa..5900a793b 100644 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou1.java +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou1.java @@ -4,53 +4,52 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; +import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; -import net.minecraft.util.Direction; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import net.minecraftforge.common.util.ForgeDirection; +import biomesoplenty.api.BOPBlockHelper; public class WorldGenBayou1 extends WorldGenAbstractTree { - private final int minTreeHeight; - private final int randomTreeHeight; + private Block wood; + private Block leaves; - private final boolean vinesGrow; + private int woodMeta; + private int leavesMeta; - private final Block wood; - private final Block leaves; - - private final int metaWood; - private final int metaLeaves; - - public WorldGenBayou1(Block wood, Block leaves, int metaWood, int metaLeaves, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight, boolean vinesGrow) - { - super(doBlockNotify); - - this.wood = wood; - this.leaves = leaves; - this.metaWood = metaWood; - this.metaLeaves = metaLeaves; - this.minTreeHeight = minTreeHeight; - this.randomTreeHeight = randomTreeHeight; - this.vinesGrow = vinesGrow; - } - - @Override - public boolean generate(World world, Random random, int x, int y, int z) + public WorldGenBayou1(Block wood, Block leaves, int woodMeta, int leavesMeta) { - int l = random.nextInt(randomTreeHeight) + this.minTreeHeight; + super(false); + + this.wood = wood; + this.leaves = leaves; + + this.woodMeta = woodMeta; + this.leavesMeta = leavesMeta; + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + int l; + + for (l = random.nextInt(8) + 10; world.func_147439_a(x, y - 1, z).func_149688_o() == Material.field_151586_h; --y) + { + ; + } + boolean flag = true; if (y >= 1 && y + l + 1 <= 256) { - byte b0; + int j1; int k1; - Block block; for (int i1 = y; i1 <= y + 1 + l; ++i1) { - b0 = 1; + byte b0 = 1; if (i1 == y) { @@ -59,20 +58,27 @@ public class WorldGenBayou1 extends WorldGenAbstractTree if (i1 >= y + 1 + l - 2) { - b0 = 2; + b0 = 3; } - for (int j1 = x - b0; j1 <= x + b0 && flag; ++j1) + for (j1 = x - b0; j1 <= x + b0 && flag; ++j1) { for (k1 = z - b0; k1 <= z + b0 && flag; ++k1) { if (i1 >= 0 && i1 < 256) { - block = world.func_147439_a(j1, i1, k1); + Block block = world.func_147439_a(j1, i1, k1); - if (!this.isReplaceable(world, j1, i1, k1)) + if (!(block.isAir(world, j1, i1, k1) || block.isLeaves(world, j1, i1, k1))) { - flag = false; + if (block != Blocks.water && block != Blocks.flowing_water) + { + flag = false; + } + else if (i1 > y) + { + flag = false; + } } } else @@ -89,159 +95,110 @@ public class WorldGenBayou1 extends WorldGenAbstractTree } else { - Block block2 = world.func_147439_a(x, y - 1, z); + Block block1 = world.func_147439_a(x, y - 1, z); + Block block2 = world.func_147439_a(x + 1, y - 1, z); + Block block3 = world.func_147439_a(x - 1, y - 1, z); + Block block4 = world.func_147439_a(x, y - 1, z + 1); + Block block5 = world.func_147439_a(x, y - 1, z - 1); + + boolean isSoil = block1.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling) && + block2.canSustainPlant(world, x + 1, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling) && + block3.canSustainPlant(world, x - 1, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling) && + block4.canSustainPlant(world, x, y - 1, z + 1, ForgeDirection.UP, (BlockSapling)Blocks.sapling) && + block5.canSustainPlant(world, x, y - 1, z - 1, ForgeDirection.UP, (BlockSapling)Blocks.sapling); - boolean isSoil = block2.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling); - if (isSoil && y < 256 - l - 1) { - b0 = 3; - byte b1 = 0; + block1.onPlantGrow(world, x, y - 1, z, x, y, z); + block1.onPlantGrow(world, x + 1, y - 1, z, x + 1, y, z); + block1.onPlantGrow(world, x - 1, y - 1, z, x - 1, y, z); + block1.onPlantGrow(world, x, y - 1, z + 1, x, y, z + 1); + block1.onPlantGrow(world, x, y - 1, z - 1, x, y, z - 1); + + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x - 1, y, z, this.wood, this.woodMeta); + this.func_150516_a(world, x + 1, y, z, this.wood, this.woodMeta); + this.func_150516_a(world, x, y, z - 1, this.wood, this.woodMeta); + this.func_150516_a(world, x, y, z + 1, this.wood, this.woodMeta); + this.func_150516_a(world, x - 1, y + 1, z, this.wood, this.woodMeta); + this.func_150516_a(world, x + 1, y + 1, z, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + 1, z - 1, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + 1, z + 1, this.wood, this.woodMeta); + this.func_150516_a(world, x - 1, y + 2, z, this.wood, this.woodMeta); + this.func_150516_a(world, x + 1, y + 2, z, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + 2, z - 1, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + 2, z + 1, this.wood, this.woodMeta); + this.func_150516_a(world, x - 1, y + 3, z, this.wood, this.woodMeta); + this.func_150516_a(world, x + 1, y + 3, z, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + 3, z - 1, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + 3, z + 1, this.wood, this.woodMeta); + int l1; - int i2; - int j2; - int i3; + int l2; + int k2; - for (k1 = y - b0 + l; k1 <= y + l; ++k1) + for (k2 = y - 3 + l; k2 <= y + l; ++k2) { - i3 = k1 - (y + l); - l1 = b1 + 1 - i3 / 2; + j1 = k2 - (y + l); + k1 = 2 - j1 / 4; - for (i2 = x - l1; i2 <= x + l1; ++i2) + for (l2 = x - k1; l2 <= x + k1; ++l2) { - j2 = i2 - x; + l1 = l2 - x; - for (int k2 = z - l1; k2 <= z + l1; ++k2) + for (int i2 = z - k1; i2 <= z + k1; ++i2) { - int l2 = k2 - z; + int j2 = i2 - z; - if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0 && i3 != 0) + if ((Math.abs(l1) != k1 || Math.abs(j2) != k1 || random.nextInt(2) != 0 && j1 != 0) && world.func_147439_a(l2, k2, i2).canBeReplacedByLeaves(world, l2, k2, i2)) { - Block block1 = world.func_147439_a(i2, k1, k2); - - if (block1.isAir(world, i2, k1, k2) || block1.isLeaves(world, i2, k1, k2)) - { - this.func_150516_a(world, i2, k1, k2, leaves, this.metaLeaves); - } + //TODO: setBlockAndMetadata() + this.func_150516_a(world, l2, k2, i2, this.leaves, this.leavesMeta); } } } } - for (k1 = 0; k1 < l; ++k1) + for (k2 = 0; k2 < l; ++k2) { - block = world.func_147439_a(x, y + k1, z); + Block block6 = world.func_147439_a(x, y + k2, z); - if (block.isAir(world, x, y + k1, z) || block.isLeaves(world, x, y + k1, z)) + if (block6.isAir(world, x, y + k2, z) || block6.isLeaves(world, x, y + k2, z) || block6 == Blocks.flowing_water || block6 == Blocks.water) { - //TODO: setBlockAndMetadata() - this.func_150516_a(world, x, y + k1, z, wood, metaWood); - - this.func_150516_a(world, x - 1, y + (l - 4), z, leaves, 1); - this.func_150516_a(world, x + 1, y + (l - 4), z, leaves, 1); - this.func_150516_a(world, x, y + (l - 4), z - 1, leaves, 1); - this.func_150516_a(world, x, y + (l - 4), z + 1, leaves, 1); - - this.func_150516_a(world, x - 1, y + (l - 5), z + 1, leaves, 1); - this.func_150516_a(world, x - 1, y + (l - 5), z - 1, leaves, 1); - this.func_150516_a(world, x + 1, y + (l - 5), z + 1, leaves, 1); - this.func_150516_a(world, x + 1, y + (l - 5), z - 1, leaves, 1); - this.func_150516_a(world, x - 1, y + (l - 5), z, leaves, 1); - this.func_150516_a(world, x + 1, y + (l - 5), z, leaves, 1); - this.func_150516_a(world, x, y + (l - 5), z - 1, leaves, 1); - this.func_150516_a(world, x, y + (l - 5), z + 1, leaves, 1); - - this.func_150516_a(world, x - 1, y + (l - 6), z, leaves, 1); - this.func_150516_a(world, x + 1, y + (l - 6), z, leaves, 1); - this.func_150516_a(world, x, y + (l - 6), z - 1, leaves, 1); - this.func_150516_a(world, x, y + (l), z + 1, leaves, 1); - - this.func_150516_a(world, x - 1, y + (l - 7), z + 1, leaves, 1); - this.func_150516_a(world, x - 1, y + (l - 7), z - 1, leaves, 1); - this.func_150516_a(world, x + 1, y + (l - 7), z + 1, leaves, 1); - this.func_150516_a(world, x + 1, y + (l - 7), z - 1, leaves, 1); - this.func_150516_a(world, x - 1, y + (l - 7), z, leaves, 1); - this.func_150516_a(world, x + 1, y + (l - 7), z, leaves, 1); - this.func_150516_a(world, x, y + (l - 7), z - 1, leaves, 1); - this.func_150516_a(world, x, y + (l - 7), z + 1, leaves, 1); - - this.func_150516_a(world, x - 1, y + (l - 8), z, leaves, 1); - this.func_150516_a(world, x + 1, y + (l - 8), z, leaves, 1); - this.func_150516_a(world, x, y + (l - 8), z - 1, leaves, 1); - this.func_150516_a(world, x, y + (l - 8), z + 1, leaves, 1); - - if (this.vinesGrow && k1 > 0) - { - if (random.nextInt(3) > 0 && world.func_147437_c(x - 1, y + k1, z)) - { - this.func_150516_a(world, x - 1, y + k1, z, Blocks.vine, 8); - } - - if (random.nextInt(3) > 0 && world.func_147437_c(x + 1, y + k1, z)) - { - this.func_150516_a(world, x + 1, y + k1, z, Blocks.vine, 2); - } - - if (random.nextInt(3) > 0 && world.func_147437_c(x, y + k1, z - 1)) - { - this.func_150516_a(world, x, y + k1, z - 1, Blocks.vine, 1); - } - - if (random.nextInt(3) > 0 && world.func_147437_c(x, y + k1, z + 1)) - { - this.func_150516_a(world, x, y + k1, z + 1, Blocks.vine, 4); - } - } + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y + k2, z, this.wood, this.woodMeta); } } - if (this.vinesGrow) + for (k2 = y - 3 + l; k2 <= y + l; ++k2) { - for (k1 = y - 3 + l; k1 <= y + l; ++k1) + j1 = k2 - (y + l); + k1 = 2 - j1 / 2; + + for (l2 = x - k1; l2 <= x + k1; ++l2) { - i3 = k1 - (y + l); - l1 = 2 - i3 / 2; - - for (i2 = x - l1; i2 <= x + l1; ++i2) + for (l1 = z - k1; l1 <= z + k1; ++l1) { - for (j2 = z - l1; j2 <= z + l1; ++j2) + if (world.func_147439_a(l2, k2, l1).isLeaves(world, l2, k2, l1)) { - if (world.func_147439_a(i2, k1, j2).isLeaves(world, i2, k1, j2)) + if (random.nextInt(4) == 0 && world.func_147439_a(l2 - 1, k2, l1).isAir(world, l2 - 1, k2, l1)) { - if (random.nextInt(4) == 0 && world.func_147439_a(i2 - 1, k1, j2).isAir(world, i2 - 1, k1, j2)) - { - this.growVines(world, i2 - 1, k1, j2, 8); - } - - if (random.nextInt(4) == 0 && world.func_147439_a(i2 + 1, k1, j2).isAir(world, i2 + 1, k1, j2)) - { - this.growVines(world, i2 + 1, k1, j2, 2); - } - - if (random.nextInt(4) == 0 && world.func_147439_a(i2, k1, j2 - 1).isAir(world, i2, k1, j2 - 1)) - { - this.growVines(world, i2, k1, j2 - 1, 1); - } - - if (random.nextInt(4) == 0 && world.func_147439_a(i2, k1, j2 + 1).isAir(world, i2, k1, j2 + 1)) - { - this.growVines(world, i2, k1, j2 + 1, 4); - } + this.generateVines(world, l2 - 1, k2, l1, 8); } - } - } - } - if (random.nextInt(5) == 0 && l > 5) - { - for (k1 = 0; k1 < 2; ++k1) - { - for (i3 = 0; i3 < 4; ++i3) - { - if (random.nextInt(4 - k1) == 0) + if (random.nextInt(4) == 0 && world.func_147439_a(l2 + 1, k2, l1).isAir(world, l2 + 1, k2, l1)) { - l1 = random.nextInt(3); - this.func_150516_a(world, x + Direction.offsetX[Direction.rotateOpposite[i3]], y + l - 5 + k1, z + Direction.offsetZ[Direction.rotateOpposite[i3]], Blocks.cocoa, l1 << 2 | i3); + this.generateVines(world, l2 + 1, k2, l1, 2); + } + + if (random.nextInt(4) == 0 && world.func_147439_a(l2, k2, l1 - 1).isAir(world, l2, k2, l1 - 1)) + { + this.generateVines(world, l2, k2, l1 - 1, 1); + } + + if (random.nextInt(4) == 0 && world.func_147439_a(l2, k2, l1 + 1).isAir(world, l2, k2, l1 + 1)) + { + this.generateVines(world, l2, k2, l1 + 1, 4); } } } @@ -262,25 +219,26 @@ public class WorldGenBayou1 extends WorldGenAbstractTree } } - private void growVines(World world, int x, int y, int z, int flag) - { - //TODO: setBlockAndMetadata() - this.func_150516_a(world, x, y, z, Blocks.vine, flag); - int i1 = 4; + private void generateVines(World world, int x, int y, int z, int flag) + { + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y, z, BOPBlockHelper.get("willow"), flag); + int i1 = 4; - while (true) - { - --y; + while (true) + { + --y; - //TODO: getBlock() - if (world.func_147439_a(x, y, z).isAir(world, x, y, z) || i1 <= 0) - { - return; - } + //TODO: getBlock() + if (world.func_147439_a(x, y, z).isAir(world, x, y, z) || i1 <= 0) + { + return; + } - //TODO: setBlockAndMetadata() - this.func_150516_a(world, x, y, z, Blocks.vine, flag); - --i1; - } - } + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y, z, BOPBlockHelper.get("willow"), flag); + --i1; + } + } } + diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou2.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou2.java new file mode 100644 index 000000000..ba56c0561 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou2.java @@ -0,0 +1,235 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraftforge.common.util.ForgeDirection; +import biomesoplenty.api.BOPBlockHelper; + +public class WorldGenBayou2 extends WorldGenAbstractTree +{ + private Block wood; + private Block leaves; + + private int woodMeta; + private int leavesMeta; + + public WorldGenBayou2(Block wood, Block leaves, int woodMeta, int leavesMeta) + { + super(false); + + this.wood = wood; + this.leaves = leaves; + + this.woodMeta = woodMeta; + this.leavesMeta = leavesMeta; + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + int l; + + for (l = random.nextInt(5) + 8; world.func_147439_a(x, y - 1, z).func_149688_o() == Material.field_151586_h; --y) + { + ; + } + + boolean flag = true; + + if (y >= 1 && y + l + 1 <= 256) + { + int j1; + int k1; + + for (int i1 = y; i1 <= y + 1 + l; ++i1) + { + byte b0 = 1; + + if (i1 == y) + { + b0 = 0; + } + + if (i1 >= y + 1 + l - 2) + { + b0 = 3; + } + + for (j1 = x - b0; j1 <= x + b0 && flag; ++j1) + { + for (k1 = z - b0; k1 <= z + b0 && flag; ++k1) + { + if (i1 >= 0 && i1 < 256) + { + Block block = world.func_147439_a(j1, i1, k1); + + if (!(block.isAir(world, j1, i1, k1) || block.isLeaves(world, j1, i1, k1))) + { + if (block != Blocks.water && block != Blocks.flowing_water) + { + flag = false; + } + else if (i1 > y) + { + flag = false; + } + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block1 = world.func_147439_a(x, y - 1, z); + Block block2 = world.func_147439_a(x + 1, y - 1, z); + Block block3 = world.func_147439_a(x - 1, y - 1, z); + Block block4 = world.func_147439_a(x, y - 1, z + 1); + Block block5 = world.func_147439_a(x, y - 1, z - 1); + + boolean isSoil = block1.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling) && + block2.canSustainPlant(world, x + 1, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling) && + block3.canSustainPlant(world, x - 1, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling) && + block4.canSustainPlant(world, x, y - 1, z + 1, ForgeDirection.UP, (BlockSapling)Blocks.sapling) && + block5.canSustainPlant(world, x, y - 1, z - 1, ForgeDirection.UP, (BlockSapling)Blocks.sapling); + + if (isSoil && y < 256 - l - 1) + { + block1.onPlantGrow(world, x, y - 1, z, x, y, z); + block1.onPlantGrow(world, x + 1, y - 1, z, x + 1, y, z); + block1.onPlantGrow(world, x - 1, y - 1, z, x - 1, y, z); + block1.onPlantGrow(world, x, y - 1, z + 1, x, y, z + 1); + block1.onPlantGrow(world, x, y - 1, z - 1, x, y, z - 1); + + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x - 1, y, z, this.wood, this.woodMeta); + this.func_150516_a(world, x + 1, y, z, this.wood, this.woodMeta); + this.func_150516_a(world, x, y, z - 1, this.wood, this.woodMeta); + this.func_150516_a(world, x, y, z + 1, this.wood, this.woodMeta); + this.func_150516_a(world, x - 1, y + 1, z, this.wood, this.woodMeta); + this.func_150516_a(world, x + 1, y + 1, z, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + 1, z - 1, this.wood, this.woodMeta); + this.func_150516_a(world, x, y + 1, z + 1, this.wood, this.woodMeta); + + int l1; + int l2; + int k2; + + for (k2 = y - 3 + l; k2 <= y + l; ++k2) + { + j1 = k2 - (y + l); + k1 = 2 - j1 / 2; + + for (l2 = x - k1; l2 <= x + k1; ++l2) + { + l1 = l2 - x; + + for (int i2 = z - k1; i2 <= z + k1; ++i2) + { + int j2 = i2 - z; + + if ((Math.abs(l1) != k1 || Math.abs(j2) != k1 || random.nextInt(2) != 0 && j1 != 0) && world.func_147439_a(l2, k2, i2).canBeReplacedByLeaves(world, l2, k2, i2)) + { + //TODO: setBlockAndMetadata() + this.func_150516_a(world, l2, k2, i2, this.leaves, this.leavesMeta); + } + } + } + } + + for (k2 = 0; k2 < l; ++k2) + { + Block block6 = world.func_147439_a(x, y + k2, z); + + if (block6.isAir(world, x, y + k2, z) || block6.isLeaves(world, x, y + k2, z) || block6 == Blocks.flowing_water || block6 == Blocks.water) + { + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y + k2, z, this.wood, this.woodMeta); + } + } + + for (k2 = y - 3 + l; k2 <= y + l; ++k2) + { + j1 = k2 - (y + l); + k1 = 2 - j1 / 2; + + for (l2 = x - k1; l2 <= x + k1; ++l2) + { + for (l1 = z - k1; l1 <= z + k1; ++l1) + { + if (world.func_147439_a(l2, k2, l1).isLeaves(world, l2, k2, l1)) + { + if (random.nextInt(4) == 0 && world.func_147439_a(l2 - 1, k2, l1).isAir(world, l2 - 1, k2, l1)) + { + this.generateVines(world, l2 - 1, k2, l1, 8); + } + + if (random.nextInt(4) == 0 && world.func_147439_a(l2 + 1, k2, l1).isAir(world, l2 + 1, k2, l1)) + { + this.generateVines(world, l2 + 1, k2, l1, 2); + } + + if (random.nextInt(4) == 0 && world.func_147439_a(l2, k2, l1 - 1).isAir(world, l2, k2, l1 - 1)) + { + this.generateVines(world, l2, k2, l1 - 1, 1); + } + + if (random.nextInt(4) == 0 && world.func_147439_a(l2, k2, l1 + 1).isAir(world, l2, k2, l1 + 1)) + { + this.generateVines(world, l2, k2, l1 + 1, 4); + } + } + } + } + } + + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } + + private void generateVines(World world, int x, int y, int z, int flag) + { + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y, z, BOPBlockHelper.get("willow"), flag); + int i1 = 4; + + while (true) + { + --y; + + //TODO: getBlock() + if (world.func_147439_a(x, y, z).isAir(world, x, y, z) || i1 <= 0) + { + return; + } + + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y, z, BOPBlockHelper.get("willow"), flag); + --i1; + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou3.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou3.java new file mode 100644 index 000000000..7e38e13e3 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBayou3.java @@ -0,0 +1,157 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Random; + +import biomesoplenty.api.BOPBlockHelper; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.Direction; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraftforge.common.util.ForgeDirection; + +public class WorldGenBayou3 extends WorldGenAbstractTree +{ + private final Block wood; + + private final int metaWood; + + public WorldGenBayou3(Block wood, int metaWood) + { + this(wood, metaWood, false); + } + + public WorldGenBayou3(Block wood, int metaWood, boolean doBlockNotify) + { + super(doBlockNotify); + + this.wood = wood; + this.metaWood = metaWood; + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + int l; + + for (l = 7; world.func_147439_a(x, y - 1, z).func_149688_o() == Material.field_151586_h; --y) + { + ; + } + + boolean flag = true; + + if (y >= 1 && y + l + 1 <= 256) + { + int j1; + int k1; + + for (int i1 = y; i1 <= y + 1 + l; ++i1) + { + byte b0 = 1; + + if (i1 == y) + { + b0 = 0; + } + + if (i1 >= y + 1 + l - 2) + { + b0 = 3; + } + + for (j1 = x - b0; j1 <= x + b0 && flag; ++j1) + { + for (k1 = z - b0; k1 <= z + b0 && flag; ++k1) + { + if (i1 >= 0 && i1 < 256) + { + Block block = world.func_147439_a(j1, i1, k1); + + if (!(block.isAir(world, j1, i1, k1) || block.isLeaves(world, j1, i1, k1))) + { + if (block != Blocks.water && block != Blocks.flowing_water) + { + flag = false; + } + else if (i1 > y) + { + flag = false; + } + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block1 = world.func_147439_a(x, y - 1, z); + + boolean isSoil = block1.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling); + if (isSoil && y < 256 - l - 1) + { + block1.onPlantGrow(world, x, y - 1, z, x, y, z); + + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x - 1, y, z, this.wood, this.metaWood); + this.func_150516_a(world, x + 1, y, z, this.wood, this.metaWood); + this.func_150516_a(world, x, y, z - 1, this.wood, this.metaWood); + this.func_150516_a(world, x, y, z + 1, this.wood, this.metaWood); + this.func_150516_a(world, x - 1, y + 1, z, this.wood, this.metaWood); + this.func_150516_a(world, x + 1, y + 1, z, this.wood, this.metaWood); + this.func_150516_a(world, x, y + 1, z - 1, this.wood, this.metaWood); + this.func_150516_a(world, x, y + 1, z + 1, this.wood, this.metaWood); + this.func_150516_a(world, x - 1, y + 2, z, this.wood, this.metaWood); + this.func_150516_a(world, x + 1, y + 2, z, this.wood, this.metaWood); + this.func_150516_a(world, x, y + 2, z - 1, this.wood, this.metaWood); + this.func_150516_a(world, x, y + 2, z + 1, this.wood, this.metaWood); + this.func_150516_a(world, x - 1, y + 3, z, this.wood, this.metaWood); + this.func_150516_a(world, x + 1, y + 3, z, this.wood, this.metaWood); + this.func_150516_a(world, x, y + 3, z - 1, this.wood, this.metaWood); + this.func_150516_a(world, x, y + 3, z + 1, this.wood, this.metaWood); + this.func_150516_a(world, x - 1, y + 4, z, this.wood, this.metaWood); + this.func_150516_a(world, x + 1, y + 4, z, this.wood, this.metaWood); + this.func_150516_a(world, x, y + 4, z - 1, this.wood, this.metaWood); + this.func_150516_a(world, x, y + 4, z + 1, this.wood, this.metaWood); + + int l1; + int l2; + int k2; + + for (k2 = 0; k2 < l; ++k2) + { + Block block2 = world.func_147439_a(x, y + k2, z); + + if (block2.isAir(world, x, y + k2, z) || block2.isLeaves(world, x, y + k2, z) || block2 == Blocks.flowing_water || block2 == Blocks.water) + { + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y + k2, z, this.wood, this.metaWood); + } + } + + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBogBush.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBogBush.java new file mode 100644 index 000000000..ca7be2321 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBogBush.java @@ -0,0 +1,50 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; + +public class WorldGenBogBush extends WorldGenAbstractTree +{ + public WorldGenBogBush() + { + super(false); + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + //TODO: isAirBlock() + while (world.func_147437_c(x, y, z) && y > 2) + { + --y; + } + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != Blocks.grass && block != Blocks.sand) + { + return false; + } + else + { + for (int var7 = -2; var7 <= 2; ++var7) + { + for (int var8 = -2; var8 <= 2; ++var8) + { + //TODO: isAirBlock() isAirBlock() + if (world.func_147437_c(x + var7, y - 1, z + var8) && world.func_147437_c(x + var7, y - 2, z + var8)) + return false; + } + } + + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y + 1, z, Blocks.leaves, 4); + return true; + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenCypress.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenCypress.java new file mode 100644 index 000000000..b3ee79b74 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenCypress.java @@ -0,0 +1,198 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; +import net.minecraft.init.Blocks; +import net.minecraft.util.Direction; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraftforge.common.util.ForgeDirection; + +public class WorldGenCypress extends WorldGenAbstractTree +{ + private final int minTreeHeight; + private final int randomTreeHeight; + + private final Block wood; + private final Block leaves; + + private final int metaWood; + private final int metaLeaves; + + private final int altNo; + + public WorldGenCypress(Block wood, Block leaves, int metaWood, int metaLeaves, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight, int altNo) + { + super(doBlockNotify); + + this.wood = wood; + this.leaves = leaves; + this.metaWood = metaWood; + this.metaLeaves = metaLeaves; + this.minTreeHeight = minTreeHeight; + this.randomTreeHeight = randomTreeHeight; + + this.altNo = altNo; + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + int l = random.nextInt(randomTreeHeight) + minTreeHeight; + int i1; + int j1; + int k1; + + switch (altNo) + { + case 1: + i1 = 2; + j1 = l - i1; + k1 = 1; + break; + + default: + i1 = 3 + random.nextInt(2); + j1 = l - i1; + k1 = 1; + break; + } + + boolean flag = true; + + if (y >= 1 && y + l + 1 <= 256) + { + int i2; + int l3; + + for (int l1 = y; l1 <= y + 1 + l && flag; ++l1) + { + boolean flag1 = true; + + if (l1 - y < i1) + { + l3 = 0; + } + else + { + l3 = k1; + } + + for (i2 = x - l3; i2 <= x + l3 && flag; ++i2) + { + for (int j2 = z - l3; j2 <= z + l3 && flag; ++j2) + { + if (l1 >= 0 && l1 < 256) + { + Block block = world.func_147439_a(i2, l1, j2); + + if (!block.isAir(world, i2, l1, j2) && !block.isLeaves(world, i2, l1, j2)) + { + flag = false; + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block1 = world.func_147439_a(x, y - 1, z); + + boolean isSoil = block1.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling); + if (isSoil && y < 256 - l - 1) + { + block1.onPlantGrow(world, x, y - 1, z, x, y, z); + l3 = random.nextInt(2); + i2 = 1; + byte b0 = 0; + int k2; + int i4; + + for (i4 = 0; i4 <= j1; ++i4) + { + k2 = y + l - i4; + + for (int l2 = x - l3; l2 <= x + l3; ++l2) + { + int i3 = l2 - x; + + for (int j3 = z - l3; j3 <= z + l3; ++j3) + { + int k3 = j3 - z; + + if ((Math.abs(i3) != l3 || Math.abs(k3) != l3 || l3 <= 0) && world.func_147439_a(l2, k2, j3).canBeReplacedByLeaves(world, l2, k2, j3)) + { + if (random.nextInt(3) != 0) + { + //TODO: setBlockAndMetadata() + this.func_150516_a(world, l2, k2, j3, leaves, this.metaLeaves); + } + } + } + } + + if (l3 >= i2) + { + l3 = b0; + b0 = 1; + ++i2; + + if (i2 > k1) + { + i2 = k1; + } + } + else + { + ++l3; + } + } + + i4 = random.nextInt(3); + + for (k2 = 0; k2 < l - i4; ++k2) + { + Block block2 = world.func_147439_a(x, y + k2, z); + + if (block2.isAir(world, x, y + k2, z) || block2.isLeaves(world, x, y + k2, z)) + { + //TODO: setBlockAndMetadata() + this.func_150516_a(world, x, y + k2, z, wood, metaWood); + this.func_150516_a(world, x, (y + k2), z, wood, metaWood); + this.func_150516_a(world, x, (y + k2) - 2, z, wood, metaWood); + this.func_150516_a(world, x, (y + k2) - 1, z, wood, metaWood); + this.func_150516_a(world, x, (y + k2), z, wood, metaWood); + this.func_150516_a(world, x, (y + k2) + 1, z, wood, metaWood); + this.func_150516_a(world, x - 1, (y + k2) + 1, z, leaves, metaLeaves); + this.func_150516_a(world, x + 1, (y + k2) + 1, z, leaves, metaLeaves); + this.func_150516_a(world, x, (y + k2) + 1, z - 1, leaves, metaLeaves); + this.func_150516_a(world, x, (y + k2) + 1, z + 1, leaves, metaLeaves); + this.func_150516_a(world, x, (y + k2) + 2, z, leaves, metaLeaves); + } + } + + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index 053ab573e..9acfbd036 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -6,7 +6,6 @@ import net.minecraft.init.Blocks; import net.minecraft.world.gen.feature.WorldGenDoublePlant; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenLiquids; -import net.minecraft.world.gen.feature.WorldGenSand; import net.minecraft.world.gen.feature.WorldGenerator; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora; @@ -15,6 +14,7 @@ import biomesoplenty.common.world.features.WorldGenBOPTallGrass; import biomesoplenty.common.world.features.WorldGenRiverCane; import biomesoplenty.common.world.features.WorldGenSplotches; import biomesoplenty.common.world.features.WorldGenWaterReeds; +import biomesoplenty.common.world.features.WorldGenWaterside; public class WorldGenFieldAssociation { @@ -27,9 +27,11 @@ public class WorldGenFieldAssociation private static void associateFieldsWithGenerators() { - associateField("generateQuicksand", new WorldGenSplotches(BOPBlockHelper.get("mud"), 1, 24)); - associateField("generateCanyon", new WorldGenSplotches(BOPBlockHelper.get("redRock"), 0, 48)); - associateField("generateStoneInGrass", new WorldGenSplotches(Blocks.stone, 0, 32)); + associateField("generateQuicksand", new WorldGenSplotches(BOPBlockHelper.get("mud"), 1, 24, Blocks.grass, Blocks.dirt, Blocks.sand)); + associateField("generateCanyon", new WorldGenSplotches(BOPBlockHelper.get("redRock"), 0, 48, Blocks.stone)); + associateField("generateStoneInGrass", new WorldGenSplotches(Blocks.stone, 0, 32, Blocks.grass, BOPBlockHelper.get("holyGrass"))); + associateField("generateGrass", new WorldGenSplotches(Blocks.grass, 0, 48, BOPBlockHelper.get("redRock"))); + associateField("generateSand", new WorldGenSplotches(Blocks.sand, 0, 32, BOPBlockHelper.get("redRock"))); associateField("waterPoolsPerChunk", new WorldGenLiquids(Blocks.flowing_water)); associateField("lavaPoolsPerChunk", new WorldGenLiquids(Blocks.flowing_lava)); @@ -37,7 +39,7 @@ public class WorldGenFieldAssociation associateField("waterLakesPerChunk", new WorldGenLakes(Blocks.water)); associateField("lavaLakesPerChunk", new WorldGenLakes(Blocks.lava)); - associateField("mudPerChunk", new WorldGenSand(BOPBlockHelper.get("mud"), 7)); + associateField("mudPerChunk", new WorldGenWaterside(BOPBlockHelper.get("mud"), 7, Blocks.dirt, Blocks.grass)); associateField("riverCanePerChunk", new WorldGenRiverCane()); associateField("shrubsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 9)); associateField("bushesPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 4)); @@ -60,6 +62,8 @@ public class WorldGenFieldAssociation associateField("highCattailsPerChunk", new WorldGenBOPDoubleFlora(BOPBlockHelper.get("plants"), BOPBlockHelper.get("plants"), 10, 9)); associateField("algaePerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 0)); associateField("sproutsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 5)); + associateField("tinyCactiPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("plants"), 12)); + associateField("oasesPerChunk", new WorldGenWaterside(Blocks.grass, 7, Blocks.sand, BOPBlockHelper.get("redRock"))); WorldGenDoublePlant doubleTallGrass = new WorldGenDoublePlant(); //TODO: setMetadata() ? diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGeneratorBOP.java b/src/main/java/biomesoplenty/common/world/generation/WorldGeneratorBOP.java index ab3cf7b4e..da8e505bb 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGeneratorBOP.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGeneratorBOP.java @@ -10,6 +10,16 @@ import biomesoplenty.common.world.decoration.IBOPDecoration; public abstract class WorldGeneratorBOP extends WorldGenerator implements IWorldGeneratorBOP { - @Override + public WorldGeneratorBOP(boolean doBlockNotify) + { + super(doBlockNotify); + } + + public WorldGeneratorBOP() + { + this(false); + } + + @Override public abstract void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int x, int z) throws Exception; }