Added coral gen

This commit is contained in:
Matt Caughey 2013-09-12 13:59:00 -04:00
parent 194476c9b5
commit 2c71e3ef90
9 changed files with 183 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 B

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

After

Width:  |  Height:  |  Size: 628 B

View file

@ -62,6 +62,7 @@ import biomesoplenty.worldgen.WorldGenCanyonGrass;
import biomesoplenty.worldgen.WorldGenCattail; import biomesoplenty.worldgen.WorldGenCattail;
import biomesoplenty.worldgen.WorldGenCloud; import biomesoplenty.worldgen.WorldGenCloud;
import biomesoplenty.worldgen.WorldGenCobwebs; import biomesoplenty.worldgen.WorldGenCobwebs;
import biomesoplenty.worldgen.WorldGenCoral;
import biomesoplenty.worldgen.WorldGenCrystal1; import biomesoplenty.worldgen.WorldGenCrystal1;
import biomesoplenty.worldgen.WorldGenCrystal2; import biomesoplenty.worldgen.WorldGenCrystal2;
import biomesoplenty.worldgen.WorldGenDesertCactus; import biomesoplenty.worldgen.WorldGenDesertCactus;
@ -90,6 +91,7 @@ import biomesoplenty.worldgen.WorldGenQuagmire;
import biomesoplenty.worldgen.WorldGenQuicksand; import biomesoplenty.worldgen.WorldGenQuicksand;
import biomesoplenty.worldgen.WorldGenReedBOP; import biomesoplenty.worldgen.WorldGenReedBOP;
import biomesoplenty.worldgen.WorldGenShield; import biomesoplenty.worldgen.WorldGenShield;
import biomesoplenty.worldgen.WorldGenShortKelp;
import biomesoplenty.worldgen.WorldGenSmolderingGrass; import biomesoplenty.worldgen.WorldGenSmolderingGrass;
import biomesoplenty.worldgen.WorldGenSprout; import biomesoplenty.worldgen.WorldGenSprout;
import biomesoplenty.worldgen.WorldGenSteppe; import biomesoplenty.worldgen.WorldGenSteppe;
@ -211,8 +213,10 @@ public class BiomeDecoratorBOP extends BiomeDecorator
protected WorldGenerator crystalGen; protected WorldGenerator crystalGen;
protected WorldGenerator crystalGen2; protected WorldGenerator crystalGen2;
protected WorldGenerator kelpGen; protected WorldGenerator kelpGen;
protected WorldGenerator shortKelpGen;
protected WorldGenerator graveGen; protected WorldGenerator graveGen;
protected WorldGenerator pumpkinAltGen; protected WorldGenerator pumpkinAltGen;
protected WorldGenerator coralGen;
protected WorldGenerator boneSpineGen; protected WorldGenerator boneSpineGen;
protected WorldGenerator boneSpine2Gen; protected WorldGenerator boneSpine2Gen;
@ -294,8 +298,10 @@ public class BiomeDecoratorBOP extends BiomeDecorator
protected int cobwebsPerChunk; protected int cobwebsPerChunk;
protected int kelpPerChunk; protected int kelpPerChunk;
protected int kelpThickPerChunk; protected int kelpThickPerChunk;
protected int shortKelpPerChunk;
protected int gravesPerChunk; protected int gravesPerChunk;
protected int pumpkinsPerChunk; protected int pumpkinsPerChunk;
protected int coralPerChunk;
protected int boneSpinesPerChunk; protected int boneSpinesPerChunk;
protected int boneSpines2PerChunk; protected int boneSpines2PerChunk;
@ -442,6 +448,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
berryBushGen = new WorldGenBOPFlowers(Blocks.foliage.get().blockID, 8); berryBushGen = new WorldGenBOPFlowers(Blocks.foliage.get().blockID, 8);
tinyCactusGen = new WorldGenBOPFlowers(Blocks.plants.get().blockID, 12); tinyCactusGen = new WorldGenBOPFlowers(Blocks.plants.get().blockID, 12);
aloeGen = new WorldGenBOPFlowers(Blocks.flowers.get().blockID, 12); aloeGen = new WorldGenBOPFlowers(Blocks.flowers.get().blockID, 12);
coralGen = new WorldGenCoral(Blocks.coral.get().blockID, 4);
lilyflowerGen = new WorldGenLilyflower(); lilyflowerGen = new WorldGenLilyflower();
deathbloomGen = new WorldGenBOPFlowers(Blocks.flowers.get().blockID, 2); deathbloomGen = new WorldGenBOPFlowers(Blocks.flowers.get().blockID, 2);
hydrangeaGen = new WorldGenBOPFlowers(Blocks.flowers.get().blockID, 4); hydrangeaGen = new WorldGenBOPFlowers(Blocks.flowers.get().blockID, 4);
@ -459,6 +466,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
crystalGen = new WorldGenCrystal1(); crystalGen = new WorldGenCrystal1();
crystalGen2 = new WorldGenCrystal2(); crystalGen2 = new WorldGenCrystal2();
kelpGen = new WorldGenKelp(false); kelpGen = new WorldGenKelp(false);
shortKelpGen = new WorldGenShortKelp(false);
graveGen = new WorldGenGrave(); graveGen = new WorldGenGrave();
mushroomBrownGen = new WorldGenBOPFlowers(Block.mushroomBrown.blockID, 0); mushroomBrownGen = new WorldGenBOPFlowers(Block.mushroomBrown.blockID, 0);
mushroomRedGen = new WorldGenBOPFlowers(Block.mushroomRed.blockID, 0); mushroomRedGen = new WorldGenBOPFlowers(Block.mushroomRed.blockID, 0);
@ -562,8 +570,10 @@ public class BiomeDecoratorBOP extends BiomeDecorator
cobwebsPerChunk = 0; cobwebsPerChunk = 0;
kelpPerChunk = 0; kelpPerChunk = 0;
kelpThickPerChunk = 0; kelpThickPerChunk = 0;
shortKelpPerChunk = 0;
gravesPerChunk = 0; gravesPerChunk = 0;
pumpkinsPerChunk = 0; pumpkinsPerChunk = 0;
coralPerChunk = 0;
generateLakes = true; generateLakes = true;
generateAsh = false; generateAsh = false;
generateMycelium = false; generateMycelium = false;
@ -985,6 +995,14 @@ public class BiomeDecoratorBOP extends BiomeDecorator
kelpGen.generate(currentWorld, randomGenerator, var3, var4, var5); kelpGen.generate(currentWorld, randomGenerator, var3, var4, var5);
} }
for (var2 = 0; var2 < shortKelpPerChunk; ++var2)
{
var3 = chunk_X + randomGenerator.nextInt(16);
var4 = randomGenerator.nextInt(64);
var5 = chunk_Z + randomGenerator.nextInt(16);
shortKelpGen.generate(currentWorld, randomGenerator, var3, var4, var5);
}
for (var2 = 0; var2 < rainbowflowersPerChunk; ++var2) for (var2 = 0; var2 < rainbowflowersPerChunk; ++var2)
{ {
int var956 = randomGenerator.nextInt(10); int var956 = randomGenerator.nextInt(10);
@ -1055,6 +1073,14 @@ public class BiomeDecoratorBOP extends BiomeDecorator
plantWhiteGen.generate(currentWorld, randomGenerator, var3, var4, var5); plantWhiteGen.generate(currentWorld, randomGenerator, var3, var4, var5);
} }
for (var2 = 0; var2 < coralPerChunk; ++var2)
{
var3 = chunk_X + randomGenerator.nextInt(16) + 8;
var4 = randomGenerator.nextInt(256);
var5 = chunk_Z + randomGenerator.nextInt(16) + 8;
coralGen.generate(currentWorld, randomGenerator, var3, var4, var5);
}
for (var2 = 0; var2 < blueFlowersPerChunk; ++var2) for (var2 = 0; var2 < blueFlowersPerChunk; ++var2)
{ {
var3 = chunk_X + randomGenerator.nextInt(16) + 8; var3 = chunk_X + randomGenerator.nextInt(16) + 8;

View file

@ -9,9 +9,15 @@ import biomesoplenty.api.Blocks;
public class BiomeGenOceanCoral extends BiomeGenBase public class BiomeGenOceanCoral extends BiomeGenBase
{ {
private BiomeDecoratorBOP customBiomeDecorator;
public BiomeGenOceanCoral(int par1) public BiomeGenOceanCoral(int par1)
{ {
super(par1); super(par1);
theBiomeDecorator = new BiomeDecoratorBOP(this);
customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator;
customBiomeDecorator.coralPerChunk = 200;
customBiomeDecorator.shortKelpPerChunk = 99;
spawnableCreatureList.clear(); spawnableCreatureList.clear();
} }

View file

@ -18,6 +18,7 @@ public class BiomeGenOceanKelp extends BiomeGenBase
customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator; customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator;
customBiomeDecorator.kelpPerChunk = 999; customBiomeDecorator.kelpPerChunk = 999;
customBiomeDecorator.kelpThickPerChunk = 999; customBiomeDecorator.kelpThickPerChunk = 999;
customBiomeDecorator.shortKelpPerChunk = 200;
spawnableCreatureList.clear(); spawnableCreatureList.clear();
} }

View file

@ -0,0 +1,41 @@
package biomesoplenty.worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.api.Blocks;
public class WorldGenCoral extends WorldGenerator
{
/** The ID of the plant block used in this plant generator. */
private int plantBlockId;
private int plantBlockMeta;
public WorldGenCoral(int par1, int meta)
{
plantBlockId = par1;
plantBlockMeta = meta;
}
@Override
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
for (int l = 0; l < 64; ++l)
{
int i1 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
int j1 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
int k1 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
int var999 = par2Random.nextInt(4);
if ((par1World.getBlockId(i1, j1, k1) == Block.waterStill.blockID || par1World.getBlockId(i1, j1, k1) == Block.waterMoving.blockID) && Block.blocksList[plantBlockId].canPlaceBlockOnSide(par1World, i1, j1, k1, 1, new ItemStack(plantBlockId, 1, plantBlockMeta)))
{
par1World.setBlock(i1, j1, k1, Blocks.coral.get().blockID, 4 + var999, 2);
}
}
return true;
}
}

View file

@ -0,0 +1,109 @@
package biomesoplenty.worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.api.Blocks;
import net.minecraft.block.material.Material;
public class WorldGenShortKelp extends WorldGenerator
{
public WorldGenShortKelp(boolean var1)
{
super(var1);
}
@Override
public boolean generate(World var1, Random var2, int var3, int var4, int var5)
{
int var6 = var2.nextInt(4) + 3;
int var7 = var2.nextInt(3) + 2;
int var8 = var6 - var7;
int var9 = 1;
boolean var10 = true;
if (var4 >= 1 && var4 + var6 + 1 <= 256)
{
int var11;
int var13;
int var15;
int var21;
var11 = var1.getBlockId(var3, var4 - 1, var5);
if ((var11 == Block.sand.blockID || var11 == Block.dirt.blockID) && var4 < 256 - var6 - 1)
{
if (var1.getBlockMaterial(var3, var4, var5) != Material.water)
{
return false;
}
var21 = var2.nextInt(2);
var13 = 1;
boolean var22 = false;
int var17;
int var16;
int var999 = 0;
int var998;
int var996;
for (var15 = 0; var15 <= var8; ++var15)
{
var16 = var4 + var6 - var15;
if (var21 >= var13)
{
var21 = var22 ? 1 : 0;
var22 = true;
++var13;
if (var13 > var9)
{
var13 = var9;
}
}
else
{
++var21;
}
}
var15 = var2.nextInt(3);
for (var16 = 0; var16 < var6 - var15; ++var16)
{
var17 = var1.getBlockId(var3, (var4 + (var16 + 2)), var5);
if (var17 == Block.waterStill.blockID || var17 == Block.waterMoving.blockID)
{
this.setBlockAndMetadata(var1, var3, var4, var5, Blocks.coral.get().blockID, 0);
this.setBlockAndMetadata(var1, var3, var4 + var16, var5, Blocks.coral.get().blockID, 1);
++var999;
}
}
var998 = var1.getBlockId(var3, (var4 + (var999 + 1)), var5);
if (var998 == Block.waterStill.blockID || var998 == Block.waterMoving.blockID)
{
if (var999 == 0)
{
this.setBlockAndMetadata(var1, var3, var4, var5, Blocks.coral.get().blockID, 3);
}
else
{
this.setBlockAndMetadata(var1, var3, var4, var5, Blocks.coral.get().blockID, 0);
this.setBlockAndMetadata(var1, var3, var4 + var999, var5, Blocks.coral.get().blockID, 2);
}
}
return true;
} else
return false;
} else
return false;
}
}