diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java index 93ef263a8..289b28bd3 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenBrushland.java @@ -1,47 +1,56 @@ package biomesoplenty.common.biomes; import java.util.HashMap; +import java.util.Random; -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.WorldGenAbstractTree; import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenBrush1; +import biomesoplenty.common.world.features.trees.WorldGenBrush2; +import biomesoplenty.common.world.features.trees.WorldGenChaparral2; public class BiomeGenBrushland extends BOPBiome { - + private static final Height biomeHeight = new Height(0.3F, 0.3F); + public BiomeGenBrushland(int id) { super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(13222271); + this.setTemperatureRainfall(2.0F, 0.05F); this.theBiomeDecorator.treesPerChunk = 10; this.theBiomeDecorator.grassPerChunk = 6; this.theBiomeDecorator.flowersPerChunk = -999; - /*customBiomeDecorator.thornsPerChunk = 4; - customBiomeDecorator.shrubsPerChunk = 30; - customBiomeDecorator.waterReedsPerChunk = 2; - customBiomeDecorator.generateQuicksand = true;*/ + this.bopWorldFeatures.thornsPerChunk = 4; + this.bopWorldFeatures.shrubsPerChunk = 30; + this.bopWorldFeatures.waterReedsPerChunk = 2; + this.bopWorldFeatures.generateQuicksand = true; } - - /* @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) { - return par1Random.nextInt(2) == 0 ? new WorldGenBrush2() : (par1Random.nextInt(5) == 0 ? new WorldGenBrush1() : new WorldGenChaparral2()); + return random.nextInt(2) == 0 ? new WorldGenBrush2() : (random.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); + 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; } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenCanyon.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenCanyon.java index db3dd44e5..f82e50520 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenCanyon.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenCanyon.java @@ -1,80 +1,100 @@ package biomesoplenty.common.biomes; +import java.util.HashMap; +import java.util.Random; + +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; +import biomesoplenty.common.world.features.trees.WorldGenBOPShrub; +import biomesoplenty.common.world.features.trees.WorldGenPineTree; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.BiomeGenBase.Height; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenerator; public class BiomeGenCanyon extends BOPBiome { + private static final Height biomeHeight = new Height(1.5F, 2.0F); - public BiomeGenCanyon(int par1) + public BiomeGenCanyon(int id) { - super(par1); - /* - spawnableCreatureList.clear(); - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - topBlock = (byte)Blocks.hardDirt.get().blockID; - fillerBlock = (byte)Blocks.hardDirt.get().blockID; - customBiomeDecorator.treesPerChunk = 7; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.canyonGrassPerChunk = 5; - customBiomeDecorator.aloePerChunk = 2; - customBiomeDecorator.waterReedsPerChunk = 2; - customBiomeDecorator.generatePumpkins = false; - customBiomeDecorator.generateCanyon = true; - */ + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(11836528); + this.setTemperatureRainfall(0.8F, 0.4F); + + this.spawnableCreatureList.clear(); + + this.topBlock = BOPBlockHelper.get("hardDirt"); + this.fillerBlock = BOPBlockHelper.get("hardDirt"); + this.theBiomeDecorator.grassPerChunk = 5; + this.theBiomeDecorator.treesPerChunk = 7; + this.theBiomeDecorator.flowersPerChunk = -999; + + this.bopWorldFeatures.bromeliadsPerChunk = 2; + this.bopWorldFeatures.waterReedsPerChunk = 2; + this.bopWorldFeatures.generatePumpkins = false; + this.bopWorldFeatures.generateCanyon = true; } - /** - * 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(9) == 0 ? new WorldGenPineTree() : new WorldGenCanyonShrub(0,0); + return random.nextInt(9) == 0 ? new WorldGenPineTree() : new WorldGenBOPShrub(Blocks.log2, Blocks.leaves2, 0, 0, 86, 96, BOPBlockHelper.get("hardDirt")); } + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 2), 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 = 12 + 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, Blocks.amethystOre.get().blockID, 2, 2); + //TODO: setBlock() + world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 2, 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 11123300; } - */ - /** - * Provides the basic foliage 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 11123300; } - */ } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenDeadForest.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenDeadForest.java index e5dcf1de7..d0e28d947 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenDeadForest.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenDeadForest.java @@ -1,91 +1,83 @@ package biomesoplenty.common.biomes; -import net.minecraft.world.biome.BiomeGenBase; +import java.util.HashMap; +import java.util.Random; + +import net.minecraft.init.Blocks; +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.WorldGenBOPTaiga2; +import biomesoplenty.common.world.features.trees.WorldGenDeadTree1; +import biomesoplenty.common.world.features.trees.WorldGenOriginalTree; public class BiomeGenDeadForest extends BOPBiome { + private static final Height biomeHeight = new Height(0.2F, 0.7F); - public BiomeGenDeadForest(int par1) + public BiomeGenDeadForest(int id) { - super(par1); - /* - theBiomeDecorator = new BiomeDecoratorBOP(this); - customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; - customBiomeDecorator.treesPerChunk = 3; - customBiomeDecorator.grassPerChunk = 1; - customBiomeDecorator.thornsPerChunk = 2; - customBiomeDecorator.flowersPerChunk = -999; - customBiomeDecorator.reedsPerChunk = -999; - customBiomeDecorator.wheatGrassPerChunk = 1; - customBiomeDecorator.shrubsPerChunk = 2; - customBiomeDecorator.waterReedsPerChunk = 2; - */ + super(id); + + //TODO: setHeight() + this.func_150570_a(biomeHeight); + //TODO: setColor() + this.setColor(12362085); + this.setTemperatureRainfall(1.2F, 0.1F); + + this.theBiomeDecorator.treesPerChunk = 3; + this.theBiomeDecorator.grassPerChunk = 1; + this.theBiomeDecorator.flowersPerChunk = -999; + this.theBiomeDecorator.reedsPerChunk = -999; + + this.bopWorldFeatures.shrubsPerChunk = 2; + this.bopWorldFeatures.thornsPerChunk = 2; + this.bopWorldFeatures.waterReedsPerChunk = 2; + } + + @Override + public HashMap getWeightedWorldGenForGrass() + { + HashMap grassMap = new HashMap(); + + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 0), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 1D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D); + grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D); + + return grassMap; + } + + @Override + //TODO: getRandomWorldGenForTrees() + public WorldGenAbstractTree func_150567_a(Random random) + { + return random.nextInt(3) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("mud")) : + (random.nextInt(4) == 0 ? new WorldGenBOPTaiga2(Blocks.log, Blocks.leaves, 1, 1, false, 9, 9, 2, 4, 2, 4) : + new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves2"), 0, 0, false, 5, 3, false)); } - /** - * Gets a WorldGen appropriate for this biome. - */ - /* @Override - public WorldGenerator getRandomWorldGenForGrass(Random par1Random) - { - return par1Random.nextInt(9) == 0 ? new WorldGenTallGrass(Block.tallGrass.blockID, 0) : new WorldGenTallGrass(Blocks.foliage.get().blockID, 1); - } - */ - - /** - * Gets a WorldGen appropriate for this biome. - */ - /* - @Override - public WorldGenerator getRandomWorldGenForTrees(Random par1Random) - { - return par1Random.nextInt(3) == 0 ? new WorldGenDeadTree(false) : (par1Random.nextInt(4) == 0 ? new WorldGenTaiga5(false): new WorldGenDeadTree2(false)); - } - */ - - /** - * 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 12362085; } @Override - public int getBiomeFoliageColor() + //TODO: getBiomeFoliageColor() + public int func_150571_c(int x, int y, int z) { return 12362085; } - */ - /** - * takes temperature, returns color - */ - /* @Override public int getSkyColorByTemp(float par1) { - if (BOPConfigurationMisc.skyColors) - return 9873591; - 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(); - } + if (BOPConfigurationMisc.skyColors) return 9873591; + else return super.getSkyColorByTemp(par1); } - */ } diff --git a/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java b/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java index 710919c90..edc033ea1 100644 --- a/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java +++ b/src/main/java/biomesoplenty/common/biomes/BiomeGenHighland.java @@ -3,14 +3,12 @@ package biomesoplenty.common.biomes; import java.util.HashMap; import java.util.Random; -import biomesoplenty.api.BOPBlockHelper; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.biome.BiomeGenBase.Height; -import net.minecraft.world.gen.feature.WorldGenTallGrass; import net.minecraft.world.gen.feature.WorldGenerator; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.world.features.WorldGenBOPTallGrass; public class BiomeGenHighland extends BOPBiome { @@ -38,9 +36,9 @@ public class BiomeGenHighland extends BOPBiome { 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); + 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; } diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index 030710cdd..083a57e6c 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -8,8 +8,11 @@ import biomesoplenty.common.biomes.BiomeGenAlps; import biomesoplenty.common.biomes.BiomeGenArctic; import biomesoplenty.common.biomes.BiomeGenBambooForest; import biomesoplenty.common.biomes.BiomeGenBorealForest; +import biomesoplenty.common.biomes.BiomeGenBrushland; +import biomesoplenty.common.biomes.BiomeGenCanyon; import biomesoplenty.common.biomes.BiomeGenCherryBlossomGrove; import biomesoplenty.common.biomes.BiomeGenCrag; +import biomesoplenty.common.biomes.BiomeGenDeadForest; import biomesoplenty.common.biomes.BiomeGenDeciduousForest; import biomesoplenty.common.biomes.BiomeGenDunes; import biomesoplenty.common.biomes.BiomeGenFlowerField; @@ -73,15 +76,15 @@ public class BOPBiomes //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 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 BiomeGenBrushland(BOPConfigurationIDs.brushlandID).setBiomeName("Brushland"), BOPBiomeTemperatureType.HOT)); + registerOnlyBiome(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 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 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 BiomeGenDunes(BOPConfigurationIDs.dunesID).setBiomeName("Dunes"), BOPBiomeTemperatureType.HOT)); /*registerBiome(new BOPBiomeListEntry(new BiomeGenFen(BOPConfigurationIDs.fenID).setBiomeName("Fen"), 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 c8583ad8e..60eae1b49 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -2,6 +2,13 @@ package biomesoplenty.common.world.decoration; public class BOPWorldFeatures { + public boolean generatePumpkins = true; + public boolean generateQuicksand = false; + public boolean generateCanyon = false; + + public int waterPondsPerChunk = 0; + public int lavaPondsPerChunk = 0; + public int mudPerChunk = 0; public int riverCanePerChunk = 0; public int shrubsPerChunk = 0; @@ -18,15 +25,10 @@ public class BOPWorldFeatures 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 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 e22d5d945..27a962809 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenBOPFlora.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenBOPFlora.java @@ -57,8 +57,9 @@ public class WorldGenBOPFlora extends WorldGeneratorBOP { int randX = x + random.nextInt(16); int randZ = z + random.nextInt(16); + int randY = random.nextInt(world.getHeightValue(randX, randZ)); - worldGenerator.generate(world, random, randX, world.getTopSolidOrLiquidBlock(randX, randZ), randZ); + worldGenerator.generate(world, random, randX, randY, 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 58c19670c..a02ddaac2 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenBOPTallGrass.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenBOPTallGrass.java @@ -60,8 +60,9 @@ public class WorldGenBOPTallGrass extends WorldGeneratorBOP { int randX = x + random.nextInt(16); int randZ = z + random.nextInt(16); + int randY = random.nextInt(world.getHeightValue(randX, randZ)); - worldGenerator.generate(world, random, randX, world.getTopSolidOrLiquidBlock(randX, randZ), randZ); + worldGenerator.generate(world, random, randX, randY, 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 39a0c52e3..db1b8e68b 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenMoss.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenMoss.java @@ -57,8 +57,9 @@ public class WorldGenMoss extends WorldGeneratorBOP { int randX = x + random.nextInt(16); int randZ = z + random.nextInt(16); + int randY = random.nextInt(world.getHeightValue(randX, randZ)); - worldGenerator.generate(world, random, randX, world.getTopSolidOrLiquidBlock(randX, randZ), randZ); + worldGenerator.generate(world, random, randX, randY, randZ); } } } diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenRiverCane.java b/src/main/java/biomesoplenty/common/world/features/WorldGenRiverCane.java index d16436c14..d2201375a 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenRiverCane.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenRiverCane.java @@ -49,8 +49,9 @@ public class WorldGenRiverCane extends WorldGeneratorBOP { int randX = x + random.nextInt(16); int randZ = z + random.nextInt(16); + int randY = random.nextInt(world.getHeightValue(randX, randZ)); - worldGenerator.generate(world, random, randX, world.getTopSolidOrLiquidBlock(randX, randZ), randZ); + worldGenerator.generate(world, random, randX, randY, randZ); } } } diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java b/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java new file mode 100644 index 000000000..53d250c3c --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java @@ -0,0 +1,115 @@ +package biomesoplenty.common.world.features; + +import java.lang.reflect.Field; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +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 WorldGenSplotches extends WorldGeneratorBOP +{ + private Block splotchBlock; + private int splotchBlockMeta; + + private int numberOfBlocks; + + public WorldGenSplotches(Block quicksandBlock, int quicksandBlockMeta, int numberOfBlocks) + { + this.splotchBlock = quicksandBlock; + this.splotchBlockMeta = quicksandBlockMeta; + this.numberOfBlocks = numberOfBlocks; + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + float var6 = random.nextFloat() * (float)Math.PI; + double var7 = x + MathHelper.sin(var6) * numberOfBlocks / 8.0F; + double var9 = x - MathHelper.sin(var6) * numberOfBlocks / 8.0F; + double var11 = z + MathHelper.cos(var6) * numberOfBlocks / 8.0F; + double var13 = z - MathHelper.cos(var6) * numberOfBlocks / 8.0F; + double var15 = y + random.nextInt(3) - 2; + double var17 = y + random.nextInt(3) - 2; + + for (int var19 = 0; var19 <= numberOfBlocks; ++var19) + { + double var20 = var7 + (var9 - var7) * var19 / numberOfBlocks; + double var22 = var15 + (var17 - var15) * var19 / numberOfBlocks; + double var24 = var11 + (var13 - var11) * var19 / numberOfBlocks; + double var26 = random.nextDouble() * numberOfBlocks / 16.0D; + double var28 = (MathHelper.sin(var19 * (float)Math.PI / numberOfBlocks) + 1.0F) * var26 + 1.0D; + double var30 = (MathHelper.sin(var19 * (float)Math.PI / numberOfBlocks) + 1.0F) * var26 + 1.0D; + int var32 = MathHelper.floor_double(var20 - var28 / 2.0D); + int var33 = MathHelper.floor_double(var22 - var30 / 2.0D); + int var34 = MathHelper.floor_double(var24 - var28 / 2.0D); + int var35 = MathHelper.floor_double(var20 + var28 / 2.0D); + int var36 = MathHelper.floor_double(var22 + var30 / 2.0D); + int var37 = MathHelper.floor_double(var24 + var28 / 2.0D); + + for (int var38 = var32; var38 <= var35; ++var38) + { + double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D); + + if (var39 * var39 < 1.0D) + { + for (int var41 = var33; var41 <= var36; ++var41) + { + double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D); + + if (var39 * var39 + var42 * var42 < 1.0D) + { + for (int var44 = var34; var44 <= var37; ++var44) + { + double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D); + + //TODO: getBlock() getBlock() getBlock() + if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (world.func_147439_a(var38, var41, var44) == Blocks.grass || world.func_147439_a(var38, var41, var44) == Blocks.dirt || world.func_147439_a(var38, var41, var44) == Blocks.sand)) + { + //TODO: setBlockAndMetadata() + this.func_150516_a(world, var38, var41, var44, splotchBlock, splotchBlockMeta); + } + } + } + } + } + } + } + + return true; + } + + @Override + public void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int x, int z) throws Exception + { + String fieldName = worldGeneratorField.getName(); + + if (fieldName.equals("generateQuicksand") && bopDecoration.getWorldFeatures().generateQuicksand) + { + for (int i = 0; i < 5; ++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("generateCanyon") && bopDecoration.getWorldFeatures().generateCanyon) + { + 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/features/WorldGenWaterReeds.java b/src/main/java/biomesoplenty/common/world/features/WorldGenWaterReeds.java index 4348d073b..50e941d6c 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenWaterReeds.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenWaterReeds.java @@ -48,8 +48,9 @@ public class WorldGenWaterReeds extends WorldGeneratorBOP { int randX = x + random.nextInt(16); int randZ = z + random.nextInt(16); + int randY = random.nextInt(world.getHeightValue(randX, randZ)); - worldGenerator.generate(world, random, randX, world.getTopSolidOrLiquidBlock(randX, randZ), randZ); + worldGenerator.generate(world, random, randX, randY, randZ); } } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPShrub.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPShrub.java new file mode 100644 index 000000000..367f4d681 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBOPShrub.java @@ -0,0 +1,96 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenTrees; + +public class WorldGenBOPShrub extends WorldGenTrees +{ + private Block wood; + private Block leaves; + + private int metaWood; + private int metaLeaves; + + private int minHeight; + private int maxHeight; + + private List soilBlocks; + + public WorldGenBOPShrub(Block wood, Block leaves, int metaWood, int metaLeaves, Block... soilBlocks) + { + this(wood, leaves, metaWood, metaLeaves, 0, 256, soilBlocks); + } + + public WorldGenBOPShrub(Block wood, Block leaves, int metaWood, int metaLevaes, int minHeight, int maxHeight, Block... soilBlocks) + { + super(false); + + this.wood = wood; + this.leaves = leaves; + + this.metaWood = metaWood; + this.metaLeaves = metaLeaves; + + this.minHeight = minHeight; + this.maxHeight = maxHeight; + + this.soilBlocks = Arrays.asList(soilBlocks); + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + Block block; + + do + { + block = world.func_147439_a(x, y, z); + if (!(block.isLeaves(world, x, y, z) || block.isAir(world, x, y, z))) + { + break; + } + --y; + } while (y > 0); + + Block block1 = world.func_147439_a(x, y, z); + + if (soilBlocks.contains(block1)) + { + ++y; + + if (y > minHeight && y < maxHeight) + { + this.func_150516_a(world, x, y, z, wood, metaWood); + + for (int l = y; l <= y + 2; ++l) + { + int i1 = l - y; + int j1 = 2 - i1; + + for (int k1 = x - j1; k1 <= x + j1; ++k1) + { + int l1 = k1 - x; + + for (int i2 = z - j1; i2 <= z + j1; ++i2) + { + int j2 = i2 - z; + + if ((Math.abs(l1) != j1 || Math.abs(j2) != j1 || random.nextInt(2) != 0) && world.func_147439_a(k1, l, i2).canBeReplacedByLeaves(world, k1, l, i2)) + { + this.func_150516_a(world, k1, l, i2, leaves, metaLeaves); + } + } + } + } + } + } + + return true; + } +} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBrush1.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBrush1.java new file mode 100644 index 000000000..eee59377b --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBrush1.java @@ -0,0 +1,74 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; + +public class WorldGenBrush1 extends WorldGenAbstractTree +{ + public WorldGenBrush1() + { + super(false); + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + //TODO: isAirBlock() + while (world.func_147437_c(x, y, z) && y > 2) + { + --y; + } + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != Blocks.grass) + { + return false; + } + else + { + for (int var7 = -2; var7 <= 2; ++var7) + { + for (int var8 = -2; var8 <= 2; ++var8) + { + //TODO: isAirBlock() isAirBlock() + if (world.func_147437_c(x + var7, y - 1, z + var8) && world.func_147437_c(x + var7, y - 2, z + var8)) + return false; + } + } + + //TODO: setBlock() + world.func_147449_b(x, y, z, Blocks.dirt); + world.func_147465_d(x, y + 1, z, Blocks.log, 3, 2); + world.func_147465_d(x, y + 2, z, Blocks.log, 3, 2); + world.func_147465_d(x, y + 3, z, Blocks.log, 3, 2); + world.func_147465_d(x, y + 4, z, Blocks.log, 3, 2); + world.func_147465_d(x, y + 5, z, Blocks.log, 3, 2); + world.func_147465_d(x, y + 6, z, Blocks.log, 3, 2); + world.func_147465_d(x, y + 7, z, Blocks.log, 3, 2); + world.func_147449_b(x + 1, y + 7, z, Blocks.leaves); + world.func_147449_b(x - 1, y + 7, z, Blocks.leaves); + world.func_147449_b(x, y + 7, z + 1, Blocks.leaves); + world.func_147449_b(x, y + 7, z - 1, Blocks.leaves); + + world.func_147449_b(x + 1, y + 8, z, Blocks.leaves); + world.func_147449_b(x - 1, y + 8, z, Blocks.leaves); + world.func_147449_b(x, y + 8, z + 1, Blocks.leaves); + world.func_147449_b(x, y + 8, z - 1, Blocks.leaves); + + world.func_147449_b(x + 1, y + 8, z + 1, Blocks.leaves); + world.func_147449_b(x + 1, y + 8, z - 1, Blocks.leaves); + world.func_147449_b(x - 1, y + 8, z + 1, Blocks.leaves); + world.func_147449_b(x - 1, y + 8, z - 1, Blocks.leaves); + world.func_147449_b(x, y + 8, z, Blocks.leaves); + + world.func_147449_b(x, y + 9, z, Blocks.leaves); + return true; + } + } +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBrush2.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBrush2.java new file mode 100644 index 000000000..29ef4b675 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenBrush2.java @@ -0,0 +1,67 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; + +public class WorldGenBrush2 extends WorldGenAbstractTree +{ + public WorldGenBrush2() + { + super(false); + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + //TODO: isAirBlock() + while (world.func_147437_c(x, y, z) && y > 2) + { + --y; + } + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + if (block != Blocks.grass) + { + return false; + } + else + { + for (int var7 = -2; var7 <= 2; ++var7) + { + for (int var8 = -2; var8 <= 2; ++var8) + { + //TODO: isAirBlock() isAirBlock() + if (world.func_147437_c(x + var7, y - 1, z + var8) && world.func_147437_c(x + var7, y - 2, z + var8)) + return false; + } + } + + //TODO: setBlock() + world.func_147449_b(x, y, z, Blocks.dirt); + world.func_147465_d(x, y + 1, z, Blocks.log, 3, 2); + world.func_147465_d(x, y + 2, z, Blocks.log, 3, 2); + world.func_147465_d(x, y + 3, z, Blocks.log, 3, 2); + world.func_147465_d(x, y + 4, z, Blocks.log, 3, 2); + world.func_147449_b(x + 1, y + 4, z, Blocks.leaves); + world.func_147449_b(x - 1, y + 4, z, Blocks.leaves); + world.func_147449_b(x, y + 4, z + 1, Blocks.leaves); + world.func_147449_b(x, y + 4, z - 1, Blocks.leaves); + world.func_147449_b(x + 1, y + 4, z + 1, Blocks.leaves); + world.func_147449_b(x + 1, y + 4, z - 1, Blocks.leaves); + world.func_147449_b(x - 1, y + 4, z + 1, Blocks.leaves); + world.func_147449_b(x - 1, y + 4, z - 1, Blocks.leaves); + world.func_147449_b(x + 1, y + 5, z, Blocks.leaves); + world.func_147449_b(x - 1, y + 5, z, Blocks.leaves); + world.func_147449_b(x, y + 5, z + 1, Blocks.leaves); + world.func_147449_b(x, y + 5, z - 1, Blocks.leaves); + world.func_147449_b(x, y + 5, z, Blocks.leaves); + return true; + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenChaparral2.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenChaparral2.java new file mode 100644 index 000000000..802b4cff5 --- /dev/null +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenChaparral2.java @@ -0,0 +1,56 @@ +package biomesoplenty.common.world.features.trees; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; + +public class WorldGenChaparral2 extends WorldGenAbstractTree +{ + public WorldGenChaparral2() + { + super(false); + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) + { + //TODO: isAirBlock() + while (world.func_147437_c(x, y, z) && y > 2) + { + --y; + } + + //TODO: getBlock() + Block block = world.func_147439_a(x, y, z); + + + if (block != Blocks.grass && block != Blocks.sand) + return false; + else + { + for (int var7 = -2; var7 <= 2; ++var7) + { + for (int var8 = -2; var8 <= 2; ++var8) + { + //TODO: isAirBlock() isAirBlock() + if (world.func_147437_c(x + var7, y - 1, z + var8) && world.func_147437_c(x + var7, y - 2, z + var8)) + return false; + } + } + + //TODO: setBlock() + world.func_147449_b(x, y, z, Blocks.dirt); + world.func_147449_b(x, y + 1, z, Blocks.log); + world.func_147449_b(x, y + 2, z, Blocks.log); + world.func_147449_b(x + 1, y + 2, z, Blocks.leaves); + world.func_147449_b(x - 1, y + 2, z, Blocks.leaves); + world.func_147449_b(x, y + 2, z + 1, Blocks.leaves); + world.func_147449_b(x, y + 2, z - 1, Blocks.leaves); + world.func_147449_b(x, y + 3, z, Blocks.leaves); + return true; + } + } +} diff --git a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenPineTree.java b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenPineTree.java index 5386e65d8..2c704ed09 100644 --- a/src/main/java/biomesoplenty/common/world/features/trees/WorldGenPineTree.java +++ b/src/main/java/biomesoplenty/common/world/features/trees/WorldGenPineTree.java @@ -52,7 +52,9 @@ public class WorldGenPineTree extends WorldGenAbstractTree //================ int h = 1; - buildBlock(world, x, y, z, Blocks.dirt, 0); + + var6.onPlantGrow(world, x, y - 1, z, x, y, z); + for(int b = 0; b < baselength; b++) { buildBlock(world, x, y + h, z, BOPBlockHelper.get("logs4"), 0); diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index 43ad7e38c..de387804d 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -2,14 +2,13 @@ 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; import biomesoplenty.common.world.features.WorldGenBOPTallGrass; import biomesoplenty.common.world.features.WorldGenMud; +import biomesoplenty.common.world.features.WorldGenSplotches; import biomesoplenty.common.world.features.WorldGenRiverCane; import biomesoplenty.common.world.features.WorldGenWaterReeds; @@ -44,6 +43,9 @@ public class WorldGenFieldAssociation associateField("toadstoolsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("mushrooms"), 0)); associateField("blueMilksPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("mushrooms"), 2)); + associateField("generateQuicksand", new WorldGenSplotches(BOPBlockHelper.get("mud"), 1, 24)); + associateField("generateCanyon", new WorldGenSplotches(BOPBlockHelper.get("redRock"), 0, 48)); + WorldGenDoublePlant doubleTallGrass = new WorldGenDoublePlant(); //TODO: setMetadata() ? doubleTallGrass.func_150548_a(2);