Package net.minecraft.util.math
Class Box
java.lang.Object
net.minecraft.util.math.Box
An immutable box with double-valued coordinates. The box is axis-aligned
and the coordinates are minimum inclusive and maximum exclusive.
This box has proper hashCode() and equals(Object)
implementations and can be used as a map key.
- See Also:
- Mappings:
Namespace Name official dvointermediary net/minecraft/class_238named net/minecraft/util/math/Box
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBox(double x1, double y1, double z1, double x2, double y2, double z2) Creates a box of the given positions as corners.Creates a box that only contains the given block position.Creates a box of the given positions as corners.Creates a box of the given positions as corners. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(double x, double y, double z) Checks if the given position is in this box.booleanChecks if the given position is in this box.contract(double value) contract(double x, double y, double z) booleanexpand(double value) expand(double x, double y, double z) static Boxstatic BoxdoubleReturns the center position of this box.doublegetMax(Direction.Axis axis) doublegetMin(Direction.Axis axis) doubledoubledoubleinthashCode()intersection(Box box) Creates the maximum box that this box and the given box contain.booleanintersects(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) Checks if this box intersects the box of the given coordinates.booleanintersects(Box box) Checks if this box intersects the given box.booleanintersects(Vec3d pos1, Vec3d pos2) Checks if this box intersects the box of the given positions as corners.booleanisValid()Checks if any of the coordinates of this box is not a number.static Boxoffset(double x, double y, double z) Creates a box that is translated byx,y,zon each axis from this box.Creates a box that is translated byblockPos.getX(),blockPos.getY(),blockPos.getZ()on each axis from this box.Creates a box that is translated byvec.x,vec.y,vec.zon each axis from this box.static @Nullable BlockHitResultshrink(double x, double y, double z) stretch(double x, double y, double z) toString()traceCollisionSide(double[] traceDistanceResult, @Nullable Direction approachDirection, double deltaX, double deltaY, double deltaZ, double begin, double minX, double maxX, double minZ, double maxZ, Direction resultDirection, double startX, double startY, double startZ) traceCollisionSide(Box box, Vec3d intersectingVector, double[] traceDistanceResult, @Nullable Direction approachDirection, double deltaX, double deltaY, double deltaZ) Creates the minimum box that contains this box and the given box.withMaxX(double maxX) Creates a box with the maximum X provided and all other coordinates of this box.withMaxY(double maxY) Creates a box with the maximum Y provided and all other coordinates of this box.withMaxZ(double maxZ) Creates a box with the maximum Z provided and all other coordinates of this box.withMinX(double minX) Creates a box with the minimum X provided and all other coordinates of this box.withMinY(double minY) Creates a box with the minimum Y provided and all other coordinates of this box.withMinZ(double minZ) Creates a box with the minimum Z provided and all other coordinates of this box.
-
Field Details
-
EPSILON
private static final double EPSILON- See Also:
- Mappings:
Namespace Name Mixin selector official gLdvo;g:Dintermediary field_31879Lnet/minecraft/class_238;field_31879:Dnamed EPSILONLnet/minecraft/util/math/Box;EPSILON:D
-
minX
public final double minX- Mappings:
Namespace Name Mixin selector official aLdvo;a:Dintermediary field_1323Lnet/minecraft/class_238;field_1323:Dnamed minXLnet/minecraft/util/math/Box;minX:D
-
minY
public final double minY- Mappings:
Namespace Name Mixin selector official bLdvo;b:Dintermediary field_1322Lnet/minecraft/class_238;field_1322:Dnamed minYLnet/minecraft/util/math/Box;minY:D
-
minZ
public final double minZ- Mappings:
Namespace Name Mixin selector official cLdvo;c:Dintermediary field_1321Lnet/minecraft/class_238;field_1321:Dnamed minZLnet/minecraft/util/math/Box;minZ:D
-
maxX
public final double maxX- Mappings:
Namespace Name Mixin selector official dLdvo;d:Dintermediary field_1320Lnet/minecraft/class_238;field_1320:Dnamed maxXLnet/minecraft/util/math/Box;maxX:D
-
maxY
public final double maxY- Mappings:
Namespace Name Mixin selector official eLdvo;e:Dintermediary field_1325Lnet/minecraft/class_238;field_1325:Dnamed maxYLnet/minecraft/util/math/Box;maxY:D
-
maxZ
public final double maxZ- Mappings:
Namespace Name Mixin selector official fLdvo;f:Dintermediary field_1324Lnet/minecraft/class_238;field_1324:Dnamed maxZLnet/minecraft/util/math/Box;maxZ:D
-
-
Constructor Details
-
Box
public Box(double x1, double y1, double z1, double x2, double y2, double z2) Creates a box of the given positions as corners.- Mappings:
Namespace Name Mixin selector official <init>Ldvo;<init>(DDDDDD)Vintermediary <init>Lnet/minecraft/class_238;<init>(DDDDDD)Vnamed <init>Lnet/minecraft/util/math/Box;<init>(DDDDDD)V
-
Box
Creates a box that only contains the given block position.- Mappings:
Namespace Name Mixin selector official <init>Ldvo;<init>(Lgt;)Vintermediary <init>Lnet/minecraft/class_238;<init>(Lnet/minecraft/class_2338;)Vnamed <init>Lnet/minecraft/util/math/Box;<init>(Lnet/minecraft/util/math/BlockPos;)V
-
Box
Creates a box of the given positions as corners.- Mappings:
Namespace Name Mixin selector official <init>Ldvo;<init>(Lgt;Lgt;)Vintermediary <init>Lnet/minecraft/class_238;<init>(Lnet/minecraft/class_2338;Lnet/minecraft/class_2338;)Vnamed <init>Lnet/minecraft/util/math/Box;<init>(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;)V
-
Box
Creates a box of the given positions as corners.- Mappings:
Namespace Name Mixin selector official <init>Ldvo;<init>(Ldvt;Ldvt;)Vintermediary <init>Lnet/minecraft/class_238;<init>(Lnet/minecraft/class_243;Lnet/minecraft/class_243;)Vnamed <init>Lnet/minecraft/util/math/Box;<init>(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;)V
-
-
Method Details
-
from
- Mappings:
Namespace Name Mixin selector official aLdvo;a(Ldjw;)Ldvo;intermediary method_19316Lnet/minecraft/class_238;method_19316(Lnet/minecraft/class_3341;)Lnet/minecraft/class_238;named fromLnet/minecraft/util/math/Box;from(Lnet/minecraft/util/math/BlockBox;)Lnet/minecraft/util/math/Box;
-
from
- Mappings:
Namespace Name Mixin selector official aLdvo;a(Ldvt;)Ldvo;intermediary method_29968Lnet/minecraft/class_238;method_29968(Lnet/minecraft/class_243;)Lnet/minecraft/class_238;named fromLnet/minecraft/util/math/Box;from(Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Box;
-
withMinX
Creates a box with the minimum X provided and all other coordinates of this box.- Mappings:
Namespace Name Mixin selector official aLdvo;a(D)Ldvo;intermediary method_35574Lnet/minecraft/class_238;method_35574(D)Lnet/minecraft/class_238;named withMinXLnet/minecraft/util/math/Box;withMinX(D)Lnet/minecraft/util/math/Box;
-
withMinY
Creates a box with the minimum Y provided and all other coordinates of this box.- Mappings:
Namespace Name Mixin selector official bLdvo;b(D)Ldvo;intermediary method_35575Lnet/minecraft/class_238;method_35575(D)Lnet/minecraft/class_238;named withMinYLnet/minecraft/util/math/Box;withMinY(D)Lnet/minecraft/util/math/Box;
-
withMinZ
Creates a box with the minimum Z provided and all other coordinates of this box.- Mappings:
Namespace Name Mixin selector official cLdvo;c(D)Ldvo;intermediary method_35576Lnet/minecraft/class_238;method_35576(D)Lnet/minecraft/class_238;named withMinZLnet/minecraft/util/math/Box;withMinZ(D)Lnet/minecraft/util/math/Box;
-
withMaxX
Creates a box with the maximum X provided and all other coordinates of this box.- Mappings:
Namespace Name Mixin selector official dLdvo;d(D)Ldvo;intermediary method_35577Lnet/minecraft/class_238;method_35577(D)Lnet/minecraft/class_238;named withMaxXLnet/minecraft/util/math/Box;withMaxX(D)Lnet/minecraft/util/math/Box;
-
withMaxY
Creates a box with the maximum Y provided and all other coordinates of this box.- Mappings:
Namespace Name Mixin selector official eLdvo;e(D)Ldvo;intermediary method_35578Lnet/minecraft/class_238;method_35578(D)Lnet/minecraft/class_238;named withMaxYLnet/minecraft/util/math/Box;withMaxY(D)Lnet/minecraft/util/math/Box;
-
withMaxZ
Creates a box with the maximum Z provided and all other coordinates of this box.- Mappings:
Namespace Name Mixin selector official fLdvo;f(D)Ldvo;intermediary method_35579Lnet/minecraft/class_238;method_35579(D)Lnet/minecraft/class_238;named withMaxZLnet/minecraft/util/math/Box;withMaxZ(D)Lnet/minecraft/util/math/Box;
-
getMin
- Mappings:
Namespace Name Mixin selector official aLdvo;a(Lgy$a;)Dintermediary method_1001Lnet/minecraft/class_238;method_1001(Lnet/minecraft/class_2350$class_2351;)Dnamed getMinLnet/minecraft/util/math/Box;getMin(Lnet/minecraft/util/math/Direction$Axis;)D
-
getMax
- Mappings:
Namespace Name Mixin selector official bLdvo;b(Lgy$a;)Dintermediary method_990Lnet/minecraft/class_238;method_990(Lnet/minecraft/class_2350$class_2351;)Dnamed getMaxLnet/minecraft/util/math/Box;getMax(Lnet/minecraft/util/math/Direction$Axis;)D
-
equals
-
hashCode
public int hashCode() -
shrink
- Mappings:
Namespace Name Mixin selector official aLdvo;a(DDD)Ldvo;intermediary method_1002Lnet/minecraft/class_238;method_1002(DDD)Lnet/minecraft/class_238;named shrinkLnet/minecraft/util/math/Box;shrink(DDD)Lnet/minecraft/util/math/Box;
-
stretch
- Mappings:
Namespace Name Mixin selector official bLdvo;b(Ldvt;)Ldvo;intermediary method_18804Lnet/minecraft/class_238;method_18804(Lnet/minecraft/class_243;)Lnet/minecraft/class_238;named stretchLnet/minecraft/util/math/Box;stretch(Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Box;
-
stretch
- Mappings:
Namespace Name Mixin selector official bLdvo;b(DDD)Ldvo;intermediary method_1012Lnet/minecraft/class_238;method_1012(DDD)Lnet/minecraft/class_238;named stretchLnet/minecraft/util/math/Box;stretch(DDD)Lnet/minecraft/util/math/Box;
-
expand
- See Also:
- Mappings:
Namespace Name Mixin selector official cLdvo;c(DDD)Ldvo;intermediary method_1009Lnet/minecraft/class_238;method_1009(DDD)Lnet/minecraft/class_238;named expandLnet/minecraft/util/math/Box;expand(DDD)Lnet/minecraft/util/math/Box;
-
expand
- See Also:
- Mappings:
Namespace Name Mixin selector official gLdvo;g(D)Ldvo;intermediary method_1014Lnet/minecraft/class_238;method_1014(D)Lnet/minecraft/class_238;named expandLnet/minecraft/util/math/Box;expand(D)Lnet/minecraft/util/math/Box;
-
intersection
Creates the maximum box that this box and the given box contain.- Mappings:
Namespace Name Mixin selector official aLdvo;a(Ldvo;)Ldvo;intermediary method_999Lnet/minecraft/class_238;method_999(Lnet/minecraft/class_238;)Lnet/minecraft/class_238;named intersectionLnet/minecraft/util/math/Box;intersection(Lnet/minecraft/util/math/Box;)Lnet/minecraft/util/math/Box;
-
union
Creates the minimum box that contains this box and the given box.- Mappings:
Namespace Name Mixin selector official bLdvo;b(Ldvo;)Ldvo;intermediary method_991Lnet/minecraft/class_238;method_991(Lnet/minecraft/class_238;)Lnet/minecraft/class_238;named unionLnet/minecraft/util/math/Box;union(Lnet/minecraft/util/math/Box;)Lnet/minecraft/util/math/Box;
-
offset
Creates a box that is translated byx,y,zon each axis from this box.- Mappings:
Namespace Name Mixin selector official dLdvo;d(DDD)Ldvo;intermediary method_989Lnet/minecraft/class_238;method_989(DDD)Lnet/minecraft/class_238;named offsetLnet/minecraft/util/math/Box;offset(DDD)Lnet/minecraft/util/math/Box;
-
offset
Creates a box that is translated byblockPos.getX(),blockPos.getY(),blockPos.getZ()on each axis from this box.- See Also:
- Mappings:
Namespace Name Mixin selector official aLdvo;a(Lgt;)Ldvo;intermediary method_996Lnet/minecraft/class_238;method_996(Lnet/minecraft/class_2338;)Lnet/minecraft/class_238;named offsetLnet/minecraft/util/math/Box;offset(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/Box;
-
offset
Creates a box that is translated byvec.x,vec.y,vec.zon each axis from this box.- See Also:
- Mappings:
Namespace Name Mixin selector official cLdvo;c(Ldvt;)Ldvo;intermediary method_997Lnet/minecraft/class_238;method_997(Lnet/minecraft/class_243;)Lnet/minecraft/class_238;named offsetLnet/minecraft/util/math/Box;offset(Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Box;
-
intersects
Checks if this box intersects the given box.- Mappings:
Namespace Name Mixin selector official cLdvo;c(Ldvo;)Zintermediary method_994Lnet/minecraft/class_238;method_994(Lnet/minecraft/class_238;)Znamed intersectsLnet/minecraft/util/math/Box;intersects(Lnet/minecraft/util/math/Box;)Z
-
intersects
public boolean intersects(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) Checks if this box intersects the box of the given coordinates.- Mappings:
Namespace Name Mixin selector official aLdvo;a(DDDDDD)Zintermediary method_1003Lnet/minecraft/class_238;method_1003(DDDDDD)Znamed intersectsLnet/minecraft/util/math/Box;intersects(DDDDDD)Z
-
intersects
Checks if this box intersects the box of the given positions as corners.- Mappings:
Namespace Name Mixin selector official aLdvo;a(Ldvt;Ldvt;)Zintermediary method_993Lnet/minecraft/class_238;method_993(Lnet/minecraft/class_243;Lnet/minecraft/class_243;)Znamed intersectsLnet/minecraft/util/math/Box;intersects(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;)Z
-
contains
Checks if the given position is in this box.- Mappings:
Namespace Name Mixin selector official dLdvo;d(Ldvt;)Zintermediary method_1006Lnet/minecraft/class_238;method_1006(Lnet/minecraft/class_243;)Znamed containsLnet/minecraft/util/math/Box;contains(Lnet/minecraft/util/math/Vec3d;)Z
-
contains
public boolean contains(double x, double y, double z) Checks if the given position is in this box.- Mappings:
Namespace Name Mixin selector official eLdvo;e(DDD)Zintermediary method_1008Lnet/minecraft/class_238;method_1008(DDD)Znamed containsLnet/minecraft/util/math/Box;contains(DDD)Z
-
getAverageSideLength
public double getAverageSideLength()- Mappings:
Namespace Name Mixin selector official aLdvo;a()Dintermediary method_995Lnet/minecraft/class_238;method_995()Dnamed getAverageSideLengthLnet/minecraft/util/math/Box;getAverageSideLength()D
-
getXLength
public double getXLength()- Mappings:
Namespace Name Mixin selector official bLdvo;b()Dintermediary method_17939Lnet/minecraft/class_238;method_17939()Dnamed getXLengthLnet/minecraft/util/math/Box;getXLength()D
-
getYLength
public double getYLength()- Mappings:
Namespace Name Mixin selector official cLdvo;c()Dintermediary method_17940Lnet/minecraft/class_238;method_17940()Dnamed getYLengthLnet/minecraft/util/math/Box;getYLength()D
-
getZLength
public double getZLength()- Mappings:
Namespace Name Mixin selector official dLdvo;d()Dintermediary method_17941Lnet/minecraft/class_238;method_17941()Dnamed getZLengthLnet/minecraft/util/math/Box;getZLength()D
-
contract
- See Also:
- Mappings:
Namespace Name Mixin selector official fLdvo;f(DDD)Ldvo;intermediary method_35580Lnet/minecraft/class_238;method_35580(DDD)Lnet/minecraft/class_238;named contractLnet/minecraft/util/math/Box;contract(DDD)Lnet/minecraft/util/math/Box;
-
contract
- See Also:
- Mappings:
Namespace Name Mixin selector official hLdvo;h(D)Ldvo;intermediary method_1011Lnet/minecraft/class_238;method_1011(D)Lnet/minecraft/class_238;named contractLnet/minecraft/util/math/Box;contract(D)Lnet/minecraft/util/math/Box;
-
raycast
- Mappings:
Namespace Name Mixin selector official bLdvo;b(Ldvt;Ldvt;)Ljava/util/Optional;intermediary method_992Lnet/minecraft/class_238;method_992(Lnet/minecraft/class_243;Lnet/minecraft/class_243;)Ljava/util/Optional;named raycastLnet/minecraft/util/math/Box;raycast(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;)Ljava/util/Optional;
-
raycast
@Nullable public static @Nullable BlockHitResult raycast(Iterable<Box> boxes, Vec3d from, Vec3d to, BlockPos pos) - Mappings:
Namespace Name Mixin selector official aLdvo;a(Ljava/lang/Iterable;Ldvt;Ldvt;Lgt;)Ldvp;intermediary method_1010Lnet/minecraft/class_238;method_1010(Ljava/lang/Iterable;Lnet/minecraft/class_243;Lnet/minecraft/class_243;Lnet/minecraft/class_2338;)Lnet/minecraft/class_3965;named raycastLnet/minecraft/util/math/Box;raycast(Ljava/lang/Iterable;Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/hit/BlockHitResult;
-
traceCollisionSide
@Nullable private static @Nullable Direction traceCollisionSide(Box box, Vec3d intersectingVector, double[] traceDistanceResult, @Nullable @Nullable Direction approachDirection, double deltaX, double deltaY, double deltaZ) - Mappings:
Namespace Name Mixin selector official aLdvo;a(Ldvo;Ldvt;[DLgy;DDD)Lgy;intermediary method_1007Lnet/minecraft/class_238;method_1007(Lnet/minecraft/class_238;Lnet/minecraft/class_243;[DLnet/minecraft/class_2350;DDD)Lnet/minecraft/class_2350;named traceCollisionSideLnet/minecraft/util/math/Box;traceCollisionSide(Lnet/minecraft/util/math/Box;Lnet/minecraft/util/math/Vec3d;[DLnet/minecraft/util/math/Direction;DDD)Lnet/minecraft/util/math/Direction;
-
traceCollisionSide
@Nullable private static @Nullable Direction traceCollisionSide(double[] traceDistanceResult, @Nullable @Nullable Direction approachDirection, double deltaX, double deltaY, double deltaZ, double begin, double minX, double maxX, double minZ, double maxZ, Direction resultDirection, double startX, double startY, double startZ) - Mappings:
Namespace Name Mixin selector official aLdvo;a([DLgy;DDDDDDDDLgy;DDD)Lgy;intermediary method_998Lnet/minecraft/class_238;method_998([DLnet/minecraft/class_2350;DDDDDDDDLnet/minecraft/class_2350;DDD)Lnet/minecraft/class_2350;named traceCollisionSideLnet/minecraft/util/math/Box;traceCollisionSide([DLnet/minecraft/util/math/Direction;DDDDDDDDLnet/minecraft/util/math/Direction;DDD)Lnet/minecraft/util/math/Direction;
-
toString
-
isValid
public boolean isValid()Checks if any of the coordinates of this box is not a number.- Mappings:
Namespace Name Mixin selector official eLdvo;e()Zintermediary method_1013Lnet/minecraft/class_238;method_1013()Znamed isValidLnet/minecraft/util/math/Box;isValid()Z
-
getCenter
Returns the center position of this box.- Mappings:
Namespace Name Mixin selector official fLdvo;f()Ldvt;intermediary method_1005Lnet/minecraft/class_238;method_1005()Lnet/minecraft/class_243;named getCenterLnet/minecraft/util/math/Box;getCenter()Lnet/minecraft/util/math/Vec3d;
-
of
- Mappings:
Namespace Name Mixin selector official aLdvo;a(Ldvt;DDD)Ldvo;intermediary method_30048Lnet/minecraft/class_238;method_30048(Lnet/minecraft/class_243;DDD)Lnet/minecraft/class_238;named ofLnet/minecraft/util/math/Box;of(Lnet/minecraft/util/math/Vec3d;DDD)Lnet/minecraft/util/math/Box;
-