diff --git a/src/main/java/biomesoplenty/common/biome/nether/BiomeCorruptedSands.java b/src/main/java/biomesoplenty/common/biome/nether/BiomeCorruptedSands.java index 8c65337b0..031003ca3 100644 --- a/src/main/java/biomesoplenty/common/biome/nether/BiomeCorruptedSands.java +++ b/src/main/java/biomesoplenty/common/biome/nether/BiomeCorruptedSands.java @@ -30,7 +30,7 @@ public class BiomeCorruptedSands extends BOPHellBiome // splatter top blocks IBlockPosQuery emptyNetherrack = BlockQuery.buildAnd().withAirAbove().states(this.topBlock).create(); - this.addGenerator("soulsand_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(0.7F).generationAttempts(128).replace(emptyNetherrack).with(Blocks.SOUL_SAND.getDefaultState()).create()); + this.addGenerator("soulsand_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(0.7F).generationAttempts(128).scatterYMethod(ScatterYMethod.NETHER_SURFACE).replace(emptyNetherrack).with(Blocks.SOUL_SAND.getDefaultState()).create()); this.addGenerator("thorns", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(2.0F).with(BOPPlants.THORN).create()); } diff --git a/src/main/java/biomesoplenty/common/biome/nether/BiomeFungiForest.java b/src/main/java/biomesoplenty/common/biome/nether/BiomeFungiForest.java index 91f30f3ef..bef129fe2 100644 --- a/src/main/java/biomesoplenty/common/biome/nether/BiomeFungiForest.java +++ b/src/main/java/biomesoplenty/common/biome/nether/BiomeFungiForest.java @@ -49,11 +49,11 @@ public class BiomeFungiForest extends BOPHellBiome this.addWeight(BOPClimates.HELL, 20); // shrooms - this.addGenerator("glowshroom", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.1F).with(BlockBOPMushroom.MushroomType.GLOWSHROOM).scatterYMethod(ScatterYMethod.BELOW_GROUND).create()); - this.addGenerator("flat_mushroom", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.2F).with(BlockBOPMushroom.MushroomType.FLAT_MUSHROOM).scatterYMethod(ScatterYMethod.BELOW_GROUND).create()); - this.addGenerator("toadstools", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.1F).with(BlockBOPMushroom.MushroomType.TOADSTOOL).scatterYMethod(ScatterYMethod.BELOW_GROUND).create()); - this.addGenerator("red_mushrooms", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(1.0F).with(Blocks.RED_MUSHROOM.getDefaultState()).scatterYMethod(ScatterYMethod.BELOW_GROUND).create()); - this.addGenerator("brown_mushrooms", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).with(Blocks.BROWN_MUSHROOM.getDefaultState()).scatterYMethod(ScatterYMethod.BELOW_GROUND).create()); + this.addGenerator("glowshroom", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.1F).scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(BlockBOPMushroom.MushroomType.GLOWSHROOM).scatterYMethod(ScatterYMethod.BELOW_GROUND).create()); + this.addGenerator("flat_mushroom", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.2F).scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(BlockBOPMushroom.MushroomType.FLAT_MUSHROOM).scatterYMethod(ScatterYMethod.BELOW_GROUND).create()); + this.addGenerator("toadstools", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.1F).scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(BlockBOPMushroom.MushroomType.TOADSTOOL).scatterYMethod(ScatterYMethod.BELOW_GROUND).create()); + this.addGenerator("red_mushrooms", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(1.0F).scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(Blocks.RED_MUSHROOM.getDefaultState()).scatterYMethod(ScatterYMethod.BELOW_GROUND).create()); + this.addGenerator("brown_mushrooms", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(Blocks.BROWN_MUSHROOM.getDefaultState()).scatterYMethod(ScatterYMethod.BELOW_GROUND).create()); this.addGenerator("big_brown_mushroom", GeneratorStage.BIG_SHROOM,(new GeneratorBigMushroom.Builder()).amountPerChunk(0.1F).mushroomType(GeneratorBigMushroom.BigMushroomType.BROWN).create()); this.addGenerator("big_red_mushroom", GeneratorStage.BIG_SHROOM,(new GeneratorBigMushroom.Builder()).amountPerChunk(0.5F).mushroomType(GeneratorBigMushroom.BigMushroomType.RED).create()); } diff --git a/src/main/java/biomesoplenty/common/biome/nether/BiomePolarChasm.java b/src/main/java/biomesoplenty/common/biome/nether/BiomePolarChasm.java index 97971c758..1679a5a1c 100644 --- a/src/main/java/biomesoplenty/common/biome/nether/BiomePolarChasm.java +++ b/src/main/java/biomesoplenty/common/biome/nether/BiomePolarChasm.java @@ -12,6 +12,7 @@ import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.enums.BOPClimates; import biomesoplenty.api.generation.GeneratorStage; import biomesoplenty.common.block.BlockBOPGrass; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.BlockQuery; import biomesoplenty.common.world.generator.GeneratorSplatter; import net.minecraft.block.state.IBlockState; @@ -36,6 +37,6 @@ public class BiomePolarChasm extends BOPHellBiome // splatter top blocks IBlockPosQuery emptySurface = BlockQuery.buildAnd().withAirAbove().states(this.topBlock).create(); - this.addGenerator("ice_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(2.0F).generationAttempts(128).replace(emptySurface).with(Blocks.ICE.getDefaultState()).create()); + this.addGenerator("ice_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(2.0F).generationAttempts(128).scatterYMethod(ScatterYMethod.NETHER_SURFACE).replace(emptySurface).with(Blocks.ICE.getDefaultState()).create()); } } diff --git a/src/main/java/biomesoplenty/common/biome/nether/BiomeUndergarden.java b/src/main/java/biomesoplenty/common/biome/nether/BiomeUndergarden.java index cb15b1c97..ba34cdf4f 100644 --- a/src/main/java/biomesoplenty/common/biome/nether/BiomeUndergarden.java +++ b/src/main/java/biomesoplenty/common/biome/nether/BiomeUndergarden.java @@ -7,38 +7,22 @@ ******************************************************************************/ 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; -import biomesoplenty.api.enums.BOPFlowers; -import biomesoplenty.api.enums.BOPPlants; -import biomesoplenty.api.enums.BOPTrees; +import biomesoplenty.api.enums.*; import biomesoplenty.api.generation.GeneratorStage; import biomesoplenty.common.block.BlockBOPGrass; import biomesoplenty.common.block.BlockBOPLeaves; +import biomesoplenty.common.block.BlockBOPLog; import biomesoplenty.common.block.BlockBOPMushroom; import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.BlockQuery; -import biomesoplenty.common.world.generator.GeneratorDoubleFlora; import biomesoplenty.common.world.generator.GeneratorFlora; -import biomesoplenty.common.world.generator.GeneratorGrass; import biomesoplenty.common.world.generator.GeneratorSplatter; import biomesoplenty.common.world.generator.GeneratorWeighted; import biomesoplenty.common.world.generator.tree.GeneratorTwigletTree; -import net.minecraft.block.BlockDirt; -import net.minecraft.block.BlockDoublePlant; -import net.minecraft.block.BlockFlower; -import net.minecraft.block.BlockPlanks; -import net.minecraft.block.BlockTallGrass; -import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.chunk.ChunkPrimer; public class BiomeUndergarden extends BOPHellBiome { @@ -53,22 +37,24 @@ public class BiomeUndergarden extends BOPHellBiome // splatter top blocks 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()); + IBlockState overgrownNetherrack = BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.OVERGROWN_NETHERRACK); + this.addGenerator("overgrown_netherrack_splatter", GeneratorStage.SAND, (new GeneratorSplatter.Builder()).amountPerChunk(14.0F).generationAttempts(128).scatterYMethod(ScatterYMethod.NETHER_SURFACE).replace(emptyNetherrack).with(overgrownNetherrack).create()); // flowers GeneratorWeighted flowerGenerator = new GeneratorWeighted(1.0F); this.addGenerator("flowers", GeneratorStage.FLOWERS, flowerGenerator); - flowerGenerator.add("burning_blossom", 4, (new GeneratorFlora.Builder().scatterYMethod(ScatterYMethod.ANY_SURFACE).with(BOPFlowers.BURNING_BLOSSOM).create())); + flowerGenerator.add("burning_blossom", 4, (new GeneratorFlora.Builder().scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(BOPFlowers.BURNING_BLOSSOM).create())); // trees - GeneratorWeighted treeGenerator = new GeneratorWeighted(5.0F); + IBlockPosQuery surfaceBlocks = BlockQuery.buildOr().states(this.topBlock, overgrownNetherrack).create(); + GeneratorWeighted treeGenerator = new GeneratorWeighted(7.0F); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); - 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()); + treeGenerator.add("twiglet", 3, (new GeneratorTwigletTree.Builder()).scatterYMethod(ScatterYMethod.NETHER_SURFACE).placeOn(surfaceBlocks).minHeight(2).maxHeight(2).log(BlockBOPLog.paging.getVariantState(BOPWoods.HELLBARK)).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.HELLBARK)).create()); // shrooms - 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()); + this.addGenerator("flat_mushroom", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(BlockBOPMushroom.MushroomType.FLAT_MUSHROOM).create()); + this.addGenerator("toadstools", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(BlockBOPMushroom.MushroomType.TOADSTOOL).create()); + this.addGenerator("red_mushrooms", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(0.6F).scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(Blocks.RED_MUSHROOM.getDefaultState()).create()); + this.addGenerator("brown_mushrooms", GeneratorStage.SHROOM,(new GeneratorFlora.Builder()).amountPerChunk(1.0F).scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(Blocks.BROWN_MUSHROOM.getDefaultState()).create()); } } diff --git a/src/main/java/biomesoplenty/common/biome/nether/BiomeVisceralHeap.java b/src/main/java/biomesoplenty/common/biome/nether/BiomeVisceralHeap.java index 4fdefb57e..995a4083b 100644 --- a/src/main/java/biomesoplenty/common/biome/nether/BiomeVisceralHeap.java +++ b/src/main/java/biomesoplenty/common/biome/nether/BiomeVisceralHeap.java @@ -55,8 +55,8 @@ public class BiomeVisceralHeap extends BOPHellBiome this.wallBlock = BOPBlocks.flesh.getDefaultState(); // blood pools - this.addGenerator("blood_pools", GeneratorStage.SAND, (new GeneratorLakes.Builder()).amountPerChunk(0.5F).waterLakeForBiome(this).liquid(BOPBlocks.blood).frozenLiquid((IBlockState)null).create()); + this.addGenerator("blood_pools", GeneratorStage.SAND, (new GeneratorLakes.Builder()).amountPerChunk(0.5F).waterLakeForBiome(this).liquid(BOPBlocks.blood).frozenLiquid((IBlockState)null).scatterYMethod(ScatterYMethod.NETHER_SURFACE).create()); - this.addGenerator("eyebulbs", GeneratorStage.FLOWERS, (new GeneratorDoubleFlora.Builder()).amountPerChunk(1.0F).with(BlockBOPDoublePlant.DoublePlantType.EYEBULB).create()); + this.addGenerator("eyebulbs", GeneratorStage.FLOWERS, (new GeneratorDoubleFlora.Builder()).amountPerChunk(1.0F).scatterYMethod(ScatterYMethod.NETHER_SURFACE).with(BlockBOPDoublePlant.DoublePlantType.EYEBULB).create()); } } diff --git a/src/main/java/biomesoplenty/common/util/biome/GeneratorUtils.java b/src/main/java/biomesoplenty/common/util/biome/GeneratorUtils.java index cfc223c62..062c9cf9f 100644 --- a/src/main/java/biomesoplenty/common/util/biome/GeneratorUtils.java +++ b/src/main/java/biomesoplenty/common/util/biome/GeneratorUtils.java @@ -83,7 +83,7 @@ public class GeneratorUtils public static enum ScatterYMethod { - ANYWHERE, ANY_SURFACE, AT_SURFACE, AT_GROUND, BELOW_SURFACE, BELOW_GROUND, ABOVE_SURFACE, ABOVE_GROUND; + ANYWHERE, NETHER_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; @@ -114,10 +114,10 @@ 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) + case NETHER_SURFACE: + // random point above the nether surface 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()); + pos = getFirstBlockMatching(world, new BlockPos(x, nextIntBetween(random, 1, 127), z), BlockQuery.buildAnd().add(BlockQueries.solid).withAirAbove().create()); return (pos == null ? new BlockPos(x, 1, z) : pos.up()); case ANYWHERE: default: // random y coord diff --git a/src/main/java/biomesoplenty/common/world/generator/GeneratorLakes.java b/src/main/java/biomesoplenty/common/world/generator/GeneratorLakes.java index 7b67f3556..66a123784 100644 --- a/src/main/java/biomesoplenty/common/world/generator/GeneratorLakes.java +++ b/src/main/java/biomesoplenty/common/world/generator/GeneratorLakes.java @@ -14,6 +14,7 @@ import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.api.generation.BOPGeneratorBase; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.BlockQuery; import biomesoplenty.common.util.block.BlockQuery.BlockQueryBlock; import biomesoplenty.common.util.block.BlockQuery.BlockQueryParseException; @@ -36,7 +37,8 @@ public class GeneratorLakes extends BOPGeneratorBase protected IBlockState frozenLiquid; protected IBlockState grassBorderWith; protected IBlockPosQuery grassReplace; - protected IBlockState lineWith; + protected IBlockState lineWith; + protected ScatterYMethod scatterYMethod; public Builder liquid(IBlockState a) {this.liquid = a; return this.self();} public Builder liquid(Block a) {this.liquid = a.getDefaultState(); return this.self();} @@ -50,6 +52,7 @@ public class GeneratorLakes extends BOPGeneratorBase public Builder grassReplace(IBlockState a) {this.grassReplace = new BlockQueryState(a); return this.self();} public Builder lineWith(IBlockState a) {this.lineWith = a; return this.self();} public Builder lineWith(Block a) {this.lineWith = a.getDefaultState(); return this.self();} + public Builder scatterYMethod(ScatterYMethod a) {this.scatterYMethod = a; return this.self();} public Builder waterLakeForBiome(Biome a) { @@ -79,11 +82,12 @@ public class GeneratorLakes extends BOPGeneratorBase this.grassBorderWith = Blocks.GRASS.getDefaultState(); this.grassReplace = new BlockQueryBlock(Blocks.DIRT); this.lineWith = null; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorLakes create() { - return new GeneratorLakes(this.amountPerChunk, this.liquid, this.frozenLiquid, this.grassBorderWith, this.grassReplace, this.lineWith); + return new GeneratorLakes(this.amountPerChunk, this.liquid, this.frozenLiquid, this.grassBorderWith, this.grassReplace, this.lineWith, this.scatterYMethod); } } @@ -92,9 +96,10 @@ public class GeneratorLakes extends BOPGeneratorBase protected IBlockState grassBorderWith; protected IBlockPosQuery grassReplace; protected IBlockState lineWith; + protected GeneratorUtils.ScatterYMethod scatterYMethod; - public GeneratorLakes(float amountPerChunk, IBlockState liquid, IBlockState frozenLiquid, IBlockState grassBorderWith, IBlockPosQuery grassReplace, IBlockState lineWith) + public GeneratorLakes(float amountPerChunk, IBlockState liquid, IBlockState frozenLiquid, IBlockState grassBorderWith, IBlockPosQuery grassReplace, IBlockState lineWith, ScatterYMethod scatterYMethod) { super(amountPerChunk); this.liquid = liquid; @@ -102,13 +107,14 @@ public class GeneratorLakes extends BOPGeneratorBase this.grassBorderWith = grassBorderWith; this.grassReplace = grassReplace; this.lineWith = lineWith; + this.scatterYMethod = scatterYMethod; } @Override public BlockPos getScatterY(World world, Random random, int x, int z) { // always at world surface - return GeneratorUtils.ScatterYMethod.AT_SURFACE.getBlockPos(world, random, x, z); + return this.scatterYMethod.getBlockPos(world, random, x, z); } public boolean[] getCavityShape(Random rand) diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBasicTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBasicTree.java index b78e442d3..a5ebd56b4 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBasicTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBasicTree.java @@ -16,6 +16,7 @@ import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.BlockQuery; import biomesoplenty.common.util.block.BlockQuery.BlockQueryBlock; import biomesoplenty.common.util.block.BlockQuery.BlockQueryMaterial; @@ -58,12 +59,13 @@ public class GeneratorBasicTree extends GeneratorTreeBase this.leavesLayerHeight = 2; this.placeVinesOn = BlockQueries.air; this.hangingChance = 0.0F; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorBasicTree create() { - return new GeneratorBasicTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.updateNeighbours, this.leafLayers, this.leavesOffset, this.maxLeavesRadius, this.leavesLayerHeight, this.placeVinesOn, this.hangingChance); + return new GeneratorBasicTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.updateNeighbours, this.leafLayers, this.leavesOffset, this.maxLeavesRadius, this.leavesLayerHeight, this.placeVinesOn, this.hangingChance, this.scatterYMethod); } } @@ -98,9 +100,9 @@ public class GeneratorBasicTree extends GeneratorTreeBase protected IBlockPosQuery placeVinesOn; protected float hangingChance; - public GeneratorBasicTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers, int leavesOffset, int maxLeavesRadius, int leavesLayerHeight, IBlockPosQuery placeVinesOn, float hangingChance) + public GeneratorBasicTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers, int leavesOffset, int maxLeavesRadius, int leavesLayerHeight, IBlockPosQuery placeVinesOn, float hangingChance, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); this.updateNeighbours = updateNeighbours; this.leavesOffset = leavesOffset; this.leafLayers = leafLayers; diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBayouTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBayouTree.java index fc158f140..ba1b4fa02 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBayouTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBayouTree.java @@ -13,6 +13,7 @@ import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.BlockQuery; import biomesoplenty.common.util.block.BlockQuery.BlockQueryBlock; import biomesoplenty.common.util.block.BlockQuery.BlockQueryParseException; @@ -63,12 +64,13 @@ public class GeneratorBayouTree extends GeneratorTreeBase this.leavesGradient = 4; this.vineAttempts = 20; this.maxVineLength = 20; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorBayouTree create() { - return new GeneratorBayouTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.minLeavesRadius, this.leavesGradient, this.vineAttempts, this.maxVineLength, this.rootsReplace); + return new GeneratorBayouTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.minLeavesRadius, this.leavesGradient, this.vineAttempts, this.maxVineLength, this.rootsReplace, this.scatterYMethod); } } @@ -79,9 +81,9 @@ public class GeneratorBayouTree extends GeneratorTreeBase private int maxVineLength; private IBlockPosQuery rootsReplace; - public GeneratorBayouTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, int minLeavesRadius, int leavesGradient, int vineAttempts, int maxVineLength, IBlockPosQuery rootsReplace) + public GeneratorBayouTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, int minLeavesRadius, int leavesGradient, int vineAttempts, int maxVineLength, IBlockPosQuery rootsReplace, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); this.minLeavesRadius = minLeavesRadius; this.leavesGradient = leavesGradient; this.vineAttempts = vineAttempts; diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBigTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBigTree.java index 8d47e9858..e9efab9ef 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBigTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBigTree.java @@ -19,6 +19,7 @@ import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.BlockQuery.BlockQueryMaterial; import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockLog; @@ -62,7 +63,7 @@ public class GeneratorBigTree extends GeneratorTreeBase this.trunkWidth = 1; this.foliageHeight = 4; this.foliageDensity = 1.0F; - + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } public Builder trunkWidth(int a) {this.trunkWidth = a; return this.self();} @@ -73,7 +74,7 @@ public class GeneratorBigTree extends GeneratorTreeBase @Override public GeneratorBigTree create() { - return new GeneratorBigTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.trunkWidth, this.foliageHeight, this.foliageDensity, false); + return new GeneratorBigTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.trunkWidth, this.foliageHeight, this.foliageDensity, false, this.scatterYMethod); } } @@ -98,9 +99,9 @@ public class GeneratorBigTree extends GeneratorTreeBase private List foliageCoords; - public GeneratorBigTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, int trunkWidth, int foliageHeight, double foliageDensity, boolean updateNeighbours) + public GeneratorBigTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, int trunkWidth, int foliageHeight, double foliageDensity, boolean updateNeighbours, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); this.foliageHeight = foliageHeight; this.foliageDensity = foliageDensity; this.trunkWidth = trunkWidth; diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBulbTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBulbTree.java index aae4cfbf6..8acdc8bf2 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBulbTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBulbTree.java @@ -13,6 +13,7 @@ import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import net.minecraft.block.BlockDirectional; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -38,19 +39,20 @@ public class GeneratorBulbTree extends GeneratorTreeBase this.hanging = null; this.trunkFruit = null; this.altLeaves = null; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorBulbTree create() { - return new GeneratorBulbTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight); + return new GeneratorBulbTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.scatterYMethod); } } - public GeneratorBulbTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight) + public GeneratorBulbTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); } public boolean setCocoa(World world, BlockPos pos, EnumFacing side) diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBush.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBush.java index 014ee8ced..dc924ddb0 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBush.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorBush.java @@ -14,6 +14,7 @@ import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; @@ -36,18 +37,19 @@ public class GeneratorBush extends GeneratorTreeBase this.hanging = null; this.trunkFruit = null; this.altLeaves = null; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorBush create() { - return new GeneratorBush(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight); + return new GeneratorBush(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.scatterYMethod); } } - public GeneratorBush(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight) + public GeneratorBush(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); } @Override diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorHugeTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorHugeTree.java index dbc26bbca..73e8b6adf 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorHugeTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorHugeTree.java @@ -12,6 +12,7 @@ import java.util.Random; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; @@ -20,8 +21,8 @@ import net.minecraft.world.World; public abstract class GeneratorHugeTree extends GeneratorTreeBase { - protected GeneratorHugeTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + protected GeneratorHugeTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, ScatterYMethod scatterYMethod) { + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); } protected int chooseHeight(Random rand) diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMahoganyTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMahoganyTree.java index 87769d220..ee9deab49 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMahoganyTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMahoganyTree.java @@ -13,6 +13,8 @@ import biomesoplenty.api.enums.BOPTrees; import biomesoplenty.api.enums.BOPWoods; import biomesoplenty.common.block.BlockBOPLeaves; import biomesoplenty.common.block.BlockBOPLog; +import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.BlockQuery.BlockQueryMaterial; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -45,18 +47,19 @@ public class GeneratorMahoganyTree extends GeneratorBasicTree this.leavesLayerHeight = 1; this.placeVinesOn = BlockQueries.air; this.hangingChance = 0.0F; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorMahoganyTree create() { - return new GeneratorMahoganyTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, false, this.leafLayers, this.leavesOffset, this.maxLeavesRadius, this.leavesLayerHeight, this.placeVinesOn, this.hangingChance); + return new GeneratorMahoganyTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, false, this.leafLayers, this.leavesOffset, this.maxLeavesRadius, this.leavesLayerHeight, this.placeVinesOn, this.hangingChance, this.scatterYMethod); } } - public GeneratorMahoganyTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers, int leavesOffset, int minLeavesRadius, int leavesLayerHeight, IBlockPosQuery placeVinesOn, float hangingChance) + public GeneratorMahoganyTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers, int leavesOffset, int minLeavesRadius, int leavesLayerHeight, IBlockPosQuery placeVinesOn, float hangingChance, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, updateNeighbours, leafLayers, leavesOffset, minLeavesRadius, leavesLayerHeight, placeVinesOn, hangingChance); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, updateNeighbours, leafLayers, leavesOffset, minLeavesRadius, leavesLayerHeight, placeVinesOn, hangingChance, scatterYMethod); } @Override diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMangroveTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMangroveTree.java index ca68aa973..a25cfcaf9 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMangroveTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMangroveTree.java @@ -13,6 +13,7 @@ import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.BlockQuery; import biomesoplenty.common.util.block.BlockQuery.BlockQueryBlock; import biomesoplenty.common.util.block.BlockQuery.BlockQueryParseException; @@ -63,12 +64,13 @@ public class GeneratorMangroveTree extends GeneratorTreeBase this.leavesGradient = 1; this.vineAttempts = 20; this.maxVineLength = 20; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorMangroveTree create() { - return new GeneratorMangroveTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.minLeavesRadius, this.leavesGradient, this.vineAttempts, this.maxVineLength, this.rootsReplace); + return new GeneratorMangroveTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.minLeavesRadius, this.leavesGradient, this.vineAttempts, this.maxVineLength, this.rootsReplace, this.scatterYMethod); } } @@ -79,9 +81,9 @@ public class GeneratorMangroveTree extends GeneratorTreeBase private int maxVineLength; private IBlockPosQuery rootsReplace; - public GeneratorMangroveTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, int minLeavesRadius, int leavesGradient, int vineAttempts, int maxVineLength, IBlockPosQuery rootsReplace) + public GeneratorMangroveTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, int minLeavesRadius, int leavesGradient, int vineAttempts, int maxVineLength, IBlockPosQuery rootsReplace, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); this.minLeavesRadius = minLeavesRadius; this.leavesGradient = leavesGradient; this.vineAttempts = vineAttempts; diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMegaJungleTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMegaJungleTree.java index 7f2c6c207..422d67fd2 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMegaJungleTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMegaJungleTree.java @@ -12,6 +12,8 @@ import java.util.Random; import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; +import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import net.minecraft.block.BlockPlanks; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -38,18 +40,19 @@ public class GeneratorMegaJungleTree extends GeneratorHugeTree this.hanging = null; this.trunkFruit = null; this.altLeaves = null; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorMegaJungleTree create() { - return new GeneratorMegaJungleTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight); + return new GeneratorMegaJungleTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.scatterYMethod); } } - protected GeneratorMegaJungleTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight) + protected GeneratorMegaJungleTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); } diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPalmTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPalmTree.java index 587077e93..c073e7997 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPalmTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPalmTree.java @@ -14,6 +14,7 @@ import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -38,18 +39,19 @@ public class GeneratorPalmTree extends GeneratorTreeBase this.hanging = null; this.trunkFruit = null; this.altLeaves = null; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorPalmTree create() { - return new GeneratorPalmTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight); + return new GeneratorPalmTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.scatterYMethod); } } - public GeneratorPalmTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight) + public GeneratorPalmTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); } diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPineTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPineTree.java index c875e265f..9973b3551 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPineTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPineTree.java @@ -14,6 +14,7 @@ import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -38,18 +39,19 @@ public class GeneratorPineTree extends GeneratorTreeBase this.hanging = hanging; this.trunkFruit = null; this.altLeaves = null; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorPineTree create() { - return new GeneratorPineTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight); + return new GeneratorPineTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.scatterYMethod); } } - public GeneratorPineTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight) + public GeneratorPineTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); } diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorProfileTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorProfileTree.java index 2ae41ba87..8ddd9a85b 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorProfileTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorProfileTree.java @@ -14,6 +14,7 @@ import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; @@ -42,20 +43,21 @@ public class GeneratorProfileTree extends GeneratorTreeBase this.trunkFruit = null; this.altLeaves = null; this.profile = TreeProfile.POPLAR; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorProfileTree create() { - return new GeneratorProfileTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.profile); + return new GeneratorProfileTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.profile, this.scatterYMethod); } } protected TreeProfile profile; - public GeneratorProfileTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, TreeProfile profile) + public GeneratorProfileTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, TreeProfile profile, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); this.profile = profile; } diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorRedwoodTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorRedwoodTree.java index 02638e0da..fdaca2f97 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorRedwoodTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorRedwoodTree.java @@ -17,6 +17,7 @@ import biomesoplenty.api.enums.BOPWoods; import biomesoplenty.common.block.BlockBOPLeaves; import biomesoplenty.common.block.BlockBOPLog; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.world.generator.GeneratorSpike; import net.minecraft.block.BlockOldLeaf; import net.minecraft.block.state.IBlockState; @@ -41,19 +42,20 @@ public class GeneratorRedwoodTree extends GeneratorTreeBase this.hanging = null; this.trunkFruit = null; this.altLeaves = null; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorRedwoodTree create() { - return new GeneratorRedwoodTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight); + return new GeneratorRedwoodTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.scatterYMethod); } } - protected GeneratorRedwoodTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight) + protected GeneratorRedwoodTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); } public boolean canPlaceHere(World world, BlockPos pos, int height, int radius) diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorRedwoodTreeThin.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorRedwoodTreeThin.java index b09e7ea48..583de0afe 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorRedwoodTreeThin.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorRedwoodTreeThin.java @@ -17,6 +17,7 @@ import biomesoplenty.api.enums.BOPWoods; import biomesoplenty.common.block.BlockBOPLeaves; import biomesoplenty.common.block.BlockBOPLog; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.world.generator.GeneratorSpike; import net.minecraft.block.BlockOldLeaf; import net.minecraft.block.state.IBlockState; @@ -41,19 +42,20 @@ public class GeneratorRedwoodTreeThin extends GeneratorTreeBase this.hanging = null; this.trunkFruit = null; this.altLeaves = null; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorRedwoodTreeThin create() { - return new GeneratorRedwoodTreeThin(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight); + return new GeneratorRedwoodTreeThin(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.scatterYMethod); } } - protected GeneratorRedwoodTreeThin(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight) + protected GeneratorRedwoodTreeThin(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); } public boolean canPlaceHere(World world, BlockPos pos, int height, int radius) diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTaigaTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTaigaTree.java index a9862dba0..ee92a741a 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTaigaTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTaigaTree.java @@ -13,6 +13,7 @@ import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import net.minecraft.block.BlockOldLeaf; import net.minecraft.block.BlockOldLog; import net.minecraft.block.BlockPlanks; @@ -46,20 +47,21 @@ public class GeneratorTaigaTree extends GeneratorTreeBase this.trunkFruit = null; this.altLeaves = null; this.trunkWidth = 1; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorTaigaTree create() { - return new GeneratorTaigaTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.trunkWidth); + return new GeneratorTaigaTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.trunkWidth, this.scatterYMethod); } } private int trunkWidth; - public GeneratorTaigaTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, int trunkWidth) + public GeneratorTaigaTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, int trunkWidth, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); this.trunkWidth = trunkWidth; } diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTreeBase.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTreeBase.java index cc4a11fcc..44e7ada18 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTreeBase.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTreeBase.java @@ -17,6 +17,7 @@ import biomesoplenty.api.generation.BOPGeneratorBase; import biomesoplenty.common.block.BlockBOPLeaves; import biomesoplenty.common.block.BlockBOPLog; import biomesoplenty.common.util.biome.GeneratorUtils; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.BlockQuery; import biomesoplenty.common.util.block.BlockQuery.BlockQueryBlock; import biomesoplenty.common.util.block.BlockQuery.BlockQueryMaterial; @@ -52,8 +53,9 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase protected int minHeight; protected int maxHeight; protected IProperty logAxisProperty; + protected ScatterYMethod scatterYMethod; - protected GeneratorTreeBase(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight) { + protected GeneratorTreeBase(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, ScatterYMethod scatterYMethod) { super(amountPerChunk); this.placeOn = placeOn; this.replace = replace; @@ -66,6 +68,7 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase this.minHeight = minHeight; this.maxHeight = maxHeight; this.logAxisProperty = GeneratorUtils.getAxisProperty(log); + this.scatterYMethod = scatterYMethod; } protected static abstract class InnerBuilder, G extends GeneratorTreeBase> extends BOPGeneratorBase.InnerBuilder @@ -81,6 +84,7 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase protected int minHeight; protected int maxHeight; protected boolean updateNeighbours; + protected ScatterYMethod scatterYMethod; public T placeOn(IBlockPosQuery a) {this.placeOn = a; return this.self();} public T placeOn(String a) throws BlockQueryParseException {this.placeOn = BlockQuery.parseQueryString(a); return this.self();} @@ -151,14 +155,15 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase public T maxHeight(int a) {this.maxHeight = a; return this.self();} public T updateNeighbours(boolean a) {this.updateNeighbours = a; return this.self();} + + public T scatterYMethod(ScatterYMethod a) {this.scatterYMethod = a; return this.self();} } @Override public BlockPos getScatterY(World world, Random random, int x, int z) { - // always at world surface - return GeneratorUtils.ScatterYMethod.AT_SURFACE.getBlockPos(world, random, x, z); + return this.scatterYMethod.getBlockPos(world, random, x, z); } public boolean setLeaves(World world, BlockPos pos) diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTwigletTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTwigletTree.java index 27ef906da..62b01f02d 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTwigletTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorTwigletTree.java @@ -13,6 +13,7 @@ import java.util.Random; import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.config.IConfigObj; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import net.minecraft.block.BlockCocoa; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -46,20 +47,21 @@ public class GeneratorTwigletTree extends GeneratorTreeBase this.altLeaves = null; this.leafChanceEven = 0.2F; this.leafChanceOdd = 0.9F; + this.scatterYMethod = ScatterYMethod.AT_SURFACE; } @Override public GeneratorTwigletTree create() { - return new GeneratorTwigletTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.leafChanceEven, this.leafChanceOdd); + return new GeneratorTwigletTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.trunkFruit, this.altLeaves, this.minHeight, this.maxHeight, this.leafChanceEven, this.leafChanceOdd, this.scatterYMethod); } } private float leafChanceEven; private float leafChanceOdd; - public GeneratorTwigletTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, float leafChanceEven, float leafChanceOdd) + public GeneratorTwigletTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState trunkFruit, IBlockState altLeaves, int minHeight, int maxHeight, float leafChanceEven, float leafChanceOdd, ScatterYMethod scatterYMethod) { - super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight); + super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight, scatterYMethod); this.leafChanceEven = leafChanceEven; this.leafChanceOdd = leafChanceOdd; }