Added wisteria generation

This commit is contained in:
Adubbz 2016-02-05 22:24:56 +11:00
parent 58600d70e1
commit aa163aa6f1
21 changed files with 125 additions and 76 deletions

View file

@ -82,7 +82,7 @@ public class BiomeGenLushSwamp extends BOPBiome
// trees & logs // trees & logs
GeneratorWeighted treeGenerator = new GeneratorWeighted(9); GeneratorWeighted treeGenerator = new GeneratorWeighted(9);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("swamp", 5, (new GeneratorBasicTree.Builder()).minHeight(8).maxHeight(12).minLeavesRadius(2).vine(BOPBlocks.ivy.getDefaultState()).create()); treeGenerator.add("swamp", 5, (new GeneratorBasicTree.Builder()).minHeight(8).maxHeight(12).maxLeavesRadius(2).vine(BOPBlocks.ivy.getDefaultState()).create());
// grasses // grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(5.0F); GeneratorWeighted grassGenerator = new GeneratorWeighted(5.0F);

View file

@ -78,7 +78,7 @@ public class BiomeGenMysticGrove extends BOPBiome
// trees & logs // trees & logs
GeneratorWeighted treeGenerator = new GeneratorWeighted(10); GeneratorWeighted treeGenerator = new GeneratorWeighted(10);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("flowering_vine", 2, (new GeneratorBasicTree.Builder()).minHeight(8).maxHeight(12).minLeavesRadius(2).vine(BOPBlocks.flower_vine.getDefaultState()).create()); treeGenerator.add("flowering_vine", 2, (new GeneratorBasicTree.Builder()).minHeight(8).maxHeight(12).maxLeavesRadius(2).vine(BOPBlocks.flower_vine.getDefaultState()).create());
treeGenerator.add("magic", 9, (new GeneratorBasicTree.Builder()).log(BOPWoods.MAGIC).leaves(BOPTrees.MAGIC).create()); treeGenerator.add("magic", 9, (new GeneratorBasicTree.Builder()).log(BOPWoods.MAGIC).leaves(BOPTrees.MAGIC).create());
treeGenerator.add("jacaranda", 1, (new GeneratorBasicTree.Builder()).minHeight(4).maxHeight(7).log(BOPWoods.JACARANDA).leaves(BOPTrees.JACARANDA).create()); treeGenerator.add("jacaranda", 1, (new GeneratorBasicTree.Builder()).minHeight(4).maxHeight(7).log(BOPWoods.JACARANDA).leaves(BOPTrees.JACARANDA).create());
treeGenerator.add("oak_large", 3, (new GeneratorBigTree.Builder()).create()); treeGenerator.add("oak_large", 3, (new GeneratorBigTree.Builder()).create());

View file

@ -80,7 +80,7 @@ public class BiomeGenOminousWoods extends BOPBiome
// trees & logs // trees & logs
GeneratorWeighted treeGenerator = new GeneratorWeighted(9); GeneratorWeighted treeGenerator = new GeneratorWeighted(9);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("umbran_moss", 4, (new GeneratorBasicTree.Builder()).log(BOPWoods.UMBRAN).leaves(BOPTrees.UMBRAN).minHeight(8).maxHeight(12).minLeavesRadius(2).vine(BOPBlocks.tree_moss.getDefaultState()).create()); treeGenerator.add("umbran_moss", 4, (new GeneratorBasicTree.Builder()).log(BOPWoods.UMBRAN).leaves(BOPTrees.UMBRAN).minHeight(8).maxHeight(12).maxLeavesRadius(2).vine(BOPBlocks.tree_moss.getDefaultState()).create());
treeGenerator.add("umbran_spruce", 5, (new GeneratorTaigaTree.Builder()).log(BOPWoods.UMBRAN).leaves(BOPTrees.UMBRAN).maxHeight(20).create()); // TODO: implement pine cones treeGenerator.add("umbran_spruce", 5, (new GeneratorTaigaTree.Builder()).log(BOPWoods.UMBRAN).leaves(BOPTrees.UMBRAN).maxHeight(20).create()); // TODO: implement pine cones
treeGenerator.add("dead_tree", 3, (new GeneratorBigTree.Builder()).minHeight(5).maxHeight(12).foliageHeight(0).foliageDensity(0.5D).log(BOPWoods.DEAD).leaves(Blocks.air.getDefaultState()).create()); treeGenerator.add("dead_tree", 3, (new GeneratorBigTree.Builder()).minHeight(5).maxHeight(12).foliageHeight(0).foliageDensity(0.5D).log(BOPWoods.DEAD).leaves(Blocks.air.getDefaultState()).create());
treeGenerator.add("mega_umbran", 4, (new GeneratorTaigaTree.Builder()).log(BOPWoods.UMBRAN).leaves(BOPTrees.UMBRAN).minHeight(20).maxHeight(30).trunkWidth(2).create()); treeGenerator.add("mega_umbran", 4, (new GeneratorTaigaTree.Builder()).log(BOPWoods.UMBRAN).leaves(BOPTrees.UMBRAN).minHeight(20).maxHeight(30).trunkWidth(2).create());

