More kelp stuff once again

This commit is contained in:
Matt Caughey 2013-09-08 14:23:45 -04:00
parent 8403dcbe6b
commit 6db062d806
6 changed files with 42 additions and 35 deletions

View file

@ -69,6 +69,7 @@ import biomesoplenty.worldgen.WorldGenDriedDirt;
import biomesoplenty.worldgen.WorldGenGravel;
import biomesoplenty.worldgen.WorldGenHighCattail;
import biomesoplenty.worldgen.WorldGenHighGrass;
import biomesoplenty.worldgen.WorldGenKelp;
import biomesoplenty.worldgen.WorldGenLilyflower;
import biomesoplenty.worldgen.WorldGenMelon;
import biomesoplenty.worldgen.WorldGenMesa;
@ -207,6 +208,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
protected WorldGenerator rainbowflowerGen;
protected WorldGenerator crystalGen;
protected WorldGenerator crystalGen2;
protected WorldGenerator kelpGen;
protected WorldGenerator boneSpineGen;
protected WorldGenerator boneSpine2Gen;
@ -286,6 +288,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
protected int sunflowersPerChunk;
protected int rainbowflowersPerChunk;
protected int cobwebsPerChunk;
protected int kelpPerChunk;
protected int boneSpinesPerChunk;
protected int boneSpines2PerChunk;
@ -447,6 +450,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
cattailGen = new WorldGenCattail();
crystalGen = new WorldGenCrystal1();
crystalGen2 = new WorldGenCrystal2();
kelpGen = new WorldGenKelp(false);
mushroomBrownGen = new WorldGenBOPFlowers(Block.mushroomBrown.blockID, 0);
mushroomRedGen = new WorldGenBOPFlowers(Block.mushroomRed.blockID, 0);
toadstoolGen = new WorldGenBOPFlowers(Blocks.mushrooms.get().blockID, 0);
@ -547,6 +551,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
boneSpinesPerChunk = 0;
boneSpines2PerChunk = 0;
cobwebsPerChunk = 0;
kelpPerChunk = 0;
generateLakes = true;
generateAsh = false;
generateMycelium = false;
@ -936,6 +941,14 @@ public class BiomeDecoratorBOP extends BiomeDecorator
sunflowerGen.generate(currentWorld, randomGenerator, var3, var4, var5);
}
for (var2 = 0; var2 < kelpPerChunk; ++var2)
{
var3 = chunk_X + randomGenerator.nextInt(16) + 8;
var4 = randomGenerator.nextInt(64);
var5 = chunk_Z + randomGenerator.nextInt(16) + 8;
kelpGen.generate(currentWorld, randomGenerator, var3, var4, var5);
}
for (var2 = 0; var2 < rainbowflowersPerChunk; ++var2)
{
int var956 = randomGenerator.nextInt(10);

View file

@ -19,7 +19,7 @@ public class BiomeGenOceanKelp extends BiomeGenBase
super(par1);
theBiomeDecorator = new BiomeDecoratorBOP(this);
customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator;
customBiomeDecorator.treesPerChunk = 50;
customBiomeDecorator.kelpPerChunk = 99;
spawnableCreatureList.clear();
}
@ -42,13 +42,4 @@ public class BiomeGenOceanKelp extends BiomeGenBase
}
}
}
/**
* Gets a WorldGen appropriate for this biome.
*/
@Override
public WorldGenerator getRandomWorldGenForTrees(Random par1Random)
{
return new WorldGenKelp(false);
}
}

View file

@ -29,6 +29,7 @@ public class BiomeGenWateryWillows extends BiomeGenBase
customBiomeDecorator.waterLakesPerChunk = 8;
customBiomeDecorator.reedsBOPPerChunk = 3;
customBiomeDecorator.hydrangeasPerChunk = 5;
customBiomeDecorator.kelpPerChunk = 50;
}
/**

View file

@ -75,7 +75,7 @@ public class BonemealHandler
if (event.world.rand.nextFloat() < 0.45D)
{
WorldGenKelp worldgenkelp = new WorldGenKelp(false);
worldgenkelp.generate(event.world, event.world.rand, event.X, event.Y - 1, event.Z);
worldgenkelp.generate(event.world, event.world.rand, event.X, event.Y, event.Z);
}
}
}

View file

@ -128,16 +128,7 @@ public class ItemBlockCoral extends ItemBlock
return false;
else if (world.canPlaceEntityOnSide(itemID, x, y, z, false, side, player, itemstack))
{
if (itemstack.getItemDamage() == 0)
{
if (world.getBlockId(x, y + 1, z) == Block.waterStill.blockID || world.getBlockId(x, y + 1, z) == Block.waterMoving.blockID)
{
onItemUsePlaceBlock(itemstack, player, world, x, y, z, side, hitX, hitY, hitZ);
return true;
}
}
else
if (world.getBlockId(x, y + 1, z) == Block.waterStill.blockID || world.getBlockId(x, y + 1, z) == Block.waterMoving.blockID)
{
onItemUsePlaceBlock(itemstack, player, world, x, y, z, side, hitX, hitY, hitZ);

View file

@ -6,6 +6,7 @@ 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 WorldGenKelp extends WorldGenerator
{
@ -34,14 +35,20 @@ public class WorldGenKelp extends WorldGenerator
if ((var11 == Block.sand.blockID || var11 == Block.dirt.blockID) && var4 < 256 - var6 - 1)
{
var1.setBlock(var3, var4 - 1, var5, Block.sand.blockID);
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 = 2;
int var999 = 0;
int var998;
int var996;
for (var15 = 0; var15 <= var8; ++var15)
{
@ -66,32 +73,36 @@ public class WorldGenKelp extends WorldGenerator
var15 = var2.nextInt(3);
for (var16 = 2; var16 < var6 - var15; ++var16)
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 + 1, var5, Blocks.coral.get().blockID, 0);
this.setBlockAndMetadata(var1, var3, var4, var5, Blocks.coral.get().blockID, 0);
this.setBlockAndMetadata(var1, var3, var4 + var16, var5, Blocks.coral.get().blockID, 1);
++var999;
}
}
var996 = var1.getBlockId(var3, (var4 + (var999 + 2)), var5);
var998 = var1.getBlockId(var3, (var4 + (var999 + 1)), var5);
if (var998 == Block.waterStill.blockID || var998 == Block.waterMoving.blockID)
{
if (var999 == 2)
if (var996 != Block.waterStill.blockID && var996 != Block.waterMoving.blockID)
{
if (var998 == Block.waterStill.blockID || var998 == Block.waterMoving.blockID)
{
this.setBlockAndMetadata(var1, var3, var4 + var999, var5, Blocks.coral.get().blockID, 2);
this.setBlockAndMetadata(var1, var3, var4 + 1, var5, Blocks.coral.get().blockID, 0);
if (var999 == 0)
{
this.setBlockAndMetadata(var1, var3, var4 + var999, var5, Blocks.coral.get().blockID, 2);
this.setBlockAndMetadata(var1, var3, var4, var5, Blocks.coral.get().blockID, 0);
}
else
{
this.setBlockAndMetadata(var1, var3, var4 + var999, var5, Blocks.coral.get().blockID, 2);
}
}
else
{
this.setBlockAndMetadata(var1, var3, var4 + var999, var5, Blocks.coral.get().blockID, 2);
}
}
}
return true;
} else