Added option for trees to have alternate leaf blocks, and added flowering leaves to trees in some biomes

This commit is contained in:
Forstride 2016-02-12 19:04:56 -05:00
parent a784039759
commit 6a5d870376
26 changed files with 157 additions and 60 deletions

View file

@ -14,7 +14,6 @@ import net.minecraft.block.BlockTallGrass;
import net.minecraft.entity.passive.EntityMooshroom;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
import biomesoplenty.api.biome.BOPBiome;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.biome.generation.GeneratorWeighted;
@ -28,13 +27,13 @@ import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPTrees;
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorBigMushroom;
import biomesoplenty.common.world.feature.GeneratorColumns;
import biomesoplenty.common.world.feature.GeneratorFlora;
import biomesoplenty.common.world.feature.GeneratorGrass;
import biomesoplenty.common.world.feature.GeneratorMixedLily;
import biomesoplenty.common.world.feature.GeneratorOreSingle;
import biomesoplenty.common.world.feature.GeneratorSplotches;
import biomesoplenty.common.world.feature.tree.GeneratorBush;
@ -73,7 +72,7 @@ public class BiomeGenFungiForest extends BOPBiome
GeneratorWeighted treeGenerator = new GeneratorWeighted(12);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("mega_oak", 1, (new GeneratorMegaJungleTree.Builder()).log(BlockPlanks.EnumType.OAK).leaves(BlockPlanks.EnumType.OAK).vine(BOPBlocks.ivy.getDefaultState()).create());
treeGenerator.add("oak_bush", 1, (new GeneratorBush.Builder()).maxHeight(2).create());
treeGenerator.add("oak_bush", 1, (new GeneratorBush.Builder()).maxHeight(2).altLeaves(BOPTrees.FLOWERING).create());
// grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(5.0F);

View file

@ -26,6 +26,7 @@ import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPTrees;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorBigFlower;
import biomesoplenty.common.world.feature.GeneratorDoubleFlora;
@ -62,7 +63,7 @@ public class BiomeGenGarden extends BOPBiome
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("red_big_flowers", 1, (new GeneratorBigFlower.Builder()).flowerType(GeneratorBigFlower.BigFlowerType.RED).create());
treeGenerator.add("yellow_big_flowers", 1, (new GeneratorBigFlower.Builder()).flowerType(GeneratorBigFlower.BigFlowerType.YELLOW).create());
treeGenerator.add("oak_bush", 2, (new GeneratorBush.Builder()).maxHeight(2).create());
treeGenerator.add("oak_bush", 2, (new GeneratorBush.Builder()).maxHeight(2).altLeaves(BOPTrees.FLOWERING).create());
// grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(6.0F);

View file

@ -23,6 +23,7 @@ import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPTrees;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorDoubleFlora;
import biomesoplenty.common.world.feature.GeneratorFlora;
@ -52,8 +53,8 @@ public class BiomeGenGrove extends BOPBiome
this.addGenerator("sprouts", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.1F).with(BOPPlants.SPROUT).create());
this.addGenerator("berry_bushes", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.2F).with(BOPPlants.BERRYBUSH).create());
this.addGenerator("bushes", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.4F).with(BOPPlants.BUSH).create());
this.addGenerator("shrubs", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.3F).with(BOPPlants.SHRUB).create());
this.addGenerator("clover_patches", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(3.0F).with(BOPPlants.CLOVERPATCH).create());
this.addGenerator("shrubs", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.1F).with(BOPPlants.SHRUB).create());
this.addGenerator("clover_patches", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.6F).with(BOPPlants.CLOVERPATCH).create());
this.addGenerator("leaf_piles", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.5F).with(BOPPlants.LEAFPILE).create());
// trees
@ -61,11 +62,11 @@ public class BiomeGenGrove extends BOPBiome
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("dark_poplar", 1, (new GeneratorProfileTree.Builder()).minHeight(6).maxHeight(14).log(BlockPlanks.EnumType.DARK_OAK).leaves(BlockPlanks.EnumType.DARK_OAK).profile(GeneratorProfileTree.TreeProfile.POPLAR).create());
treeGenerator.add("poplar", 1, (new GeneratorProfileTree.Builder()).minHeight(8).maxHeight(18).log(BlockPlanks.EnumType.BIRCH).leaves(BlockPlanks.EnumType.BIRCH).profile(GeneratorProfileTree.TreeProfile.POPLAR).create());
treeGenerator.add("bush", 1, (new GeneratorBush.Builder()).maxHeight(2).create());
treeGenerator.add("bush", 1, (new GeneratorBush.Builder()).maxHeight(2).altLeaves(BOPTrees.FLOWERING).create());
// flowers
GeneratorWeighted flowerGenerator = new GeneratorWeighted(5.0F);
GeneratorWeighted flowerGenerator = new GeneratorWeighted(3.0F);
this.addGenerator("flowers", GeneratorStage.GRASS, flowerGenerator);
flowerGenerator.add("clover", 4, (new GeneratorFlora.Builder().with(BOPFlowers.CLOVER).create()));
flowerGenerator.add("white_anemones", 2, (new GeneratorFlora.Builder().with(BOPFlowers.WHITE_ANEMONE).create()));
@ -75,7 +76,7 @@ public class BiomeGenGrove extends BOPBiome
flowerGenerator.add("poppy", 1, (new GeneratorFlora.Builder().with(BlockFlower.EnumFlowerType.POPPY).create()));
// grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(2.0F);
GeneratorWeighted grassGenerator = new GeneratorWeighted(9.0F);
this.addGenerator("grass", GeneratorStage.GRASS, grassGenerator);
grassGenerator.add("shortgrass", 1, (new GeneratorGrass.Builder()).with(BOPPlants.SHORTGRASS).create());
grassGenerator.add("mediumgrass", 1, (new GeneratorGrass.Builder()).with(BOPPlants.MEDIUMGRASS).create());