View file

@ -66,7 +66,7 @@ public class BiomeGenTemperateRainforest extends BOPBiome
treeGenerator.add("small_cedar", 3, (new GeneratorTaigaTree.Builder()).log(BlockPlanks.EnumType.OAK).leaves(BlockPlanks.EnumType.OAK).minHeight(5).maxHeight(15).create()); treeGenerator.add("small_cedar", 3, (new GeneratorTaigaTree.Builder()).log(BlockPlanks.EnumType.OAK).leaves(BlockPlanks.EnumType.OAK).minHeight(5).maxHeight(15).create());
treeGenerator.add("cedar", 5, (new GeneratorTaigaTree.Builder()).log(BlockPlanks.EnumType.OAK).leaves(BlockPlanks.EnumType.OAK).minHeight(20).maxHeight(40).create()); treeGenerator.add("cedar", 5, (new GeneratorTaigaTree.Builder()).log(BlockPlanks.EnumType.OAK).leaves(BlockPlanks.EnumType.OAK).minHeight(20).maxHeight(40).create());
treeGenerator.add("oak_bush", 5, (new GeneratorBush.Builder()).maxHeight(2).create()); treeGenerator.add("oak_bush", 5, (new GeneratorBush.Builder()).maxHeight(2).create());
treeGenerator.add("willow", 1, (new GeneratorBasicTree.Builder()).log(BOPWoods.WILLOW).leaves(BOPTrees.WILLOW).minHeight(8).maxHeight(12).minLeavesRadius(2).vine(BlockBOPLeaves.paging.getVariantState(BOPTrees.WILLOW).withProperty(BlockLeaves.DECAYABLE, Boolean.valueOf(false))).leavesOffset(0).create()); treeGenerator.add("willow", 1, (new GeneratorBasicTree.Builder()).log(BOPWoods.WILLOW).leaves(BOPTrees.WILLOW).minHeight(8).maxHeight(12).maxLeavesRadius(2).vine(BlockBOPLeaves.paging.getVariantState(BOPTrees.WILLOW).withProperty(BlockLeaves.DECAYABLE, Boolean.valueOf(false))).leavesOffset(0).create());
// other plants // other plants
this.addGenerator("shrubs", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.6F).with(BOPPlants.SHRUB).create()); this.addGenerator("shrubs", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.6F).with(BOPPlants.SHRUB).create());

View file

@ -74,7 +74,7 @@ public class BiomeGenWetland extends BOPBiome
// trees & logs // trees & logs
GeneratorWeighted treeGenerator = new GeneratorWeighted(7); GeneratorWeighted treeGenerator = new GeneratorWeighted(7);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("willow", 3, (new GeneratorBasicTree.Builder()).log(BOPWoods.WILLOW).leaves(BOPTrees.WILLOW).minHeight(8).maxHeight(12).minLeavesRadius(2).vine(BlockBOPLeaves.paging.getVariantState(BOPTrees.WILLOW).withProperty(BlockLeaves.DECAYABLE, Boolean.valueOf(false))).leavesOffset(0).create()); treeGenerator.add("willow", 3, (new GeneratorBasicTree.Builder()).log(BOPWoods.WILLOW).leaves(BOPTrees.WILLOW).minHeight(8).maxHeight(12).maxLeavesRadius(2).vine(BlockBOPLeaves.paging.getVariantState(BOPTrees.WILLOW).withProperty(BlockLeaves.DECAYABLE, Boolean.valueOf(false))).leavesOffset(0).create());
treeGenerator.add("spruce", 5, (new GeneratorTaigaTree.Builder()).maxHeight(13).create()); // TODO: implement pine cones treeGenerator.add("spruce", 5, (new GeneratorTaigaTree.Builder()).maxHeight(13).create()); // TODO: implement pine cones
// grasses // grasses

View file

