Improved poplar tree generation

This commit is contained in:
Forstride 2019-08-10 08:19:22 -04:00
parent 1c6b1f66c4
commit f8ce3f8055
3 changed files with 23 additions and 6 deletions

View File

@ -55,7 +55,7 @@ public class BorealForestBiome extends BiomeBOP
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Vegetation // Vegetation
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Biome.createDecoratedFeature(Feature.RANDOM_SELECTOR, new MultipleRandomFeatureConfig(new Feature[]{Feature.FANCY_TREE, Feature.NORMAL_TREE, BOPBiomeFeatures.YELLOW_POPLAR_TREE, BOPBiomeFeatures.YELLOW_AUTUMN_TREE}, new IFeatureConfig[]{IFeatureConfig.NO_FEATURE_CONFIG, IFeatureConfig.NO_FEATURE_CONFIG, IFeatureConfig.NO_FEATURE_CONFIG, IFeatureConfig.NO_FEATURE_CONFIG}, new float[]{0.075F, 0.15F, 0.3F, 0.3F}, BOPBiomeFeatures.TALL_SPRUCE_TREE, IFeatureConfig.NO_FEATURE_CONFIG), Placement.COUNT_EXTRA_HEIGHTMAP, new AtSurfaceWithExtraConfig(12, 0.4F, 1))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Biome.createDecoratedFeature(Feature.RANDOM_SELECTOR, new MultipleRandomFeatureConfig(new Feature[]{Feature.FANCY_TREE, Feature.NORMAL_TREE, BOPBiomeFeatures.YELLOW_POPLAR_TREE, BOPBiomeFeatures.YELLOW_AUTUMN_TREE}, new IFeatureConfig[]{IFeatureConfig.NO_FEATURE_CONFIG, IFeatureConfig.NO_FEATURE_CONFIG, IFeatureConfig.NO_FEATURE_CONFIG, IFeatureConfig.NO_FEATURE_CONFIG}, new float[]{0.075F, 0.15F, 0.3F, 0.3F}, BOPBiomeFeatures.TALL_SPRUCE_TREE, IFeatureConfig.NO_FEATURE_CONFIG), Placement.COUNT_EXTRA_HEIGHTMAP, new AtSurfaceWithExtraConfig(10, 0.4F, 1)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Biome.createDecoratedFeature(new FernGrassFeature(NoFeatureConfig::deserialize), IFeatureConfig.NO_FEATURE_CONFIG, Placement.COUNT_HEIGHTMAP_DOUBLE, new FrequencyConfig(8))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Biome.createDecoratedFeature(new FernGrassFeature(NoFeatureConfig::deserialize), IFeatureConfig.NO_FEATURE_CONFIG, Placement.COUNT_HEIGHTMAP_DOUBLE, new FrequencyConfig(8)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Biome.createDecoratedFeature(Feature.SWEET_BERRY_BUSH, IFeatureConfig.NO_FEATURE_CONFIG, Placement.COUNT_HEIGHTMAP_DOUBLE, new FrequencyConfig(1))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Biome.createDecoratedFeature(Feature.SWEET_BERRY_BUSH, IFeatureConfig.NO_FEATURE_CONFIG, Placement.COUNT_HEIGHTMAP_DOUBLE, new FrequencyConfig(1)));
this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Biome.createDecoratedFeature(Feature.BUSH, new BushConfig(BOPBlocks.reed.getDefaultState()), Placement.COUNT_HEIGHTMAP_DOUBLE, new FrequencyConfig(5))); this.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Biome.createDecoratedFeature(Feature.BUSH, new BushConfig(BOPBlocks.reed.getDefaultState()), Placement.COUNT_HEIGHTMAP_DOUBLE, new FrequencyConfig(5)));

View File

