From 49eeb93534b73e1ff18674012532fcc64b8bcf23 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Tue, 7 Jan 2014 00:26:39 +1100 Subject: [PATCH] Readded a few biomes, heavily altered the existing decoration system to be more configurable --- .../java/biomesoplenty/BiomesOPlenty.java | 4 +- .../biomesoplenty/common/biomes/BOPBiome.java | 2 +- .../common/biomes/BiomeGenBambooForest.java | 10 +- .../common/biomes/BiomeGenBorealForest.java | 123 +++-- .../common/biomes/BiomeGenBrushland.java | 61 ++- .../biomes/BiomeGenCherryBlossomGrove.java | 115 +++-- .../biomes/BiomeGenConiferousForest.java | 3 +- .../biomes/BiomeGenDeciduousForest.java | 126 ++--- .../common/biomes/BiomeGenDunes.java | 6 +- .../common/biomes/BiomeGenFrostForest.java | 6 +- .../common/biomes/BiomeGenGrassland.java | 10 +- .../common/biomes/BiomeGenHighland.java | 4 +- .../common/biomes/BiomeGenJadeCliffs.java | 2 +- .../common/biomes/BiomeGenLavenderFields.java | 2 +- .../common/biomes/BiomeGenMarsh.java | 110 ++-- .../common/biomes/BiomeGenMountain.java | 6 +- .../common/biomes/BiomeGenMysticGrove.java | 4 +- .../common/biomes/BiomeGenOminousWoods.java | 6 +- .../common/biomes/BiomeGenRainforest.java | 8 +- .../common/biomes/BiomeGenSacredSprings.java | 2 +- .../common/biomes/BiomeGenShrubland.java | 6 +- .../common/biomes/BiomeGenThicket.java | 4 +- .../common/blocks/BlockBOPFoliage.java | 8 +- .../biomesoplenty/common/core/BOPBiomes.java | 26 +- .../eventhandler/BOPCommonEventHandlers.java | 2 + .../world/DecorateBiomeEventHandler.java | 110 +--- .../DecorationModificationEventHandler.java | 120 +++++ .../world/decoration/BOPWorldFeatures.java | 57 +- .../world/features/WorldGenBOPFlora.java | 18 +- .../world/features/WorldGenBOPTallGrass.java | 20 +- .../common/world/features/WorldGenMoss.java | 18 +- .../common/world/features/WorldGenMud.java | 20 +- .../world/features/WorldGenRiverCane.java | 18 +- .../world/features/WorldGenWaterReeds.java | 22 +- .../features/trees/WorldGenBOPBigTree.java | 485 ++++++++++++++++++ .../features/trees/WorldGenBOPTaiga2.java | 21 +- .../features/trees/WorldGenBulbTree.java | 58 +-- .../SwampForcedDecorator.java | 2 +- .../generation/ForcedBOPWorldGenerators.java | 36 ++ .../generation/ForcedWorldGeneratorBOP.java | 15 + .../world/generation/IWorldGeneratorBOP.java | 14 + .../WorldGenFieldAssociation.java | 7 +- .../world/generation/WorldGeneratorBOP.java | 15 + 43 files changed, 1270 insertions(+), 442 deletions(-) create mode 100644 src/main/java/biomesoplenty/common/eventhandler/world/DecorationModificationEventHandler.java create mode 100644 src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPBigTree.java create mode 100644 src/main/java/biomesoplenty/common/world/generation/ForcedBOPWorldGenerators.java create mode 100644 src/main/java/biomesoplenty/common/world/generation/ForcedWorldGeneratorBOP.java create mode 100644 src/main/java/biomesoplenty/common/world/generation/IWorldGeneratorBOP.java rename src/main/java/biomesoplenty/common/world/{ => generation}/WorldGenFieldAssociation.java (86%) create mode 100644 src/main/java/biomesoplenty/common/world/generation/WorldGeneratorBOP.java diff --git a/src/main/java/biomesoplenty/BiomesOPlenty.java b/src/main/java/biomesoplenty/BiomesOPlenty.java index 33322110a..015bef386 100644 --- a/src/main/java/biomesoplenty/BiomesOPlenty.java +++ b/src/main/java/biomesoplenty/BiomesOPlenty.java @@ -13,9 +13,10 @@ import biomesoplenty.common.core.BOPVanillaCompat; import biomesoplenty.common.eventhandler.BOPCommonEventHandlers; import biomesoplenty.common.helpers.CreativeTabsBOP; import biomesoplenty.common.utils.BOPModInfo; -import biomesoplenty.common.world.WorldGenFieldAssociation; import biomesoplenty.common.world.WorldTypeBOP; import biomesoplenty.common.world.decoration.ForcedDecorators; +import biomesoplenty.common.world.generation.ForcedBOPWorldGenerators; +import biomesoplenty.common.world.generation.WorldGenFieldAssociation; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; @@ -53,6 +54,7 @@ public class BiomesOPlenty BOPCrafting.init(); BOPBiomes.init(); WorldGenFieldAssociation.init(); + ForcedBOPWorldGenerators.init(); ForcedDecorators.init(); BOPEntities.init(); BOPVanillaCompat.init(); diff --git a/src/main/java/biomesoplenty/common/biomes/BOPBiome.java b/src/main/java/biomesoplenty/common/biomes/BOPBiome.java index 8d46ba7b2..05a40b1c4 100644 --- a/src/main/java/biomesoplenty/common/biomes/BOPBiome.java +++ b/src/main/java/biomesoplenty/common/biomes/BOPBiome.java @@ -32,7 +32,7 @@ public abstract class BOPBiome extends BiomeGenBase implements IBOPDecoration @Override public WorldGenBOPFlora getRandomWorldGenForBOPFlowers(Random random) { - if (!getWeightedWorldGenForBOPFlowers().isEmpty()) + if (getWeightedWorldGenForBOPFlowers() != null && !getWeightedWorldGenForBOPFlowers().isEmpty()) { return (WorldGenBOPFlora)getRandomWeightedWorldGenerator(getWeightedWorldGenForBOPFlowers()); } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenBambooForest.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenBambooForest.java index 467b6a80e..7fe15bf1f 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenBambooForest.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenBambooForest.java @@ -32,12 +32,12 @@ public class BiomeGenBambooForest extends BOPBiome this.theBiomeDecorator.grassPerChunk = 5; this.theBiomeDecorator.flowersPerChunk = -999; - this.bopWorldFeatures.perChunk.riverCanePerChunk = 6; - this.bopWorldFeatures.perChunk.shrubsPerChunk = 6; - this.bopWorldFeatures.perChunk.bushesPerChunk = 5; - this.bopWorldFeatures.perChunk.cloverPatchesPerChunk = 10; + this.bopWorldFeatures.riverCanePerChunk = 6; + this.bopWorldFeatures.shrubsPerChunk = 6; + this.bopWorldFeatures.bushesPerChunk = 5; + this.bopWorldFeatures.cloverPatchesPerChunk = 10; - this.bopWorldFeatures.doGeneration.generatePumpkins = false; + this.bopWorldFeatures.generatePumpkins = false; } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenBorealForest.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenBorealForest.java index c5b41ea46..2a2b80bf3 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenBorealForest.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenBorealForest.java @@ -1,89 +1,98 @@ 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.EntityWolf; +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.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2; +import biomesoplenty.common.world.features.trees.WorldGenOriginalTree; public class BiomeGenBorealForest extends BOPBiome { - - @SuppressWarnings("unchecked") - public BiomeGenBorealForest(int par1) + private static final Height biomeHeight = new Height(0.2F, 1.0F); + + public BiomeGenBorealForest(int id) { - super(par1); - /* - spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 4)); - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 20; - customBiomeDecorator.grassPerChunk = 50; - customBiomeDecorator.wheatGrassPerChunk = 25; - customBiomeDecorator.shrubsPerChunk = 10; - customBiomeDecorator.waterReedsPerChunk = 4; - */ + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(10467185); + this.setTemperatureRainfall(0.6F, 0.7F); + + this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 4)); + + this.theBiomeDecorator.treesPerChunk = 20; + this.theBiomeDecorator.grassPerChunk = 50; + + this.bopWorldFeatures.shrubsPerChunk = 10; + this.bopWorldFeatures.waterReedsPerChunk = 4; } - /** - * Gets a WorldGen appropriate for this biome. - */ - /* @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) { - return par1Random.nextInt(2) == 0 ? new WorldGenTallGrass(Block.tallGrass.blockID, 2) : new WorldGenTallGrass(Block.tallGrass.blockID, 1); - } - */ - - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(4) == 0 ? new WorldGenRainforestTree1(false) : (par1Random.nextInt(5) == 0 ? new WorldGenShrub(0,0) : (par1Random.nextInt(3) == 0 ? new WorldGenAutumn(false) : (par1Random.nextInt(3) == 0 ? worldGeneratorForest : new WorldGenTaiga10(false)))); - //return (WorldGenerator)(par1Random.nextInt(2) == 0 ? this.worldGeneratorTrees : (par1Random.nextInt(5) == 0 ? new WorldGenShrub(0,0) : (par1Random.nextInt(3) == 0 ? new WorldGenAutumn(false) : (par1Random.nextInt(3) == 0 ? this.worldGeneratorForest : new WorldGenTaiga10(false))))); + return random.nextInt(4) == 0 ? new WorldGenOriginalTree(Blocks.log, Blocks.leaves, 0, 0, false, 8, 2, false) : (random.nextInt(5) == 0 ? new WorldGenShrub(0,0) : (random.nextInt(3) == 0 ? new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves1"), 2, 0, false, 5, 3, false) : + (random.nextInt(3) == 0 ? worldGeneratorTrees : new WorldGenBOPTaiga2(Blocks.log, Blocks.leaves, 1, 1, false, 13, 9, 4, 4, 2, 1)))); } + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 1D); + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 2), 2D); + 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 par1World, Random par2Random, int par3, int par4) + public void decorate(World world, Random random, int chunkX, int chunkZ) { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 3 + par2Random.nextInt(6); + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.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); + 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); - Block block = Block.blocksList[var10]; - if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID)) + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) { - par1World.setBlock(var7, var8, var9, Block.oreEmerald.blockID, 0, 2); + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 0, 2); } } } - */ - /** - * 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 10467185; } - */ - /** - * 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 13225573; } - */ } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java index f730d03e8..93ef263a8 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java @@ -1,30 +1,31 @@ package biomesoplenty.common.biomes; +import java.util.HashMap; + +import biomesoplenty.api.BOPBlockHelper; +import net.minecraft.init.Blocks; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenTallGrass; +import net.minecraft.world.gen.feature.WorldGenerator; public class BiomeGenBrushland extends BOPBiome { - public BiomeGenBrushland(int par1) + public BiomeGenBrushland(int id) { - super(par1); - /* - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 10; - customBiomeDecorator.grassPerChunk = 6; - customBiomeDecorator.thornsPerChunk = 4; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.wheatGrassPerChunk = 3; + super(id); + + this.theBiomeDecorator.treesPerChunk = 10; + this.theBiomeDecorator.grassPerChunk = 6; + this.theBiomeDecorator.flowersPerChunk = -999; + + /*customBiomeDecorator.thornsPerChunk = 4; customBiomeDecorator.shrubsPerChunk = 30; customBiomeDecorator.waterReedsPerChunk = 2; - customBiomeDecorator.generateQuicksand = true; - */ + customBiomeDecorator.generateQuicksand = true;*/ } - /** - * Gets a WorldGen appropriate for this biome. - */ + /* @Override public WorldGenerator getRandomWorldGenForTrees(Random par1Random) @@ -32,26 +33,30 @@ public class BiomeGenBrushland extends BOPBiome return par1Random.nextInt(2) == 0 ? new WorldGenBrush2() : (par1Random.nextInt(5) == 0 ? new WorldGenBrush1() : new WorldGenChaparral2()); } */ + + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + grassMap.put(new WorldGenTallGrass(Blocks.tallgrass, 1), 1D); + + return grassMap; + } - /** - * 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 13222271; } - */ - /** - * 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 11716223; } - */ } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenCherryBlossomGrove.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenCherryBlossomGrove.java index 99f5eedc6..d527e3b4a 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenCherryBlossomGrove.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenCherryBlossomGrove.java @@ -1,76 +1,107 @@ 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.WorldGenBOPFlora; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenBOPBigTree; public class BiomeGenCherryBlossomGrove extends BOPBiome { + private static final Height biomeHeight = new Height(0.3F, 0.4F); - public BiomeGenCherryBlossomGrove(int par1) + public BiomeGenCherryBlossomGrove(int id) { - super(par1); - /* - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 3; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.pinkFlowersPerChunk = 15; - customBiomeDecorator.whiteFlowersPerChunk = 30; - customBiomeDecorator.tinyFlowersPerChunk = 25; - customBiomeDecorator.grassPerChunk = 15; - customBiomeDecorator.lilyflowersPerChunk = 9; - customBiomeDecorator.wheatGrassPerChunk = 1; - customBiomeDecorator.shrubsPerChunk = 2; - customBiomeDecorator.cloverPatchesPerChunk = 15; - customBiomeDecorator.generatePumpkins = false; - */ + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(16289679); + this.setTemperatureRainfall(0.7F, 0.8F); + + this.theBiomeDecorator.treesPerChunk = 3; + this.theBiomeDecorator.grassPerChunk = 15; + this.theBiomeDecorator.flowersPerChunk = -999; + + this.bopWorldFeatures.shrubsPerChunk = 2; + this.bopWorldFeatures.cloverPatchesPerChunk = 15; + this.bopWorldFeatures.generatePumpkins = false; } - /** - * Gets a WorldGen appropriate for this biome. - */ - /* @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) { - return par1Random.nextInt(3) == 0 ? new WorldGenCherry2(false) : new WorldGenCherry1(false); + return random.nextInt(3) == 0 ? new WorldGenBOPBigTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves3"), 1, 3) : new WorldGenBOPBigTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves3"), 1, 1); } + @Override + public HashMap getWeightedWorldGenForBOPFlowers() + { + HashMap flowerMap = new HashMap(); + + flowerMap.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 6), 3D); + flowerMap.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 9), 6D); + flowerMap.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 0), 5D); + + 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 par1World, Random par2Random, int par3, int par4) + public void decorate(World world, Random random, int chunkX, int chunkZ) { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 3 + par2Random.nextInt(6); + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.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); + 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); - Block block = Block.blocksList[var10]; - if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID)) + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) { - par1World.setBlock(var7, var8, var9, Block.oreEmerald.blockID, 0, 2); + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 6, 2); } } } - */ - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - /* @Override - public int getBiomeGrassColor() + //TODO: getBiomeGrassColor() + public int func_150558_b(int x, int y, int z) { return 10747818; } @Override - public int getBiomeFoliageColor() + //TODO: getBiomeFoliageColor() + public int func_150571_c(int x, int y, int z) { return 10747818; } - */ } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenConiferousForest.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenConiferousForest.java index e28f839ea..91fbd66c5 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenConiferousForest.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenConiferousForest.java @@ -11,8 +11,7 @@ public class BiomeGenConiferousForest extends BOPBiome super(par1); /* spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 8, 4, 4)); - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; + customBiomeDecorator.treesPerChunk = 8; customBiomeDecorator.grassPerChunk = 10; customBiomeDecorator.mushroomsPerChunk = 8; diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenDeciduousForest.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenDeciduousForest.java index da9865cf4..52bac68fa 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenDeciduousForest.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenDeciduousForest.java @@ -1,92 +1,100 @@ 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.WorldGenShrub; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenBulbTree; public class BiomeGenDeciduousForest extends BOPBiome { - - public BiomeGenDeciduousForest(int par1) + //private static final Height biomeHeight = new Height(); Not set? + + public BiomeGenDeciduousForest(int id) { - super(par1); - /* - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 15; - customBiomeDecorator.grassPerChunk = 10; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.toadstoolsPerChunk = 1; - customBiomeDecorator.bushesPerChunk = 8; - customBiomeDecorator.berryBushesPerChunk = 2; - customBiomeDecorator.blueMilksPerChunk = 2; - customBiomeDecorator.poisonIvyPerChunk = 1; - customBiomeDecorator.wheatGrassPerChunk = 10; - customBiomeDecorator.shrubsPerChunk = 10; - customBiomeDecorator.waterReedsPerChunk = 2; - */ + super(id); + + //this.func_150570_a(biomeHeight); Not set? + //TODO: setColor() + this.setColor(12695369); + this.setTemperatureRainfall(0.7F, 0.8F); + + this.theBiomeDecorator.treesPerChunk = 15; + this.theBiomeDecorator.grassPerChunk = 10; + this.theBiomeDecorator.flowersPerChunk = -999; + + this.bopWorldFeatures.toadstoolsPerChunk = 1; + this.bopWorldFeatures.bushesPerChunk = 8; + this.bopWorldFeatures.berryBushesPerChunk = 2; + this.bopWorldFeatures.blueMilksPerChunk = 2; + this.bopWorldFeatures.poisonIvyPerChunk = 1; + this.bopWorldFeatures.shrubsPerChunk = 10; + this.bopWorldFeatures.waterReedsPerChunk = 2; } - /** - * Gets a WorldGen appropriate for this biome. - */ - /* @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) { - return par1Random.nextInt(4) == 0 ? new WorldGenShrub(2,2) : new WorldGenDeciduous(false); + return random.nextInt(4) == 0 ? new WorldGenShrub(2,2) : new WorldGenBulbTree(Blocks.log, Blocks.leaves, 0, 0, false, 10, 15, false); } - */ - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(5) == 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), 1D); + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 2), 2D); + 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 par1World, Random par2Random, int par3, int par4) + public void decorate(World world, Random random, int chunkX, int chunkZ) { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 3 + par2Random.nextInt(6); + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.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); + 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); - Block block = Block.blocksList[var10]; - if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID)) + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) { - par1World.setBlock(var7, var8, var9, Block.oreEmerald.blockID, 0, 2); + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 0, 2); } } } - */ - /** - * 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 12695369; } - */ - /** - * 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 12896570; } - */ } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenDunes.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenDunes.java index c56051112..9e9d86bb9 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenDunes.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenDunes.java @@ -35,9 +35,9 @@ public class BiomeGenDunes extends BOPBiome this.theBiomeDecorator.grassPerChunk = 75; this.theBiomeDecorator.generateLakes = false; - this.bopWorldFeatures.perChunk.desertSproutsPerChunk = 25; - this.bopWorldFeatures.perChunk.bromeliadsPerChunk = 5; - this.bopWorldFeatures.perChunk.waterReedsPerChunk = 4; + this.bopWorldFeatures.desertSproutsPerChunk = 25; + this.bopWorldFeatures.bromeliadsPerChunk = 5; + this.bopWorldFeatures.waterReedsPerChunk = 4; } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenFrostForest.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenFrostForest.java index 2cf5f4bf5..f1fa19b58 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenFrostForest.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenFrostForest.java @@ -33,9 +33,9 @@ public class BiomeGenFrostForest extends BOPBiome this.theBiomeDecorator.flowersPerChunk = -999; this.theBiomeDecorator.mushroomsPerChunk = -999; - this.bopWorldFeatures.perChunk.shrubsPerChunk = 1; - this.bopWorldFeatures.perChunk.bopFlowersPerChunk = 3; - this.bopWorldFeatures.doGeneration.generatePumpkins = false; + this.bopWorldFeatures.shrubsPerChunk = 1; + this.bopWorldFeatures.bopFlowersPerChunk = 3; + this.bopWorldFeatures.generatePumpkins = false; } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenGrassland.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenGrassland.java index 6ef6e81ea..9616caa05 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenGrassland.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenGrassland.java @@ -42,11 +42,11 @@ public class BiomeGenGrassland extends BOPBiome this.theBiomeDecorator.reedsPerChunk = 35; this.theBiomeDecorator.mushroomsPerChunk = 20; - this.bopWorldFeatures.perChunk.waterLakesPerChunk = 15; - this.bopWorldFeatures.perChunk.portobellosPerChunk = 3; - this.bopWorldFeatures.perChunk.riverCanePerChunk = 5; - this.bopWorldFeatures.perChunk.waterReedsPerChunk = 2; - this.bopWorldFeatures.doGeneration.generatePumpkins = false; + this.bopWorldFeatures.waterPondsPerChunk = 15; + this.bopWorldFeatures.portobellosPerChunk = 3; + this.bopWorldFeatures.riverCanePerChunk = 5; + this.bopWorldFeatures.waterReedsPerChunk = 2; + this.bopWorldFeatures.generatePumpkins = false; } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java index b3d835967..710919c90 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java @@ -29,8 +29,8 @@ public class BiomeGenHighland extends BOPBiome this.theBiomeDecorator.treesPerChunk = -999; this.theBiomeDecorator.grassPerChunk = 25; - this.bopWorldFeatures.perChunk.doubleTallGrassPerChunk = 25; - this.bopWorldFeatures.perChunk.wildCarrotsPerChunk = 1; + this.bopWorldFeatures.doubleTallGrassPerChunk = 25; + this.bopWorldFeatures.wildCarrotsPerChunk = 1; } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenJadeCliffs.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenJadeCliffs.java index cf2acb2f5..f45eb8ff1 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenJadeCliffs.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenJadeCliffs.java @@ -31,7 +31,7 @@ public class BiomeGenJadeCliffs extends BOPBiome this.theBiomeDecorator.treesPerChunk = 12; this.theBiomeDecorator.grassPerChunk = 3; - this.bopWorldFeatures.perChunk.wildCarrotsPerChunk = 1; + this.bopWorldFeatures.wildCarrotsPerChunk = 1; } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenLavenderFields.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenLavenderFields.java index 7f804193d..3a6299217 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenLavenderFields.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenLavenderFields.java @@ -30,7 +30,7 @@ public class BiomeGenLavenderFields extends BOPBiome this.theBiomeDecorator.flowersPerChunk = -999; this.theBiomeDecorator.grassPerChunk = 20; - this.bopWorldFeatures.perChunk.lavenderPerChunk = 999; + this.bopWorldFeatures.lavenderPerChunk = 999; } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenMarsh.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenMarsh.java index 1b7524478..fd5b8fcc5 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenMarsh.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenMarsh.java @@ -1,59 +1,87 @@ 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.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; public class BiomeGenMarsh extends BOPBiome { - - public BiomeGenMarsh(int par1) + private static final Height biomeHeight = new Height(0.2F, 0.2F); + + public BiomeGenMarsh(int id) { - super(par1); - /* - spawnableCreatureList.clear(); - spawnableWaterCreatureList.clear(); - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = -999; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.grassPerChunk = 50; - customBiomeDecorator.wheatGrassPerChunk = 50; - customBiomeDecorator.highGrassPerChunk = 50; - customBiomeDecorator.reedsPerChunk = -999; - customBiomeDecorator.waterLakesPerChunk = 100; - customBiomeDecorator.sandPerChunk = -999; - customBiomeDecorator.sandPerChunk2 = -999; - customBiomeDecorator.mudPerChunk = 1; - customBiomeDecorator.mudPerChunk2 = 1; - customBiomeDecorator.koruPerChunk = 1; - customBiomeDecorator.waterReedsPerChunk = 10; - customBiomeDecorator.generatePumpkins = false; - spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 1, 3)); - */ - } - - /* - @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); + super(id); - int var55 = 12 + par2Random.nextInt(6); + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(6725742); + this.setTemperatureRainfall(0.5F, 0.9F); - for (int var66 = 0; var66 < var55; ++var66) + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + + this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 1, 3)); + + this.theBiomeDecorator.treesPerChunk = -999; + this.theBiomeDecorator.flowersPerChunk = -999; + this.theBiomeDecorator.grassPerChunk = 50; + + this.theBiomeDecorator.reedsPerChunk = -999; + this.theBiomeDecorator.sandPerChunk = -999; + this.theBiomeDecorator.sandPerChunk2 = -999; + + this.bopWorldFeatures.koruPerChunk = 1; + this.bopWorldFeatures.doubleTallGrassPerChunk = 50; + this.bopWorldFeatures.mudPerChunk = 1; + this.bopWorldFeatures.waterPondsPerChunk = 100; + this.bopWorldFeatures.waterReedsPerChunk = 10; + this.bopWorldFeatures.generatePumpkins = false; + } + + @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 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 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 (var100 == Block.stone.blockID) + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) { - par1World.setBlock(var77, var88, var99, Blocks.amethystOre.get().blockID, 12, 2); + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 12, 2); } } } - @Override + /*@Override public int getFogColour() { return 12638463; diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenMountain.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenMountain.java index 961124d16..57f35bfcf 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenMountain.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenMountain.java @@ -29,9 +29,9 @@ public class BiomeGenMountain extends BOPBiome this.theBiomeDecorator.treesPerChunk = 2; this.theBiomeDecorator.grassPerChunk = 3; - this.bopWorldFeatures.perChunk.berryBushesPerChunk = 3; - this.bopWorldFeatures.perChunk.shrubsPerChunk = 10; - this.bopWorldFeatures.perChunk.waterReedsPerChunk = 4; + this.bopWorldFeatures.berryBushesPerChunk = 3; + this.bopWorldFeatures.shrubsPerChunk = 10; + this.bopWorldFeatures.waterReedsPerChunk = 4; } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenMysticGrove.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenMysticGrove.java index 775111f03..39ac88025 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenMysticGrove.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenMysticGrove.java @@ -38,8 +38,8 @@ public class BiomeGenMysticGrove extends BOPBiome customBiomeDecorator.lilyflowersPerChunk = 3; customBiomeDecorator.poisonWaterPerChunk = 1;*/ - this.bopWorldFeatures.perChunk.cloverPatchesPerChunk = 10; - this.bopWorldFeatures.perChunk.shrubsPerChunk = 4; + this.bopWorldFeatures.cloverPatchesPerChunk = 10; + this.bopWorldFeatures.shrubsPerChunk = 4; } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenOminousWoods.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenOminousWoods.java index 8b2517cfe..c33220e94 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenOminousWoods.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenOminousWoods.java @@ -49,9 +49,9 @@ public class BiomeGenOminousWoods extends BOPBiome this.theBiomeDecorator.sandPerChunk = -999; this.theBiomeDecorator.sandPerChunk2 = -999; - this.bopWorldFeatures.perChunk.bopFlowersPerChunk = 1; - this.bopWorldFeatures.perChunk.thornsPerChunk = 9; - this.bopWorldFeatures.perChunk.poisonIvyPerChunk = 3; + this.bopWorldFeatures.bopFlowersPerChunk = 1; + this.bopWorldFeatures.thornsPerChunk = 9; + this.bopWorldFeatures.poisonIvyPerChunk = 3; //TODO: FEATURE customBiomeDecorator.poisonWaterPerChunk = 15; } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenRainforest.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenRainforest.java index 95d8316ab..439cf73b6 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenRainforest.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenRainforest.java @@ -37,10 +37,10 @@ public class BiomeGenRainforest extends BOPBiome this.theBiomeDecorator.mushroomsPerChunk = 25; - this.bopWorldFeatures.perChunk.bopFlowersPerChunk = 25; - this.bopWorldFeatures.perChunk.shrubsPerChunk = 5; - this.bopWorldFeatures.perChunk.cloverPatchesPerChunk = 20; - this.bopWorldFeatures.doGeneration.generatePumpkins = false; + this.bopWorldFeatures.bopFlowersPerChunk = 25; + this.bopWorldFeatures.shrubsPerChunk = 5; + this.bopWorldFeatures.cloverPatchesPerChunk = 20; + this.bopWorldFeatures.generatePumpkins = false; /*TODO: FEATURE customBiomeDecorator.pinkFlowersPerChunk = 2; customBiomeDecorator.rosesPerChunk = 10; diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenSacredSprings.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenSacredSprings.java index 61c3fc664..a348f82e1 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenSacredSprings.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenSacredSprings.java @@ -32,7 +32,7 @@ public class BiomeGenSacredSprings extends BOPBiome this.theBiomeDecorator.grassPerChunk = 4; this.theBiomeDecorator.waterlilyPerChunk = 5; - this.bopWorldFeatures.perChunk.bopFlowersPerChunk = 2; + this.bopWorldFeatures.bopFlowersPerChunk = 2; } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenShrubland.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenShrubland.java index 5962a7579..7f203312a 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenShrubland.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenShrubland.java @@ -33,9 +33,9 @@ public class BiomeGenShrubland extends BOPBiome this.theBiomeDecorator.flowersPerChunk = 0; this.theBiomeDecorator.grassPerChunk = 5; - this.bopWorldFeatures.perChunk.bushesPerChunk = 7; - this.bopWorldFeatures.perChunk.shrubsPerChunk = 5; - this.bopWorldFeatures.doGeneration.generatePumpkins = false; + this.bopWorldFeatures.bushesPerChunk = 7; + this.bopWorldFeatures.shrubsPerChunk = 5; + this.bopWorldFeatures.generatePumpkins = false; } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenThicket.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenThicket.java index 314be431d..ebdc33366 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenThicket.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenThicket.java @@ -27,8 +27,8 @@ public class BiomeGenThicket extends BOPBiome this.theBiomeDecorator.treesPerChunk = 17; this.theBiomeDecorator.grassPerChunk = 1; - this.bopWorldFeatures.perChunk.thornsPerChunk = 25; - this.bopWorldFeatures.perChunk.shrubsPerChunk = 15; + this.bopWorldFeatures.thornsPerChunk = 25; + this.bopWorldFeatures.shrubsPerChunk = 15; } @Override diff --git a/src/main/java/biomesoplenty/common/blocks/BlockBOPFoliage.java b/src/main/java/biomesoplenty/common/blocks/BlockBOPFoliage.java index f38a8f34a..0af749c79 100644 --- a/src/main/java/biomesoplenty/common/blocks/BlockBOPFoliage.java +++ b/src/main/java/biomesoplenty/common/blocks/BlockBOPFoliage.java @@ -159,6 +159,8 @@ public class BlockBOPFoliage extends BlockTallGrass implements IShearable //TODO: getBlock() Block block = world.func_147439_a(x, y - 1, z); + if (block == Blocks.air) return false; + switch (metadata) { case GRASSTOP: @@ -176,6 +178,9 @@ public class BlockBOPFoliage extends BlockTallGrass implements IShearable //TODO: canReplace() public boolean func_149705_a(World world, int x, int y, int z, int side, ItemStack itemStack) { + //TODO: getBlock() + if (world.func_147439_a(x, y - 1, z) == Blocks.air) return false; + return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.isValidPosition(world, x, y, z, itemStack.getItemDamage()); } @@ -185,9 +190,6 @@ public class BlockBOPFoliage extends BlockTallGrass implements IShearable { //TODO: getBlock() Block block = world.func_147439_a(x, y, z); - - //TODO: updateTick() - super.func_149695_a(world, x, y, z, block); this.dropIfCantStay(world, x, y, z, new ItemStack(block, 1, world.getBlockMetadata(x, y, z))); } diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index 1e648c300..70bc6ac68 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -7,7 +7,10 @@ import biomesoplenty.api.BOPBiomeHelper.BOPBiomeTemperatureType; import biomesoplenty.common.biomes.BiomeGenAlps; import biomesoplenty.common.biomes.BiomeGenArctic; import biomesoplenty.common.biomes.BiomeGenBambooForest; +import biomesoplenty.common.biomes.BiomeGenBorealForest; +import biomesoplenty.common.biomes.BiomeGenCherryBlossomGrove; import biomesoplenty.common.biomes.BiomeGenCrag; +import biomesoplenty.common.biomes.BiomeGenDeciduousForest; import biomesoplenty.common.biomes.BiomeGenDunes; import biomesoplenty.common.biomes.BiomeGenFlowerField; import biomesoplenty.common.biomes.BiomeGenFrostForest; @@ -15,6 +18,7 @@ import biomesoplenty.common.biomes.BiomeGenGrassland; import biomesoplenty.common.biomes.BiomeGenHighland; import biomesoplenty.common.biomes.BiomeGenJadeCliffs; import biomesoplenty.common.biomes.BiomeGenLavenderFields; +import biomesoplenty.common.biomes.BiomeGenMarsh; import biomesoplenty.common.biomes.BiomeGenMountain; import biomesoplenty.common.biomes.BiomeGenOminousWoods; import biomesoplenty.common.biomes.BiomeGenPasture; @@ -67,18 +71,18 @@ public class BOPBiomes 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 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 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 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 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 BiomeGenDeciduousForest(BOPConfigurationIDs.deciduousForestID).setBiomeName("Deciduous Forest"), 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));*/; registerBiome(new BOPBiomeListEntry(new BiomeGenFlowerField(BOPConfigurationIDs.flowerFieldID).setBiomeName("Flower Field"), BOPBiomeTemperatureType.WARM)); @@ -88,13 +92,13 @@ public class BOPBiomes /*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)); + registerOnlyBiome(new BOPBiomeListEntry(new BiomeGenLavenderFields(BOPConfigurationIDs.lavenderFieldsID).setBiomeName("Lavender Fields"), BOPBiomeTemperatureType.WARM)); /*registerBiome(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));*/ + //registerBiome(new BOPBiomeListEntry(new BiomeGenMeadow(BOPConfigurationIDs.meadowID).setBiomeName("Meadow"), BOPBiomeTemperatureType.COOL)); + //registerBiome(new BOPBiomeListEntry(new BiomeGenMoor(BOPConfigurationIDs.moorID).setBiomeName("Moor"), BOPBiomeTemperatureType.COOL)); registerBiome(new BOPBiomeListEntry(new BiomeGenMountain(BOPConfigurationIDs.mountainID).setBiomeName("Mountain"), BOPBiomeTemperatureType.WARM)); //registerBiome(new BOPBiomeListEntry(new BiomeGenMysticGrove(BOPConfigurationIDs.mysticGroveID).setBiomeName("Mystic Grove"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenOminousWoods(BOPConfigurationIDs.ominousWoodsID).setBiomeName("Ominous Woods"), BOPBiomeTemperatureType.COOL)); diff --git a/src/main/java/biomesoplenty/common/eventhandler/BOPCommonEventHandlers.java b/src/main/java/biomesoplenty/common/eventhandler/BOPCommonEventHandlers.java index b9cbff972..0f3cc1078 100644 --- a/src/main/java/biomesoplenty/common/eventhandler/BOPCommonEventHandlers.java +++ b/src/main/java/biomesoplenty/common/eventhandler/BOPCommonEventHandlers.java @@ -8,6 +8,7 @@ import biomesoplenty.common.eventhandler.misc.CapeEventHandler; import biomesoplenty.common.eventhandler.potions.PotionParalysisEventHandler; import biomesoplenty.common.eventhandler.potions.PotionPossessionEventHandler; import biomesoplenty.common.eventhandler.world.DecorateBiomeEventHandler; +import biomesoplenty.common.eventhandler.world.DecorationModificationEventHandler; public class BOPCommonEventHandlers { @@ -22,6 +23,7 @@ public class BOPCommonEventHandlers private static void registerWorldEventHandlers() { MinecraftForge.EVENT_BUS.register(new DecorateBiomeEventHandler()); + MinecraftForge.TERRAIN_GEN_BUS.register(new DecorationModificationEventHandler()); } private static void registerEntityEventHandlers() diff --git a/src/main/java/biomesoplenty/common/eventhandler/world/DecorateBiomeEventHandler.java b/src/main/java/biomesoplenty/common/eventhandler/world/DecorateBiomeEventHandler.java index 2eb4cd93a..6c90d18cb 100644 --- a/src/main/java/biomesoplenty/common/eventhandler/world/DecorateBiomeEventHandler.java +++ b/src/main/java/biomesoplenty/common/eventhandler/world/DecorateBiomeEventHandler.java @@ -5,22 +5,18 @@ import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.Ev import java.lang.reflect.Field; import java.util.Random; -import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.gen.feature.WorldGenLiquids; -import net.minecraft.world.gen.feature.WorldGenPumpkin; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.event.terraingen.DecorateBiomeEvent; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType; import net.minecraftforge.event.terraingen.TerrainGen; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate; -import biomesoplenty.common.world.WorldGenFieldAssociation; import biomesoplenty.common.world.decoration.BOPWorldFeatures; import biomesoplenty.common.world.decoration.ForcedDecorators; import biomesoplenty.common.world.decoration.IBOPDecoration; -import cpw.mods.fml.common.eventhandler.Event.Result; +import biomesoplenty.common.world.generation.ForcedBOPWorldGenerators; +import biomesoplenty.common.world.generation.IWorldGeneratorBOP; +import biomesoplenty.common.world.generation.WorldGenFieldAssociation; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.relauncher.ReflectionHelper; @@ -36,10 +32,10 @@ public class DecorateBiomeEventHandler Random random = event.rand; - int x = chunkX + 8; - int z = chunkZ + 8; + int x = chunkX * 16; + int z = chunkZ * 16; - BiomeGenBase biome = world.getBiomeGenForCoordsBody(x, z); + BiomeGenBase biome = world.getBiomeGenForCoordsBody(x + 16, z + 16); IBOPDecoration bopDecoration = null; @@ -54,31 +50,37 @@ public class DecorateBiomeEventHandler if (bopDecoration != null) { - for (Field worldGeneratorField : BOPWorldFeatures.PerChunk.class.getFields()) + for (Field worldGeneratorField : BOPWorldFeatures.class.getFields()) { try { - int worldGenPerChunk = worldGeneratorField.getInt(bopDecoration.getWorldFeatures().perChunk); + WorldGenerator worldGenerator = null; - for (int i = 0; i < worldGenPerChunk; i++) + if (worldGeneratorField.getName().equals("bopFlowersPerChunk") && TerrainGen.decorate(world, random, chunkX, chunkZ, FLOWERS)) { - int randX = x + random.nextInt(16); - int randZ = z + random.nextInt(16); + worldGenerator = bopDecoration.getRandomWorldGenForBOPFlowers(random); + } + else + { + worldGenerator = WorldGenFieldAssociation.getAssociatedWorldGenerator(worldGeneratorField.getName()); + } - WorldGenerator worldGenerator = null; - - if (worldGeneratorField.getName().equals("bopFlowersPerChunk") && TerrainGen.decorate(world, random, chunkX, chunkZ, FLOWERS)) + if (worldGenerator != null) + { + IWorldGeneratorBOP worldGeneratorBOP = null; + + if (worldGenerator instanceof IWorldGeneratorBOP) { - worldGenerator = bopDecoration.getRandomWorldGenForBOPFlowers(random); + worldGeneratorBOP = (IWorldGeneratorBOP)worldGenerator; } - else + else if (ForcedBOPWorldGenerators.hasForcedGenerator(worldGenerator.getClass())) { - worldGenerator = WorldGenFieldAssociation.getAssociatedWorldGenerator(worldGeneratorField.getName()); + worldGeneratorBOP = ForcedBOPWorldGenerators.getForcedGenerator(worldGenerator.getClass()); } - - if (worldGenerator != null) + + if (worldGeneratorBOP != null) { - worldGenerator.generate(world, random, randX, world.getTopSolidOrLiquidBlock(randX, randZ), randZ); + worldGeneratorBOP.doGeneration(world, random, worldGeneratorField, worldGenerator, biome, bopDecoration, x, z); } } } @@ -89,67 +91,7 @@ public class DecorateBiomeEventHandler } } } - - @SubscribeEvent - public void modifyDecor(Decorate event) - { - World world = event.world; - int chunkX = event.chunkX; - int chunkZ = event.chunkZ; - - Random random = event.rand; - - int x = chunkX + 8; - int z = chunkZ + 8; - - - BiomeGenBase biome = world.getBiomeGenForCoordsBody(x, z); - IBOPDecoration bopDecoration = null; - - if (biome instanceof IBOPDecoration) - { - bopDecoration = (IBOPDecoration)biome; - } - else if (ForcedDecorators.biomeHasForcedDecorator(biome.biomeID)) - { - bopDecoration = ForcedDecorators.getForcedDecorator(biome.biomeID); - } - - if (bopDecoration != null) - { - if (event.type == EventType.PUMPKIN) - { - if (!bopDecoration.getWorldFeatures().doGeneration.generatePumpkins) event.setResult(Result.DENY); - } - else if (event.type == EventType.LAKE) - { - if (biome.theBiomeDecorator.generateLakes) - { - for (int i = 0; i < bopDecoration.getWorldFeatures().perChunk.waterLakesPerChunk; ++i) - { - int randX = x + random.nextInt(16); - int randY = random.nextInt(random.nextInt(248) + 8); - int randZ = z + random.nextInt(16); - - (new WorldGenLiquids(Blocks.flowing_water)).generate(world, random, randX, randY, randZ); - } - - for (int i = 0; i < bopDecoration.getWorldFeatures().perChunk.lavaLakesPerChunk; ++i) - { - int randX = x + random.nextInt(16); - int randY = random.nextInt(random.nextInt(random.nextInt(240) + 8) + 8); - int randZ = z + random.nextInt(16); - - (new WorldGenLiquids(Blocks.flowing_lava)).generate(world, random, randX, randY, randZ); - } - } - - event.setResult(Result.DENY); - } - } - } - public static void decorate(World world, Random random, BiomeGenBase biome, int x, int z) { BiomeDecorator biomeDecorator = biome.theBiomeDecorator; diff --git a/src/main/java/biomesoplenty/common/eventhandler/world/DecorationModificationEventHandler.java b/src/main/java/biomesoplenty/common/eventhandler/world/DecorationModificationEventHandler.java new file mode 100644 index 000000000..92bf81c0e --- /dev/null +++ b/src/main/java/biomesoplenty/common/eventhandler/world/DecorationModificationEventHandler.java @@ -0,0 +1,120 @@ +package biomesoplenty.common.eventhandler.world; + +import java.util.Random; + +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenLakes; +import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate; +import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType; +import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate; +import biomesoplenty.common.world.decoration.ForcedDecorators; +import biomesoplenty.common.world.decoration.IBOPDecoration; +import cpw.mods.fml.common.eventhandler.Event.Result; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +public class DecorationModificationEventHandler +{ + @SubscribeEvent + public void modifyDecor(Decorate event) + { + World world = event.world; + + int chunkX = event.chunkX; + int chunkZ = event.chunkZ; + + Random random = event.rand; + + int x = chunkX + 8; + int z = chunkZ + 8; + + BiomeGenBase biome = world.getBiomeGenForCoordsBody(x, z); + IBOPDecoration bopDecoration = null; + + if (biome instanceof IBOPDecoration) + { + bopDecoration = (IBOPDecoration)biome; + } + else if (ForcedDecorators.biomeHasForcedDecorator(biome.biomeID)) + { + bopDecoration = ForcedDecorators.getForcedDecorator(biome.biomeID); + } + + if (bopDecoration != null) + { + if (event.type == Decorate.EventType.PUMPKIN) + { + if (!bopDecoration.getWorldFeatures().generatePumpkins) + { + event.setResult(Result.DENY); + } + } + } + } + + @SubscribeEvent + public void modifyPopulation(Populate event) + { + World world = event.world; + + int chunkX = event.chunkX; + int chunkZ = event.chunkZ; + + Random random = event.rand; + + int x = chunkX * 16; + int z = chunkZ * 16; + + BiomeGenBase biome = world.getBiomeGenForCoordsBody(x + 16, z + 16); + IBOPDecoration bopDecoration = null; + + if (biome instanceof IBOPDecoration) + { + bopDecoration = (IBOPDecoration)biome; + } + else if (ForcedDecorators.biomeHasForcedDecorator(biome.biomeID)) + { + bopDecoration = ForcedDecorators.getForcedDecorator(biome.biomeID); + } + + if (bopDecoration != null) + { + if (event.type == Populate.EventType.LAKE) + { + event.setResult(Result.DENY); + + for (int i = 0; i < bopDecoration.getWorldFeatures().waterPondsPerChunk; i++) + { + if (random.nextInt(4) == 0) + { + int randX = x + random.nextInt(16) + 8; + int randY = random.nextInt(256); + int randZ = z + random.nextInt(16) + 8; + + (new WorldGenLakes(Blocks.water)).generate(world, random, randX, randY, randZ); + } + } + } + else if (event.type == Populate.EventType.LAVA) + { + event.setResult(Result.DENY); + + for (int i = 0; i < bopDecoration.getWorldFeatures().lavaPondsPerChunk; i++) + { + if (random.nextInt(8) == 0) + { + int randX = x + random.nextInt(16) + 8; + int randY = random.nextInt(random.nextInt(248) + 8); + int randZ = z + random.nextInt(16) + 8; + + if (randY < 63 || random.nextInt(10) == 0) + { + (new WorldGenLakes(Blocks.lava)).generate(world, random, randX, randY, randZ); + } + } + } + } + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java index f7c7669a9..c8583ad8e 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -2,36 +2,31 @@ package biomesoplenty.common.world.decoration; public class BOPWorldFeatures { - public PerChunk perChunk = new PerChunk(); - public DoGeneration doGeneration = new DoGeneration(); - - public class PerChunk - { - public int mudPerChunk = 0; - public int riverCanePerChunk = 0; - public int shrubsPerChunk = 0; - public int bushesPerChunk = 0; - public int cloverPatchesPerChunk = 0; - public int lavenderPerChunk = 0; - public int thornsPerChunk = 0; - public int stalagmitesPerChunk = 3; - public int stalactitesPerChunk = 6; - public int desertSproutsPerChunk = 0; - public int bromeliadsPerChunk = 0; - public int waterReedsPerChunk = 0; - public int wildCarrotsPerChunk = 0; - public int doubleTallGrassPerChunk = 0; - public int poisonIvyPerChunk = 0; - public int berryBushesPerChunk = 0; - public int waterLakesPerChunk = 50; - public int lavaLakesPerChunk = 20; - public int portobellosPerChunk = 0; + public int mudPerChunk = 0; + public int riverCanePerChunk = 0; + public int shrubsPerChunk = 0; + public int bushesPerChunk = 0; + public int cloverPatchesPerChunk = 0; + public int lavenderPerChunk = 0; + public int thornsPerChunk = 0; + public int stalagmitesPerChunk = 3; + public int stalactitesPerChunk = 6; + public int desertSproutsPerChunk = 0; + public int bromeliadsPerChunk = 0; + public int waterReedsPerChunk = 0; + public int wildCarrotsPerChunk = 0; + public int doubleTallGrassPerChunk = 0; + public int poisonIvyPerChunk = 0; + public int berryBushesPerChunk = 0; + public int waterPondsPerChunk = 0; + public int lavaPondsPerChunk = 0; + public int portobellosPerChunk = 0; + public int koruPerChunk = 0; + public int toadstoolsPerChunk = 0; + public int blueMilksPerChunk = 0; - public int bopFlowersPerChunk = 0; - } - - public class DoGeneration - { - public boolean generatePumpkins = true; - } + public int bopFlowersPerChunk = 0; + + public boolean generatePumpkins = true; + public boolean generateQuicksand = false; } diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenBOPFlora.java b/src/main/java/biomesoplenty/common/world/features/WorldGenBOPFlora.java index 3af666bc5..9f2ef6bb6 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenBOPFlora.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenBOPFlora.java @@ -1,13 +1,17 @@ package biomesoplenty.common.world.features; +import java.lang.reflect.Field; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; 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 WorldGenBOPFlora extends WorldGenerator +public class WorldGenBOPFlora extends WorldGeneratorBOP { private Block flora; private int floraMeta; @@ -45,4 +49,16 @@ public class WorldGenBOPFlora extends WorldGenerator 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); + } + } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenBOPTallGrass.java b/src/main/java/biomesoplenty/common/world/features/WorldGenBOPTallGrass.java index 8cf058716..a595f5480 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenBOPTallGrass.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenBOPTallGrass.java @@ -1,13 +1,17 @@ package biomesoplenty.common.world.features; +import java.lang.reflect.Field; import java.util.Random; + import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; 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 WorldGenBOPTallGrass extends WorldGenerator +public class WorldGenBOPTallGrass extends WorldGeneratorBOP { private Block tallGrass; private int tallGrassMetadata; @@ -48,4 +52,16 @@ public class WorldGenBOPTallGrass extends WorldGenerator 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); + } + } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenMoss.java b/src/main/java/biomesoplenty/common/world/features/WorldGenMoss.java index 8abe72797..fa4410a29 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenMoss.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenMoss.java @@ -1,14 +1,18 @@ package biomesoplenty.common.world.features; +import java.lang.reflect.Field; import java.util.Random; import net.minecraft.util.Direction; import net.minecraft.util.Facing; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.feature.WorldGenerator; import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.decoration.IBOPDecoration; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; -public class WorldGenMoss extends WorldGenerator +public class WorldGenMoss extends WorldGeneratorBOP { @Override public boolean generate(World world, Random par2Random, int par3, int par4, int par5) @@ -45,4 +49,16 @@ public class WorldGenMoss extends WorldGenerator 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/WorldGenMud.java b/src/main/java/biomesoplenty/common/world/features/WorldGenMud.java index 82a863117..f6ff40952 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenMud.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenMud.java @@ -1,15 +1,19 @@ package biomesoplenty.common.world.features; +import java.lang.reflect.Field; import java.util.Random; -import biomesoplenty.api.BOPBlockHelper; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.decoration.IBOPDecoration; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; -public class WorldGenMud extends WorldGenerator +public class WorldGenMud extends WorldGeneratorBOP { /** The maximum radius used when generating a patch of blocks. */ private int radius; @@ -57,4 +61,16 @@ public class WorldGenMud extends WorldGenerator 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/WorldGenRiverCane.java b/src/main/java/biomesoplenty/common/world/features/WorldGenRiverCane.java index 2236e11f7..e3f02c781 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenRiverCane.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenRiverCane.java @@ -1,13 +1,17 @@ package biomesoplenty.common.world.features; +import java.lang.reflect.Field; import java.util.Random; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.feature.WorldGenerator; import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.decoration.IBOPDecoration; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; -public class WorldGenRiverCane extends WorldGenerator +public class WorldGenRiverCane extends WorldGeneratorBOP { @Override public boolean generate(World world, Random par2Random, int x, int y, int z) @@ -37,4 +41,16 @@ public class WorldGenRiverCane extends WorldGenerator 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/WorldGenWaterReeds.java b/src/main/java/biomesoplenty/common/world/features/WorldGenWaterReeds.java index 3534ab786..3119858b7 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenWaterReeds.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenWaterReeds.java @@ -1,16 +1,18 @@ package biomesoplenty.common.world.features; +import java.lang.reflect.Field; import java.util.Random; -import biomesoplenty.api.BOPBlockHelper; - -import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.decoration.IBOPDecoration; +import biomesoplenty.common.world.generation.WorldGeneratorBOP; -public class WorldGenWaterReeds extends WorldGenerator +public class WorldGenWaterReeds extends WorldGeneratorBOP { @Override public boolean generate(World world, Random random, int x, int y, int z) @@ -38,4 +40,16 @@ public class WorldGenWaterReeds extends WorldGenerator 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); + } + } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPBigTree.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPBigTree.java new file mode 100644 index 000000000..7c4a72dff --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPBigTree.java @@ -0,0 +1,485 @@ +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.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraftforge.common.util.ForgeDirection; + +public class WorldGenBOPBigTree extends WorldGenAbstractTree +{ + static final byte[] otherCoordPairs = new byte[] {(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; + + Random rand = new Random(); + + World worldObj; + int[] basePos = new int[] {0, 0, 0}; + int heightLimit; + int height; + double heightAttenuation = 0.618D; + double branchDensity = 1.0D; + double branchSlope = 0.381D; + double scaleWidth = 1.0D; + double leafDensity = 1.0D; + + int trunkSize = 1; + + int heightLimitLimit = 12; + + int leafDistanceLimit = 4; + + int[][] leafNodes; + + private final Block wood; + private final Block leaves; + + private final int metaWood; + private final int metaLeaves; + + public WorldGenBOPBigTree(Block wood, Block leaves, int metaWood, int metaLeaves) + { + super(false); + + this.wood = wood; + this.leaves = leaves; + + this.metaWood = metaWood; + this.metaLeaves = metaLeaves; + } + + void generateLeafNodeList() + { + this.height = (int)((double)this.heightLimit * this.heightAttenuation); + + if (this.height >= this.heightLimit) + { + this.height = this.heightLimit - 1; + } + + int i = (int)(1.382D + Math.pow(this.leafDensity * (double)this.heightLimit / 13.0D, 2.0D)); + + if (i < 1) + { + i = 1; + } + + int[][] aint = new int[i * this.heightLimit][4]; + int j = this.basePos[1] + this.heightLimit - this.leafDistanceLimit; + int k = 1; + int l = this.basePos[1] + this.height; + int i1 = j - this.basePos[1]; + aint[0][0] = this.basePos[0]; + aint[0][1] = j; + aint[0][2] = this.basePos[2]; + aint[0][3] = l; + --j; + + while (i1 >= 0) + { + int j1 = 0; + float f = this.layerSize(i1); + + if (f < 0.0F) + { + --j; + --i1; + } + else + { + for (double d0 = 0.5D; j1 < i; ++j1) + { + double d1 = this.scaleWidth * (double)f * ((double)this.rand.nextFloat() + 0.328D); + double d2 = (double)this.rand.nextFloat() * 2.0D * Math.PI; + int k1 = MathHelper.floor_double(d1 * Math.sin(d2) + (double)this.basePos[0] + d0); + int l1 = MathHelper.floor_double(d1 * Math.cos(d2) + (double)this.basePos[2] + d0); + int[] aint1 = new int[] {k1, j, l1}; + int[] aint2 = new int[] {k1, j + this.leafDistanceLimit, l1}; + + if (this.checkBlockLine(aint1, aint2) == -1) + { + int[] aint3 = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; + double d3 = Math.sqrt(Math.pow((double)Math.abs(this.basePos[0] - aint1[0]), 2.0D) + Math.pow((double)Math.abs(this.basePos[2] - aint1[2]), 2.0D)); + double d4 = d3 * this.branchSlope; + + if ((double)aint1[1] - d4 > (double)l) + { + aint3[1] = l; + } + else + { + aint3[1] = (int)((double)aint1[1] - d4); + } + + if (this.checkBlockLine(aint3, aint1) == -1) + { + aint[k][0] = k1; + aint[k][1] = j; + aint[k][2] = l1; + aint[k][3] = aint3[1]; + ++k; + } + } + } + + --j; + --i1; + } + } + + this.leafNodes = new int[k][4]; + System.arraycopy(aint, 0, this.leafNodes, 0, k); + } + + void func_150529_a(int p_150529_1_, int p_150529_2_, int p_150529_3_, float p_150529_4_, byte p_150529_5_, Block p_150529_6_) + { + int l = (int)((double)p_150529_4_ + 0.618D); + byte b1 = otherCoordPairs[p_150529_5_]; + byte b2 = otherCoordPairs[p_150529_5_ + 3]; + int[] aint = new int[] {p_150529_1_, p_150529_2_, p_150529_3_}; + int[] aint1 = new int[] {0, 0, 0}; + int i1 = -l; + int j1 = -l; + + for (aint1[p_150529_5_] = aint[p_150529_5_]; i1 <= l; ++i1) + { + aint1[b1] = aint[b1] + i1; + j1 = -l; + + while (j1 <= l) + { + double d0 = Math.pow((double)Math.abs(i1) + 0.5D, 2.0D) + Math.pow((double)Math.abs(j1) + 0.5D, 2.0D); + + if (d0 > (double)(p_150529_4_ * p_150529_4_)) + { + ++j1; + } + else + { + aint1[b2] = aint[b2] + j1; + Block block1 = this.worldObj.func_147439_a(aint1[0], aint1[1], aint1[2]); + + if (!block1.isAir(worldObj, aint1[0], aint1[1], aint1[2]) && !block1.isLeaves(worldObj, aint1[0], aint1[1], aint1[2])) + { + ++j1; + } + else + { + this.func_150516_a(this.worldObj, aint1[0], aint1[1], aint1[2], p_150529_6_, metaLeaves); + ++j1; + } + } + } + } + } + + // JAVADOC METHOD $$ func_76490_a + float layerSize(int par1) + { + if ((double)par1 < (double)((float)this.heightLimit) * 0.3D) + { + return -1.618F; + } + else + { + float f = (float)this.heightLimit / 2.0F; + float f1 = (float)this.heightLimit / 2.0F - (float)par1; + float f2; + + if (f1 == 0.0F) + { + f2 = f; + } + else if (Math.abs(f1) >= f) + { + f2 = 0.0F; + } + else + { + f2 = (float)Math.sqrt(Math.pow((double)Math.abs(f), 2.0D) - Math.pow((double)Math.abs(f1), 2.0D)); + } + + f2 *= 0.5F; + return f2; + } + } + + float leafSize(int par1) + { + return par1 >= 0 && par1 < this.leafDistanceLimit ? (par1 != 0 && par1 != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; + } + + // JAVADOC METHOD $$ func_76491_a + void generateLeafNode(int par1, int par2, int par3) + { + int l = par2; + + for (int i1 = par2 + this.leafDistanceLimit; l < i1; ++l) + { + float f = this.leafSize(l - par2); + this.func_150529_a(par1, l, par3, f, (byte)1, leaves); + } + } + + void func_150530_a(int[] p_150530_1_, int[] p_150530_2_, Block p_150530_3_) + { + int[] aint2 = new int[] {0, 0, 0}; + byte b0 = 0; + byte b1; + + for (b1 = 0; b0 < 3; ++b0) + { + aint2[b0] = p_150530_2_[b0] - p_150530_1_[b0]; + + if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) + { + b1 = b0; + } + } + + if (aint2[b1] != 0) + { + byte b2 = otherCoordPairs[b1]; + byte b3 = otherCoordPairs[b1 + 3]; + byte b4; + + if (aint2[b1] > 0) + { + b4 = 1; + } + else + { + b4 = -1; + } + + double d0 = (double)aint2[b2] / (double)aint2[b1]; + double d1 = (double)aint2[b3] / (double)aint2[b1]; + int[] aint3 = new int[] {0, 0, 0}; + int i = 0; + + for (int j = aint2[b1] + b4; i != j; i += b4) + { + aint3[b1] = MathHelper.floor_double((double)(p_150530_1_[b1] + i) + 0.5D); + aint3[b2] = MathHelper.floor_double((double)p_150530_1_[b2] + (double)i * d0 + 0.5D); + aint3[b3] = MathHelper.floor_double((double)p_150530_1_[b3] + (double)i * d1 + 0.5D); + byte b5 = (byte)metaWood; + int k = Math.abs(aint3[0] - p_150530_1_[0]); + int l = Math.abs(aint3[2] - p_150530_1_[2]); + int i1 = Math.max(k, l); + + if (i1 > 0) + { + if (k == i1) + { + b5 += 4; + } + else if (l == i1) + { + b5 += 8; + } + } + + this.func_150516_a(this.worldObj, aint3[0], aint3[1], aint3[2], p_150530_3_, b5); + } + } + } + + void generateLeaves() + { + int i = 0; + + for (int j = this.leafNodes.length; i < j; ++i) + { + int k = this.leafNodes[i][0]; + int l = this.leafNodes[i][1]; + int i1 = this.leafNodes[i][2]; + this.generateLeafNode(k, l, i1); + } + } + + boolean leafNodeNeedsBase(int par1) + { + return (double)par1 >= (double)this.heightLimit * 0.2D; + } + + void generateTrunk() + { + int i = this.basePos[0]; + int j = this.basePos[1]; + int k = this.basePos[1] + this.height; + int l = this.basePos[2]; + int[] aint = new int[] {i, j, l}; + int[] aint1 = new int[] {i, k, l}; + this.func_150530_a(aint, aint1, wood); + + if (this.trunkSize == 2) + { + ++aint[0]; + ++aint1[0]; + this.func_150530_a(aint, aint1, wood); + ++aint[2]; + ++aint1[2]; + this.func_150530_a(aint, aint1, wood); + aint[0] += -1; + aint1[0] += -1; + this.func_150530_a(aint, aint1, wood); + } + } + + // JAVADOC METHOD $$ func_76494_d + void generateLeafNodeBases() + { + int i = 0; + int j = this.leafNodes.length; + + for (int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; i < j; ++i) + { + int[] aint1 = this.leafNodes[i]; + int[] aint2 = new int[] {aint1[0], aint1[1], aint1[2]}; + aint[1] = aint1[3]; + int k = aint[1] - this.basePos[1]; + + if (this.leafNodeNeedsBase(k)) + { + this.func_150530_a(aint, aint2, wood); + } + } + } + + // JAVADOC METHOD $$ func_76496_a + int checkBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger) + { + int[] aint2 = new int[] {0, 0, 0}; + byte b0 = 0; + byte b1; + + for (b1 = 0; b0 < 3; ++b0) + { + aint2[b0] = par2ArrayOfInteger[b0] - par1ArrayOfInteger[b0]; + + if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) + { + b1 = b0; + } + } + + if (aint2[b1] == 0) + { + return -1; + } + else + { + byte b2 = otherCoordPairs[b1]; + byte b3 = otherCoordPairs[b1 + 3]; + byte b4; + + if (aint2[b1] > 0) + { + b4 = 1; + } + else + { + b4 = -1; + } + + double d0 = (double)aint2[b2] / (double)aint2[b1]; + double d1 = (double)aint2[b3] / (double)aint2[b1]; + int[] aint3 = new int[] {0, 0, 0}; + int i = 0; + int j; + + for (j = aint2[b1] + b4; i != j; i += b4) + { + aint3[b1] = par1ArrayOfInteger[b1] + i; + aint3[b2] = MathHelper.floor_double((double)par1ArrayOfInteger[b2] + (double)i * d0); + aint3[b3] = MathHelper.floor_double((double)par1ArrayOfInteger[b3] + (double)i * d1); + Block block = this.worldObj.func_147439_a(aint3[0], aint3[1], aint3[2]); + + if (!this.isReplaceable(worldObj, aint3[0], aint3[1], aint3[2])) + { + break; + } + } + + return i == j ? -1 : Math.abs(i); + } + } + + // JAVADOC METHOD $$ func_76497_e + boolean validTreeLocation() + { + int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; + int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]}; + Block block = this.worldObj.func_147439_a(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); + + boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling); + if (!isSoil) + { + return false; + } + else + { + int i = this.checkBlockLine(aint, aint1); + + if (i == -1) + { + return true; + } + else if (i < 6) + { + return false; + } + else + { + this.heightLimit = i; + return true; + } + } + } + + @Override + public void setScale(double par1, double par3, double par5) + { + this.heightLimitLimit = (int)(par1 * 12.0D); + + if (par1 > 0.5D) + { + this.leafDistanceLimit = 5; + } + + this.scaleWidth = par3; + this.leafDensity = par5; + } + + @Override + public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) + { + this.worldObj = par1World; + long l = par2Random.nextLong(); + this.rand.setSeed(l); + this.basePos[0] = par3; + this.basePos[1] = par4; + this.basePos[2] = par5; + + if (this.heightLimit == 0) + { + this.heightLimit = 5 + this.rand.nextInt(this.heightLimitLimit); + } + + if (!this.validTreeLocation()) + { + return false; + } + else + { + this.generateLeafNodeList(); + this.generateLeaves(); + this.generateTrunk(); + this.generateLeafNodeBases(); + return true; + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPTaiga2.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPTaiga2.java index e104b5941..26faad21d 100644 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPTaiga2.java +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPTaiga2.java @@ -20,8 +20,19 @@ public class WorldGenBOPTaiga2 extends WorldGenAbstractTree private final int metaWood; private final int metaLeaves; + + private final int minI; + private final int randomI; + + private final int minK; + private final int randomK; public WorldGenBOPTaiga2(Block wood, Block leaves, int metaWood, int metaLeaves, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight) + { + this(wood, leaves, metaWood, metaLeaves, doBlockNotify, minTreeHeight, randomTreeHeight, 1, 2, 2, 2); + } + + public WorldGenBOPTaiga2(Block wood, Block leaves, int metaWood, int metaLeaves, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight, int minI, int randomI, int minK, int randomK) { super(doBlockNotify); @@ -31,15 +42,21 @@ public class WorldGenBOPTaiga2 extends WorldGenAbstractTree this.metaLeaves = metaLeaves; this.minTreeHeight = minTreeHeight; this.randomTreeHeight = randomTreeHeight; + + this.minI = minI; + this.randomI = randomI; + + this.minK = minK; + this.randomK = randomK; } @Override public boolean generate(World world, Random random, int x, int y, int z) { int l = random.nextInt(randomTreeHeight) + minTreeHeight; - int i1 = 1 + random.nextInt(2); + int i1 = minI + random.nextInt(randomI); int j1 = l - i1; - int k1 = 2 + random.nextInt(2); + int k1 = minK + random.nextInt(randomK); boolean flag = true; if (y >= 1 && y + l + 1 <= 256) diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBulbTree.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBulbTree.java index 2e2d7be8e..b2ac09eb0 100644 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBulbTree.java +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBulbTree.java @@ -105,7 +105,7 @@ public class WorldGenBulbTree extends WorldGenAbstractTree for (k1 = y - b0 + l; k1 <= y + l; ++k1) { i3 = k1 - (y + l); - l1 = b1 + 1 - i3 / 2; + l1 = b1 + 1 - i3 / 3; for (i2 = x - l1; i2 <= x + l1; ++i2) { @@ -137,38 +137,38 @@ public class WorldGenBulbTree extends WorldGenAbstractTree //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 - 4), z, leaves, metaLeaves); + this.func_150516_a(world, x + 1, y + (l - 4), z, leaves, metaLeaves); + this.func_150516_a(world, x, y + (l - 4), z - 1, leaves, metaLeaves); + this.func_150516_a(world, x, y + (l - 4), z + 1, leaves, metaLeaves); - 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 - 5), z + 1, leaves, metaLeaves); + this.func_150516_a(world, x - 1, y + (l - 5), z - 1, leaves, metaLeaves); + this.func_150516_a(world, x + 1, y + (l - 5), z + 1, leaves, metaLeaves); + this.func_150516_a(world, x + 1, y + (l - 5), z - 1, leaves, metaLeaves); + this.func_150516_a(world, x - 1, y + (l - 5), z, leaves, metaLeaves); + this.func_150516_a(world, x + 1, y + (l - 5), z, leaves, metaLeaves); + this.func_150516_a(world, x, y + (l - 5), z - 1, leaves, metaLeaves); + this.func_150516_a(world, x, y + (l - 5), z + 1, leaves, metaLeaves); - 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 - 6), z, leaves, metaLeaves); + this.func_150516_a(world, x + 1, y + (l - 6), z, leaves, metaLeaves); + this.func_150516_a(world, x, y + (l - 6), z - 1, leaves, metaLeaves); + this.func_150516_a(world, x, y + (l), z + 1, leaves, metaLeaves); - 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 - 7), z + 1, leaves, metaLeaves); + this.func_150516_a(world, x - 1, y + (l - 7), z - 1, leaves, metaLeaves); + this.func_150516_a(world, x + 1, y + (l - 7), z + 1, leaves, metaLeaves); + this.func_150516_a(world, x + 1, y + (l - 7), z - 1, leaves, metaLeaves); + this.func_150516_a(world, x - 1, y + (l - 7), z, leaves, metaLeaves); + this.func_150516_a(world, x + 1, y + (l - 7), z, leaves, metaLeaves); + this.func_150516_a(world, x, y + (l - 7), z - 1, leaves, metaLeaves); + this.func_150516_a(world, x, y + (l - 7), z + 1, leaves, metaLeaves); - 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); + this.func_150516_a(world, x - 1, y + (l - 8), z, leaves, metaLeaves); + this.func_150516_a(world, x + 1, y + (l - 8), z, leaves, metaLeaves); + this.func_150516_a(world, x, y + (l - 8), z - 1, leaves, metaLeaves); + this.func_150516_a(world, x, y + (l - 8), z + 1, leaves, metaLeaves); if (this.vinesGrow && k1 > 0) { diff --git a/src/main/java/biomesoplenty/common/world/forceddecorators/SwampForcedDecorator.java b/src/main/java/biomesoplenty/common/world/forceddecorators/SwampForcedDecorator.java index da4a366b0..61a0a9702 100644 --- a/src/main/java/biomesoplenty/common/world/forceddecorators/SwampForcedDecorator.java +++ b/src/main/java/biomesoplenty/common/world/forceddecorators/SwampForcedDecorator.java @@ -9,6 +9,6 @@ public class SwampForcedDecorator extends ForcedDecorator { public SwampForcedDecorator() { - this.bopWorldFeatures.perChunk.mudPerChunk = 3; + this.bopWorldFeatures.mudPerChunk = 3; } } diff --git a/src/main/java/biomesoplenty/common/world/generation/ForcedBOPWorldGenerators.java b/src/main/java/biomesoplenty/common/world/generation/ForcedBOPWorldGenerators.java new file mode 100644 index 000000000..014ffaed2 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/generation/ForcedBOPWorldGenerators.java @@ -0,0 +1,36 @@ +package biomesoplenty.common.world.generation; + +import java.util.HashMap; + +import biomesoplenty.common.world.decoration.IBOPDecoration; +import biomesoplenty.common.world.forceddecorators.ForcedDecorator; + +public class ForcedBOPWorldGenerators +{ + public static HashMap forcedGeneratorMap = new HashMap(); + + public static void init() + { + addForcedGenerators(); + } + + private static void addForcedGenerators() + { + + } + + public static void addForcedGenerator(Class worldGenClass, ForcedWorldGeneratorBOP generator) + { + forcedGeneratorMap.put(worldGenClass, generator); + } + + public static ForcedWorldGeneratorBOP getForcedGenerator(Class worldGenClass) + { + return forcedGeneratorMap.get(worldGenClass); + } + + public static boolean hasForcedGenerator(Class worldGenClass) + { + return forcedGeneratorMap.containsKey(worldGenClass); + } +} diff --git a/src/main/java/biomesoplenty/common/world/generation/ForcedWorldGeneratorBOP.java b/src/main/java/biomesoplenty/common/world/generation/ForcedWorldGeneratorBOP.java new file mode 100644 index 000000000..8945c6f47 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/generation/ForcedWorldGeneratorBOP.java @@ -0,0 +1,15 @@ +package biomesoplenty.common.world.generation; + +import java.lang.reflect.Field; +import java.util.Random; + +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.common.world.decoration.IBOPDecoration; + +public abstract class ForcedWorldGeneratorBOP implements IWorldGeneratorBOP +{ + @Override + public abstract void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int x, int z) throws Exception; +} diff --git a/src/main/java/biomesoplenty/common/world/generation/IWorldGeneratorBOP.java b/src/main/java/biomesoplenty/common/world/generation/IWorldGeneratorBOP.java new file mode 100644 index 000000000..81fb80254 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/generation/IWorldGeneratorBOP.java @@ -0,0 +1,14 @@ +package biomesoplenty.common.world.generation; + +import java.lang.reflect.Field; +import java.util.Random; + +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.common.world.decoration.IBOPDecoration; + +public interface IWorldGeneratorBOP +{ + public void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int randX, int randZ) throws Exception; +} diff --git a/src/main/java/biomesoplenty/common/world/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java similarity index 86% rename from src/main/java/biomesoplenty/common/world/WorldGenFieldAssociation.java rename to src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index 84eb2cd5b..43ad7e38c 100644 --- a/src/main/java/biomesoplenty/common/world/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -1,8 +1,10 @@ -package biomesoplenty.common.world; +package biomesoplenty.common.world.generation; import java.util.HashMap; +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.WorldGenerator; import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.common.world.features.WorldGenBOPFlora; @@ -38,6 +40,9 @@ public class WorldGenFieldAssociation associateField("poisonIvyPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 7)); associateField("berryBushesPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 8)); associateField("portobellosPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("mushrooms"), 1)); + associateField("koruPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 12)); + associateField("toadstoolsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("mushrooms"), 0)); + associateField("blueMilksPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("mushrooms"), 2)); 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 new file mode 100644 index 000000000..ab3cf7b4e --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGeneratorBOP.java @@ -0,0 +1,15 @@ +package biomesoplenty.common.world.generation; + +import java.lang.reflect.Field; +import java.util.Random; + +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.common.world.decoration.IBOPDecoration; + +public abstract class WorldGeneratorBOP extends WorldGenerator implements IWorldGeneratorBOP +{ + @Override + public abstract void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int x, int z) throws Exception; +}