@ -13,6 +13,7 @@ import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.block.BlockBOPCoral; import biomesoplenty.common.block.BlockBOPCoral;
import biomesoplenty.common.block.BlockBOPDoublePlant; import biomesoplenty.common.block.BlockBOPDoublePlant;
import biomesoplenty.common.block.BlockBOPLilypad; import biomesoplenty.common.block.BlockBOPLilypad;
import biomesoplenty.common.block.BlockBOPPlant;
import biomesoplenty.common.entities.EntityButterfly; import biomesoplenty.common.entities.EntityButterfly;
import biomesoplenty.common.entities.EntitySnail; import biomesoplenty.common.entities.EntitySnail;
import biomesoplenty.common.enums.BOPClimates; import biomesoplenty.common.enums.BOPClimates;
@ -45,7 +46,7 @@ public class BiomeGenWisteriaMeadow extends BOPBiome
this.spawnableCreatureList.add(new SpawnListEntry(EntityButterfly.class, 6, 2, 4)); this.spawnableCreatureList.add(new SpawnListEntry(EntityButterfly.class, 6, 2, 4));
//trees //trees
this.addGenerator("trees", GeneratorStage.TREE, (new GeneratorBasicTree.Builder()).amountPerChunk(1.0F).minHeight(6).maxHeight(10).minLeavesRadius(2).create()); this.addGenerator("trees", GeneratorStage.TREE, (new GeneratorBasicTree.Builder()).amountPerChunk(1.0F).minHeight(6).maxHeight(10).hanging(BlockBOPPlant.paging.getVariantState(BOPPlants.WISTERIA)).maxLeavesRadius(2).hangingChance(0.75F).create());
// grasses // grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(5.0F); GeneratorWeighted grassGenerator = new GeneratorWeighted(5.0F);

View file

@ -36,7 +36,7 @@ public class BiomeExtSwampland extends ExtendedBiomeWrapper
// trees // trees
GeneratorWeighted treeGenerator = new GeneratorWeighted(0.5F); GeneratorWeighted treeGenerator = new GeneratorWeighted(0.5F);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("willow", 1, (new GeneratorBasicTree.Builder()).log(BOPWoods.WILLOW).leaves(BOPTrees.WILLOW).minHeight(8).maxHeight(12).minLeavesRadius(2).vine(BlockBOPLeaves.paging.getVariantState(BOPTrees.WILLOW).withProperty(BlockLeaves.DECAYABLE, Boolean.valueOf(false))).leavesOffset(0).create()); treeGenerator.add("willow", 1, (new GeneratorBasicTree.Builder()).log(BOPWoods.WILLOW).leaves(BOPTrees.WILLOW).minHeight(8).maxHeight(12).maxLeavesRadius(2).vine(BlockBOPLeaves.paging.getVariantState(BOPTrees.WILLOW).withProperty(BlockLeaves.DECAYABLE, Boolean.valueOf(false))).leavesOffset(0).create());
// grasses // grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(1.2F); GeneratorWeighted grassGenerator = new GeneratorWeighted(1.2F);

View file

