Class PlacedFeatureIndexer

java.lang.Object
net.minecraft.world.gen.feature.util.PlacedFeatureIndexer

public class PlacedFeatureIndexer extends Object
A class for indexing placed features with a feature order cycle detection.

Placed features have the generation steps, and they generate in that order. For example, if biome X registers the placed feature A in the GenerationStep.Feature.UNDERGROUND_ORES step and the placed feature B and C in the GenerationStep.Feature.TOP_LAYER_MODIFICATION step, then B and C generate after A. If, then, biome Y registers B in the GenerationStep.Feature.LOCAL_MODIFICATIONS, this will cause a "feature order cycle", because B should generate after A according to the biome X, but A should generate after B according to biome Y. This is wrong and causes a crash.

In other words, "feature order cycle" occurs when placed features are registered in multiple generation steps, due to e.g. reusing vanilla features. To prevent this error, make sure to generate the feature in the same generation step as vanilla, and if that is not possible, create a new feature.

Mappings:
Namespace Name
official cnp
intermediary net/minecraft/class_7510
named net/minecraft/world/gen/feature/util/PlacedFeatureIndexer
  • Constructor Details

    • PlacedFeatureIndexer

      public PlacedFeatureIndexer()
  • Method Details

    • collectIndexedFeatures

      public static <T> List<PlacedFeatureIndexer.IndexedFeatures> collectIndexedFeatures(List<T> biomes, Function<T,List<RegistryEntryList<PlacedFeature>>> biomesToPlacedFeaturesList, boolean listInvolvedBiomesOnFailure)
      Returns the indexed placed features collected after validating feature orders.
      Parameters:
      biomesToPlacedFeaturesList - a function that, given a biome, returns a list of placed features grouped by their generation steps
      listInvolvedBiomesOnFailure - whether to include involved biomes in the thrown exception
      Returns:
      the indexed placed features collected after validating feature orders
      Throws:
      IllegalStateException - when a feature order cycle is detected
      API Note:
      Check the class documentation for what feature order cycle means.
      Mappings:
      Namespace Name Mixin selector
      official a Lcnp;a(Ljava/util/List;Ljava/util/function/Function;Z)Ljava/util/List;
      intermediary method_44210 Lnet/minecraft/class_7510;method_44210(Ljava/util/List;Ljava/util/function/Function;Z)Ljava/util/List;
      named collectIndexedFeatures Lnet/minecraft/world/gen/feature/util/PlacedFeatureIndexer;collectIndexedFeatures(Ljava/util/List;Ljava/util/function/Function;Z)Ljava/util/List;