Package net.minecraft
Class class_5459
java.lang.Object
net.minecraft.class_5459
public class class_5459 extends Object
- Mappings:
Namespace Name official i
intermediary net/minecraft/class_5459
named net/minecraft/class_5459
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
class_5459.class_5460
static class
class_5459.IntBounds
-
Constructor Summary
Constructors Constructor Description class_5459()
-
Method Summary
Modifier and Type Method Description (package private) static com.mojang.datafixers.util.Pair<class_5459.IntBounds,Integer>
findLargestRectangle(int[] heights)
Finds the largest rectangle within a histogram, where the vertical bars each have width 1 and height specified inheights
.static class_5459.class_5460
method_30574(BlockPos blockPos, Direction.Axis axis, int int2, Direction.Axis axis2, int int3, Predicate<BlockPos> predicate)
private static int
method_30575(Predicate<BlockPos> predicate, BlockPos.Mutable mutable, Direction direction, int int2)
-
Constructor Details
-
class_5459
public class_5459()
-
-
Method Details
-
method_30574
public static class_5459.class_5460 method_30574(BlockPos blockPos, Direction.Axis axis, int int2, Direction.Axis axis2, int int3, Predicate<BlockPos> predicate)- Mappings:
Namespace Name Mixin selector official a
Li;a(Lfx;Lgc$a;ILgc$a;ILjava/util/function/Predicate;)Li$a;
intermediary method_30574
Lnet/minecraft/class_5459;method_30574(Lnet/minecraft/class_2338;Lnet/minecraft/class_2350$class_2351;ILnet/minecraft/class_2350$class_2351;ILjava/util/function/Predicate;)Lnet/minecraft/class_5459$class_5460;
named method_30574
Lnet/minecraft/class_5459;method_30574(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction$Axis;ILnet/minecraft/util/math/Direction$Axis;ILjava/util/function/Predicate;)Lnet/minecraft/class_5459$class_5460;
-
method_30575
private static int method_30575(Predicate<BlockPos> predicate, BlockPos.Mutable mutable, Direction direction, int int2)- Mappings:
Namespace Name Mixin selector official a
Li;a(Ljava/util/function/Predicate;Lfx$a;Lgc;I)I
intermediary method_30575
Lnet/minecraft/class_5459;method_30575(Ljava/util/function/Predicate;Lnet/minecraft/class_2338$class_2339;Lnet/minecraft/class_2350;I)I
named method_30575
Lnet/minecraft/class_5459;method_30575(Ljava/util/function/Predicate;Lnet/minecraft/util/math/BlockPos$Mutable;Lnet/minecraft/util/math/Direction;I)I
-
findLargestRectangle
static com.mojang.datafixers.util.Pair<class_5459.IntBounds,Integer> findLargestRectangle(int[] heights)Finds the largest rectangle within a histogram, where the vertical bars each have width 1 and height specified inheights
.- 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
- Implementation Note:
- This implementation solves the problem using a stack. The
stack maintains a collection of height limits of rectangles that may grow as the
array iteration continues. When a new height is encountered, each position
p
in the stack would be popped if the rectangle with height limit at positionp
can no longer extend right. The popped rectangle becomes the return value if it has a larger area than the current candidate.When the rectangle area is calculated, the range is between
p0 + 1
, wherep0
is the current top of stack after popping rectangles that can no longer extend, and the current iterated positioni
. - Mappings:
Namespace Name Mixin selector official a
Li;a([I)Lcom/mojang/datafixers/util/Pair;
intermediary method_30576
Lnet/minecraft/class_5459;method_30576([I)Lcom/mojang/datafixers/util/Pair;
named findLargestRectangle
Lnet/minecraft/class_5459;findLargestRectangle([I)Lcom/mojang/datafixers/util/Pair;
-