@ -45,19 +45,21 @@ public class GeneratorBasicTree extends GeneratorTreeBase
this.log = Blocks.log.getDefaultState(); this.log = Blocks.log.getDefaultState();
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null;
this.minHeight = 4; this.minHeight = 4;
this.maxHeight = 7; this.maxHeight = 7;
this.leafLayers = 4; this.leafLayers = 4;
this.leavesOffset = 1; this.leavesOffset = 1;
this.minLeavesRadius = 1; this.maxLeavesRadius = 1;
this.leavesLayerHeight = 2; this.leavesLayerHeight = 2;
this.placeVinesOn = BlockQueries.air; this.placeVinesOn = BlockQueries.air;
this.hangingChance = 0.0F;
} }
@Override @Override
public GeneratorBasicTree create() public GeneratorBasicTree create()
{ {
return new GeneratorBasicTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight, false, this.leafLayers, this.leavesOffset, this.minLeavesRadius, this.leavesLayerHeight, this.placeVinesOn); return new GeneratorBasicTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.minHeight, this.maxHeight, false, this.leafLayers, this.leavesOffset, this.maxLeavesRadius, this.leavesLayerHeight, this.placeVinesOn, this.hangingChance);
} }
} }
@ -65,38 +67,43 @@ public class GeneratorBasicTree extends GeneratorTreeBase
{ {
protected int leafLayers; protected int leafLayers;
protected int leavesOffset; protected int leavesOffset;
protected int minLeavesRadius; protected int maxLeavesRadius;
protected int leavesLayerHeight; protected int leavesLayerHeight;
protected IBlockPosQuery placeVinesOn; protected IBlockPosQuery placeVinesOn;
protected float hangingChance;
public T leafLayers(int a) {this.leafLayers = a; return this.self();} public T leafLayers(int a) {this.leafLayers = a; return this.self();}
public T leavesOffset(int a) {this.leavesOffset = a; return this.self();} public T leavesOffset(int a) {this.leavesOffset = a; return this.self();}
public T leavesLayerHeight(int a) {this.leavesLayerHeight = a; return this.self();} public T leavesLayerHeight(int a) {this.leavesLayerHeight = a; return this.self();}
public T minLeavesRadius(int a) {this.minLeavesRadius = a; return this.self();} public T maxLeavesRadius(int a) {this.maxLeavesRadius = a; return this.self();}
public T placeVinesOn(IBlockPosQuery a) {this.placeVinesOn = a; return this.self();} public T placeVinesOn(IBlockPosQuery a) {this.placeVinesOn = a; return this.self();}
public T placeVinesOn(String a) throws BlockQueryParseException {this.placeVinesOn = BlockQuery.parseQueryString(a); return this.self();} public T placeVinesOn(String a) throws BlockQueryParseException {this.placeVinesOn = BlockQuery.parseQueryString(a); return this.self();}
public T placeVinesOn(Block a) {this.placeVinesOn = new BlockQueryBlock(a); return this.self();} public T placeVinesOn(Block a) {this.placeVinesOn = new BlockQueryBlock(a); return this.self();}
public T placeVinesOn(IBlockState a) {this.placeVinesOn = new BlockQueryState(a); return this.self();} public T placeVinesOn(IBlockState a) {this.placeVinesOn = new BlockQueryState(a); return this.self();}
public T placeVinesOn(Material... a) {this.placeVinesOn = new BlockQueryMaterial(a); return this.self();} public T placeVinesOn(Material... a) {this.placeVinesOn = new BlockQueryMaterial(a); return this.self();}
public T hangingChance(float a) {this.hangingChance = a; return this.self();}
} }
protected boolean updateNeighbours; protected boolean updateNeighbours;
protected int leafLayers; protected int leafLayers;
protected int leavesOffset; protected int leavesOffset;
protected int minLeavesRadius; protected int maxLeavesRadius;
protected int leavesLayerHeight; protected int leavesLayerHeight;
protected IBlockPosQuery placeVinesOn; protected IBlockPosQuery placeVinesOn;
protected float hangingChance;
public GeneratorBasicTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers, int leavesOffset, int minLeavesRadius, int leavesLayerHeight, IBlockPosQuery placeVinesOn) public GeneratorBasicTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers, int leavesOffset, int maxLeavesRadius, int leavesLayerHeight, IBlockPosQuery placeVinesOn, float hangingChance)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
this.updateNeighbours = updateNeighbours; this.updateNeighbours = updateNeighbours;
this.leavesOffset = leavesOffset; this.leavesOffset = leavesOffset;
this.leafLayers = leafLayers; this.leafLayers = leafLayers;
this.minLeavesRadius = minLeavesRadius; this.maxLeavesRadius = maxLeavesRadius;
this.leavesLayerHeight = leavesLayerHeight; this.leavesLayerHeight = leavesLayerHeight;
this.placeVinesOn = placeVinesOn; this.placeVinesOn = placeVinesOn;
this.hangingChance = hangingChance;
} }
@Override @Override
@ -169,7 +176,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
int currentLayer = y - (pos.getY() + height); int currentLayer = y - (pos.getY() + height);
//Uses integer division truncation (-3 / 2 = -1, -2 / 2 = -1) to reduce //Uses integer division truncation (-3 / 2 = -1, -2 / 2 = -1) to reduce
//the radius closer to the top of the tree. (2, 2, 1, 1) //the radius closer to the top of the tree. (2, 2, 1, 1)
int leavesRadius = this.minLeavesRadius - currentLayer / this.leavesLayerHeight; int leavesRadius = this.maxLeavesRadius - currentLayer / this.leavesLayerHeight;
for (int x = pos.getX() - leavesRadius; x <= pos.getX() + leavesRadius; x++) for (int x = pos.getX() - leavesRadius; x <= pos.getX() + leavesRadius; x++)
{ {
@ -203,7 +210,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
int currentLayer = y - (pos.getY() + height); int currentLayer = y - (pos.getY() + height);
//Uses integer division truncation (-3 / 2 = -1, -2 / 2 = -1) to reduce //Uses integer division truncation (-3 / 2 = -1, -2 / 2 = -1) to reduce
//the radius closer to the top of the tree. (3, 3, 2, 2) //the radius closer to the top of the tree. (3, 3, 2, 2)
int leavesRadius = (this.minLeavesRadius + this.leavesOffset) - currentLayer / this.leavesLayerHeight; int leavesRadius = (this.maxLeavesRadius + this.leavesOffset) - currentLayer / this.leavesLayerHeight;
for (int x = pos.getX() - leavesRadius; x <= pos.getX() + leavesRadius; x++) for (int x = pos.getX() - leavesRadius; x <= pos.getX() + leavesRadius; x++)
{ {
@ -243,6 +250,9 @@ public class GeneratorBasicTree extends GeneratorTreeBase
} }
} }
} }
//Generate fruit or any other blocks that may hang off of the tree
if (this.hanging != null) this.generateHanging(world, pos, height);
return true; return true;
} }
@ -267,28 +277,27 @@ public class GeneratorBasicTree extends GeneratorTreeBase
if (this.replace.matches(world, blockpos2)) if (this.replace.matches(world, blockpos2))
{ {
this.setBlockAndNotifyAdequately(world, start.up(layer), this.log); this.setBlockAndNotifyAdequately(world, start.up(layer), this.log);
}
//If vines are enabled, randomly cover the sides of the trunk with vines from the bottom up }
/*if (this.vine != null && layer > 0) }
protected void generateHanging(World world, BlockPos start, int height)
{
//Generate below the bottom layer of leaves
int y = start.getY() + (height - this.leafLayers);
for (int x = start.getX() - maxLeavesRadius; x <= start.getX() + maxLeavesRadius; x++)
{
for (int z = start.getZ() - maxLeavesRadius; z <= start.getZ() + maxLeavesRadius; z++)
{
BlockPos hangingPos = new BlockPos(x, y, z);
System.out.println(hangingPos);
if (!world.isAirBlock(hangingPos.up()) && world.rand.nextFloat() <= this.hangingChance)
{ {
if (random.nextInt(3) > 0 && this.placeVinesOn.matches(world, pos.add(-1, layer, 0))) this.setHanging(world, hangingPos);
{ }
this.setBlockAndNotifyAdequately(world, pos.add(-1, layer, 0), this.getVineStateForSide(EnumFacing.EAST));
}
if (random.nextInt(3) > 0 && this.placeVinesOn.matches(world, pos.add(1, layer, 0)))
{
this.setBlockAndNotifyAdequately(world, pos.add(1, layer, 0), this.getVineStateForSide(EnumFacing.WEST));
}
if (random.nextInt(3) > 0 && this.placeVinesOn.matches(world, pos.add(0, layer, -1)))
{
this.setBlockAndNotifyAdequately(world, pos.add(0, layer, -1), this.getVineStateForSide(EnumFacing.SOUTH));
}
if (random.nextInt(3) > 0 && this.placeVinesOn.matches(world, pos.add(0, layer, 1)))
{
this.setBlockAndNotifyAdequately(world, pos.add(0, layer, 1), this.getVineStateForSide(EnumFacing.NORTH));
}
}*/
} }
} }
} }
@ -340,5 +349,8 @@ public class GeneratorBasicTree extends GeneratorTreeBase
this.log = conf.getBlockState("logState", this.log); this.log = conf.getBlockState("logState", this.log);
this.leaves = conf.getBlockState("leavesState", this.leaves); this.leaves = conf.getBlockState("leavesState", this.leaves);
this.vine = conf.getBlockState("vineState", this.vine); this.vine = conf.getBlockState("vineState", this.vine);
this.hanging = conf.getBlockState("hangingState", this.hanging);
this.hangingChance = conf.getFloat("hangingChance", this.hangingChance);
} }
} }

