Skip to content

Commit

Permalink
Dark podzol under tree gen
Browse files Browse the repository at this point in the history
  • Loading branch information
maityyy committed Nov 10, 2024
1 parent 4456c37 commit bbc5494
Show file tree
Hide file tree
Showing 10 changed files with 363 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
import net.minecraft.world.gen.foliage.BushFoliagePlacer;
import net.minecraft.world.gen.foliage.DarkOakFoliagePlacer;
import net.minecraft.world.gen.foliage.SpruceFoliagePlacer;
import net.minecraft.world.gen.placementmodifier.CountPlacementModifier;
import net.minecraft.world.gen.placementmodifier.RandomOffsetPlacementModifier;
import net.minecraft.world.gen.stateprovider.BlockStateProvider;
import net.minecraft.world.gen.stateprovider.RandomizedIntBlockStateProvider;
import net.minecraft.world.gen.stateprovider.SimpleBlockStateProvider;
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
import net.minecraft.world.gen.treedecorator.AlterGroundTreeDecorator;
import net.minecraft.world.gen.trunk.StraightTrunkPlacer;

import static moriyashiine.aylyth.common.data.world.feature.AylythConfiguredFeatures.*;

Expand All @@ -71,8 +74,10 @@ public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {
var largeGiantJackOLanternMushroomWithPatch = configuredFeatures.getOrThrow(LARGE_GIANT_JACK_O_LANTERN_MUSHROOM_WITH_PATCH);

var spruceChecked = placedFeatures.getOrThrow(TreePlacedFeatures.SPRUCE_CHECKED);
var sprucePodzolChecked = placedFeatures.getOrThrow(AylythPlacedFeatures.SPRUCE_PODZOL_CHECKED);
var megaSpruceChecked = placedFeatures.getOrThrow(TreePlacedFeatures.MEGA_SPRUCE_CHECKED);
var aylythianDarkOak = placedFeatures.getOrThrow(AylythPlacedFeatures.AYLYTHIAN_DARK_OAK);
var aylythianDarkOakPodzol = placedFeatures.getOrThrow(AylythPlacedFeatures.AYLYTHIAN_DARK_OAK_PODZOL);
var aylythianMegaDarkOak = placedFeatures.getOrThrow(AylythPlacedFeatures.AYLYTHIAN_MEGA_DARK_OAK);
var ympe = placedFeatures.getOrThrow(AylythPlacedFeatures.YMPE_TREE);
var bigYmpe = placedFeatures.getOrThrow(AylythPlacedFeatures.BIG_YMPE_TREE);
Expand Down Expand Up @@ -112,6 +117,16 @@ public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {
ConfiguredFeatures.register(context, DARK_OAK_SEEP, AylythFeatures.SEEP_FEATURE, new SeepFeature.SeepFeatureConfig(Blocks.DARK_OAK_LOG.getDefaultState(), AylythBlocks.DARK_OAK_SEEP.getDefaultState(), AylythBlocks.MARIGOLD.getDefaultState(), 5, 0.5F));
ConfiguredFeatures.register(context, YMPE_SEEP, AylythFeatures.SEEP_FEATURE, new SeepFeature.SeepFeatureConfig(AylythBlocks.YMPE_LOG.getDefaultState(), AylythBlocks.YMPE_SEEP.getDefaultState(), AylythBlocks.MARIGOLD.getDefaultState(), 5, 0.5F));

ConfiguredFeatures.register(context, SPRUCE_PODZOL_CHECKED, Feature.TREE, new TreeFeatureConfig.Builder(
BlockStateProvider.of(Blocks.SPRUCE_LOG),
new StraightTrunkPlacer(5, 2, 1),
BlockStateProvider.of(Blocks.SPRUCE_LEAVES),
new SpruceFoliagePlacer(UniformIntProvider.create(2, 3), UniformIntProvider.create(0, 2), UniformIntProvider.create(1, 2)),
new TwoLayersFeatureSize(2, 0, 2))
.ignoreVines()
.decorators(ImmutableList.of(new AlterGroundTreeDecorator(BlockStateProvider.of(Blocks.MUD)))) // TODO replace with AylythBlocks.DARK_PODZOL
.build()
);
ConfiguredFeatures.register(context, AYLYTHIAN_DARK_OAK, Feature.TREE, new TreeFeatureConfig.Builder(
SimpleBlockStateProvider.of(Blocks.DARK_OAK_LOG.getDefaultState()),
new AylthianTrunkPlacer(12, 2, 5),
Expand Down Expand Up @@ -144,6 +159,39 @@ public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {
0.1875f
)
)).build());
ConfiguredFeatures.register(context, AYLYTHIAN_DARK_OAK_PODZOL, Feature.TREE, new TreeFeatureConfig.Builder(
SimpleBlockStateProvider.of(Blocks.DARK_OAK_LOG.getDefaultState()),
new AylthianTrunkPlacer(12, 2, 5),
SimpleBlockStateProvider.of(Blocks.DARK_OAK_LEAVES.getDefaultState()),
new DarkOakFoliagePlacer(ConstantIntProvider.create(1), ConstantIntProvider.create(0)),
new TwoLayersFeatureSize(1, 1, 2))
.ignoreVines()
.decorators(ImmutableList.of(
new AlterGroundTreeDecorator(BlockStateProvider.of(Blocks.MUD)), // TODO replace with AylythBlocks.DARK_PODZOL
new GrapeVineDecorator(UniformIntProvider.create(0, 9), 1),
new PlaceAroundTreeDecorator(RegistryEntryList.of(
RegistryEntry.of(new PlacedFeature(oakStrewnLeavesConfigured, List.of(
CountPlacementModifier.of(UniformIntProvider.create(4, 8)),
RandomOffsetPlacementModifier.horizontally(UniformIntProvider.create(2, 6)),
PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP,
PlacedFeatures.wouldSurvive(AylythBlocks.OAK_STREWN_LEAVES)
))),
RegistryEntry.of(new PlacedFeature(oakLeafPileConfigured, List.of(
CountPlacementModifier.of(UniformIntProvider.create(0, 2)),
RandomOffsetPlacementModifier.horizontally(UniformIntProvider.create(2, 6)),
PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP,
PlacedFeatures.wouldSurvive(AylythBlocks.OAK_STREWN_LEAVES)
)))
)),
new BranchDecorator(
new WeightedBlockStateProvider(DataPool.<BlockState>builder()
.add(AylythBlocks.DARK_OAK_BRANCH.getDefaultState(), 2)
.add(AylythBlocks.BARE_DARK_OAK_BRANCH.getDefaultState(), 4)
.build()),
ConstantIntProvider.create(2),
0.1875f
)
)).build());
ConfiguredFeatures.register(context, AYLYTHIAN_MEGA_DARK_OAK, Feature.TREE, new TreeFeatureConfig.Builder(
SimpleBlockStateProvider.of(Blocks.DARK_OAK_LOG.getDefaultState()),
new AylthianTrunkPlacer(18, 6, 7),
Expand Down Expand Up @@ -295,9 +343,9 @@ public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {

ConfiguredFeatures.register(context, DEEP_ROOF_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfig(List.of(new RandomFeatureEntry(aylythianDarkOak, 0.25F)), aylythianMegaDarkOak));
ConfiguredFeatures.register(context, CONIFEROUS_DEEP_ROOF_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfig(List.of(new RandomFeatureEntry(aylythianMegaDarkOak, 0.65F)), megaSpruceChecked));
ConfiguredFeatures.register(context, COPSE_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfig(List.of(new RandomFeatureEntry(ympe, 0.25F)), aylythianDarkOak));
ConfiguredFeatures.register(context, COPSE_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfig(List.of(new RandomFeatureEntry(ympe, 0.25F)), aylythianDarkOakPodzol));
ConfiguredFeatures.register(context, DEEPWOOD_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfig(List.of(new RandomFeatureEntry(ympe, 0.25F), new RandomFeatureEntry(bigYmpe, 0.25F)), aylythianDarkOak));
ConfiguredFeatures.register(context, CONIFEROUS_COPSE_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfig(List.of(new RandomFeatureEntry(ympe, 0.25F)), spruceChecked));
ConfiguredFeatures.register(context, CONIFEROUS_COPSE_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfig(List.of(new RandomFeatureEntry(ympe, 0.25F)), sprucePodzolChecked));
ConfiguredFeatures.register(context, CONIFEROUS_DEEPWOOD_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfig(List.of(new RandomFeatureEntry(ympe, 0.15F), new RandomFeatureEntry(bigYmpe, 0.15F)), spruceChecked));
ConfiguredFeatures.register(context, OVERGROWTH_CLEARING_TREES,Feature.RANDOM_SELECTOR, new RandomFeatureConfig(List.of(new RandomFeatureEntry(ympe, 0.5F)), spruceChecked));
ConfiguredFeatures.register(context, MIRE_WATER_TREES, Feature.RANDOM_SELECTOR, new RandomFeatureConfig(List.of(), writhewood));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ private AylythPlacedFeatureBootstrap() {}
public static void bootstrap(Registerable<PlacedFeature> context) {
var features = context.getRegistryLookup(RegistryKeys.CONFIGURED_FEATURE);

var sprucePodzolChecked = features.getOrThrow(AylythConfiguredFeatures.SPRUCE_PODZOL_CHECKED);
var aylythianDarkOak = features.getOrThrow(AylythConfiguredFeatures.AYLYTHIAN_DARK_OAK);
var aylythianDarkOakPodzol = features.getOrThrow(AylythConfiguredFeatures.AYLYTHIAN_DARK_OAK_PODZOL);
var aylythianMegaDarkOak = features.getOrThrow(AylythConfiguredFeatures.AYLYTHIAN_MEGA_DARK_OAK);
var ympe = features.getOrThrow(AylythConfiguredFeatures.YMPE_TREE);
var bigYmpe = features.getOrThrow(AylythConfiguredFeatures.BIG_YMPE_TREE);
Expand Down Expand Up @@ -76,7 +78,9 @@ public static void bootstrap(Registerable<PlacedFeature> context) {
var jackOLanternMushroom = features.getOrThrow(AylythConfiguredFeatures.JACK_O_LANTERN_MUSHROOM);
var giantJackOLanternMushrooms = features.getOrThrow(AylythConfiguredFeatures.GIANT_JACK_O_LANTERN_MUSHROOMS);

PlacedFeatures.register(context, SPRUCE_PODZOL_CHECKED, sprucePodzolChecked, List.of(PlacedFeatures.wouldSurvive(Blocks.SPRUCE_SAPLING)));
PlacedFeatures.register(context, AYLYTHIAN_DARK_OAK, aylythianDarkOak, List.of(PlacedFeatures.wouldSurvive(Blocks.DARK_OAK_SAPLING)));
PlacedFeatures.register(context, AYLYTHIAN_DARK_OAK_PODZOL, aylythianDarkOakPodzol, List.of(PlacedFeatures.wouldSurvive(Blocks.DARK_OAK_SAPLING)));
PlacedFeatures.register(context, AYLYTHIAN_MEGA_DARK_OAK, aylythianMegaDarkOak, List.of(PlacedFeatures.wouldSurvive(Blocks.DARK_OAK_SAPLING)));
PlacedFeatures.register(context, YMPE_TREE, ympe, List.of(PlacedFeatures.wouldSurvive(AylythBlocks.YMPE_SAPLING)));
PlacedFeatures.register(context, BIG_YMPE_TREE, bigYmpe, List.of(PlacedFeatures.wouldSurvive(AylythBlocks.YMPE_SAPLING)));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
{
"type": "minecraft:tree",
"config": {
"decorators": [
{
"type": "minecraft:alter_ground",
"provider": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "minecraft:mud"
}
}
},
{
"type": "aylyth:grape_vine",
"chance_point": 1,
"chance_range": {
"type": "minecraft:uniform",
"value": {
"max_inclusive": 9,
"min_inclusive": 0
}
}
},
{
"type": "aylyth:place_around",
"placed_features": [
{
"feature": "aylyth:oak_strewn_leaves",
"placement": [
{
"type": "minecraft:count",
"count": {
"type": "minecraft:uniform",
"value": {
"max_inclusive": 8,
"min_inclusive": 4
}
}
},
{
"type": "minecraft:random_offset",
"xz_spread": {
"type": "minecraft:uniform",
"value": {
"max_inclusive": 6,
"min_inclusive": 2
}
},
"y_spread": 0
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE_WG"
},
{
"type": "minecraft:block_predicate_filter",
"predicate": {
"type": "minecraft:would_survive",
"state": {
"Name": "aylyth:oak_strewn_leaves",
"Properties": {
"leaves": "0"
}
}
}
}
]
},
{
"feature": "aylyth:oak_leaf_pile",
"placement": [
{
"type": "minecraft:count",
"count": {
"type": "minecraft:uniform",
"value": {
"max_inclusive": 2,
"min_inclusive": 0
}
}
},
{
"type": "minecraft:random_offset",
"xz_spread": {
"type": "minecraft:uniform",
"value": {
"max_inclusive": 6,
"min_inclusive": 2
}
},
"y_spread": 0
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE_WG"
},
{
"type": "minecraft:block_predicate_filter",
"predicate": {
"type": "minecraft:would_survive",
"state": {
"Name": "aylyth:oak_strewn_leaves",
"Properties": {
"leaves": "0"
}
}
}
}
]
}
]
},
{
"type": "aylyth:branches",
"block_state": {
"type": "minecraft:weighted_state_provider",
"entries": [
{
"data": {
"Name": "aylyth:dark_oak_branch",
"Properties": {
"facing": "north"
}
},
"weight": 2
},
{
"data": {
"Name": "aylyth:bare_dark_oak_branch",
"Properties": {
"facing": "north"
}
},
"weight": 4
}
]
},
"chance": 0.1875,
"min_branch_height": 2
}
],
"dirt_provider": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "minecraft:dirt"
}
},
"foliage_placer": {
"type": "minecraft:dark_oak_foliage_placer",
"offset": 0,
"radius": 1
},
"foliage_provider": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "minecraft:dark_oak_leaves",
"Properties": {
"distance": "7",
"persistent": "false",
"waterlogged": "false"
}
}
},
"force_dirt": false,
"ignore_vines": true,
"minimum_size": {
"type": "minecraft:two_layers_feature_size",
"limit": 1,
"lower_size": 1,
"upper_size": 2
},
"trunk_placer": {
"type": "aylyth:aylythian",
"base_height": 12,
"height_rand_a": 2,
"height_rand_b": 5
},
"trunk_provider": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "minecraft:dark_oak_log",
"Properties": {
"axis": "y"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "minecraft:random_selector",
"config": {
"default": "minecraft:spruce_checked",
"default": "aylyth:spruce_podzol_checked",
"features": [
{
"chance": 0.25,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "minecraft:random_selector",
"config": {
"default": "aylyth:aylythian_dark_oak",
"default": "aylyth:aylythian_dark_oak_podzol",
"features": [
{
"chance": 0.25,
Expand Down
Loading

0 comments on commit bbc5494

Please sign in to comment.