Class PortalUtil

java.lang.Object
net.minecraft.world.PortalUtil

public class PortalUtil
extends Object
  • Constructor Details

    • PortalUtil

      public PortalUtil()
  • Method Details

    • getLargestRectangle

      public static PortalUtil.Rectangle getLargestRectangle​(BlockPos center, Direction.Axis primaryAxis, int primaryMaxBlocks, Direction.Axis secondaryAxis, int secondaryMaxBlocks, Predicate<BlockPos> predicate)
      Gets the largest rectangle of blocks along two axes for which all blocks meet a predicate. Used for getting rectangles of Nether portal blocks.
    • moveWhile

      private static int moveWhile​(Predicate<BlockPos> predicate, BlockPos.Mutable mutable, Direction direction, int max)
    • findLargestRectangle

      static com.mojang.datafixers.util.Pair<PortalUtil.IntBounds,​Integer> findLargestRectangle​(int[] heights)
      Finds the largest rectangle within a histogram, where the vertical bars each have width 1 and height specified in heights.
      Parameters:
      heights - the heights of bars in the histogram
      Returns:
      the base of the rectangle as an inclusive range and the height of the rectangle packed in a pair
      See Also:
      Largest Rectangle in Histogram - LeetCode