View file

@ -54,6 +54,7 @@ public class GeneratorBayouTree extends GeneratorTreeBase
this.log = Blocks.log.getDefaultState(); this.log = Blocks.log.getDefaultState();
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = Blocks.vine.getDefaultState(); this.vine = Blocks.vine.getDefaultState();
this.hanging = null;
this.minHeight = 8; this.minHeight = 8;
this.maxHeight = 18; this.maxHeight = 18;
this.minLeavesRadius = 2; this.minLeavesRadius = 2;
@ -65,7 +66,7 @@ public class GeneratorBayouTree extends GeneratorTreeBase
@Override @Override
public GeneratorBayouTree create() public GeneratorBayouTree create()
{ {
return new GeneratorBayouTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, 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.minHeight, this.maxHeight, this.minLeavesRadius, this.leavesGradient, this.vineAttempts, this.maxVineLength, this.rootsReplace);
} }
} }
@ -76,9 +77,9 @@ public class GeneratorBayouTree extends GeneratorTreeBase
private int maxVineLength; private int maxVineLength;
private IBlockPosQuery rootsReplace; private IBlockPosQuery rootsReplace;
public GeneratorBayouTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, 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, int minHeight, int maxHeight, int minLeavesRadius, int leavesGradient, int vineAttempts, int maxVineLength, IBlockPosQuery rootsReplace)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
this.minLeavesRadius = minLeavesRadius; this.minLeavesRadius = minLeavesRadius;
this.leavesGradient = leavesGradient; this.leavesGradient = leavesGradient;
this.vineAttempts = vineAttempts; this.vineAttempts = vineAttempts;

