Magical Forest

Magical Forest

1M Downloads

Feature Cycle (crash), with Magical Forest + Tectonic

alcatrazEscapee opened this issue · 0 comments

commented

This was reported to me (alcatrazEscapee/cyanide#15), but Cyanide just caught the feature cycle and displayed the issue.

The feature cycle:

Feature 'tectonic:common/seagrass_land'
  must be before 'tectonic:common/grass/patch_grass_dense' (defined in 'tectonic:old_growth_evergreen_forest' at index 5, 6 and 9 others)
  must be before 'minecraft:brown_mushroom_taiga' (defined in 'minecraft:taiga' at index 4, 5)
  must be before 'minecraft:red_mushroom_taiga' (defined in 'byg:frosted_taiga' at index 4, 5 and 10 others)
  must be before 'minecraft:patch_grass_plain' (defined in 'magicalforest:magical_forest' at index 7, 8)
  must be before 'minecraft:flower_meadow' (defined in 'magicalforest:magical_forest' at index 8, 9)
  must be before 'tectonic:common/seagrass_land' (defined in 'minecraft:meadow' at index 3, 4 and 1 others)
  • Note that the byg:frosted_tagia is not necessary, as this ordering is also defined by Tectonic in it's override of minecraft:tagia

Basically

  • Tectonic defines tectonic:common/seagrass_land before minecraft:brown_mushroom_tagia, and after minecraft:flower_meadow, in two separate places.
  • Magical forest defines these vanilla features in the opposite order.
  • Vanilla, as far as I can see, does not a priori define an ordering between these.

Also reported as Apollounknowndev/tectonic#14


// I really now hate feature cycle in 1.18... is there anything providing a feature cycle documentation?

As a side note, TelepathicGrunt has written up a lovely blurb on what a feature cycle is, which I shall copy paste below if you find it of interest. The TL;DR is "always order features as they are in vanilla and if not make sure you're always putting your own features in a consistent order w.r.t any vanilla features."

Here’s why feature cycles are a thing. When the game goes to generate a chunk, it collects all the biomes in that chunk, then grabs all the placedfeatures from all the biomes, and then generates them. Now say two biomes have birch trees in them and are in the same chunk. We should not just both biomes birch tree PlacedFeature together because then at the border of these biomes, the density of birch trees would be doubled

So instead, we consolidate this list of PlacedFeatures to not have duplicates of the exact same placedfeature instances.

Here’s where the feature cycle issue comes in

Biome 1 has a lake before birch tree in its generation stage. Biome 2 has birch tree before lake in its generation stage.

When the game consolidates the PlacedFeatures into a list of what to spawn for that chunk with both biomes, which feature should generate first?

And that there is the issue. Mojang decided this should be a crash.

Only way this can be resolved easily is to force all biomes to have the features in the same order in relation to other features. So if one biome has lakes before birch trees, so do all the other biomes. It came be in different generation stages as long as the lake is still before the birch tree.

Though this becomes complex if you’re shuffling PlacedFeatures in different stages as then the cycle could involve many PlacedFeatures

Better to keep them in the same generation stage and same order across all biomes for simplicity and easier checking.

Again, to be clear, the cycle is between instances of the placedfeature. So if a lake and tree is out of order, it doesn’t mean all lakes and all trees. Just that specific lake placedfeature and specific tree placedfeature is out of order

From MMD Discord