From 86799fb464af150c9e39e761adbcbfc85c6a330f Mon Sep 17 00:00:00 2001 From: Forstride Date: Wed, 13 Dec 2023 03:52:04 -0500 Subject: [PATCH] Made poplar trees in the Mediterranean Forest look nicer --- .../103d9f3f36b01595f1aa5172191e60eff02e6924 | 10 +++++----- .../configured_feature/aspen_tree.json | 1 + .../dark_oak_poplar_tree.json | 1 + .../spruce_poplar_tree.json | 1 + .../trees_mediterranean_forest.json | 4 ++-- .../worldgen/feature/BOPTreeFeatures.java | 6 +++--- .../PoplarTreeConfiguration.java | 19 ++++++++++++++++--- .../feature/tree/PoplarTreeFeature.java | 4 ++++ .../placement/BOPVegetationPlacements.java | 2 +- 9 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 b/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 index 0048413aa..df45fdacd 100644 --- a/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 +++ b/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 @@ -1,4 +1,4 @@ -// 1.20.4 2023-12-09T20:21:39.0210994 Registries +// 1.20.4 2023-12-13T03:23:45.3537111 Registries a09ddf53150a7fcf8767a311dd5cf040fa2e9221 data/biomesoplenty/damage_type/bramble.json 2d0eab2cc85c4c6397fdc41dd0cedefbc4a7a150 data/biomesoplenty/damage_type/fumarole.json 1db19ce8d33b8c131955b60ed830200bbee6a912 data/biomesoplenty/worldgen/biome/aspen_glade.json @@ -71,7 +71,7 @@ a4d5101a19a38da4f42164b672b74766edb26bc9 data/biomesoplenty/worldgen/configured_ 002c55f5e2c8d1f8e4dc04266adb4716b5d17763 data/biomesoplenty/worldgen/configured_feature/acacia_bush_tree.json 6a4e15b136ce5f0d2672ba43c13f628fb7febd6a data/biomesoplenty/worldgen/configured_feature/acacia_twiglet.json d5b35b4d78f4ece7de470e07042aa6b0d37b967f data/biomesoplenty/worldgen/configured_feature/acacia_twiglet_small.json -10b6a4f3088fa78727126850b7a7784ed405c775 data/biomesoplenty/worldgen/configured_feature/aspen_tree.json +0a655897c67fb080ad5a16402720bfbec87cf3e7 data/biomesoplenty/worldgen/configured_feature/aspen_tree.json 14386c8cb811e1cd0d768ba7fe5b06642e0471c7 data/biomesoplenty/worldgen/configured_feature/big_dripleaf.json 9e764721494e61fc108e60fa5e2b3c44158b736f data/biomesoplenty/worldgen/configured_feature/big_flowering_oak_tree.json 76d786439348db02c59279d595db7e28459d07d1 data/biomesoplenty/worldgen/configured_feature/big_flowering_oak_tree_bees.json @@ -102,7 +102,7 @@ d208d291658b2a5cabee58b8efffdfbbce41aee8 data/biomesoplenty/worldgen/configured_ 4ee211197e2a70a95ea4170871c0ecd9d32908ab data/biomesoplenty/worldgen/configured_feature/crag_splatter.json 64932fa65018e2be7acff61093a904d583277b44 data/biomesoplenty/worldgen/configured_feature/cypress_tree.json 0f79e15b55bf3b5be1523ed3e85ea4fa26a796d0 data/biomesoplenty/worldgen/configured_feature/cypress_tree_medium.json -d5329c2465eec8f80840beb02df74b3b278e37f0 data/biomesoplenty/worldgen/configured_feature/dark_oak_poplar_tree.json +1c568da7ae87f6695078ede1bef42f1488501f5e data/biomesoplenty/worldgen/configured_feature/dark_oak_poplar_tree.json cd2b9f82f108fe30dd3a4a878bd7216a37c98091 data/biomesoplenty/worldgen/configured_feature/dead_grass.json 08290748a4feb659eabc32c099b036ba04f3d930 data/biomesoplenty/worldgen/configured_feature/dead_tree_wasteland.json 599fe99edb01b6d56389ca55908717765a1ea2cb data/biomesoplenty/worldgen/configured_feature/dead_twiglet_tree.json @@ -264,7 +264,7 @@ c7c6754b855b755d3c183e6f8e86e0ade2b878c5 data/biomesoplenty/worldgen/configured_ 3a4c60fa1ee57b5b8ba28a25bc0c41a86293fa45 data/biomesoplenty/worldgen/configured_feature/spring_water_extra.json 490897b03b2cb822737519650a9abe093070f922 data/biomesoplenty/worldgen/configured_feature/sprouts_undergrowth.json 37c885b65c9c00709ebb25c7b9d25e069e1577ee data/biomesoplenty/worldgen/configured_feature/spruce_bush.json -74763ef1e31a7f95d3d177658f45404fd19f5ba9 data/biomesoplenty/worldgen/configured_feature/spruce_poplar_tree.json +7a5228091146cfb88a6a39df41d15fd596e13412 data/biomesoplenty/worldgen/configured_feature/spruce_poplar_tree.json 74610c78a0d85f60a0dcc58529cc074e2a0f239a data/biomesoplenty/worldgen/configured_feature/spruce_twiglet_tree.json 19e829755dddeb397e2443239ec3d04cb2c8ad4a data/biomesoplenty/worldgen/configured_feature/stringy_cobweb.json 05649aa4fe194a5d4243f1fc04c59ecfb5e3193d data/biomesoplenty/worldgen/configured_feature/sunflower.json @@ -589,7 +589,7 @@ b59fd06e1c240962408eec93e18073f73bbe357c data/biomesoplenty/worldgen/placed_feat 79564b193186648ac462ad275bb96a48e4c9f49a data/biomesoplenty/worldgen/placed_feature/trees_lavender_field.json b4fe6b6e47c2a605e7a3ac56544f53b7b01be919 data/biomesoplenty/worldgen/placed_feature/trees_lush_desert.json b7d1c71b95c28dc779f234c161af0893f1580cc2 data/biomesoplenty/worldgen/placed_feature/trees_maple_forest.json -4a9a91dcdc955306b05a70f504b7326bd10e5581 data/biomesoplenty/worldgen/placed_feature/trees_mediterranean_forest.json +fc477ffc633402d541637216204461e6363663a0 data/biomesoplenty/worldgen/placed_feature/trees_mediterranean_forest.json 49812f9dd6be5ebcac01c67917de11e17a842699 data/biomesoplenty/worldgen/placed_feature/trees_muskeg.json 9ef311cea091d529b11c5c20b5c155cc784a748d data/biomesoplenty/worldgen/placed_feature/trees_mystic_grove.json fe07b22d36731cb4483426e50177b2f790b5a833 data/biomesoplenty/worldgen/placed_feature/trees_old_growth_dead_forest.json diff --git a/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/aspen_tree.json b/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/aspen_tree.json index 4618786b4..ecaf1d9b2 100644 --- a/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/aspen_tree.json +++ b/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/aspen_tree.json @@ -25,6 +25,7 @@ "Name": "minecraft:air" } }, + "leaves_at_bottom": false, "max_height": 20, "min_height": 12, "trunk_fruit_provider": { diff --git a/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/dark_oak_poplar_tree.json b/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/dark_oak_poplar_tree.json index abb3052f9..e68728ec6 100644 --- a/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/dark_oak_poplar_tree.json +++ b/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/dark_oak_poplar_tree.json @@ -25,6 +25,7 @@ "Name": "minecraft:air" } }, + "leaves_at_bottom": true, "max_height": 15, "min_height": 12, "trunk_fruit_provider": { diff --git a/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/spruce_poplar_tree.json b/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/spruce_poplar_tree.json index 67ed8dbab..779249926 100644 --- a/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/spruce_poplar_tree.json +++ b/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/spruce_poplar_tree.json @@ -25,6 +25,7 @@ "Name": "minecraft:air" } }, + "leaves_at_bottom": true, "max_height": 15, "min_height": 12, "trunk_fruit_provider": { diff --git a/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/trees_mediterranean_forest.json b/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/trees_mediterranean_forest.json index 92e1f1174..5497c4800 100644 --- a/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/trees_mediterranean_forest.json +++ b/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/trees_mediterranean_forest.json @@ -7,11 +7,11 @@ "type": "minecraft:weighted_list", "distribution": [ { - "data": 3, + "data": 2, "weight": 9 }, { - "data": 4, + "data": 3, "weight": 1 } ] diff --git a/src/main/java/biomesoplenty/common/worldgen/feature/BOPTreeFeatures.java b/src/main/java/biomesoplenty/common/worldgen/feature/BOPTreeFeatures.java index bd2ebcde1..2660a21d6 100644 --- a/src/main/java/biomesoplenty/common/worldgen/feature/BOPTreeFeatures.java +++ b/src/main/java/biomesoplenty/common/worldgen/feature/BOPTreeFeatures.java @@ -138,10 +138,10 @@ public static void bootstrap(BootstapContext> context) register(context, BOPTreeFeatures.TALL_SPRUCE_TREE_BEES, BOPBaseFeatures.TAIGA_TREE, new TaigaTreeConfiguration.Builder().maxHeight(13).decorator(new BeehiveDecorator(0.05f)).build()); register(context, BOPTreeFeatures.TALL_UMBRAN_TREE, BOPBaseFeatures.UMBRAN_TREE, new TaigaTreeConfiguration.Builder().trunk(BlockStateProvider.simple(BOPBlocks.UMBRAN_LOG.get())).foliage(BlockStateProvider.simple(BOPBlocks.UMBRAN_LEAVES.get())).minHeight(20).maxHeight(30).trunkWidth(2).build()); register(context, BOPTreeFeatures.UMBRAN_TREE, BOPBaseFeatures.UMBRAN_TREE, new TaigaTreeConfiguration.Builder().trunk(BlockStateProvider.simple(BOPBlocks.UMBRAN_LOG.get())).foliage(BlockStateProvider.simple(BOPBlocks.UMBRAN_LEAVES.get())).maxHeight(20).build()); - register(context, BOPTreeFeatures.BIG_MAGIC_TREE, BOPBaseFeatures.MAGIC_TREE, new MagicTreeConfiguration.Builder().minHeight(16).maxHeight(20).build()); - register(context, BOPTreeFeatures.DARK_OAK_POPLAR_TREE, BOPBaseFeatures.POPLAR_TREE, new PoplarTreeConfiguration.Builder().trunk(BlockStateProvider.simple(Blocks.DARK_OAK_LOG)).foliage(BlockStateProvider.simple(Blocks.DARK_OAK_LEAVES)).build()); register(context, BOPTreeFeatures.MAGIC_TREE, BOPBaseFeatures.MAGIC_TREE, new MagicTreeConfiguration.Builder().minHeight(5).maxHeight(12).build()); - register(context, BOPTreeFeatures.SPRUCE_POPLAR_TREE, BOPBaseFeatures.POPLAR_TREE, new PoplarTreeConfiguration.Builder().trunk(BlockStateProvider.simple(Blocks.SPRUCE_LOG)).foliage(BlockStateProvider.simple(Blocks.SPRUCE_LEAVES)).build()); + register(context, BOPTreeFeatures.BIG_MAGIC_TREE, BOPBaseFeatures.MAGIC_TREE, new MagicTreeConfiguration.Builder().minHeight(16).maxHeight(20).build()); + register(context, BOPTreeFeatures.DARK_OAK_POPLAR_TREE, BOPBaseFeatures.POPLAR_TREE, new PoplarTreeConfiguration.Builder().trunk(BlockStateProvider.simple(Blocks.DARK_OAK_LOG)).foliage(BlockStateProvider.simple(Blocks.DARK_OAK_LEAVES)).leavesAtBottom(true).build()); + register(context, BOPTreeFeatures.SPRUCE_POPLAR_TREE, BOPBaseFeatures.POPLAR_TREE, new PoplarTreeConfiguration.Builder().trunk(BlockStateProvider.simple(Blocks.SPRUCE_LOG)).foliage(BlockStateProvider.simple(Blocks.SPRUCE_LEAVES)).leavesAtBottom(true).build()); register(context, BOPTreeFeatures.CYPRESS_TREE, BOPBaseFeatures.CYPRESS_TREE, new CypressTreeConfiguration.Builder().build()); register(context, BOPTreeFeatures.CYPRESS_TREE_MEDIUM, BOPBaseFeatures.CYPRESS_TREE, new CypressTreeConfiguration.Builder().minHeight(18).maxHeight(25).trunkWidth(2).build()); register(context, BOPTreeFeatures.ACACIA_BUSH_TREE, BOPBaseFeatures.BUSH_TREE, new BasicTreeConfiguration.Builder().maxHeight(2).minHeight(2).trunk(BlockStateProvider.simple(Blocks.ACACIA_LOG)).foliage(BlockStateProvider.simple(Blocks.ACACIA_LEAVES)).build()); diff --git a/src/main/java/biomesoplenty/common/worldgen/feature/configurations/PoplarTreeConfiguration.java b/src/main/java/biomesoplenty/common/worldgen/feature/configurations/PoplarTreeConfiguration.java index 1c875aef0..7c866c759 100644 --- a/src/main/java/biomesoplenty/common/worldgen/feature/configurations/PoplarTreeConfiguration.java +++ b/src/main/java/biomesoplenty/common/worldgen/feature/configurations/PoplarTreeConfiguration.java @@ -23,26 +23,39 @@ public class PoplarTreeConfiguration extends BOPTreeConfiguration BlockStateProvider.CODEC.fieldOf("alt_foliage_provider").forGetter((instance) -> instance.altFoliageProvider), Codec.INT.fieldOf("min_height").forGetter((instance) -> instance.minHeight), Codec.INT.fieldOf("max_height").forGetter((instance) -> instance.maxHeight), - TreeDecorator.CODEC.listOf().fieldOf("decorators").forGetter(instance -> instance.decorators) + TreeDecorator.CODEC.listOf().fieldOf("decorators").forGetter(instance -> instance.decorators), + Codec.BOOL.fieldOf("leaves_at_bottom").forGetter((instance) -> instance.leavesAtBottom) ).apply(builder, PoplarTreeConfiguration::new); }); - protected PoplarTreeConfiguration(BlockStateProvider trunkProvider, BlockStateProvider foliageProvider, BlockStateProvider vineProvider, BlockStateProvider hangingProvider, BlockStateProvider trunkFruitProvider, BlockStateProvider altFoliageProvider, int minHeight, int maxHeight, List decorators) + public final boolean leavesAtBottom; + + protected PoplarTreeConfiguration(BlockStateProvider trunkProvider, BlockStateProvider foliageProvider, BlockStateProvider vineProvider, BlockStateProvider hangingProvider, BlockStateProvider trunkFruitProvider, BlockStateProvider altFoliageProvider, int minHeight, int maxHeight, List decorators, boolean leavesAtBottom) { super(trunkProvider, foliageProvider, vineProvider, hangingProvider, trunkFruitProvider, altFoliageProvider, minHeight, maxHeight, decorators); + this.leavesAtBottom = leavesAtBottom; } public static class Builder extends BOPTreeConfiguration.Builder { + private boolean leavesAtBottom; + public Builder() { this.minHeight = 12; this.maxHeight = 15; + this.leavesAtBottom = false; + } + + public PoplarTreeConfiguration.Builder leavesAtBottom(boolean a) + { + this.leavesAtBottom = a; + return this; } public PoplarTreeConfiguration build() { - return new PoplarTreeConfiguration(this.trunkProvider, this.foliageProvider, this.vineProvider, this.hangingProvider, this.trunkFruitProvider, this.altFoliageProvider, this.minHeight, this.maxHeight, this.decorators); + return new PoplarTreeConfiguration(this.trunkProvider, this.foliageProvider, this.vineProvider, this.hangingProvider, this.trunkFruitProvider, this.altFoliageProvider, this.minHeight, this.maxHeight, this.decorators, this.leavesAtBottom); } } } diff --git a/src/main/java/biomesoplenty/common/worldgen/feature/tree/PoplarTreeFeature.java b/src/main/java/biomesoplenty/common/worldgen/feature/tree/PoplarTreeFeature.java index f4e194977..fd2b0a851 100644 --- a/src/main/java/biomesoplenty/common/worldgen/feature/tree/PoplarTreeFeature.java +++ b/src/main/java/biomesoplenty/common/worldgen/feature/tree/PoplarTreeFeature.java @@ -37,6 +37,10 @@ protected boolean doPlace(WorldGenLevel world, RandomSource random, BlockPos sta int height = GeneratorUtil.nextIntBetween(random, config.minHeight, config.maxHeight); if (height < 4) {return false;} int baseHeight = height / 3; + if (config.leavesAtBottom) + { + baseHeight = 0; + } int leavesHeight = height - baseHeight; // Move up to space above ground diff --git a/src/main/java/biomesoplenty/common/worldgen/placement/BOPVegetationPlacements.java b/src/main/java/biomesoplenty/common/worldgen/placement/BOPVegetationPlacements.java index c6bd0b7cc..7e20bf43a 100644 --- a/src/main/java/biomesoplenty/common/worldgen/placement/BOPVegetationPlacements.java +++ b/src/main/java/biomesoplenty/common/worldgen/placement/BOPVegetationPlacements.java @@ -445,7 +445,7 @@ public static void bootstrap(BootstapContext context) register(context, BOPVegetationPlacements.TREES_LAVENDER_FIELD, TREES_LAVENDER_FIELD, treePlacement(PlacementUtils.countExtra(0, 0.2F, 9))); register(context, BOPVegetationPlacements.TREES_LUSH_DESERT, TREES_LUSH_DESERT, treePlacement(PlacementUtils.countExtra(0, 0.2F, 8))); register(context, BOPVegetationPlacements.TREES_MAPLE_FOREST, TREES_MAPLE_FOREST, treePlacement(PlacementUtils.countExtra(12, 0.1F, 1))); - register(context, BOPVegetationPlacements.TREES_MEDITERRANEAN_FOREST, TREES_MEDITERRANEAN_FOREST, treePlacement(PlacementUtils.countExtra(3, 0.1F, 1))); + register(context, BOPVegetationPlacements.TREES_MEDITERRANEAN_FOREST, TREES_MEDITERRANEAN_FOREST, treePlacement(PlacementUtils.countExtra(2, 0.1F, 1))); register(context, BOPVegetationPlacements.TREES_MUSKEG, TREES_MUSKEG, treePlacement(PlacementUtils.countExtra(0, 0.5F, 1))); register(context, BOPVegetationPlacements.TREES_OLD_GROWTH_DEAD_FOREST, TREES_OLD_GROWTH_DEAD_FOREST, treePlacement(PlacementUtils.countExtra(5, 0.1F, 1))); register(context, BOPVegetationPlacements.TREES_MYSTIC_GROVE, TREES_MYSTIC_GROVE, treePlacement(PlacementUtils.countExtra(5, 0.2F, 10)));