View file

@ -52,6 +52,7 @@ public class GeneratorBigTree extends GeneratorTreeBase
this.log = Blocks.log.getDefaultState(); this.log = Blocks.log.getDefaultState();
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null;
this.minHeight = 5; this.minHeight = 5;
this.maxHeight = 17; this.maxHeight = 17;
@ -69,7 +70,7 @@ public class GeneratorBigTree extends GeneratorTreeBase
@Override @Override
public GeneratorBigTree create() public GeneratorBigTree create()
{ {
return new GeneratorBigTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, 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.minHeight, this.maxHeight, this.trunkWidth, this.foliageHeight, this.foliageDensity, false);
} }
} }
@ -94,9 +95,9 @@ public class GeneratorBigTree extends GeneratorTreeBase
private List<FoliageCoords> foliageCoords; private List<FoliageCoords> foliageCoords;
public GeneratorBigTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, 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, int minHeight, int maxHeight, int trunkWidth, int foliageHeight, double foliageDensity, boolean updateNeighbours)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
this.foliageHeight = foliageHeight; this.foliageHeight = foliageHeight;
this.foliageDensity = foliageDensity; this.foliageDensity = foliageDensity;
this.trunkWidth = trunkWidth; this.trunkWidth = trunkWidth;

View file

@ -34,20 +34,21 @@ public class GeneratorBulbTree extends GeneratorTreeBase
this.replace = BlockQueries.airOrLeaves; this.replace = BlockQueries.airOrLeaves;
this.log = Blocks.log.getDefaultState(); this.log = Blocks.log.getDefaultState();
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null;
} }
@Override @Override
public GeneratorBulbTree create() { public GeneratorBulbTree create() {
return new GeneratorBulbTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight); return new GeneratorBulbTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.minHeight, this.maxHeight);
} }
} }
public GeneratorBulbTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight) public GeneratorBulbTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
} }
public boolean setCocoa(World world, BlockPos pos, EnumFacing side) public boolean setCocoa(World world, BlockPos pos, EnumFacing side)

View file

@ -33,18 +33,19 @@ public class GeneratorBush extends GeneratorTreeBase
this.log = Blocks.log.getDefaultState(); this.log = Blocks.log.getDefaultState();
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null;
} }
@Override @Override
public GeneratorBush create() { public GeneratorBush create() {
return new GeneratorBush(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight); return new GeneratorBush(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.minHeight, this.maxHeight);
} }
} }
public GeneratorBush(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight) public GeneratorBush(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
} }
@Override @Override

View file

@ -20,8 +20,8 @@ import net.minecraft.world.World;
public abstract class GeneratorHugeTree extends GeneratorTreeBase public abstract class GeneratorHugeTree extends GeneratorTreeBase
{ {
protected GeneratorHugeTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight) { protected GeneratorHugeTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight) {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
} }
protected int chooseHeight(Random rand) protected int chooseHeight(Random rand)

View file

