From fb5b6ef118a7a2b6dfbb50305b95e9af4356c588 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Sat, 11 Jan 2014 17:56:44 +1100 Subject: [PATCH] Readded the Shield and Seasonal Forest --- .../common/biomes/BiomeGenRedwoodForest.java | 10 +- .../common/biomes/BiomeGenSeasonalForest.java | 157 +++++++++--------- .../common/biomes/BiomeGenShield.java | 111 +++++++------ .../biomesoplenty/common/core/BOPBiomes.java | 12 +- .../world/decoration/BOPWorldFeatures.java | 1 + .../world/features/WorldGenSplotches.java | 11 ++ .../generation/WorldGenFieldAssociation.java | 1 + 7 files changed, 168 insertions(+), 135 deletions(-) diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenRedwoodForest.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenRedwoodForest.java index e1f3a6904..1318e9f9b 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenRedwoodForest.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenRedwoodForest.java @@ -6,6 +6,7 @@ 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; @@ -16,10 +17,17 @@ import biomesoplenty.common.world.features.trees.WorldGenRedwoodTree2; public class BiomeGenRedwoodForest extends BOPBiome { - + private static final Height biomeHeight = new Height(0.4F, 0.4F); + public BiomeGenRedwoodForest(int id) { super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(7187004); + this.setTemperatureRainfall(0.8F, 0.4F); this.theBiomeDecorator.treesPerChunk = 75; this.theBiomeDecorator.grassPerChunk = 16; diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenSeasonalForest.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenSeasonalForest.java index 73674ba00..4fe1dc2b8 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenSeasonalForest.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenSeasonalForest.java @@ -1,118 +1,111 @@ package biomesoplenty.common.biomes; -import net.minecraft.world.biome.BiomeGenBase; +import java.util.HashMap; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenBOPBigTree; +import biomesoplenty.common.world.features.trees.WorldGenOriginalTree; public class BiomeGenSeasonalForest extends BOPBiome { + private static final Height biomeHeight = new Height(0.3F, 0.7F); - @SuppressWarnings("unchecked") - public BiomeGenSeasonalForest(int par1) + public BiomeGenSeasonalForest(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 = 8; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.toadstoolsPerChunk = 4; - customBiomeDecorator.wheatGrassPerChunk = 4; - customBiomeDecorator.shrubsPerChunk = 15; - customBiomeDecorator.waterReedsPerChunk = 4; - */ - } + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(12502092); + this.setTemperatureRainfall(0.7F, 0.8F); - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new WorldGenTallGrass( - Blocks.foliage.get().blockID, 2) : new WorldGenTallGrass( - Blocks.foliage.get().blockID, 1); - } - */ + this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 4)); - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new WorldGenAutumn2(false) - : (par1Random.nextInt(3) == 0 ? new WorldGenAutumn(false) - : (par1Random.nextInt(6) == 0 ? new WorldGenAutumn2Big( - false) - : (par1Random.nextInt(6) == 0 ? new WorldGenMapleBig( - false) - : (par1Random.nextInt(3) == 0 ? new WorldGenMaple( - false) - : (par1Random.nextInt(5) == 0 ? new WorldGenDeadTree2( - false) - : (par1Random - .nextInt(6) == 0 ? worldGeneratorBigTree - : worldGeneratorTrees)))))); + this.theBiomeDecorator.treesPerChunk = 20; + this.theBiomeDecorator.grassPerChunk = 8; + this.theBiomeDecorator.flowersPerChunk = -999; + + this.bopWorldFeatures.toadstoolsPerChunk = 4; + this.bopWorldFeatures.shrubsPerChunk = 15; + this.bopWorldFeatures.waterReedsPerChunk = 4; } @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) + public HashMap getWeightedWorldGenForGrass() { - super.decorate(par1World, par2Random, par3, par4); - int var5 = 3 + par2Random.nextInt(6); + 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, 2), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 1D); + + return grassMap; + } + + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(2) == 0 ? new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves2"), 0, 3, false, 5, 3, false) + : (random.nextInt(3) == 0 ? new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves1"), 2, 0, false, 5, 3, false) + : (random.nextInt(6) == 0 ? new WorldGenBOPBigTree(Blocks.log, BOPBlockHelper.get("leaves2"), 0, 3) + : (random.nextInt(6) == 0 ? new WorldGenBOPBigTree(Blocks.log, BOPBlockHelper.get("leaves3"), 0, 2) + : (random.nextInt(3) == 0 ? new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves3"), 0, 2, false, 5, 3, false) + : (random.nextInt(5) == 0 ? new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves2"), 0, 0, false, 5, 3, false) + : (random.nextInt(6) == 0 ? worldGeneratorBigTree + : worldGeneratorTrees)))))); + } + + @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); + int x = chunkX + random.nextInt(16); + int y = random.nextInt(28) + 4; + int z = chunkZ + random.nextInt(16); - Block block = Block.blocksList[var10]; - if (block != null - && block.isGenMineableReplaceable(par1World, var7, var8, - var9, Block.stone.blockID)) + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + 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 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 11781186; } - */ - /** - * 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 12502092; // return 12502595; } - */ - /** - * Fog Color - */ - /* - @Override + /*@Override public int getFogColour() { return 16764548; diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenShield.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenShield.java index 660e7c28d..7f36468c9 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenShield.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenShield.java @@ -1,45 +1,71 @@ package biomesoplenty.common.biomes; +import java.util.HashMap; +import java.util.Random; + +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.WorldGenMoss; -import net.minecraft.world.biome.BiomeGenBase; +import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2; +import biomesoplenty.common.world.features.trees.WorldGenPineTree; public class BiomeGenShield extends BOPBiome { + private static final Height biomeHeight = new Height(0.1F, 0.3F); - public BiomeGenShield(int par1) + public BiomeGenShield(int id) { - super(par1); - /* - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 7; - customBiomeDecorator.grassPerChunk = 12; - customBiomeDecorator.wheatGrassPerChunk = 6; - customBiomeDecorator.mushroomsPerChunk = 4; - customBiomeDecorator.sandPerChunk = -999; - customBiomeDecorator.sandPerChunk2 = -999; - customBiomeDecorator.gravelPerChunk = 6; - customBiomeDecorator.gravelPerChunk2 = 6; - customBiomeDecorator.shrubsPerChunk = 4; - customBiomeDecorator.waterReedsPerChunk = 4; - customBiomeDecorator.generateStoneInGrass2 = true; - */ - } + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(6586168); + this.setTemperatureRainfall(0.5F, 0.8F); - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(2) == 0 ? new WorldGenShrub(0,0) : (par1Random.nextInt(4) == 0 ? new WorldGenPineTree() : (par1Random.nextInt(6) == 0 ? new WorldGenTaiga9(false) : new WorldGenTaiga5(false))); + this.theBiomeDecorator.treesPerChunk = 7; + this.theBiomeDecorator.grassPerChunk = 12; + this.theBiomeDecorator.mushroomsPerChunk = 4; + this.theBiomeDecorator.sandPerChunk = -999; + this.theBiomeDecorator.sandPerChunk2 = -999; + + this.bopWorldFeatures.shrubsPerChunk = 4; + this.bopWorldFeatures.waterReedsPerChunk = 4; + this.bopWorldFeatures.generateStoneInGrass2 = true; } @Override - public void decorate(World par1World, Random par2Random, int par3, int par4) - { - super.decorate(par1World, par2Random, par3, par4); + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(2) == 0 ? new WorldGenShrub(0, 0) : + (random.nextInt(4) == 0 ? new WorldGenPineTree() : + (random.nextInt(6) == 0 ? new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves2"), 3, 1, false, 10, 10, 5) : + new WorldGenBOPTaiga2(Blocks.log, Blocks.leaves, 1, 1, false, 9, 9, 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 void decorate(World world, Random random, int chunkX, int chunkZ) + { + super.decorate(world, random, chunkX, chunkZ); for (int i = 0; i < 20; i++) { @@ -49,28 +75,19 @@ public class BiomeGenShield extends BOPBiome new WorldGenMoss().generate(world, random, x, y, z); } - } - */ + } - /** - * 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 6586168; } - */ - - /** - * 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 7902787; } - */ } diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index 99b73ce0e..f3cb1da71 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -47,6 +47,8 @@ import biomesoplenty.common.biomes.BiomeGenQuagmire; import biomesoplenty.common.biomes.BiomeGenRainforest; import biomesoplenty.common.biomes.BiomeGenRedwoodForest; import biomesoplenty.common.biomes.BiomeGenSacredSprings; +import biomesoplenty.common.biomes.BiomeGenSeasonalForest; +import biomesoplenty.common.biomes.BiomeGenShield; import biomesoplenty.common.biomes.BiomeGenShrubland; import biomesoplenty.common.biomes.BiomeGenThicket; import biomesoplenty.common.configuration.BOPConfigurationIDs; @@ -134,8 +136,8 @@ public class BOPBiomes 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)); - /*registerBiome(new BOPBiomeListEntry(new BiomeGenSeasonalForest(BOPConfigurationIDs.seasonalForestID).setBiomeName("Seasonal Forest"), BOPBiomeTemperatureType.COOL)); - registerBiome(new BOPBiomeListEntry(new BiomeGenShield(BOPConfigurationIDs.shieldID).setBiomeName("Shield"), BOPBiomeTemperatureType.COOL));*/ + registerBiome(new BOPBiomeListEntry(new BiomeGenSeasonalForest(BOPConfigurationIDs.seasonalForestID).setBiomeName("Seasonal Forest"), BOPBiomeTemperatureType.COOL)); + registerBiome(new BOPBiomeListEntry(new BiomeGenShield(BOPConfigurationIDs.shieldID).setBiomeName("Shield"), BOPBiomeTemperatureType.COOL)); registerBiome(new BOPBiomeListEntry(new BiomeGenShrubland(BOPConfigurationIDs.shrublandID).setBiomeName("Shrubland"), BOPBiomeTemperatureType.COOL)); //registerBiome(new BOPBiomeListEntry(new BiomeGenSilkglades(BOPConfigurationIDs.silkgladesID).setBiomeName("Silkglades"), BOPBiomeTemperatureType.COOL)); /*registerBiome(new BOPBiomeListEntry(new BiomeGenSludgepit(BOPConfigurationIDs.sludgepitID).setBiomeName("Sludgepit"), BOPBiomeTemperatureType.WARM)); @@ -145,9 +147,9 @@ public class BOPBiomes /*registerBiome(new BOPBiomeListEntry(new BiomeGenTimber(BOPConfigurationIDs.timberID).setBiomeName("Timber"), BOPBiomeTemperatureType.COOL)); registerBiome(new BOPBiomeListEntry(new BiomeGenTropicalRainforest(BOPConfigurationIDs.tropicalRainforestID).setBiomeName("Tropical Rainforest"), BOPBiomeTemperatureType.HOT)); registerBiome(new BOPBiomeListEntry(new BiomeGenTropics(BOPConfigurationIDs.tropicsID).setBiomeName("Tropics"), BOPBiomeTemperatureType.HOT)); - registerBiome(new BOPBiomeListEntry(new BiomeGenTundra(BOPConfigurationIDs.tundraID).setBiomeName("Tundra"), BOPBiomeTemperatureType.ICY)); - registerBiome(new BOPBiomeListEntry(new BiomeGenVolcano(BOPConfigurationIDs.volcanoID).setBiomeName("Volcano"), BOPBiomeTemperatureType.HOT)); - registerBiome(new BOPBiomeListEntry(new BiomeGenWasteland(BOPConfigurationIDs.wastelandID).setBiomeName("Wasteland"), BOPBiomeTemperatureType.HOT)); + registerBiome(new BOPBiomeListEntry(new BiomeGenTundra(BOPConfigurationIDs.tundraID).setBiomeName("Tundra"), BOPBiomeTemperatureType.ICY));*/ + //registerBiome(new BOPBiomeListEntry(new BiomeGenVolcano(BOPConfigurationIDs.volcanoID).setBiomeName("Volcano"), BOPBiomeTemperatureType.HOT)); + /*registerBiome(new BOPBiomeListEntry(new BiomeGenWasteland(BOPConfigurationIDs.wastelandID).setBiomeName("Wasteland"), BOPBiomeTemperatureType.HOT)); registerBiome(new BOPBiomeListEntry(new BiomeGenWetland(BOPConfigurationIDs.wetlandID).setBiomeName("Wetland"), BOPBiomeTemperatureType.WARM)); registerBiome(new BOPBiomeListEntry(new BiomeGenWoodland(BOPConfigurationIDs.woodlandID).setBiomeName("Woodland"), 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 60fba69a2..a10da422d 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -6,6 +6,7 @@ public class BOPWorldFeatures public boolean generateQuicksand = false; public boolean generateCanyon = false; public boolean generateStoneInGrass = false; + public boolean generateStoneInGrass2 = false; public boolean generateGrass = false; public boolean generateSand = false; public boolean generateQuagmire = false; diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java b/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java index 4bd6b7222..c562f2445 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java @@ -130,6 +130,17 @@ public class WorldGenSplotches extends WorldGeneratorBOP worldGenerator.generate(world, random, randX, randY, randZ); } } + else if (fieldName.equals("generateStoneInGrass2") && bopDecoration.getWorldFeatures().generateStoneInGrass2) + { + for (int i = 0; i < 20; ++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); + } + } else if (fieldName.equals("generateGrass") && bopDecoration.getWorldFeatures().generateGrass) { for (int i = 0; i < 15; ++i) diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index d4da13e9f..720d4a4a5 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -30,6 +30,7 @@ public class WorldGenFieldAssociation associateField("generateQuicksand", new WorldGenSplotches(BOPBlockHelper.get("mud"), 1, 24, Blocks.grass, Blocks.dirt, Blocks.sand)); associateField("generateCanyon", new WorldGenSplotches(BOPBlockHelper.get("redRock"), 0, 48, Blocks.stone)); associateField("generateStoneInGrass", new WorldGenSplotches(Blocks.stone, 0, 32, Blocks.grass, BOPBlockHelper.get("holyGrass"))); + associateField("generateStoneInGrass2", new WorldGenSplotches(Blocks.stone, 0, 48, Blocks.grass, Blocks.dirt)); 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")));