Readded ocean biomes. Closes #234

This commit is contained in:
Adubbz 2014-05-19 16:41:20 +10:00
parent c30fcbb7a6
commit 89d311c193
8 changed files with 149 additions and 10 deletions

View file

@ -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

View file

@ -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);
}
}
}
}

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);
}
}
}
}

View file

@ -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);
}
}

View file

@ -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());