@ -34,25 +34,27 @@ public class GeneratorMahoganyTree extends GeneratorBasicTree
this.log = BlockBOPLog.paging.getVariantState(BOPWoods.MAHOGANY); this.log = BlockBOPLog.paging.getVariantState(BOPWoods.MAHOGANY);
this.leaves = BlockBOPLeaves.paging.getVariantState(BOPTrees.MAHOGANY); this.leaves = BlockBOPLeaves.paging.getVariantState(BOPTrees.MAHOGANY);
this.vine = null; this.vine = null;
this.hanging = null;
this.minHeight = 10; this.minHeight = 10;
this.maxHeight = 15; this.maxHeight = 15;
this.leafLayers = 4; this.leafLayers = 4;
this.leavesOffset = 1; this.leavesOffset = 1;
this.minLeavesRadius = 1; this.maxLeavesRadius = 1;
this.leavesLayerHeight = 1; this.leavesLayerHeight = 1;
this.placeVinesOn = BlockQueries.air; this.placeVinesOn = BlockQueries.air;
this.hangingChance = 0.0F;
} }
@Override @Override
public GeneratorMahoganyTree create() public GeneratorMahoganyTree create()
{ {
return new GeneratorMahoganyTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight, false, this.leafLayers, this.leavesOffset, this.minLeavesRadius, this.leavesLayerHeight, this.placeVinesOn); return new GeneratorMahoganyTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.minHeight, this.maxHeight, false, this.leafLayers, this.leavesOffset, this.maxLeavesRadius, this.leavesLayerHeight, this.placeVinesOn, this.hangingChance);
} }
} }
public GeneratorMahoganyTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers, int leavesOffset, int minLeavesRadius, int leavesLayerHeight, IBlockPosQuery placeVinesOn) public GeneratorMahoganyTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers, int leavesOffset, int minLeavesRadius, int leavesLayerHeight, IBlockPosQuery placeVinesOn, float hangingChance)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight, updateNeighbours, leafLayers, leavesOffset, minLeavesRadius, leavesLayerHeight, placeVinesOn); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight, updateNeighbours, leafLayers, leavesOffset, minLeavesRadius, leavesLayerHeight, placeVinesOn, hangingChance);
} }
@Override @Override

View file

@ -35,18 +35,19 @@ public class GeneratorMegaJungleTree extends GeneratorHugeTree
this.log(BlockPlanks.EnumType.JUNGLE); this.log(BlockPlanks.EnumType.JUNGLE);
this.leaves(BlockPlanks.EnumType.JUNGLE); this.leaves(BlockPlanks.EnumType.JUNGLE);
this.vine = Blocks.vine.getDefaultState(); this.vine = Blocks.vine.getDefaultState();
this.hanging = null;
} }
@Override @Override
public GeneratorMegaJungleTree create() { public GeneratorMegaJungleTree create() {
return new GeneratorMegaJungleTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight); return new GeneratorMegaJungleTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.minHeight, this.maxHeight);
} }
} }
protected GeneratorMegaJungleTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight) protected GeneratorMegaJungleTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
} }

View file

@ -35,18 +35,19 @@ public class GeneratorPineTree extends GeneratorTreeBase
this.log = Blocks.log.getDefaultState(); this.log = Blocks.log.getDefaultState();
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = hanging;
} }
@Override @Override
public GeneratorPineTree create() { public GeneratorPineTree create() {
return new GeneratorPineTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight); return new GeneratorPineTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.minHeight, this.maxHeight);
} }
} }
public GeneratorPineTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight) public GeneratorPineTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
} }

View file

@ -38,21 +38,22 @@ public class GeneratorProfileTree extends GeneratorTreeBase
this.log = Blocks.log.getDefaultState(); this.log = Blocks.log.getDefaultState();
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null;
this.profile = TreeProfile.POPLAR; this.profile = TreeProfile.POPLAR;
} }
@Override @Override
public GeneratorProfileTree create() { public GeneratorProfileTree create() {
return new GeneratorProfileTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight, this.profile); return new GeneratorProfileTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.minHeight, this.maxHeight, this.profile);
} }
} }
protected TreeProfile profile; protected TreeProfile profile;
public GeneratorProfileTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, TreeProfile profile) public GeneratorProfileTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight, TreeProfile profile)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
this.profile = profile; this.profile = profile;
} }

View file

@ -40,19 +40,20 @@ public class GeneratorRedwoodTree extends GeneratorTreeBase
this.log = BlockBOPLog.paging.getVariantState(BOPWoods.REDWOOD); this.log = BlockBOPLog.paging.getVariantState(BOPWoods.REDWOOD);
this.leaves = BlockBOPLeaves.paging.getVariantState(BOPTrees.REDWOOD); this.leaves = BlockBOPLeaves.paging.getVariantState(BOPTrees.REDWOOD);
this.vine = null; this.vine = null;
this.hanging = null;
} }
@Override @Override
public GeneratorRedwoodTree create() public GeneratorRedwoodTree create()
{ {
return new GeneratorRedwoodTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight); return new GeneratorRedwoodTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.minHeight, this.maxHeight);
} }
} }
protected GeneratorRedwoodTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight) protected GeneratorRedwoodTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
} }
public boolean canPlaceHere(World world, BlockPos pos, int height, int radius) public boolean canPlaceHere(World world, BlockPos pos, int height, int radius)