View file

@ -52,7 +52,7 @@ public class BiomeGenLavenderFields extends BOPBiome
GeneratorWeighted treeGenerator = new GeneratorWeighted(1);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("jacaranda", 3, (new GeneratorBasicTree.Builder()).minHeight(4).maxHeight(7).log(BOPWoods.JACARANDA).leaves(BOPTrees.JACARANDA).create());
treeGenerator.add("oak", 1, (new GeneratorBigTree.Builder()).create());
treeGenerator.add("oak", 1, (new GeneratorBigTree.Builder()).altLeaves(BOPTrees.FLOWERING).create());
// grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(15);

View file

@ -83,7 +83,7 @@ public class BiomeGenMysticGrove extends BOPBiome
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("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()).altLeaves(BOPTrees.FLOWERING).create());
// grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(3.0F);

View file

@ -13,6 +13,7 @@ import biomesoplenty.common.enums.BOPClimates;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPTrees;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorDoubleFlora;
import biomesoplenty.common.world.feature.GeneratorFlora;
@ -50,7 +51,7 @@ public class BiomeGenOrchard extends BOPBiome
// trees
GeneratorWeighted treeGenerator = new GeneratorWeighted(4);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("oak_large", 1, (new GeneratorBigTree.Builder()).create());
treeGenerator.add("oak_large", 1, (new GeneratorBigTree.Builder()).altLeaves(BOPTrees.FLOWERING).create());
// grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(15);

View file

@ -59,7 +59,7 @@ public class BiomeGenRainforest extends BOPBiome
GeneratorWeighted treeGenerator = new GeneratorWeighted(20);
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("oak", 4, (new GeneratorBasicTree.Builder()).minHeight(8).maxHeight(12).create());
treeGenerator.add("oak", 4, (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());
// grasses

View file

@ -57,7 +57,7 @@ public class BiomeGenSacredSprings extends BOPBiome
// trees
this.addGenerator("sacred_oak_trees", GeneratorStage.POST, (new GeneratorBigTree.Builder()).amountPerChunk(0.2F).log(BOPWoods.SACRED_OAK).leaves(BOPTrees.SACRED_OAK).minHeight(35).maxHeight(40).trunkWidth(2).foliageDensity(2.0D).create());
this.addGenerator("leaves_clusters", GeneratorStage.TREE, (new GeneratorBush.Builder()).amountPerChunk(12.5F).maxHeight(2).create());
this.addGenerator("large_oak", GeneratorStage.TREE, (new GeneratorBigTree.Builder()).amountPerChunk(3.0F).log(BlockPlanks.EnumType.OAK).leaves(BlockPlanks.EnumType.OAK).create());
this.addGenerator("large_oak", GeneratorStage.TREE, (new GeneratorBigTree.Builder()).amountPerChunk(3.0F).log(BlockPlanks.EnumType.OAK).leaves(BlockPlanks.EnumType.OAK).altLeaves(BOPTrees.FLOWERING).create());
// grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(2.75F);

View file

@ -13,11 +13,14 @@ import biomesoplenty.common.block.BlockBOPMushroom;
import biomesoplenty.common.enums.BOPFlowers;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPTrees;
import biomesoplenty.common.enums.BOPWoods;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.feature.GeneratorDoubleFlora;
import biomesoplenty.common.world.feature.GeneratorFlora;
import biomesoplenty.common.world.feature.GeneratorGrass;
import biomesoplenty.common.world.feature.GeneratorOreSingle;
import biomesoplenty.common.world.feature.tree.GeneratorBasicTree;
public class BiomeExtForest extends ExtendedBiomeWrapper
{
@ -30,6 +33,12 @@ public class BiomeExtForest extends ExtendedBiomeWrapper
this.beachBiomeId = BOPBiomes.gravel_beach.get().biomeID;
}
// trees
GeneratorWeighted treeGenerator = new GeneratorWeighted(0.5F);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
treeGenerator.add("flowering_oak", 1, (new GeneratorBasicTree.Builder()).altLeaves(BOPTrees.FLOWERING).create());
// grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(5.0F);
this.addGenerator("grass", GeneratorStage.GRASS, grassGenerator);

View file

@ -184,8 +184,8 @@ public class BlockBOPSapling extends BlockBOPDecoration implements IGrowable {
return new GeneratorBasicTree.Builder().log(BlockPlanks.EnumType.OAK).leaves(BOPTrees.MAPLE).minHeight(5).maxHeight(10).create();
case HELLBARK: //Not implemented
return new WorldGenTrees(true);
case FLOWERING: //Not implemented
return new WorldGenTrees(true);
case FLOWERING:
return new GeneratorBasicTree.Builder().altLeaves(BOPTrees.FLOWERING).create();
case JACARANDA:
return new GeneratorBasicTree.Builder().minHeight(4).maxHeight(7).log(BOPWoods.JACARANDA).leaves(BOPTrees.JACARANDA).create();
case SACRED_OAK:
@ -204,7 +204,7 @@ public class BlockBOPSapling extends BlockBOPDecoration implements IGrowable {
return new GeneratorMahoganyTree.Builder().create();
case EBONY:
return new GeneratorBigTree.Builder().log(BOPWoods.EBONY).leaves(BOPTrees.EBONY).minHeight(4).maxHeight(10).foliageHeight(1).create();
case EUCALYPTUS: //Not implemented
case EUCALYPTUS:
return new GeneratorBulbTree.Builder().minHeight(15).maxHeight(30).log(BOPWoods.EUCALYPTUS).leaves(BOPTrees.EUCALYPTUS).create();
default:
return null;

View file

@ -46,6 +46,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState();
this.vine = null;
this.hanging = null;
this.altLeaves = null;
this.minHeight = 4;
this.maxHeight = 7;
this.leafLayers = 4;
@ -59,7 +60,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
@Override
public GeneratorBasicTree create()
{
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);
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);
}
}
@ -94,9 +95,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, 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 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, minHeight, maxHeight);
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight);
this.updateNeighbours = updateNeighbours;
this.leavesOffset = leavesOffset;
this.leafLayers = leafLayers;
@ -193,7 +194,21 @@ public class GeneratorBasicTree extends GeneratorTreeBase
BlockPos leavesPos = new BlockPos(x, y, z);
if (this.replace.matches(world, leavesPos))
{
this.setBlockAndNotifyAdequately(world, leavesPos, this.leaves);
if (this.altLeaves != null)
{
if (random.nextInt(4) == 0)
{
this.setBlockAndNotifyAdequately(world, leavesPos, this.altLeaves);
}
else
{
this.setBlockAndNotifyAdequately(world, leavesPos, this.leaves);
}
}
else
{
this.setBlockAndNotifyAdequately(world, leavesPos, this.leaves);
}
}
}
}
@ -348,6 +363,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
this.leaves = conf.getBlockState("leavesState", this.leaves);
this.vine = conf.getBlockState("vineState", this.vine);
this.hanging = conf.getBlockState("hangingState", this.hanging);
this.altLeaves = conf.getBlockState("altLeavesState", this.altLeaves);
this.hangingChance = conf.getFloat("hangingChance", this.hangingChance);
}

