From 9ed744df0228fd5dcbfd220688fb07ac19f9f8ca Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 9 Jan 2014 18:26:21 +1100 Subject: [PATCH] Bugfixing and readded the Maple Woods --- .../biomesoplenty/common/biomes/BOPBiome.java | 4 +- .../common/biomes/BiomeGenLushDesert.java | 6 +- .../common/biomes/BiomeGenMapleWoods.java | 118 ++++++++++++------ .../biomesoplenty/common/core/BOPBiomes.java | 3 +- .../world/DecorateBiomeEventHandler.java | 2 +- .../features/trees/WorldGenBOPTaiga2.java | 6 + 6 files changed, 92 insertions(+), 47 deletions(-) diff --git a/src/main/java/biomesoplenty/common/biomes/BOPBiome.java b/src/main/java/biomesoplenty/common/biomes/BOPBiome.java index 00c306de7..747433891 100644 --- a/src/main/java/biomesoplenty/common/biomes/BOPBiome.java +++ b/src/main/java/biomesoplenty/common/biomes/BOPBiome.java @@ -34,7 +34,7 @@ public abstract class BOPBiome extends BiomeGenBase implements IBOPDecoration { Throwable cause = e.getCause(); - if (e.getMessage().equals("Already decorating!!") || (cause != null && cause.getMessage().equals("Already decorating!!"))) + if (e.getMessage() != null && e.getMessage().equals("Already decorating!!") || (cause != null && cause.getMessage() != null && cause.getMessage().equals("Already decorating!!"))) { } else @@ -60,7 +60,7 @@ public abstract class BOPBiome extends BiomeGenBase implements IBOPDecoration @Override public WorldGenerator getRandomWorldGenForGrass(Random random) { - if (!getWeightedWorldGenForGrass().isEmpty()) + if (getWeightedWorldGenForBOPFlowers() != null && !getWeightedWorldGenForGrass().isEmpty()) { return getRandomWeightedWorldGenerator(getWeightedWorldGenForGrass()); } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenLushDesert.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenLushDesert.java index 9d076903a..eb8df530a 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenLushDesert.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenLushDesert.java @@ -20,7 +20,7 @@ import net.minecraft.world.gen.feature.WorldGenerator; public class BiomeGenLushDesert extends BOPBiome { - private static final Height biomeHeight = new Height(0.2F, 0.4F); + private static final Height biomeHeight = new Height(0.2F, 0.9F); public BiomeGenLushDesert(int id) { @@ -29,8 +29,8 @@ public class BiomeGenLushDesert extends BOPBiome //TODO: setHeight() this.func_150570_a(biomeHeight); //TODO: setColor() - this.setColor(10739795); - this.setTemperatureRainfall(1.2F, 0.9F); + this.setColor(9087277); + this.setTemperatureRainfall(0.8F, 0.2F); this.spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 6)); diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenMapleWoods.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenMapleWoods.java index 304b30f99..9d0c2aa65 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenMapleWoods.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenMapleWoods.java @@ -1,54 +1,92 @@ 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.WorldGenBOPTaiga2; +import biomesoplenty.common.world.features.trees.WorldGenOriginalTree; public class BiomeGenMapleWoods extends BOPBiome { - - public BiomeGenMapleWoods(int par1) + private static final Height biomeHeight = new Height(0.3F, 0.6F); + + public BiomeGenMapleWoods(int id) { - super(par1); - /* - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 9; - customBiomeDecorator.grassPerChunk = 1; - customBiomeDecorator.wheatGrassPerChunk = 1; - customBiomeDecorator.violetsPerChunk = 2; - customBiomeDecorator.poisonIvyPerChunk = 1; - customBiomeDecorator.shrubsPerChunk = 2; - */ + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(6988649); + this.setTemperatureRainfall(0.2F, 0.8F); + + this.theBiomeDecorator.treesPerChunk = 9; + this.theBiomeDecorator.grassPerChunk = 1; + + this.bopWorldFeatures.bopFlowersPerChunk = 2; + this.bopWorldFeatures.poisonIvyPerChunk = 1; + this.bopWorldFeatures.shrubsPerChunk = 2; } - /** - * Gets a WorldGen appropriate for this biome. - */ - /* @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(6) == 0 ? new WorldGenTaiga5(false) : new WorldGenMaple(false); + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(6) == 0 ? new WorldGenBOPTaiga2(Blocks.log, Blocks.leaves, 1, 1, false, 9, 9, 6) : + new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves3"), 0, 2, false, 5, 3, false); } - @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 3 + par2Random.nextInt(6); + @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 HashMap getWeightedWorldGenForBOPFlowers() + { + HashMap flowerMap = new HashMap(); + + flowerMap.put(new WorldGenBOPFlora(BOPBlockHelper.get("flowers"), 8), 1D); + + return flowerMap; + } + + @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 var7 = par3 + par2Random.nextInt(16); - int var8 = par2Random.nextInt(28) + 4; - int var9 = par4 + par2Random.nextInt(16); - int var10 = par1World.getBlockId(var7, var8, var9); + for (int var6 = 0; var6 < var5; ++var6) + { + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); - Block block = Block.blocksList[var10]; - if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID)) - { - par1World.setBlock(var7, var8, var9, Block.oreEmerald.blockID, 0, 2); - } - } - } - */ + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 0, 2); + } + } + } } diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index 80f895940..4ecfdb1f1 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -32,6 +32,7 @@ import biomesoplenty.common.biomes.BiomeGenJadeCliffs; import biomesoplenty.common.biomes.BiomeGenLavenderFields; import biomesoplenty.common.biomes.BiomeGenLushDesert; import biomesoplenty.common.biomes.BiomeGenLushSwamp; +import biomesoplenty.common.biomes.BiomeGenMapleWoods; import biomesoplenty.common.biomes.BiomeGenMarsh; import biomesoplenty.common.biomes.BiomeGenMountain; import biomesoplenty.common.biomes.BiomeGenOminousWoods; @@ -110,7 +111,7 @@ public class BOPBiomes registerBiome(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)); diff --git a/src/main/java/biomesoplenty/common/eventhandler/world/DecorateBiomeEventHandler.java b/src/main/java/biomesoplenty/common/eventhandler/world/DecorateBiomeEventHandler.java index cb49147d3..94e36980d 100644 --- a/src/main/java/biomesoplenty/common/eventhandler/world/DecorateBiomeEventHandler.java +++ b/src/main/java/biomesoplenty/common/eventhandler/world/DecorateBiomeEventHandler.java @@ -90,7 +90,7 @@ public class DecorateBiomeEventHandler { Throwable cause = e.getCause(); - if (e.getMessage().equals("Already decorating!!") || (cause != null && cause.getMessage().equals("Already decorating!!"))) + if (e.getMessage() != null && e.getMessage().equals("Already decorating!!") || (cause != null && cause.getMessage() != null && cause.getMessage().equals("Already decorating!!"))) { } else 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 978c6c520..e7981a6f8 100644 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPTaiga2.java +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPTaiga2.java @@ -76,6 +76,12 @@ public class WorldGenBOPTaiga2 extends WorldGenAbstractTree j1 = l - i1; k1 = 2 + random.nextInt(2); break; + + case 6: + i1 = 2 + random.nextInt(4); + j1 = l - i1; + k1 = 2 + random.nextInt(2); + break; default: i1 = 1 + random.nextInt(2);