View file

@ -42,21 +42,22 @@ public class GeneratorTaigaTree extends GeneratorTreeBase
this.log = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); this.log = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE);
this.leaves = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE); this.leaves = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE);
this.vine = Blocks.vine.getDefaultState(); this.vine = Blocks.vine.getDefaultState();
this.hanging = null;
this.trunkWidth = 1; this.trunkWidth = 1;
} }
@Override @Override
public GeneratorTaigaTree create() { public GeneratorTaigaTree create() {
return new GeneratorTaigaTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight, this.trunkWidth); return new GeneratorTaigaTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.minHeight, this.maxHeight, this.trunkWidth);
} }
} }
private int trunkWidth; private int trunkWidth;
public GeneratorTaigaTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, int trunkWidth) public GeneratorTaigaTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight, int trunkWidth)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
this.trunkWidth = trunkWidth; this.trunkWidth = trunkWidth;
} }

View file

@ -46,17 +46,19 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
protected IBlockState log; protected IBlockState log;
protected IBlockState leaves; protected IBlockState leaves;
protected IBlockState vine; protected IBlockState vine;
protected IBlockState hanging;
protected int minHeight; protected int minHeight;
protected int maxHeight; protected int maxHeight;
protected IProperty logAxisProperty; protected IProperty logAxisProperty;
protected GeneratorTreeBase(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight) { protected GeneratorTreeBase(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight) {
super(amountPerChunk); super(amountPerChunk);
this.placeOn = placeOn; this.placeOn = placeOn;
this.replace = replace; this.replace = replace;
this.log = log; this.log = log;
this.leaves = leaves; this.leaves = leaves;
this.vine = vine; this.vine = vine;
this.hanging = hanging;
this.minHeight = minHeight; this.minHeight = minHeight;
this.maxHeight = maxHeight; this.maxHeight = maxHeight;
this.logAxisProperty = GeneratorUtils.getAxisProperty(log); this.logAxisProperty = GeneratorUtils.getAxisProperty(log);
@ -69,6 +71,7 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
protected IBlockState log; protected IBlockState log;
protected IBlockState leaves; protected IBlockState leaves;
protected IBlockState vine; protected IBlockState vine;
protected IBlockState hanging;
protected int minHeight; protected int minHeight;
protected int maxHeight; protected int maxHeight;
@ -120,6 +123,18 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
} }
return this.self(); return this.self();
} }
public T hanging(IBlockState a)
{
if (a == null)
{
this.hanging = null;
}
else
{
this.hanging = a;
}
return this.self();
}
public T minHeight(int a) {this.minHeight = a; return this.self();} public T minHeight(int a) {this.minHeight = a; return this.self();}
public T maxHeight(int a) {this.maxHeight = a; return this.self();} public T maxHeight(int a) {this.maxHeight = a; return this.self();}
@ -175,4 +190,13 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
return setOne; return setOne;
} }
public boolean setHanging(World world, BlockPos pos)
{
if (this.hanging == null) {return false;}
if (this.replace.matches(world, pos))
{
world.setBlockState(pos, this.hanging, 2);
}
return false;
}
} }

View file

@ -39,22 +39,23 @@ public class GeneratorTwigletTree extends GeneratorTreeBase
this.log = Blocks.log.getDefaultState(); this.log = Blocks.log.getDefaultState();
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null;
this.leafChanceEven = 0.2F; this.leafChanceEven = 0.2F;
this.leafChanceOdd = 0.9F; this.leafChanceOdd = 0.9F;
} }
@Override @Override
public GeneratorTwigletTree create() { public GeneratorTwigletTree create() {
return new GeneratorTwigletTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, 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.minHeight, this.maxHeight, this.leafChanceEven, this.leafChanceOdd);
} }
} }
private float leafChanceEven; private float leafChanceEven;
private float leafChanceOdd; private float leafChanceOdd;
public GeneratorTwigletTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, float leafChanceEven, float leafChanceOdd) public GeneratorTwigletTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight, float leafChanceEven, float leafChanceOdd)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
this.leafChanceEven = leafChanceEven; this.leafChanceEven = leafChanceEven;
this.leafChanceOdd = leafChanceOdd; this.leafChanceOdd = leafChanceOdd;
} }