Ecologics

Ecologics

8M Downloads

[Bug]: Ecologics generates Azalea trees in every biome (+ bonus 2nd bug in all placed features).

Vaelzan opened this issue ยท 3 comments

commented

Mod Version

1.5.3

Mod Loader

Forge

Mod Loader Version

40.0.40

What happened?

When Ecologics replaces vanilla rooted Azalea, it doesn't limit the addition of the feature to just the lush caves biome (which is the only biome in Vanilla Minecraft that naturally has the feature), and instead adds it to all biomes:

builder.getFeatures(GenerationStep.Decoration.VEGETAL_DECORATION).add(Holder.direct(ModPlacedFeatures.ROOTED_AZALEA_TREE));
- it lacks the biome check that your other placed features have.

It would be a fairly easy fix to move the entire if block (of what is currently line 71-74) to inside the lush caves block just above:

if (biomeName.equals(Biomes.LUSH_CAVES.location())) {

I believe there is also a separate bug in the same file - by using Holder.direct you're copying the contents of your configured features into the placed feature instead of making a reference to it. You can see the result more clearly if you run the /worldGenExport command while you have Oh The Biomes You Go Installed (I found that the easiest way to export worldgen as json) and take a look at the exported placed feature JSON files for Ecologics - unlike other mods, you're skipping the configured feature by including it in the placed feature instead of a reference to it. You could call the register method in net.minecraft.data.worldgen.placement.PlacementUtils instead and store the result as Holder instead of PlacedFeature (see example from another mod: https://github.com/stal111/Forbidden-Arcanus/blob/1.18/src/main/java/com/stal111/forbidden_arcanus/data/worldgen/placement/ModOrePlacements.java).

latest.log

N/A - I'm looking at the source code.

commented

More info for the second of the two bugs, so you don't need to go run the command I mentioned yourself:

Example of how your placed feature JSON ends up: https://pastebin.com/aAXZHLk0
Same thing in vanilla Minecraft: https://github.com/misode/vanilla-worldgen/blob/master/worldgen/placed_feature/rooted_azalea_tree.json

A JSON export of your placement should ideally end up pretty much identical to the one in vanilla, but with "feature": "ecologics:rooted_azalea_tree", in the top line. The other features are all impacted too, I just used the azalea as an example since it was easy to refer to the vanilla version. I haven't verified that it's the use of Holder.direct, but glancing at the code makes that seem like the likely culprit (vanilla uses Holder.hackyErase in the register method inside PlacementUtils instead, despite the scary looking name).

Edit: This is happening in the configured features too, here:

public static final ConfiguredFeature<RootSystemConfiguration, ?> ROOTED_AZALEA_TREE = new ConfiguredFeature<>(Feature.ROOT_SYSTEM, new RootSystemConfiguration(PlacementUtils.inlinePlaced(Holder.direct(ModConfiguredFeatures.AZALEA_TREE)), 3, 3, BlockTags.AZALEA_ROOT_REPLACEABLE, BlockStateProvider.simple(Blocks.ROOTED_DIRT), 20, 100, 3, 2, BlockStateProvider.simple(Blocks.HANGING_ROOTS), 20, 2, BlockPredicate.allOf(BlockPredicate.anyOf(BlockPredicate.matchesBlocks(List.of(Blocks.AIR, Blocks.CAVE_AIR, Blocks.VOID_AIR, Blocks.WATER)), BlockPredicate.matchesTag(BlockTags.LEAVES), BlockPredicate.matchesTag(BlockTags.REPLACEABLE_PLANTS)), BlockPredicate.matchesTag(BlockTags.AZALEA_GROWS_ON, Direction.DOWN.getNormal()))));
- it's copying the azalea_tree configured feature into the rooted_azalea_tree configured feature, instead of a reference to it.

commented

I appreciate the comprehensiveness. I'll put out a fix later today.