Added a new ScatterYMethod for the Nether
This commit is contained in:
parent
bb4be1aeec
commit
79a0a4aa00
2 changed files with 15 additions and 8 deletions
|
@ -10,6 +10,7 @@ package biomesoplenty.common.biome.nether;
|
|||
import java.util.Random;
|
||||
|
||||
import biomesoplenty.api.block.BOPBlocks;
|
||||
import biomesoplenty.api.block.BlockQueries;
|
||||
import biomesoplenty.api.block.IBlockPosQuery;
|
||||
import biomesoplenty.api.config.IConfigObj;
|
||||
import biomesoplenty.api.enums.BOPClimates;
|
||||
|
@ -51,13 +52,13 @@ public class BiomeUndergarden extends BOPHellBiome
|
|||
this.addWeight(BOPClimates.HELL, 20);
|
||||
|
||||
// splatter top blocks
|
||||
IBlockPosQuery emptyNetherrack = BlockQuery.buildAnd().withAirAbove().states(this.topBlock).create();
|
||||
this.addGenerator("overgrown_netherrack_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(0.7F).generationAttempts(128).replace(emptyNetherrack).with(BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.OVERGROWN_NETHERRACK)).create());
|
||||
IBlockPosQuery emptyNetherrack = BlockQuery.buildAnd().states(this.topBlock).withAirAbove().create();
|
||||
this.addGenerator("overgrown_netherrack_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(0.7F).generationAttempts(128).scatterYMethod(ScatterYMethod.ANY_SURFACE).replace(emptyNetherrack).with(BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.OVERGROWN_NETHERRACK)).create());
|
||||
|
||||
// flowers
|
||||
GeneratorWeighted flowerGenerator = new GeneratorWeighted(1.0F);
|
||||
this.addGenerator("flowers", GeneratorStage.FLOWERS, flowerGenerator);
|
||||
flowerGenerator.add("burning_blossom", 4, (new GeneratorFlora.Builder().with(BOPFlowers.BURNING_BLOSSOM).create()));
|
||||
flowerGenerator.add("burning_blossom", 4, (new GeneratorFlora.Builder().scatterYMethod(ScatterYMethod.ANY_SURFACE).with(BOPFlowers.BURNING_BLOSSOM).create()));
|
||||
|
||||
// trees
|
||||
GeneratorWeighted treeGenerator = new GeneratorWeighted(5.0F);
|
||||
|
@ -65,9 +66,9 @@ public class BiomeUndergarden extends BOPHellBiome
|
|||
treeGenerator.add("twiglet", 3, (new GeneratorTwigletTree.Builder()).placeOn(this.topBlock).minHeight(2).maxHeight(2).log(BlockBOPLeaves.paging.getVariantState(BOPTrees.HELLBARK)).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.HELLBARK)).create());
|
||||
|
||||
// shrooms
|
||||
this.addGenerator("flat_mushroom", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).with(BlockBOPMushroom.MushroomType.FLAT_MUSHROOM).create());
|
||||
this.addGenerator("toadstools", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).with(BlockBOPMushroom.MushroomType.TOADSTOOL).create());
|
||||
this.addGenerator("red_mushrooms", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.6F).with(Blocks.RED_MUSHROOM.getDefaultState()).create());
|
||||
this.addGenerator("brown_mushrooms", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(1.0F).with(Blocks.BROWN_MUSHROOM.getDefaultState()).create());
|
||||
this.addGenerator("flat_mushroom", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).scatterYMethod(ScatterYMethod.ANY_SURFACE).with(BlockBOPMushroom.MushroomType.FLAT_MUSHROOM).create());
|
||||
this.addGenerator("toadstools", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).scatterYMethod(ScatterYMethod.ANY_SURFACE).with(BlockBOPMushroom.MushroomType.TOADSTOOL).create());
|
||||
this.addGenerator("red_mushrooms", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.6F).scatterYMethod(ScatterYMethod.ANY_SURFACE).with(Blocks.RED_MUSHROOM.getDefaultState()).create());
|
||||
this.addGenerator("brown_mushrooms", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(1.0F).scatterYMethod(ScatterYMethod.ANY_SURFACE).with(Blocks.BROWN_MUSHROOM.getDefaultState()).create());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ package biomesoplenty.common.util.biome;
|
|||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
|
||||
import biomesoplenty.common.util.block.BlockQuery;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
|
@ -82,7 +83,7 @@ public class GeneratorUtils
|
|||
|
||||
public static enum ScatterYMethod
|
||||
{
|
||||
ANYWHERE, AT_SURFACE, AT_GROUND, BELOW_SURFACE, BELOW_GROUND, ABOVE_SURFACE, ABOVE_GROUND;
|
||||
ANYWHERE, ANY_SURFACE, AT_SURFACE, AT_GROUND, BELOW_SURFACE, BELOW_GROUND, ABOVE_SURFACE, ABOVE_GROUND;
|
||||
public BlockPos getBlockPos(World world, Random random, int x, int z)
|
||||
{
|
||||
int tempY;
|
||||
|
@ -113,6 +114,11 @@ public class GeneratorUtils
|
|||
// random point above ground (but possibly in the sea)
|
||||
tempY = world.getTopSolidOrLiquidBlock(new BlockPos(x, 0, z)).getY();
|
||||
return new BlockPos(x, GeneratorUtils.nextIntBetween(random, tempY, 255), z);
|
||||
case ANY_SURFACE:
|
||||
// random point above any surface (including caves)
|
||||
tempY = world.getHeight(new BlockPos(x, 0, z)).getY();
|
||||
pos = getFirstBlockMatching(world, new BlockPos(x, nextIntBetween(random, 1, tempY - 1), z), BlockQuery.buildAnd().add(BlockQueries.solid).withAirAbove().create());
|
||||
return (pos == null ? new BlockPos(x, 1, z) : pos.up());
|
||||
case ANYWHERE: default:
|
||||
// random y coord
|
||||
return new BlockPos(x, nextIntBetween(random, 1, 255), z);
|
||||
|
|
Loading…
Reference in a new issue