View file

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

View file

@ -53,6 +53,7 @@ public class GeneratorBigTree extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState();
this.vine = null;
this.hanging = null;
this.altLeaves = null;
this.minHeight = 5;
this.maxHeight = 17;
@ -70,7 +71,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.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.altLeaves, this.minHeight, this.maxHeight, this.trunkWidth, this.foliageHeight, this.foliageDensity, false);
}
}
@ -95,9 +96,9 @@ public class GeneratorBigTree extends GeneratorTreeBase
private List<FoliageCoords> foliageCoords;
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)
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)
{
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight);
this.foliageHeight = foliageHeight;
this.foliageDensity = foliageDensity;
this.trunkWidth = trunkWidth;
@ -271,7 +272,26 @@ public class GeneratorBigTree extends GeneratorTreeBase
for (int y = 0; y < foliageHeight; y++)
{
crossection(blockPos.up(y), foliageShape(y), this.leaves);
if (this.altLeaves != null)
{
IBlockState clusterLeaves = this.leaves;
int rand = new Random().nextInt(4);
if (rand == 0)
{
clusterLeaves = this.altLeaves;
}
else
{
clusterLeaves = this.leaves;
}
crossection(blockPos.up(y), foliageShape(y), clusterLeaves);
}
else
{
crossection(blockPos.up(y), foliageShape(y), this.leaves);
}
}
}

