From e3244afa65ec3cbdfdeaa58a11344f674511dcc8 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Fri, 10 Jan 2014 20:12:25 +1100 Subject: [PATCH] Readded the Quagmire --- .../common/biomes/BiomeGenQuagmire.java | 210 +++++++++--------- .../biomesoplenty/common/core/BOPBiomes.java | 3 +- .../world/decoration/BOPWorldFeatures.java | 1 + .../world/features/WorldGenSplotches.java | 11 + .../generation/WorldGenFieldAssociation.java | 1 + 5 files changed, 119 insertions(+), 107 deletions(-) diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenQuagmire.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenQuagmire.java index 494b6ec8a..027bd04b7 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenQuagmire.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenQuagmire.java @@ -1,128 +1,126 @@ package biomesoplenty.common.biomes; -import net.minecraft.world.biome.BiomeGenBase; +import java.util.HashMap; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.configuration.BOPConfigurationMisc; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; public class BiomeGenQuagmire extends BOPBiome { + private static final Height biomeHeight = new Height(0.2F, 0.3F); + + public BiomeGenQuagmire(int id) + { + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(5257771); + this.setTemperatureRainfall(0.8F, 0.9F); - public BiomeGenQuagmire(int par1) - { - super(par1); - /* - spawnableCreatureList.clear(); - spawnableWaterCreatureList.clear(); - topBlock = (byte)Blocks.mud.get().blockID; - fillerBlock = (byte)Blocks.mud.get().blockID; - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 0; - customBiomeDecorator.grassPerChunk = 10; - customBiomeDecorator.mushroomsPerChunk = 3; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.sandPerChunk = -999; - customBiomeDecorator.sandPerChunk2 = -999; - customBiomeDecorator.wheatGrassPerChunk = 3; - customBiomeDecorator.waterReedsPerChunk = 2; - customBiomeDecorator.koruPerChunk = 1; - waterColorMultiplier = 13390080; - customBiomeDecorator.generateQuagmire = true; - */ - } - - /* - @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 12 + par2Random.nextInt(6); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); - for (int var6 = 0; var6 < var5; ++var6) - { - int var7 = par3 + par2Random.nextInt(16); - int var8 = par2Random.nextInt(28) + 4; - int var9 = par4 + par2Random.nextInt(16); - int var10 = par1World.getBlockId(var7, var8, var9); + this.waterColorMultiplier = 13390080; - Block block = Block.blocksList[var10]; - if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID)) - { - par1World.setBlock(var7, var8, var9, Blocks.amethystOre.get().blockID, 10, 2); - } - } - } - */ + this.topBlock = BOPBlockHelper.get("mud"); + this.fillerBlock = BOPBlockHelper.get("mud"); + this.theBiomeDecorator.treesPerChunk = 0; + this.theBiomeDecorator.grassPerChunk = 10; + this.theBiomeDecorator.mushroomsPerChunk = 3; + this.theBiomeDecorator.flowersPerChunk = -999; + this.theBiomeDecorator.sandPerChunk = -999; + this.theBiomeDecorator.sandPerChunk2 = -999; - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return new WorldGenDeadTree(false); - } - */ + this.bopWorldFeatures.waterReedsPerChunk = 2; + this.bopWorldFeatures.koruPerChunk = 1; + this.bopWorldFeatures.generateQuagmire = true; + } - /** - * Provides the basic grass color based on the biome temperature and rainfall - */ - /* - @Override - public int getBiomeGrassColor() - { - return 10390377; - } - */ + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("mud")); + } - /** - * Provides the basic foliage color based on the biome temperature and rainfall - */ - /* - @Override - public int getBiomeFoliageColor() - { - return 10390377; - } - - @Override + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 1D); + + return grassMap; + } + + @Override + public void decorate(World world, Random random, int chunkX, int chunkZ) + { + super.decorate(world, random, chunkX, chunkZ); + int var5 = 12 + random.nextInt(6); + + for (int var6 = 0; var6 < var5; ++var6) + { + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 10, 2); + } + } + } + + @Override + //TODO: getBiomeGrassColor() + public int func_150558_b(int p_150558_1_, int p_150558_2_, int p_150558_3_) + { + return 10390377; + } + + @Override + //TODO: getBiomeFoliageColor() + public int func_150571_c(int x, int y, int z) + { + return 10390377; + } + + @Override + public int getSkyColorByTemp(float par1) + { + if (BOPConfigurationMisc.skyColors) return 12436670; + else return super.getSkyColorByTemp(par1); + } + + /*@Override public int getFogColour() { return 13291213; } - + @Override public float getFogCloseness() { // TODO Auto-generated method stub return 0.6F; } - */ - - /** - * takes temperature, returns color - */ - /* - @Override - public int getSkyColorByTemp(float par1) - { - if (BOPConfigurationMisc.skyColors) - return 12436670; - else - { - par1 /= 3.0F; - - if (par1 < -1.0F) - { - par1 = -1.0F; - } - - if (par1 > 1.0F) - { - par1 = 1.0F; - } - - return Color.getHSBColor(0.62222224F - par1 * 0.05F, 0.5F + par1 * 0.1F, 1.0F).getRGB(); - } - } - */ + */ } diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index 8f6fc2d72..1be9e65e0 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -43,6 +43,7 @@ import biomesoplenty.common.biomes.BiomeGenOriginValley; import biomesoplenty.common.biomes.BiomeGenOutback; import biomesoplenty.common.biomes.BiomeGenPasture; import biomesoplenty.common.biomes.BiomeGenPrairie; +import biomesoplenty.common.biomes.BiomeGenQuagmire; import biomesoplenty.common.biomes.BiomeGenRainforest; import biomesoplenty.common.biomes.BiomeGenSacredSprings; import biomesoplenty.common.biomes.BiomeGenShrubland; @@ -128,7 +129,7 @@ public class BOPBiomes registerBiome(new BOPBiomeListEntry(new BiomeGenOutback(BOPConfigurationIDs.outbackID).setBiomeName("Outback"), BOPBiomeTemperatureType.HOT)); registerBiome(new BOPBiomeListEntry(new BiomeGenPasture(BOPConfigurationIDs.pastureID).setBiomeName("Pasture"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenPrairie(BOPConfigurationIDs.prairieID).setBiomeName("Prairie"), BOPBiomeTemperatureType.WARM)); - /*registerBiome(new BOPBiomeListEntry(new BiomeGenQuagmire(BOPConfigurationIDs.quagmireID).setBiomeName("Quagmire"), BOPBiomeTemperatureType.WARM));*/ + registerBiome(new BOPBiomeListEntry(new BiomeGenQuagmire(BOPConfigurationIDs.quagmireID).setBiomeName("Quagmire"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenRainforest(BOPConfigurationIDs.rainforestID).setBiomeName("Rainforest"), BOPBiomeTemperatureType.WARM)); /*registerBiome(new BOPBiomeListEntry(new BiomeGenRedwoodForest(BOPConfigurationIDs.redwoodForestID).setBiomeName("Redwood Forest"), BOPBiomeTemperatureType.WARM));*/ registerBiome(new BOPBiomeListEntry(new BiomeGenSacredSprings(BOPConfigurationIDs.sacredSpringsID).setBiomeName("Sacred Springs"), BOPBiomeTemperatureType.WARM)); diff --git a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java index 8b57a5054..60fba69a2 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -8,6 +8,7 @@ public class BOPWorldFeatures public boolean generateStoneInGrass = false; public boolean generateGrass = false; public boolean generateSand = false; + public boolean generateQuagmire = false; public int waterPoolsPerChunk = 0; public int lavaPoolsPerChunk = 0; diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java b/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java index bfabbd920..4bd6b7222 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java @@ -152,5 +152,16 @@ public class WorldGenSplotches extends WorldGeneratorBOP worldGenerator.generate(world, random, randX, randY, randZ); } } + else if (fieldName.equals("generateQuagmire") && bopDecoration.getWorldFeatures().generateQuagmire) + { + for (int i = 0; i < 15; ++i) + { + int randX = x + random.nextInt(16); + int randY = random.nextInt(64) + 64; + int randZ = z + random.nextInt(16); + + worldGenerator.generate(world, random, randX, randY, randZ); + } + } } } diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index 59d4ed4ff..d4da13e9f 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -32,6 +32,7 @@ public class WorldGenFieldAssociation associateField("generateStoneInGrass", new WorldGenSplotches(Blocks.stone, 0, 32, Blocks.grass, BOPBlockHelper.get("holyGrass"))); associateField("generateGrass", new WorldGenSplotches(Blocks.grass, 0, 48, BOPBlockHelper.get("redRock"))); associateField("generateSand", new WorldGenSplotches(Blocks.sand, 0, 32, BOPBlockHelper.get("redRock"))); + associateField("generateQuagmire", new WorldGenSplotches(Blocks.grass, 0, 48, BOPBlockHelper.get("mud"))); associateField("waterPoolsPerChunk", new WorldGenLiquids(Blocks.flowing_water)); associateField("lavaPoolsPerChunk", new WorldGenLiquids(Blocks.flowing_lava));