diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/ocean/BiomeGenCoralReef.java b/src/main/java/biomesoplenty/common/biomes/overworld/ocean/BiomeGenCoralReef.java index 1fd73f01a..d5b5bb12c 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/ocean/BiomeGenCoralReef.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/ocean/BiomeGenCoralReef.java @@ -25,6 +25,8 @@ public class BiomeGenCoralReef extends BOPOceanBiome this.setTemperatureRainfall(0.5F, 0.9F); this.bopWorldFeatures.setFeature("coralPerChunk", 300); + this.bopWorldFeatures.setFeature("shortKelpPerChunk", 99); + this.bopWorldFeatures.setFeature("generateSponge", true); } @Override diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/ocean/BiomeGenKelpForest.java b/src/main/java/biomesoplenty/common/biomes/overworld/ocean/BiomeGenKelpForest.java new file mode 100644 index 000000000..ae121cf28 --- /dev/null +++ b/src/main/java/biomesoplenty/common/biomes/overworld/ocean/BiomeGenKelpForest.java @@ -0,0 +1,51 @@ +package biomesoplenty.common.biomes.overworld.ocean; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.biomes.BOPOceanBiome; + +public class BiomeGenKelpForest extends BOPOceanBiome +{ + private static final Height biomeHeight = new Height(-1.0F, 0.1F); + + public BiomeGenKelpForest(int biomeID) + { + super(biomeID); + + this.zoom = 0.5D; + this.threshold = 0D; + + this.setHeight(biomeHeight); + this.setColor(27468); + this.setTemperatureRainfall(0.5F, 0.9F); + + this.bopWorldFeatures.setFeature("kelpPerChunk", 999); + this.bopWorldFeatures.setFeature("kelpThickPerChunk", 999); + this.bopWorldFeatures.setFeature("shortKelpPerChunk", 200); + } + + @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); + + Block block = world.getBlock(x, y, z); + + if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone)) + { + world.setBlock(x, y, z, BOPBlockHelper.get("gemOre"), 12, 2); + } + } + } +} diff --git a/src/main/java/biomesoplenty/common/blocks/BlockBOPCoral.java b/src/main/java/biomesoplenty/common/blocks/BlockBOPCoral.java index faabda2e4..f0c305927 100644 --- a/src/main/java/biomesoplenty/common/blocks/BlockBOPCoral.java +++ b/src/main/java/biomesoplenty/common/blocks/BlockBOPCoral.java @@ -124,9 +124,6 @@ public class BlockBOPCoral extends BOPBlock { switch (metadata) { - case 8: - return block == Blocks.dirt || block == Blocks.sand || block == Blocks.sponge || block == Blocks.stone || block == Blocks.clay || block == Blocks.gravel || block == Blocks.grass || block == BOPBlockHelper.get("mud"); - case 9: // Kelp Middle return block == this; diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index 1382a67af..239c6b458 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -77,6 +77,7 @@ import biomesoplenty.common.biomes.overworld.BiomeGenWasteland; import biomesoplenty.common.biomes.overworld.BiomeGenWetland; import biomesoplenty.common.biomes.overworld.BiomeGenWoodland; import biomesoplenty.common.biomes.overworld.ocean.BiomeGenCoralReef; +import biomesoplenty.common.biomes.overworld.ocean.BiomeGenKelpForest; import biomesoplenty.common.biomes.overworld.sub.BiomeGenAlpsForest; import biomesoplenty.common.biomes.overworld.sub.BiomeGenCanyonRavine; import biomesoplenty.common.biomes.overworld.sub.BiomeGenGlacier; @@ -202,8 +203,9 @@ public class BOPBiomes //Ocean Biomes coralReef = registerOverworldSubBiome(BiomeGenCoralReef.class, "Coral Reef", 10, BiomeGenBase.ocean.biomeID); - volcano = registerOverworldSubBiome(BiomeGenVolcano.class, "Volcano", 10, BiomeGenBase.deepOcean.biomeID); + kelpForest = registerOverworldSubBiome(BiomeGenKelpForest.class, "Kelp Forest", 10, BiomeGenBase.ocean.biomeID); tropics = registerOverworldSubBiome(BiomeGenTropics.class, "Tropics", 10, BiomeGenBase.deepOcean.biomeID); + volcano = registerOverworldSubBiome(BiomeGenVolcano.class, "Volcano", 10, BiomeGenBase.deepOcean.biomeID); //Nether Biomes corruptedSands = registerNetherBiome(BiomeGenCorruptedSands.class, "Corrupted Sands", 10); diff --git a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java index b9dee50a2..aba1e57eb 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -32,6 +32,7 @@ public class BOPWorldFeatures addFeature("generateAsh", false); addFeature("generateMelons", false); addFeature("generateMycelium", false); + addFeature("generateSponge", false); addFeature("waterSpringsPerChunk", 50); addFeature("lavaSpringsPerChunk", 20); @@ -92,6 +93,9 @@ public class BOPWorldFeatures //Ocean Features addFeature("seaweedPerChunk", 0); addFeature("coralPerChunk", 0); + addFeature("kelpPerChunk", 0); + addFeature("kelpThickPerChunk", 0); + addFeature("shortKelpPerChunk", 0); //Nether Features addFeature("waspHivesPerChunk", 0); diff --git a/src/main/java/biomesoplenty/common/world/features/WorldGenKelp.java b/src/main/java/biomesoplenty/common/world/features/WorldGenKelp.java index 9d2bf3d69..16a8aaaf8 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenKelp.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenKelp.java @@ -2,24 +2,91 @@ package biomesoplenty.common.world.features; import java.util.Random; +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 biomesoplenty.api.BOPBlockHelper; +import biomesoplenty.common.blocks.BlockBOPCoral; +import biomesoplenty.common.world.decoration.BOPDecorationManager; import biomesoplenty.common.world.generation.WorldGeneratorBOP; public class WorldGenKelp extends WorldGeneratorBOP { + private final int minHeight; + private final int randomHeight; + + public WorldGenKelp(int minHeight, int randomHeight) + { + super(true); + + this.minHeight = minHeight; + this.randomHeight = randomHeight; + } + @Override public boolean generate(World world, Random rand, int x, int y, int z) { + BlockBOPCoral coral = (BlockBOPCoral)BOPBlockHelper.get("coral1"); - return false; + int x2 = x + rand.nextInt(4) - rand.nextInt(4); + int y2 = y; + int z2 = z + rand.nextInt(4) - rand.nextInt(4); + + int height = minHeight + rand.nextInt(randomHeight); + + int currentMeta; + + if (world.getBlock(x2, y2, z2) == Blocks.water && world.getBlock(x2, y2 + 1, z2) == Blocks.water && coral.canBlockStay(world, x2, y, z2, 8)) + { + for (int i = 0; i < height; ++i) + { + currentMeta = i == 0 ? 8 : i == height - 1 ? 10 : 9; + + if (world.getBlock(x2, y2 + i, z2) == Blocks.water && world.getBlock(x2, y2 + i + 1, z2) == Blocks.water) + { + world.setBlock(x2, y2 + i, z2, BOPBlockHelper.get("coral1"), currentMeta, 2); + } + else if (i > 0) + { + world.setBlock(x2, y2 + i - 1, z2, BOPBlockHelper.get("coral1"), 10, 2); + break; + } + else + { + break; + } + } + } + + return true; } @Override - public void setupGeneration(World world, Random random, BiomeGenBase biome, String featureName, int x, int z) + public void setupGeneration(World world, Random random, BiomeGenBase biome, String featureName, int x, int z) { - // TODO Auto-generated method stub - - } + if (featureName == "kelpPerChunk") + { + for (int i = 0; i < (Integer)BOPDecorationManager.getBiomeFeatures(biome.biomeID).getFeature(featureName); i++) + { + int randX = x + random.nextInt(16); + int randZ = z + random.nextInt(16); + int randY = random.nextInt(64); + this.generate(world, random, randX, randY, randZ); + } + } + else if (featureName == "kelpThickPerChunk") + { + for (int i = 0; i < (Integer)BOPDecorationManager.getBiomeFeatures(biome.biomeID).getFeature(featureName); i++) + { + int randX = x + random.nextInt(8); + int randZ = z + random.nextInt(8); + int randY = random.nextInt(64); + + this.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 index 484e8eb4b..9fb2444b4 100644 --- a/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java +++ b/src/main/java/biomesoplenty/common/world/features/WorldGenSplotches.java @@ -189,6 +189,17 @@ public class WorldGenSplotches extends WorldGeneratorBOP int randY = random.nextInt(128); int randZ = z + random.nextInt(16); + this.generate(world, random, randX, randY, randZ); + } + } + else if (featureName.equals("generateSponge") && (Boolean)BOPDecorationManager.getBiomeFeatures(biome.biomeID).getFeature("generateSponge")) + { + for (int i = 0; i < 5; ++i) + { + int randX = x + random.nextInt(16); + int randY = random.nextInt(64); + int randZ = z + random.nextInt(16); + this.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 0eb910e18..bc7f0924d 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -16,6 +16,7 @@ import biomesoplenty.common.world.features.WorldGenBOPFlora; import biomesoplenty.common.world.features.WorldGenBOPUndergroundDecoration; import biomesoplenty.common.world.features.WorldGenCobwebNest; import biomesoplenty.common.world.features.WorldGenGrassSplatter; +import biomesoplenty.common.world.features.WorldGenKelp; import biomesoplenty.common.world.features.WorldGenLavaSpout; import biomesoplenty.common.world.features.WorldGenLog; import biomesoplenty.common.world.features.WorldGenLongVine; @@ -60,7 +61,8 @@ public class WorldGenFieldAssociation associateFeature("generateQuagmire", new WorldGenSplotches(Blocks.grass, 0, 48, BOPBlockHelper.get("mud"))); associateFeature("generateAsh", new WorldGenSplotches(BOPBlockHelper.get("ash"), 0, 32, BOPBlockHelper.get("ashStone"), Blocks.netherrack)); associateFeature("generateMycelium", new WorldGenSplotches(Blocks.mycelium, 0, 32, Blocks.grass)); - + associateFeature("generateSponge", new WorldGenSplotches(Blocks.sponge, 0, 24, Blocks.dirt, Blocks.sand, Blocks.gravel)); + associateFeature("mudPerChunk", new WorldGenWaterside(BOPBlockHelper.get("mud"), 7, Blocks.dirt, Blocks.grass)); associateFeature("riverCanePerChunk", new WorldGenRiverCane()); associateFeature("shrubsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 9)); @@ -113,6 +115,9 @@ public class WorldGenFieldAssociation //Ocean Features associateFeature("seaweedPerChunk", new WorldGenBOPCoral(BOPBlockHelper.get("coral2"), 8, 256)); associateFeature("coralPerChunk", new WorldGenBOPCoral(BOPBlockHelper.get("coral1"), -1)); + associateFeature("kelpPerChunk", new WorldGenKelp(4, 8)); + associateFeature("kelpThickPerChunk", new WorldGenKelp(4, 8)); + associateFeature("shortKelpPerChunk", new WorldGenKelp(2, 3)); //Nether Features associateFeature("waspHivesPerChunk", new WorldGenWaspHive());