Added kelp generation
This commit is contained in:
parent
74b4f79676
commit
89cdcb6ce8
5 changed files with 22 additions and 35 deletions
|
@ -18,6 +18,7 @@ public class BlockQueries
|
|||
public static IBlockPosQuery hasWater;
|
||||
public static IBlockPosQuery airAbove;
|
||||
public static IBlockPosQuery airBelow;
|
||||
public static IBlockPosQuery waterCovered;
|
||||
public static IBlockPosQuery breakable;
|
||||
public static IBlockPosQuery air;
|
||||
public static IBlockPosQuery airOrLeaves;
|
||||
|
@ -43,5 +44,4 @@ public class BlockQueries
|
|||
public static IBlockPosQuery underwater;
|
||||
public static IBlockPosQuery suitableForReed;
|
||||
public static IBlockPosQuery rootsCanDigThrough;
|
||||
|
||||
}
|
|
@ -8,29 +8,18 @@
|
|||
|
||||
package biomesoplenty.common.biome.overworld;
|
||||
|
||||
import net.minecraft.block.BlockTallGrass;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
|
||||
import biomesoplenty.api.biome.BOPBiome;
|
||||
import biomesoplenty.api.biome.generation.GeneratorStage;
|
||||
import biomesoplenty.api.biome.generation.GeneratorWeighted;
|
||||
import biomesoplenty.api.block.BOPBlocks;
|
||||
import biomesoplenty.api.block.BlockQueries;
|
||||
import biomesoplenty.common.block.BlockBOPCoral;
|
||||
import biomesoplenty.common.entities.EntityButterfly;
|
||||
import biomesoplenty.common.enums.BOPClimates;
|
||||
import biomesoplenty.common.enums.BOPFlowers;
|
||||
import biomesoplenty.common.enums.BOPGems;
|
||||
import biomesoplenty.common.enums.BOPPlants;
|
||||
import biomesoplenty.common.enums.BOPTrees;
|
||||
import biomesoplenty.common.enums.BOPWoods;
|
||||
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
|
||||
import biomesoplenty.common.world.BOPWorldSettings;
|
||||
import biomesoplenty.common.world.feature.GeneratorColumns;
|
||||
import biomesoplenty.common.world.feature.GeneratorFlora;
|
||||
import biomesoplenty.common.world.feature.GeneratorGrass;
|
||||
import biomesoplenty.common.world.feature.GeneratorOreSingle;
|
||||
import biomesoplenty.common.world.feature.tree.GeneratorBasicTree;
|
||||
import biomesoplenty.common.world.feature.tree.GeneratorBigTree;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
public class BiomeGenCoralReef extends BOPBiome
|
||||
{
|
||||
|
@ -54,6 +43,9 @@ public class BiomeGenCoralReef extends BOPBiome
|
|||
this.addGenerator("glowing_coral", GeneratorStage.LILYPAD, (new GeneratorFlora.Builder()).amountPerChunk(15.0F).replace(Blocks.water).with(BOPBlocks.coral.getDefaultState().withProperty(BlockBOPCoral.VARIANT, BlockBOPCoral.CoralType.GLOWING)).scatterYMethod(ScatterYMethod.AT_GROUND).create());
|
||||
this.addGenerator("algae", GeneratorStage.LILYPAD, (new GeneratorFlora.Builder()).amountPerChunk(3.0F).replace(Blocks.water).with(BOPBlocks.coral.getDefaultState().withProperty(BlockBOPCoral.VARIANT, BlockBOPCoral.CoralType.ALGAE)).scatterYMethod(ScatterYMethod.AT_GROUND).create());
|
||||
|
||||
// kelp
|
||||
this.addGenerator("kelp", GeneratorStage.LILYPAD, (new GeneratorColumns.Builder()).replace(BlockQueries.waterCovered).placeOn(BlockQueries.groundBlocks).with(BOPBlocks.seaweed.getDefaultState()).scatterYMethod(ScatterYMethod.AT_GROUND).create());
|
||||
|
||||
// gem
|
||||
this.addGenerator("sapphire", GeneratorStage.SAND, (new GeneratorOreSingle.Builder()).amountPerChunk(12).with(BOPGems.SAPPHIRE).create());
|
||||
}
|
||||
|
|
|
@ -61,6 +61,16 @@ public class ModBlockQueries
|
|||
}
|
||||
};
|
||||
|
||||
// Match block positions with water above
|
||||
waterCovered = new IBlockPosQuery()
|
||||
{
|
||||
@Override
|
||||
public boolean matches(World world, BlockPos pos)
|
||||
{
|
||||
return world.getBlockState(pos).getBlock().getMaterial() == Material.water && world.getBlockState(pos.up()).getBlock().getMaterial() == Material.water;
|
||||
}
|
||||
};
|
||||
|
||||
// Match blocks which are not unbreakable - IE not bedrock, barrier, command blocks
|
||||
breakable = new IBlockPosQuery()
|
||||
{
|
||||
|
|
|
@ -75,17 +75,16 @@ public class GeneratorColumns extends GeneratorReplacing
|
|||
BlockPos genPos = pos.add(rand.nextInt(4) - rand.nextInt(4), rand.nextInt(3) - rand.nextInt(3), rand.nextInt(4) - rand.nextInt(4));
|
||||
|
||||
// see if we can place the column
|
||||
if (this.placeOn.matches(world, genPos.down()))
|
||||
if (this.placeOn.matches(world, genPos.down()) && this.replace.matches(world, genPos))
|
||||
{
|
||||
// choose random target height
|
||||
int height = GeneratorUtils.nextIntBetween(rand, this.minHeight, this.maxHeight);
|
||||
int targetHeight = GeneratorUtils.nextIntBetween(rand, this.minHeight, this.maxHeight);
|
||||
|
||||
// keep placing blocks upwards (if there's room)
|
||||
while(height > 0 && world.isAirBlock(genPos))
|
||||
for (int height = targetHeight; height >= 0 && replace.matches(world, genPos); height--)
|
||||
{
|
||||
world.setBlockState(genPos, this.with);
|
||||
genPos = genPos.up();
|
||||
height--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,26 +113,12 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
|
|||
}
|
||||
public T vine(IBlockState a)
|
||||
{
|
||||
if (a == null)
|
||||
{
|
||||
this.vine = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.vine = a;
|
||||
}
|
||||
this.vine = a;
|
||||
return this.self();
|
||||
}
|
||||
public T hanging(IBlockState a)
|
||||
{
|
||||
if (a == null)
|
||||
{
|
||||
this.hanging = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.hanging = a;
|
||||
}
|
||||
this.hanging = a;
|
||||
return this.self();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue