Added cocoa beans to more trees

This commit is contained in:
Forstride 2016-04-07 02:49:47 -04:00
parent 3802fa2248
commit fda0a8db85
22 changed files with 154 additions and 52 deletions

View file

@ -55,6 +55,7 @@ public class BiomeGenBrushland extends BOPBiome
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("brush", 1, (new GeneratorBasicTree.Builder()).log(BlockPlanks.EnumType.ACACIA).leaves(BlockPlanks.EnumType.ACACIA).minHeight(3).maxHeight(5).leafLayers(2).create()); treeGenerator.add("brush", 1, (new GeneratorBasicTree.Builder()).log(BlockPlanks.EnumType.ACACIA).leaves(BlockPlanks.EnumType.ACACIA).minHeight(3).maxHeight(5).leafLayers(2).create());
treeGenerator.add("brush_twiglet", 2, (new GeneratorTwigletTree.Builder()).minHeight(1).maxHeight(2).log(BOPWoods.EBONY).leaves(BOPTrees.EBONY).create()); treeGenerator.add("brush_twiglet", 2, (new GeneratorTwigletTree.Builder()).minHeight(1).maxHeight(2).log(BOPWoods.EBONY).leaves(BOPTrees.EBONY).create());
treeGenerator.add("jungle_twiglet", 1, (new GeneratorTwigletTree.Builder()).minHeight(2).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).trunkFruit(Blocks.cocoa.getDefaultState()).create());
treeGenerator.add("brush_bush", 3, (new GeneratorFlora.Builder()).placeOn(this.topBlock).replace(Material.air).withNonDecayingLeaf(BlockPlanks.EnumType.OAK).generationAttempts(8).create()); treeGenerator.add("brush_bush", 3, (new GeneratorFlora.Builder()).placeOn(this.topBlock).replace(Material.air).withNonDecayingLeaf(BlockPlanks.EnumType.OAK).generationAttempts(8).create());
treeGenerator.add("decaying_tree", 2, (new GeneratorBigTree.Builder()).amountPerChunk(1.0F).log(BOPWoods.EBONY).leaves(BOPTrees.EBONY).minHeight(4).maxHeight(10).foliageHeight(1).create()); treeGenerator.add("decaying_tree", 2, (new GeneratorBigTree.Builder()).amountPerChunk(1.0F).log(BOPWoods.EBONY).leaves(BOPTrees.EBONY).minHeight(4).maxHeight(10).foliageHeight(1).create());

View file

@ -73,6 +73,7 @@ public class BiomeGenOasis extends BOPBiome
GeneratorWeighted treeGenerator = new GeneratorWeighted(10.0F); GeneratorWeighted treeGenerator = new GeneratorWeighted(10.0F);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("palm", 4, (new GeneratorPalmTree.Builder()).log(BOPWoods.PALM).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.PALM).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false))).create()); treeGenerator.add("palm", 4, (new GeneratorPalmTree.Builder()).log(BOPWoods.PALM).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.PALM).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false))).create());
treeGenerator.add("jungle_twiglet", 1, (new GeneratorTwigletTree.Builder()).minHeight(2).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).trunkFruit(Blocks.cocoa.getDefaultState()).create());
// grasses // grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(4.0F); GeneratorWeighted grassGenerator = new GeneratorWeighted(4.0F);

View file

@ -20,6 +20,7 @@ import biomesoplenty.common.world.feature.GeneratorGrass;
import biomesoplenty.common.world.feature.GeneratorOreSingle; import biomesoplenty.common.world.feature.GeneratorOreSingle;
import biomesoplenty.common.world.feature.tree.GeneratorBush; import biomesoplenty.common.world.feature.tree.GeneratorBush;
import biomesoplenty.common.world.feature.tree.GeneratorMahoganyTree; import biomesoplenty.common.world.feature.tree.GeneratorMahoganyTree;
import biomesoplenty.common.world.feature.tree.GeneratorTwigletTree;
import net.minecraft.block.BlockFlower; import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockPlanks; import net.minecraft.block.BlockPlanks;
import net.minecraft.block.BlockTallGrass; import net.minecraft.block.BlockTallGrass;
@ -51,7 +52,8 @@ public class BiomeGenOvergrownCliffs extends BOPBiome
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("mahogany", 1, (new GeneratorMahoganyTree.Builder()).minHeight(5).maxHeight(10).create()); treeGenerator.add("mahogany", 1, (new GeneratorMahoganyTree.Builder()).minHeight(5).maxHeight(10).create());
treeGenerator.add("oak_bush", 8, (new GeneratorBush.Builder()).maxHeight(2).create()); treeGenerator.add("oak_bush", 8, (new GeneratorBush.Builder()).maxHeight(2).create());
treeGenerator.add("jungle_twiglet", 2, (new GeneratorTwigletTree.Builder()).minHeight(2).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).trunkFruit(Blocks.cocoa.getDefaultState()).create());
// other plants // other plants
this.addGenerator("shrubs", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.4F).with(BOPPlants.SHRUB).create()); this.addGenerator("shrubs", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.4F).with(BOPPlants.SHRUB).create());
this.addGenerator("sprouts", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).with(BOPPlants.SPROUT).create()); this.addGenerator("sprouts", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).with(BOPPlants.SPROUT).create());

View file

@ -51,9 +51,10 @@ public class BiomeGenRainforest extends BOPBiome
// trees & logs // trees & logs
GeneratorWeighted treeGenerator = new GeneratorWeighted(20); GeneratorWeighted treeGenerator = new GeneratorWeighted(20);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("birch", 1, (new GeneratorBasicTree.Builder()).log(BlockPlanks.EnumType.BIRCH).leaves(BlockPlanks.EnumType.BIRCH).minHeight(5).maxHeight(8).create()); treeGenerator.add("birch", 4, (new GeneratorBasicTree.Builder()).log(BlockPlanks.EnumType.BIRCH).leaves(BlockPlanks.EnumType.BIRCH).minHeight(5).maxHeight(8).create());
treeGenerator.add("oak", 4, (new GeneratorBasicTree.Builder()).minHeight(8).maxHeight(12).altLeaves(BOPTrees.FLOWERING).create()); treeGenerator.add("oak", 7, (new GeneratorBasicTree.Builder()).minHeight(8).maxHeight(12).altLeaves(BOPTrees.FLOWERING).create());
treeGenerator.add("large_oak", 1, (new GeneratorBigTree.Builder()).log(BlockPlanks.EnumType.OAK).leaves(BlockPlanks.EnumType.OAK).create()); treeGenerator.add("jungle", 1, (new GeneratorBasicTree.Builder()).minHeight(8).maxHeight(12).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).trunkFruit(Blocks.cocoa.getDefaultState()).create());
treeGenerator.add("large_oak", 4, (new GeneratorBigTree.Builder()).log(BlockPlanks.EnumType.OAK).leaves(BlockPlanks.EnumType.OAK).create());
// grasses // grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(5.0F); GeneratorWeighted grassGenerator = new GeneratorWeighted(5.0F);

View file

@ -60,7 +60,7 @@ public class BiomeGenTropicalIsland extends BOPBiome
GeneratorWeighted treeGenerator = new GeneratorWeighted(25.0F); GeneratorWeighted treeGenerator = new GeneratorWeighted(25.0F);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("palm", 4, (new GeneratorPalmTree.Builder()).log(BOPWoods.PALM).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.PALM).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false))).create()); treeGenerator.add("palm", 4, (new GeneratorPalmTree.Builder()).log(BOPWoods.PALM).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.PALM).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false))).create());
treeGenerator.add("jungle_twiglet", 2, (new GeneratorTwigletTree.Builder()).minHeight(2).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).create()); treeGenerator.add("jungle_twiglet", 2, (new GeneratorTwigletTree.Builder()).minHeight(2).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).trunkFruit(Blocks.cocoa.getDefaultState()).create());
// grasses // grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(4.0F); GeneratorWeighted grassGenerator = new GeneratorWeighted(4.0F);

View file

@ -58,7 +58,7 @@ public class BiomeGenTropicalRainforest extends BOPBiome
GeneratorWeighted treeGenerator = new GeneratorWeighted(15.0F); GeneratorWeighted treeGenerator = new GeneratorWeighted(15.0F);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("mahogany", 6, (new GeneratorMahoganyTree.Builder()).create()); treeGenerator.add("mahogany", 6, (new GeneratorMahoganyTree.Builder()).create());
treeGenerator.add("jungle", 2, (new GeneratorBasicTree.Builder()).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).minHeight(8).maxHeight(12).vine(Blocks.vine.getDefaultState()).create()); treeGenerator.add("jungle", 2, (new GeneratorBasicTree.Builder()).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).minHeight(8).maxHeight(12).trunkFruit(Blocks.cocoa.getDefaultState()).vine(Blocks.vine.getDefaultState()).create());
// flowers // flowers
GeneratorWeighted flowerGenerator = new GeneratorWeighted(1.5F); GeneratorWeighted flowerGenerator = new GeneratorWeighted(1.5F);

View file

@ -22,6 +22,7 @@ import biomesoplenty.common.util.block.BlockQuery.BlockQueryState;
import biomesoplenty.common.util.block.BlockQuery.IBlockPosQuery; import biomesoplenty.common.util.block.BlockQuery.IBlockPosQuery;
import biomesoplenty.common.util.config.BOPConfig.IConfigObj; import biomesoplenty.common.util.config.BOPConfig.IConfigObj;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.BlockSapling; import net.minecraft.block.BlockSapling;
import net.minecraft.block.BlockVine; import net.minecraft.block.BlockVine;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -46,6 +47,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = null;
this.minHeight = 4; this.minHeight = 4;
this.maxHeight = 7; this.maxHeight = 7;
@ -60,7 +62,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
@Override @Override
public GeneratorBasicTree create() public GeneratorBasicTree create()
{ {
return new GeneratorBasicTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.altLeaves, this.minHeight, this.maxHeight, false, 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, false, this.leafLayers, this.leavesOffset, this.maxLeavesRadius, this.leavesLayerHeight, this.placeVinesOn, this.hangingChance);
} }
} }
@ -95,9 +97,9 @@ public class GeneratorBasicTree extends GeneratorTreeBase
protected IBlockPosQuery placeVinesOn; protected IBlockPosQuery placeVinesOn;
protected float hangingChance; protected float hangingChance;
public GeneratorBasicTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
this.updateNeighbours = updateNeighbours; this.updateNeighbours = updateNeighbours;
this.leavesOffset = leavesOffset; this.leavesOffset = leavesOffset;
this.leafLayers = leafLayers; this.leafLayers = leafLayers;
@ -268,7 +270,25 @@ public class GeneratorBasicTree extends GeneratorTreeBase
//Generate fruit or any other blocks that may hang off of the tree //Generate fruit or any other blocks that may hang off of the tree
if (this.hanging != null) this.generateHanging(world, pos, height); if (this.hanging != null) this.generateHanging(world, pos, height);
if (this.trunkFruit != null)
{
if (random.nextInt(5) == 0 && height > 5)
{
for (int l3 = 0; l3 < 2; ++l3)
{
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
if (random.nextInt(4 - l3) == 0)
{
EnumFacing enumfacing1 = enumfacing.getOpposite();
this.generateTrunkFruit(world, random.nextInt(3), pos.add(enumfacing1.getFrontOffsetX(), height - 5 + l3, enumfacing1.getFrontOffsetZ()), enumfacing);
}
}
}
}
}
return true; return true;
} }
else else
@ -315,6 +335,18 @@ public class GeneratorBasicTree extends GeneratorTreeBase
} }
} }
private void generateTrunkFruit(World world, int age, BlockPos pos, EnumFacing direction)
{
if (this.trunkFruit == Blocks.cocoa.getDefaultState())
{
this.setBlockAndNotifyAdequately(world, pos, this.trunkFruit.withProperty(BlockCocoa.AGE, Integer.valueOf(age)).withProperty(BlockCocoa.FACING, direction));
}
else
{
this.setBlockAndNotifyAdequately(world, pos, this.trunkFruit.withProperty(BlockCocoa.FACING, direction));
}
}
private IBlockState getVineStateForSide(EnumFacing side) private IBlockState getVineStateForSide(EnumFacing side)
{ {
return this.vine.getBlock() instanceof BlockVine ? this.vine.withProperty(BlockVine.getPropertyFor(side), Boolean.valueOf(true)) : this.vine; return this.vine.getBlock() instanceof BlockVine ? this.vine.withProperty(BlockVine.getPropertyFor(side), Boolean.valueOf(true)) : this.vine;
@ -363,6 +395,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
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.hanging = conf.getBlockState("hangingState", this.hanging);
this.trunkFruit = conf.getBlockState("trunkFruitState", this.trunkFruit);
this.altLeaves = conf.getBlockState("altLeavesState", this.altLeaves); this.altLeaves = conf.getBlockState("altLeavesState", this.altLeaves);
this.hangingChance = conf.getFloat("hangingChance", this.hangingChance); this.hangingChance = conf.getFloat("hangingChance", this.hangingChance);

View file

@ -55,6 +55,7 @@ public class GeneratorBayouTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = Blocks.vine.getDefaultState(); this.vine = Blocks.vine.getDefaultState();
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = null;
this.minHeight = 8; this.minHeight = 8;
this.maxHeight = 18; this.maxHeight = 18;
@ -67,7 +68,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.hanging, 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);
} }
} }
@ -78,9 +79,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, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
this.minLeavesRadius = minLeavesRadius; this.minLeavesRadius = minLeavesRadius;
this.leavesGradient = leavesGradient; this.leavesGradient = leavesGradient;
this.vineAttempts = vineAttempts; this.vineAttempts = vineAttempts;
@ -285,5 +286,6 @@ public class GeneratorBayouTree 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("vinesState", this.vine); this.vine = conf.getBlockState("vinesState", this.vine);
this.trunkFruit = conf.getBlockState("trunkFruitState", this.trunkFruit);
} }
} }

View file

@ -54,6 +54,7 @@ public class GeneratorBigTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = null;
this.minHeight = 5; this.minHeight = 5;
this.maxHeight = 17; this.maxHeight = 17;
@ -72,7 +73,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.hanging, 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);
} }
} }
@ -97,9 +98,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, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
this.foliageHeight = foliageHeight; this.foliageHeight = foliageHeight;
this.foliageDensity = foliageDensity; this.foliageDensity = foliageDensity;
this.trunkWidth = trunkWidth; this.trunkWidth = trunkWidth;

View file

@ -36,20 +36,21 @@ public class GeneratorBulbTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = 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.hanging, 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);
} }
} }
public GeneratorBulbTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
} }
public boolean setCocoa(World world, BlockPos pos, EnumFacing side) public boolean setCocoa(World world, BlockPos pos, EnumFacing side)

View file

@ -34,19 +34,20 @@ public class GeneratorBush extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = 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.hanging, 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);
} }
} }
public GeneratorBush(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, 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, IBlockState hanging, IBlockState altLeaves, int minHeight, int 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) {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
} }
protected int chooseHeight(Random rand) protected int chooseHeight(Random rand)

View file

@ -35,6 +35,7 @@ public class GeneratorMahoganyTree extends GeneratorBasicTree
this.leaves = BlockBOPLeaves.paging.getVariantState(BOPTrees.MAHOGANY); this.leaves = BlockBOPLeaves.paging.getVariantState(BOPTrees.MAHOGANY);
this.vine = null; this.vine = null;
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = null;
this.minHeight = 10; this.minHeight = 10;
this.maxHeight = 15; this.maxHeight = 15;
@ -49,13 +50,13 @@ public class GeneratorMahoganyTree extends GeneratorBasicTree
@Override @Override
public GeneratorMahoganyTree create() public GeneratorMahoganyTree create()
{ {
return new GeneratorMahoganyTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, 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);
} }
} }
public GeneratorMahoganyTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, 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);
} }
@Override @Override

View file

@ -55,6 +55,7 @@ public class GeneratorMangroveTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = null;
this.minHeight = 8; this.minHeight = 8;
this.maxHeight = 10; this.maxHeight = 10;
@ -67,7 +68,7 @@ public class GeneratorMangroveTree extends GeneratorTreeBase
@Override @Override
public GeneratorMangroveTree create() public GeneratorMangroveTree create()
{ {
return new GeneratorMangroveTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, 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);
} }
} }
@ -78,9 +79,9 @@ public class GeneratorMangroveTree extends GeneratorTreeBase
private int maxVineLength; private int maxVineLength;
private IBlockPosQuery rootsReplace; private IBlockPosQuery rootsReplace;
public GeneratorMangroveTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
this.minLeavesRadius = minLeavesRadius; this.minLeavesRadius = minLeavesRadius;
this.leavesGradient = leavesGradient; this.leavesGradient = leavesGradient;
this.vineAttempts = vineAttempts; this.vineAttempts = vineAttempts;

View file

@ -36,19 +36,20 @@ public class GeneratorMegaJungleTree extends GeneratorHugeTree
this.leaves(BlockPlanks.EnumType.JUNGLE); this.leaves(BlockPlanks.EnumType.JUNGLE);
this.vine = Blocks.vine.getDefaultState(); this.vine = Blocks.vine.getDefaultState();
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = 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.hanging, 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);
} }
} }
protected GeneratorMegaJungleTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
} }

View file

@ -37,19 +37,20 @@ public class GeneratorPalmTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = null;
} }
@Override @Override
public GeneratorPalmTree create() { public GeneratorPalmTree create() {
return new GeneratorPalmTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, 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);
} }
} }
public GeneratorPalmTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
} }

View file

@ -36,19 +36,20 @@ public class GeneratorPineTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = hanging; this.hanging = hanging;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = null;
} }
@Override @Override
public GeneratorPineTree create() { public GeneratorPineTree create() {
return new GeneratorPineTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, 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);
} }
} }
public GeneratorPineTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
} }

View file

@ -39,22 +39,23 @@ public class GeneratorProfileTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = 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.hanging, 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);
} }
} }
protected TreeProfile profile; protected TreeProfile profile;
public GeneratorProfileTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
this.profile = profile; this.profile = profile;
} }

View file

@ -39,20 +39,21 @@ public class GeneratorRedwoodTree extends GeneratorTreeBase
this.leaves = BlockBOPLeaves.paging.getVariantState(BOPTrees.REDWOOD).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false)); this.leaves = BlockBOPLeaves.paging.getVariantState(BOPTrees.REDWOOD).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false));
this.vine = null; this.vine = null;
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = 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.hanging, 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);
} }
} }
protected GeneratorRedwoodTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, 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

@ -43,22 +43,23 @@ public class GeneratorTaigaTree extends GeneratorTreeBase
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.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = 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.hanging, 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);
} }
} }
private int trunkWidth; private int trunkWidth;
public GeneratorTaigaTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
this.trunkWidth = trunkWidth; this.trunkWidth = trunkWidth;
} }

View file

@ -47,12 +47,13 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
protected IBlockState leaves; protected IBlockState leaves;
protected IBlockState vine; protected IBlockState vine;
protected IBlockState hanging; protected IBlockState hanging;
protected IBlockState trunkFruit;
protected IBlockState altLeaves; protected IBlockState altLeaves;
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, IBlockState hanging, 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) {
super(amountPerChunk); super(amountPerChunk);
this.placeOn = placeOn; this.placeOn = placeOn;
this.replace = replace; this.replace = replace;
@ -60,6 +61,7 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
this.leaves = leaves; this.leaves = leaves;
this.vine = vine; this.vine = vine;
this.hanging = hanging; this.hanging = hanging;
this.trunkFruit = trunkFruit;
this.altLeaves = altLeaves; this.altLeaves = altLeaves;
this.minHeight = minHeight; this.minHeight = minHeight;
this.maxHeight = maxHeight; this.maxHeight = maxHeight;
@ -74,6 +76,7 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
protected IBlockState leaves; protected IBlockState leaves;
protected IBlockState vine; protected IBlockState vine;
protected IBlockState hanging; protected IBlockState hanging;
protected IBlockState trunkFruit;
protected IBlockState altLeaves; protected IBlockState altLeaves;
protected int minHeight; protected int minHeight;
protected int maxHeight; protected int maxHeight;
@ -124,6 +127,11 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
this.hanging = a; this.hanging = a;
return this.self(); return this.self();
} }
public T trunkFruit(IBlockState a)
{
this.trunkFruit = a;
return this.self();
}
public T altLeaves(IBlockState a) {this.altLeaves = a; return this.self();} public T altLeaves(IBlockState a) {this.altLeaves = a; return this.self();}
public T altLeaves(BOPTrees a) {this.altLeaves = BlockBOPLeaves.paging.getVariantState(a).withProperty(BlockLeaves.CHECK_DECAY, false); return this.self();} public T altLeaves(BOPTrees a) {this.altLeaves = BlockBOPLeaves.paging.getVariantState(a).withProperty(BlockLeaves.CHECK_DECAY, false); return this.self();}
@ -202,6 +210,16 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
return false; return false;
} }
public boolean setTrunkFruit(World world, BlockPos pos)
{
if (this.trunkFruit == null) {return false;}
if (this.replace.matches(world, pos))
{
world.setBlockState(pos, this.trunkFruit, 2);
}
return false;
}
public boolean setAltLeaves(World world, BlockPos pos) public boolean setAltLeaves(World world, BlockPos pos)
{ {
if (this.replace.matches(world, pos)) if (this.replace.matches(world, pos))

View file

@ -13,8 +13,10 @@ import java.util.Random;
import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.BlockQueries;
import biomesoplenty.common.util.block.BlockQuery.IBlockPosQuery; import biomesoplenty.common.util.block.BlockQuery.IBlockPosQuery;
import biomesoplenty.common.util.config.BOPConfig.IConfigObj; import biomesoplenty.common.util.config.BOPConfig.IConfigObj;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -40,6 +42,7 @@ public class GeneratorTwigletTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState(); this.leaves = Blocks.leaves.getDefaultState();
this.vine = null; this.vine = null;
this.hanging = null; this.hanging = null;
this.trunkFruit = null;
this.altLeaves = null; this.altLeaves = null;
this.leafChanceEven = 0.2F; this.leafChanceEven = 0.2F;
this.leafChanceOdd = 0.9F; this.leafChanceOdd = 0.9F;
@ -47,16 +50,16 @@ public class GeneratorTwigletTree extends GeneratorTreeBase
@Override @Override
public GeneratorTwigletTree create() { public GeneratorTwigletTree create() {
return new GeneratorTwigletTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, 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);
} }
} }
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, IBlockState hanging, 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)
{ {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight); super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, trunkFruit, altLeaves, minHeight, maxHeight);
this.leafChanceEven = leafChanceEven; this.leafChanceEven = leafChanceEven;
this.leafChanceOdd = leafChanceOdd; this.leafChanceOdd = leafChanceOdd;
} }
@ -97,6 +100,24 @@ public class GeneratorTwigletTree extends GeneratorTreeBase
if (random.nextFloat() < leafChance) {this.setLeaves(world, pos.add(-1, y, 0));} if (random.nextFloat() < leafChance) {this.setLeaves(world, pos.add(-1, y, 0));}
if (random.nextFloat() < leafChance) {this.setLeaves(world, pos.add(0, y, 1));} if (random.nextFloat() < leafChance) {this.setLeaves(world, pos.add(0, y, 1));}
if (random.nextFloat() < leafChance) {this.setLeaves(world, pos.add(0, y, -1));} if (random.nextFloat() < leafChance) {this.setLeaves(world, pos.add(0, y, -1));}
if (this.trunkFruit != null)
{
if (random.nextInt(3) == 0)
{
for (int l3 = 0; l3 < 2; ++l3)
{
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
if (random.nextInt(4 - l3) == 0)
{
EnumFacing enumfacing1 = enumfacing.getOpposite();
this.generateTrunkFruit(world, random.nextInt(3), pos.add(enumfacing1.getFrontOffsetX(), 0, enumfacing1.getFrontOffsetZ()), enumfacing);
}
}
}
}
}
} }
// finish with leaves on top // finish with leaves on top
this.setLeaves(world, pos.add(0, height, 0)); this.setLeaves(world, pos.add(0, height, 0));
@ -104,6 +125,18 @@ public class GeneratorTwigletTree extends GeneratorTreeBase
return true; return true;
} }
private void generateTrunkFruit(World world, int age, BlockPos pos, EnumFacing direction)
{
if (this.trunkFruit == Blocks.cocoa.getDefaultState())
{
this.setBlockAndNotifyAdequately(world, pos, this.trunkFruit.withProperty(BlockCocoa.AGE, Integer.valueOf(age)).withProperty(BlockCocoa.FACING, direction));
}
else
{
this.setBlockAndNotifyAdequately(world, pos, this.trunkFruit.withProperty(BlockCocoa.FACING, direction));
}
}
@Override @Override
public void configure(IConfigObj conf) public void configure(IConfigObj conf)
{ {