From 7e90f991119e501bc8fa3de7662e9eeefbf28206 Mon Sep 17 00:00:00 2001 From: Matt Caughey Date: Sat, 7 Sep 2013 13:01:16 -0400 Subject: [PATCH] Added Watery Willows biome (Disabled by default), changed how willow trees generate --- src/minecraft/biomesoplenty/api/Biomes.java | 1 + .../biomes/BiomeGenWateryWillows.java | 62 +++++++++++++++++++ .../configuration/BOPBiomes.java | 13 ++++ .../configuration/BOPConfiguration.java | 6 ++ .../biomesoplenty/world/WorldTypeBOP.java | 4 ++ .../worldgen/WorldGenWillow.java | 16 ++--- 6 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 src/minecraft/biomesoplenty/biomes/BiomeGenWateryWillows.java diff --git a/src/minecraft/biomesoplenty/api/Biomes.java b/src/minecraft/biomesoplenty/api/Biomes.java index c63143b08..32323baf2 100644 --- a/src/minecraft/biomesoplenty/api/Biomes.java +++ b/src/minecraft/biomesoplenty/api/Biomes.java @@ -115,6 +115,7 @@ public class Biomes public static Optional tundra = Optional.absent(); public static Optional volcano = Optional.absent(); public static Optional wasteland = Optional.absent(); + public static Optional wateryWillows = Optional.absent(); public static Optional wetland = Optional.absent(); public static Optional woodland = Optional.absent(); diff --git a/src/minecraft/biomesoplenty/biomes/BiomeGenWateryWillows.java b/src/minecraft/biomesoplenty/biomes/BiomeGenWateryWillows.java new file mode 100644 index 000000000..5b0f3b2ce --- /dev/null +++ b/src/minecraft/biomesoplenty/biomes/BiomeGenWateryWillows.java @@ -0,0 +1,62 @@ +package biomesoplenty.biomes; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.SpawnListEntry; +import net.minecraft.world.gen.feature.WorldGenShrub; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.worldgen.WorldGenWillow; + +public class BiomeGenWateryWillows extends BiomeGenBase +{ + private BiomeDecoratorBOP customBiomeDecorator; + + @SuppressWarnings("unchecked") + public BiomeGenWateryWillows(int par1) + { + super(par1); + spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 8, 4, 4)); + theBiomeDecorator = new BiomeDecoratorBOP(this); + customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; + customBiomeDecorator.treesPerChunk = 10; + customBiomeDecorator.grassPerChunk = 6; + customBiomeDecorator.sproutsPerChunk = 1; + customBiomeDecorator.carrotsPerChunk = 1; + customBiomeDecorator.waterLakesPerChunk = 8; + customBiomeDecorator.reedsBOPPerChunk = 3; + customBiomeDecorator.hydrangeasPerChunk = 5; + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + @Override + public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + { + return par1Random.nextInt(2) == 0 ? new WorldGenWillow() : new WorldGenShrub(0,0); + } + + @Override + public void decorate(World par1World, Random par2Random, int par3, int par4) + { + super.decorate(par1World, par2Random, par3, par4); + int var5 = 3 + 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); + + if (var10 == Block.stone.blockID) + { + par1World.setBlock(var7, var8, var9, Block.oreEmerald.blockID, 0, 2); + } + } + } +} diff --git a/src/minecraft/biomesoplenty/configuration/BOPBiomes.java b/src/minecraft/biomesoplenty/configuration/BOPBiomes.java index 10a0e57bf..05e033262 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPBiomes.java +++ b/src/minecraft/biomesoplenty/configuration/BOPBiomes.java @@ -172,6 +172,7 @@ public class BOPBiomes { Biomes.tundra = Optional.of((new BiomeGenTundra(BOPConfiguration.IDs.tundraID)).setColor(14090235).setBiomeName("Tundra").setTemperatureRainfall(0.2F, 0.8F).setMinMaxHeight(0.1F, 0.3F)); Biomes.volcano = Optional.of((new BiomeGenVolcano(BOPConfiguration.IDs.volcanoID)).setColor(9286496).setBiomeName("Volcano").setDisableRain().setMinMaxHeight(0.6F, 0.9F).setTemperatureRainfall(2.0F, 0.0F)); Biomes.wasteland = Optional.of((new BiomeGenWasteland(BOPConfiguration.IDs.wastelandID)).setColor(16421912).setBiomeName("Wasteland").setDisableRain().setTemperatureRainfall(2.0F, 0.0F).setMinMaxHeight(0.3F, 0.4F)); + Biomes.wateryWillows = Optional.of((new BiomeGenWateryWillows(BOPConfiguration.IDs.wateryWillowsID)).setColor(353825).setBiomeName("Watery Willows").func_76733_a(5159473).setTemperatureRainfall(0.6F, 0.7F)); Biomes.wetland = Optional.of((new BiomeGenWetland(BOPConfiguration.IDs.wetlandID)).setColor(522674).setBiomeName("Wetland").func_76733_a(9154376).setMinMaxHeight(0.3F, 0.5F).setTemperatureRainfall(0.8F, 0.9F)); Biomes.woodland = Optional.of((new BiomeGenWoodland(BOPConfiguration.IDs.woodlandID)).setColor(353825).setBiomeName("Woodland").func_76733_a(5159473).setTemperatureRainfall(1.7F, 0.2F).setMinMaxHeight(0.3F, 0.4F)); @@ -314,6 +315,7 @@ public class BOPBiomes { BiomeDictionary.registerBiomeType(Biomes.tundra.get(), Type.FROZEN, Type.WASTELAND); BiomeDictionary.registerBiomeType(Biomes.volcano.get(), Type.WASTELAND, Type.MOUNTAIN); BiomeDictionary.registerBiomeType(Biomes.wasteland.get(), Type.WASTELAND); + BiomeDictionary.registerBiomeType(Biomes.wateryWillows.get(), Type.SWAMP, Type.WATER, Type.FOREST); BiomeDictionary.registerBiomeType(Biomes.wetland.get(), Type.SWAMP, Type.FOREST); BiomeDictionary.registerBiomeType(Biomes.woodland.get(), Type.FOREST); @@ -390,6 +392,7 @@ public class BOPBiomes { addSpawnBiome(Biomes.tropics); addSpawnBiome(Biomes.tundra); addSpawnBiome(Biomes.volcano); + addSpawnBiome(Biomes.wateryWillows); addSpawnBiome(Biomes.wetland); addSpawnBiome(Biomes.woodland); @@ -466,6 +469,7 @@ public class BOPBiomes { addVillageBiome(Biomes.tropics, BOPConfiguration.TerrainGen.tropicsVillage); addVillageBiome(Biomes.tundra, BOPConfiguration.TerrainGen.tundraVillage); addVillageBiome(Biomes.volcano, BOPConfiguration.TerrainGen.volcanoVillage); + addVillageBiome(Biomes.wateryWillows, BOPConfiguration.TerrainGen.wateryWillowsVillage); addVillageBiome(Biomes.wetland, BOPConfiguration.TerrainGen.wetlandVillage); addVillageBiome(Biomes.woodland, BOPConfiguration.TerrainGen.woodlandVillage); @@ -553,6 +557,7 @@ public class BOPBiomes { addStrongholdBiome(Biomes.tundra); addStrongholdBiome(Biomes.volcano); addStrongholdBiome(Biomes.wasteland); + addStrongholdBiome(Biomes.wateryWillows); addStrongholdBiome(Biomes.wetland); addStrongholdBiome(Biomes.woodland); @@ -867,6 +872,10 @@ public class BOPBiomes { if (BOPConfiguration.BiomeGen.wastelandGen) { registerBiome(Biomes.wasteland); } + + if (BOPConfiguration.BiomeGen.wateryWillowsGen) { + registerBiome(Biomes.wateryWillows); + } if (BOPConfiguration.BiomeGen.wetlandGen) { registerBiome(Biomes.wetland); @@ -1253,6 +1262,10 @@ public class BOPBiomes { if (BOPConfiguration.BiomeGen.wastelandGen) { addBiomeToWorldTypes(getWorldTypes(), Biomes.wasteland); } + + if (BOPConfiguration.BiomeGen.wateryWillowsGen) { + addBiomeToWorldTypes(getWorldTypes(), Biomes.wateryWillows); + } if (BOPConfiguration.BiomeGen.wetlandGen) { addBiomeToWorldTypes(getWorldTypes(), Biomes.wetland); diff --git a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java index 2728faedd..e95e10662 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java +++ b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java @@ -150,6 +150,7 @@ public class BOPConfiguration public static boolean tundraGen; public static boolean volcanoGen; public static boolean wastelandGen; + public static boolean wateryWillowsGen; public static boolean wetlandGen; public static boolean woodlandGen; @@ -258,6 +259,7 @@ public class BOPConfiguration tundraGen = config.get("Biomes To Generate", "Tundra", true).getBoolean(false); volcanoGen = config.get("Biomes To Generate", "Volcano", true).getBoolean(false); wastelandGen = config.get("Biomes To Generate", "Wasteland", true).getBoolean(false); + wateryWillowsGen = config.get("Biomes To Generate", "WateryWillows", false).getBoolean(false); wetlandGen = config.get("Biomes To Generate", "Wetland", true).getBoolean(false); woodlandGen = config.get("Biomes To Generate", "Woodland", true).getBoolean(false); @@ -392,6 +394,7 @@ public class BOPConfiguration public static boolean tundraVillage; public static boolean volcanoVillage; public static boolean wastelandVillage; + public static boolean wateryWillowsVillage; public static boolean wetlandVillage; public static boolean woodlandVillage; public static boolean plainsVillage; @@ -504,6 +507,7 @@ public class BOPConfiguration tundraVillage = config.get("Allow Villages", "Tundra", true).getBoolean(false); volcanoVillage = config.get("Allow Villages", "Volcano", false).getBoolean(false); wastelandVillage = config.get("Allow Villages", "Wasteland", false).getBoolean(false); + wateryWillowsVillage = config.get("Allow Villages", "Watery Willows", false).getBoolean(false); wetlandVillage = config.get("Allow Villages", "Wetland", false).getBoolean(false); woodlandVillage = config.get("Allow Villages", "Woodland", false).getBoolean(false); @@ -783,6 +787,7 @@ public class BOPConfiguration public static int tundraID; public static int volcanoID; public static int wastelandID; + public static int wateryWillowsID; public static int wetlandID; public static int woodlandID; @@ -981,6 +986,7 @@ public class BOPConfiguration //23-79 ExtraBiomesXL + wateryWillowsID = config.get("Biome IDs", "Watery Willows ID", 33).getInt(); overgrownGreensID = config.get("Biome IDs", "Overgrown Greens ID", 34).getInt(); forestHillsNewID = config.get("Biome IDs", "Forest Hills (Sub-Biome) ID", 35).getInt(); taigaHillsNewID = config.get("Biome IDs", "Taiga Hills (Sub-Biome) ID", 36).getInt(); diff --git a/src/minecraft/biomesoplenty/world/WorldTypeBOP.java b/src/minecraft/biomesoplenty/world/WorldTypeBOP.java index b385129f3..09fa90aba 100644 --- a/src/minecraft/biomesoplenty/world/WorldTypeBOP.java +++ b/src/minecraft/biomesoplenty/world/WorldTypeBOP.java @@ -313,6 +313,10 @@ public class WorldTypeBOP extends WorldType { addNewBiome(Biomes.wasteland); } + if (BOPConfiguration.BiomeGen.wateryWillowsGen == true) + { + addNewBiome(Biomes.wateryWillows); + } if (BOPConfiguration.BiomeGen.wetlandGen == true) { addNewBiome(Biomes.wetland); diff --git a/src/minecraft/biomesoplenty/worldgen/WorldGenWillow.java b/src/minecraft/biomesoplenty/worldgen/WorldGenWillow.java index 2db989d01..a87e3e6ab 100644 --- a/src/minecraft/biomesoplenty/worldgen/WorldGenWillow.java +++ b/src/minecraft/biomesoplenty/worldgen/WorldGenWillow.java @@ -15,7 +15,7 @@ public class WorldGenWillow extends WorldGenerator { int var6; - for (var6 = par2Random.nextInt(4) + 5; par1World.getBlockMaterial(par3, par4 - 1, par5) == Material.water; --par4) + for (var6 = par2Random.nextInt(9) + 6; par1World.getBlockMaterial(par3, par4 - 1, par5) == Material.water; --par4) { ; } @@ -125,22 +125,22 @@ public class WorldGenWillow extends WorldGenerator { if (par1World.getBlockId(var12, var16, var13) == Blocks.leavesColorized.get().blockID) { - if (par2Random.nextInt(2) == 0 && par1World.getBlockId(var12 - 1, var16, var13) == 0) + if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12 - 1, var16, var13) == 0) { this.generateVines(par1World, var12 - 1, var16, var13, 8); } - if (par2Random.nextInt(2) == 0 && par1World.getBlockId(var12 + 1, var16, var13) == 0) + if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12 + 1, var16, var13) == 0) { this.generateVines(par1World, var12 + 1, var16, var13, 2); } - if (par2Random.nextInt(2) == 0 && par1World.getBlockId(var12, var16, var13 - 1) == 0) + if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12, var16, var13 - 1) == 0) { this.generateVines(par1World, var12, var16, var13 - 1, 1); } - if (par2Random.nextInt(2) == 0 && par1World.getBlockId(var12, var16, var13 + 1) == 0) + if (par2Random.nextInt(3) == 0 && par1World.getBlockId(var12, var16, var13 + 1) == 0) { this.generateVines(par1World, var12, var16, var13 + 1, 4); } @@ -162,8 +162,8 @@ public class WorldGenWillow extends WorldGenerator */ private void generateVines(World par1World, int par2, int par3, int par4, int par5) { - this.setBlockAndMetadata(par1World, par2, par3, par4, Blocks.willow.get().blockID, par5); - int var6 = 7; + this.setBlockAndMetadata(par1World, par2, par3, par4, Blocks.leavesColorized.get().blockID, 4); + int var6 = 6; while (true) { @@ -172,7 +172,7 @@ public class WorldGenWillow extends WorldGenerator if (par1World.getBlockId(par2, par3, par4) != 0 || var6 <= 0) return; - this.setBlockAndMetadata(par1World, par2, par3, par4, Blocks.willow.get().blockID, par5); + this.setBlockAndMetadata(par1World, par2, par3, par4, Blocks.leavesColorized.get().blockID, 4); --var6; } }