View file

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

View file

@ -34,18 +34,19 @@ public class GeneratorBush extends GeneratorTreeBase
this.leaves = Blocks.leaves.getDefaultState();
this.vine = null;
this.hanging = null;
this.altLeaves = null;
}
@Override
public GeneratorBush create() {
return new GeneratorBush(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.minHeight, this.maxHeight);
return new GeneratorBush(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.hanging, this.altLeaves, this.minHeight, this.maxHeight);
}
}
public GeneratorBush(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight)
public GeneratorBush(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState altLeaves, int minHeight, int maxHeight)
{
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight);
}
@Override
@ -79,7 +80,21 @@ public class GeneratorBush extends GeneratorTreeBase
//Randomly prevent the generation of leaves on the corners of each layer
if (Math.abs(x) < leavesRadius || Math.abs(z) < leavesRadius || random.nextInt(2) != 0)
{
this.setLeaves(world, pos.add(x, y, z));
if (this.altLeaves != null)
{
if (random.nextInt(4) == 0)
{
this.setAltLeaves(world, pos.add(x, y, z));
}
else
{
this.setLeaves(world, pos.add(x, y, z));
}
}
else
{
this.setLeaves(world, pos.add(x, y, z));
}
}
}
}

View file

@ -20,8 +20,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, int minHeight, int maxHeight) {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight);
protected GeneratorHugeTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState altLeaves, int minHeight, int maxHeight) {
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight);
}
protected int chooseHeight(Random rand)

View file

@ -35,6 +35,7 @@ public class GeneratorMahoganyTree extends GeneratorBasicTree
this.leaves = BlockBOPLeaves.paging.getVariantState(BOPTrees.MAHOGANY);
this.vine = null;
this.hanging = null;
this.altLeaves = null;
this.minHeight = 10;
this.maxHeight = 15;
this.leafLayers = 4;
@ -48,13 +49,13 @@ public class GeneratorMahoganyTree extends GeneratorBasicTree
@Override
public GeneratorMahoganyTree create()
{
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);
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);
}
}
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)
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)
{
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, minHeight, maxHeight, updateNeighbours, leafLayers, leavesOffset, minLeavesRadius, leavesLayerHeight, placeVinesOn, hangingChance);
super(amountPerChunk, placeOn, replace, log, leaves, vine, hanging, altLeaves, minHeight, maxHeight, updateNeighbours, leafLayers, leavesOffset, minLeavesRadius, leavesLayerHeight, placeVinesOn, hangingChance);
}
@Override

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -47,11 +47,12 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
protected IBlockState leaves;
protected IBlockState vine;
protected IBlockState hanging;
protected IBlockState altLeaves;
protected int minHeight;
protected int maxHeight;
protected IProperty logAxisProperty;
protected GeneratorTreeBase(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, int minHeight, int maxHeight) {
protected GeneratorTreeBase(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, IBlockState hanging, IBlockState altLeaves, int minHeight, int maxHeight) {
super(amountPerChunk);
this.placeOn = placeOn;
this.replace = replace;
@ -59,6 +60,7 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
this.leaves = leaves;
this.vine = vine;
this.hanging = hanging;
this.altLeaves = altLeaves;
this.minHeight = minHeight;
this.maxHeight = maxHeight;
this.logAxisProperty = GeneratorUtils.getAxisProperty(log);
@ -72,6 +74,7 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
protected IBlockState leaves;
protected IBlockState vine;
protected IBlockState hanging;
protected IBlockState altLeaves;
protected int minHeight;
protected int maxHeight;
@ -122,6 +125,19 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
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(BlockPlanks.EnumType a)
{
if (a.getMetadata() < 4)
{
this.altLeaves = Blocks.leaves.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockOldLeaf.VARIANT, a);
} else {
this.altLeaves = Blocks.leaves2.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false).withProperty(BlockNewLeaf.VARIANT, 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();}
@ -185,4 +201,14 @@ public abstract class GeneratorTreeBase extends BOPGeneratorBase
}
return false;
}
public boolean setAltLeaves(World world, BlockPos pos)
{
if (this.replace.matches(world, pos))
{
world.setBlockState(pos, this.altLeaves, 2);
return true;
}
return false;
}
}

View file

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

View file

@ -1,5 +1,5 @@
{
"parent": "biomesoplenty:block/flowering_leaves",
"parent": "biomesoplenty:items/flowering_leaves",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B