@ -59,7 +59,7 @@ public class BOPBiomeFeatures
public static final AbstractTreeFeature<NoFeatureConfig> SPRUCE_POPLAR = new PoplarTreeFeature.Builder().log(Blocks.SPRUCE_LOG.getDefaultState()).leaves(Blocks.SPRUCE_LEAVES.getDefaultState()).create(); public static final AbstractTreeFeature<NoFeatureConfig> SPRUCE_POPLAR = new PoplarTreeFeature.Builder().log(Blocks.SPRUCE_LOG.getDefaultState()).leaves(Blocks.SPRUCE_LEAVES.getDefaultState()).create();
public static final AbstractTreeFeature<NoFeatureConfig> BIRCH_POPLAR = new PoplarTreeFeature.Builder().log(Blocks.BIRCH_LOG.getDefaultState()).leaves(Blocks.BIRCH_LEAVES.getDefaultState()).create(); public static final AbstractTreeFeature<NoFeatureConfig> BIRCH_POPLAR = new PoplarTreeFeature.Builder().log(Blocks.BIRCH_LOG.getDefaultState()).leaves(Blocks.BIRCH_LEAVES.getDefaultState()).create();
public static final AbstractTreeFeature<NoFeatureConfig> DARK_OAK_POPLAR = new PoplarTreeFeature.Builder().log(Blocks.DARK_OAK_LOG.getDefaultState()).leaves(Blocks.DARK_OAK_LEAVES.getDefaultState()).create(); public static final AbstractTreeFeature<NoFeatureConfig> DARK_OAK_POPLAR = new PoplarTreeFeature.Builder().log(Blocks.DARK_OAK_LOG.getDefaultState()).leaves(Blocks.DARK_OAK_LEAVES.getDefaultState()).create();
public static final AbstractTreeFeature<NoFeatureConfig> YELLOW_POPLAR_TREE = new PoplarTreeFeature.Builder().log(Blocks.BIRCH_LOG.getDefaultState()).leaves(BOPBlocks.yellow_autumn_leaves.getDefaultState()).minHeight(10).maxHeight(18).create(); public static final AbstractTreeFeature<NoFeatureConfig> YELLOW_POPLAR_TREE = new PoplarTreeFeature.Builder().log(Blocks.BIRCH_LOG.getDefaultState()).leaves(BOPBlocks.yellow_autumn_leaves.getDefaultState()).create();
//Swamp Trees //Swamp Trees
public static final AbstractTreeFeature<NoFeatureConfig> CYPRESS_TREE = new CypressTreeFeature.Builder().create(); public static final AbstractTreeFeature<NoFeatureConfig> CYPRESS_TREE = new CypressTreeFeature.Builder().create();

View File

@ -24,8 +24,8 @@ public class PoplarTreeFeature extends TreeFeatureBase
{ {
public Builder() public Builder()
{ {
this.minHeight = 9; this.minHeight = 12;
this.maxHeight = 17; this.maxHeight = 15;
} }
@Override @Override
@ -57,7 +57,7 @@ public class PoplarTreeFeature extends TreeFeatureBase
// Choose heights and width // Choose heights and width
int height = GeneratorUtil.nextIntBetween(random, this.minHeight, this.maxHeight); int height = GeneratorUtil.nextIntBetween(random, this.minHeight, this.maxHeight);
if (height < 4) {return false;} if (height < 4) {return false;}
int baseHeight = height / (2 + random.nextInt(3)); int baseHeight = height / 3;
int leavesHeight = height - baseHeight; int leavesHeight = height - baseHeight;
// Move up to space above ground // Move up to space above ground
@ -125,12 +125,29 @@ public class PoplarTreeFeature extends TreeFeatureBase
for(int x = -radius; x <= radius; x++) for(int x = -radius; x <= radius; x++)
{ {
for(int z = -radius; z <= radius; z++) for(int z = -radius; z <= radius; z++)
{
if (radius < 2)
{ {
if (x*x + z*z <= radius*radius) if (x*x + z*z <= radius*radius)
{ {
this.setLeaves(world, pos.add(x, 0, z)); this.setLeaves(world, pos.add(x, 0, z));
} }
} }
else
{
if ((x == -radius || x == radius) && (z == -radius || z == radius)) { continue; }
this.setLeaves(world, pos.add(x, 0, z));
for (int i = -1; i < 3; i++)
{
this.setLeaves(world, pos.add(-1, i, -1));
this.setLeaves(world, pos.add(1, i, 1));
this.setLeaves(world, pos.add(-1, i, 1));
this.setLeaves(world, pos.add(1, i, -1));
}
}
}
} }
} }
} }