Class Column

java.lang.Object
net.minecraft.world.level.levelgen.Column
Direct Known Subclasses:
Column.Line, Column.Range, Column.Ray

public abstract class Column extends Object
A representation of an integer valued interval, either bounded or unbounded. While the class itself does not imply any coordinate in particular, this is practically used to represent a column in the Y direction.
  • Constructor Details

    • Column

      public Column()
  • Method Details

    • around

      public static Column.Range around(int pFloor, int pCeiling)
      Returns:
      A column of the closed interval [floor, ceiling].
    • inside

      public static Column.Range inside(int pFloor, int pCeiling)
      Returns:
      A column of the open interval (floor, ceiling).
    • below

      public static Column below(int pCeiling)
      Returns:
      A column of the unbounded interval (-infinity, ceiling).
    • fromHighest

      public static Column fromHighest(int pCeiling)
      Returns:
      A column of the unbounded interval (-infinity, ceiling].
    • above

      public static Column above(int pFloor)
      Returns:
      A column of the unbounded interval (floor, infinity).
    • fromLowest

      public static Column fromLowest(int pFloor)
      Returns:
      A column of the unbounded interval [floor, infinity).
    • line

      public static Column line()
    • create

      public static Column create(OptionalInt pFloor, OptionalInt pCeiling)
    • getCeiling

      public abstract OptionalInt getCeiling()
    • getFloor

      public abstract OptionalInt getFloor()
    • getHeight

      public abstract OptionalInt getHeight()
    • withFloor

      public Column withFloor(OptionalInt pFloor)
    • withCeiling

      public Column withCeiling(OptionalInt pCeiling)
    • scan

      public static Optional<Column> scan(LevelSimulatedReader pLevel, BlockPos pPos, int pMaxDistance, Predicate<BlockState> pColumnPredicate, Predicate<BlockState> pTipPredicate)
      Scans for a column of states satisfying columnPredicate, up to a length of maxDistance from the origin, and ending with a state which satisfies tipPredicate.
      Returns:
      A column representing the tips found. The column will be bounded if a tip was reached in the given direction, unbounded otherwise.
    • scanDirection

      private static OptionalInt scanDirection(LevelSimulatedReader pLevel, int pMaxDistance, Predicate<BlockState> pColumnPredicate, Predicate<BlockState> pTipPredicate, BlockPos.MutableBlockPos pMutablePos, int pStartY, Direction pDirection)
      Scans for a sequence of states in a given direction, up to a length of maxDistance which satisfy columnPredicate, and ending with a state which satisfies tipPredicate.
      Returns:
      The y position of the tip, if found.