Record Class PlacedFeature

java.lang.Object
java.lang.Record
com.github.darksoulq.abyssallib.world.gen.placement.PlacedFeature
Record Components:
feature - The configured feature to generate.
placement - The ordered list of modifiers to apply to the initial position.

public record PlacedFeature(ConfiguredFeature<?,?> feature, List<PlacementModifier> placement) extends Record
Represents a feature that is fully prepared for world placement.

A PlacedFeature wraps a ConfiguredFeature with an ordered list of PlacementModifiers. It acts as the execution pipeline, translating initial coordinates through the modifiers before delegating to the feature logic.

  • Field Details

    • CODEC

      public static final Codec<PlacedFeature> CODEC
      The universal codec for PlacedFeatures, supporting both direct object definitions and string-based registry lookups.
  • Constructor Details

    • PlacedFeature

      public PlacedFeature(ConfiguredFeature<?,?> feature, List<PlacementModifier> placement)
      Creates an instance of a PlacedFeature record class.
      Parameters:
      feature - the value for the feature record component
      placement - the value for the placement record component
  • Method Details

    • place

      public boolean place(WorldGenAccess level, Random random, int chunkX, int chunkZ)
      Triggers the placement pipeline starting from a chunk's root coordinates.
      Parameters:
      level - The world generation accessor.
      random - The random source for this chunk.
      chunkX - The chunk X coordinate.
      chunkZ - The chunk Z coordinate.
      Returns:
      True if the feature was successfully placed at least once.
    • place

      public boolean place(WorldGenAccess level, Random random, org.bukkit.Location origin)
      Triggers the placement pipeline starting from an absolute origin location.

      This is strictly utilized by Meta Features (like RandomFeature) to execute sub-features relative to the currently evaluated position in the world.

      Parameters:
      level - The world generation accessor.
      random - The random source.
      origin - The absolute starting coordinate for the modifier pipeline.
      Returns:
      True if the feature was successfully placed at least once.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • feature

      public ConfiguredFeature<?,?> feature()
      Returns the value of the feature record component.
      Returns:
      the value of the feature record component
    • placement

      public List<PlacementModifier> placement()
      Returns the value of the placement record component.
      Returns:
      the value of the placement record component