Package net.minecraft.util.math
Class BlockBox
java.lang.Object
net.minecraft.util.math.BlockBox
A mutable box with integer coordinates. The box is axis-aligned and the
coordinates are inclusive.
This box, though mutable, has proper hashCode and
equals implementations and can be used as map keys if user can ensure
they are not modified.
- See Also:
- Mappings:
Namespace Name named net/minecraft/util/math/BlockBoxintermediary net/minecraft/class_3341official elp
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(int x, int y, int z) booleanReturns whether this box containspos.static BlockBoxReturns a new box from two corners,firstandsecond.Returns the minimum box encompassing all of the givenboxes, or an empty optional ifboxesis empty.Deprecated.Deprecated.encompassPositions(Iterable<BlockPos> positions) Returns the minimum box encompassing all of the givenpositions, or an empty optional ifpositionsis empty.booleanexpand(int offset) Returns a new box that is expanded on each direction byoffset.expand(int x, int y, int z) Returns a new box that is expanded byx,y,zon each axis.voidforEachVertex(Consumer<BlockPos> consumer) Callsconsumerfor each vertex (corner) of this box.intReturns the number of blocks on the X axis.intReturns the number of blocks on the Y axis.intReturns the number of blocks on the Z axis.Returns the center of this box.Returns the dimensions (the size) of this box.intgetMaxX()intgetMaxY()intgetMaxZ()intgetMinX()intgetMinY()intgetMinZ()inthashCode()static BlockBoxinfinite()Returns a new all-encompassing, infinite box.booleanintersects(BlockBox other) Returns whetherotherintersects with this box.booleanintersectsXZ(int minX, int minZ, int maxX, int maxZ) Returns whether the rectangle from the given coordinates intersects with this box's XZ plane.move(int dx, int dy, int dz) Deprecated.Deprecated.offset(int x, int y, int z) Returns a new box that is translated byx,y,zon each axis from this box.static BlockBoxrotated(int x, int y, int z, int offsetX, int offsetY, int offsetZ, int sizeX, int sizeY, int sizeZ, Direction facing) toString()
-
Field Details
-
LOGGER
- Mappings:
Namespace Name Mixin selector named LOGGERLnet/minecraft/util/math/BlockBox;LOGGER:Lorg/slf4j/Logger;intermediary field_31548Lnet/minecraft/class_3341;field_31548:Lorg/slf4j/Logger;official bLelp;b:Lorg/slf4j/Logger;
-
CODEC
A codec that stores a block box as an int array. In the serialized array, the ordered elements areminX,minY,minZ,maxX,maxY,maxZ.- Mappings:
Namespace Name Mixin selector named CODECLnet/minecraft/util/math/BlockBox;CODEC:Lcom/mojang/serialization/Codec;intermediary field_29325Lnet/minecraft/class_3341;field_29325:Lcom/mojang/serialization/Codec;official aLelp;a:Lcom/mojang/serialization/Codec;
-
minX
private int minX- Mappings:
Namespace Name Mixin selector named minXLnet/minecraft/util/math/BlockBox;minX:Iintermediary field_14380Lnet/minecraft/class_3341;field_14380:Iofficial cLelp;c:I
-
minY
private int minY- Mappings:
Namespace Name Mixin selector named minYLnet/minecraft/util/math/BlockBox;minY:Iintermediary field_14379Lnet/minecraft/class_3341;field_14379:Iofficial dLelp;d:I
-
minZ
private int minZ- Mappings:
Namespace Name Mixin selector named minZLnet/minecraft/util/math/BlockBox;minZ:Iintermediary field_14378Lnet/minecraft/class_3341;field_14378:Iofficial eLelp;e:I
-
maxX
private int maxX- Mappings:
Namespace Name Mixin selector named maxXLnet/minecraft/util/math/BlockBox;maxX:Iintermediary field_14377Lnet/minecraft/class_3341;field_14377:Iofficial fLelp;f:I
-
maxY
private int maxY- Mappings:
Namespace Name Mixin selector named maxYLnet/minecraft/util/math/BlockBox;maxY:Iintermediary field_14376Lnet/minecraft/class_3341;field_14376:Iofficial gLelp;g:I
-
maxZ
private int maxZ- Mappings:
Namespace Name Mixin selector named maxZLnet/minecraft/util/math/BlockBox;maxZ:Iintermediary field_14381Lnet/minecraft/class_3341;field_14381:Iofficial hLelp;h:I
-
-
Constructor Details
-
BlockBox
Creates a box enclosing onlypos.- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/util/math/BlockBox;<init>(Lnet/minecraft/util/math/BlockPos;)Vintermediary <init>Lnet/minecraft/class_3341;<init>(Lnet/minecraft/class_2338;)Vofficial <init>Lelp;<init>(Ljh;)V
-
BlockBox
public BlockBox(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/util/math/BlockBox;<init>(IIIIII)Vintermediary <init>Lnet/minecraft/class_3341;<init>(IIIIII)Vofficial <init>Lelp;<init>(IIIIII)V
-
-
Method Details
-
create
Returns a new box from two corners,firstandsecond.- Returns:
- a new box from two corners,
firstandsecond - Mappings:
Namespace Name Mixin selector named createLnet/minecraft/util/math/BlockBox;create(Lnet/minecraft/util/math/Vec3i;Lnet/minecraft/util/math/Vec3i;)Lnet/minecraft/util/math/BlockBox;intermediary method_34390Lnet/minecraft/class_3341;method_34390(Lnet/minecraft/class_2382;Lnet/minecraft/class_2382;)Lnet/minecraft/class_3341;official aLelp;a(Lkl;Lkl;)Lelp;
-
infinite
Returns a new all-encompassing, infinite box.- Returns:
- a new all-encompassing, infinite box
- Mappings:
Namespace Name Mixin selector named infiniteLnet/minecraft/util/math/BlockBox;infinite()Lnet/minecraft/util/math/BlockBox;intermediary method_14665Lnet/minecraft/class_3341;method_14665()Lnet/minecraft/class_3341;official aLelp;a()Lelp;
-
rotated
public static BlockBox rotated(int x, int y, int z, int offsetX, int offsetY, int offsetZ, int sizeX, int sizeY, int sizeZ, Direction facing) - Mappings:
Namespace Name Mixin selector named rotatedLnet/minecraft/util/math/BlockBox;rotated(IIIIIIIIILnet/minecraft/util/math/Direction;)Lnet/minecraft/util/math/BlockBox;intermediary method_14667Lnet/minecraft/class_3341;method_14667(IIIIIIIIILnet/minecraft/class_2350;)Lnet/minecraft/class_3341;official aLelp;a(IIIIIIIIILjm;)Lelp;
-
streamChunkPos
- Mappings:
Namespace Name Mixin selector named streamChunkPosLnet/minecraft/util/math/BlockBox;streamChunkPos()Ljava/util/stream/Stream;intermediary method_54883Lnet/minecraft/class_3341;method_54883()Ljava/util/stream/Stream;official bLelp;b()Ljava/util/stream/Stream;
-
intersects
Returns whetherotherintersects with this box.- Returns:
- whether
otherintersects with this box - Mappings:
Namespace Name Mixin selector named intersectsLnet/minecraft/util/math/BlockBox;intersects(Lnet/minecraft/util/math/BlockBox;)Zintermediary method_14657Lnet/minecraft/class_3341;method_14657(Lnet/minecraft/class_3341;)Zofficial aLelp;a(Lelp;)Z
-
intersectsXZ
public boolean intersectsXZ(int minX, int minZ, int maxX, int maxZ) Returns whether the rectangle from the given coordinates intersects with this box's XZ plane.- Returns:
- whether the rectangle from the given coordinates intersects with this box's XZ plane
- Mappings:
Namespace Name Mixin selector named intersectsXZLnet/minecraft/util/math/BlockBox;intersectsXZ(IIII)Zintermediary method_14669Lnet/minecraft/class_3341;method_14669(IIII)Zofficial aLelp;a(IIII)Z
-
encompassPositions
Returns the minimum box encompassing all of the givenpositions, or an empty optional ifpositionsis empty.- Returns:
- the minimum box encompassing all of the given
positions, or an empty optional ifpositionsis empty - Mappings:
Namespace Name Mixin selector named encompassPositionsLnet/minecraft/util/math/BlockBox;encompassPositions(Ljava/lang/Iterable;)Ljava/util/Optional;intermediary method_35411Lnet/minecraft/class_3341;method_35411(Ljava/lang/Iterable;)Ljava/util/Optional;official aLelp;a(Ljava/lang/Iterable;)Ljava/util/Optional;
-
encompass
Returns the minimum box encompassing all of the givenboxes, or an empty optional ifboxesis empty.- Returns:
- the minimum box encompassing all of the given
boxes, or an empty optional ifboxesis empty - Mappings:
Namespace Name Mixin selector named encompassLnet/minecraft/util/math/BlockBox;encompass(Ljava/lang/Iterable;)Ljava/util/Optional;intermediary method_35413Lnet/minecraft/class_3341;method_35413(Ljava/lang/Iterable;)Ljava/util/Optional;official bLelp;b(Ljava/lang/Iterable;)Ljava/util/Optional;
-
encompass
Deprecated.- Mappings:
Namespace Name Mixin selector named encompassLnet/minecraft/util/math/BlockBox;encompass(Lnet/minecraft/util/math/BlockBox;)Lnet/minecraft/util/math/BlockBox;intermediary method_35412Lnet/minecraft/class_3341;method_35412(Lnet/minecraft/class_3341;)Lnet/minecraft/class_3341;official bLelp;b(Lelp;)Lelp;
-
encompass
Deprecated.Expands this box to encompass thepos.- Parameters:
pos- the pos to encompass- Returns:
- this box, for chaining
- Mappings:
Namespace Name Mixin selector named encompassLnet/minecraft/util/math/BlockBox;encompass(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/BlockBox;intermediary method_34389Lnet/minecraft/class_3341;method_34389(Lnet/minecraft/class_2338;)Lnet/minecraft/class_3341;official aLelp;a(Ljh;)Lelp;
-
move
Deprecated.- Mappings:
Namespace Name Mixin selector named moveLnet/minecraft/util/math/BlockBox;move(III)Lnet/minecraft/util/math/BlockBox;intermediary method_14661Lnet/minecraft/class_3341;method_14661(III)Lnet/minecraft/class_3341;official aLelp;a(III)Lelp;
-
move
Deprecated.- Mappings:
Namespace Name Mixin selector named moveLnet/minecraft/util/math/BlockBox;move(Lnet/minecraft/util/math/Vec3i;)Lnet/minecraft/util/math/BlockBox;intermediary method_29299Lnet/minecraft/class_3341;method_29299(Lnet/minecraft/class_2382;)Lnet/minecraft/class_3341;official aLelp;a(Lkl;)Lelp;
-
offset
Returns a new box that is translated byx,y,zon each axis from this box.- Returns:
- a new box that is translated by
x,y,zon each axis from this box - See Also:
- Mappings:
Namespace Name Mixin selector named offsetLnet/minecraft/util/math/BlockBox;offset(III)Lnet/minecraft/util/math/BlockBox;intermediary method_19311Lnet/minecraft/class_3341;method_19311(III)Lnet/minecraft/class_3341;official bLelp;b(III)Lelp;
-
expand
Returns a new box that is expanded on each direction byoffset.- Returns:
- a new box that is expanded on each direction by
offset - Mappings:
Namespace Name Mixin selector named expandLnet/minecraft/util/math/BlockBox;expand(I)Lnet/minecraft/util/math/BlockBox;intermediary method_35410Lnet/minecraft/class_3341;method_35410(I)Lnet/minecraft/class_3341;official aLelp;a(I)Lelp;
-
expand
Returns a new box that is expanded byx,y,zon each axis.- Returns:
- a new box that is expanded by
x,y,zon each axis - See Also:
- Mappings:
Namespace Name Mixin selector named expandLnet/minecraft/util/math/BlockBox;expand(III)Lnet/minecraft/util/math/BlockBox;intermediary method_59718Lnet/minecraft/class_3341;method_59718(III)Lnet/minecraft/class_3341;official cLelp;c(III)Lelp;
-
contains
Returns whether this box containspos.- Returns:
- whether this box contains
pos - Mappings:
Namespace Name Mixin selector named containsLnet/minecraft/util/math/BlockBox;contains(Lnet/minecraft/util/math/Vec3i;)Zintermediary method_14662Lnet/minecraft/class_3341;method_14662(Lnet/minecraft/class_2382;)Zofficial bLelp;b(Lkl;)Z
-
contains
public boolean contains(int x, int y, int z) - Mappings:
Namespace Name Mixin selector named containsLnet/minecraft/util/math/BlockBox;contains(III)Zintermediary method_47593Lnet/minecraft/class_3341;method_47593(III)Zofficial dLelp;d(III)Z
-
getDimensions
Returns the dimensions (the size) of this box.- Returns:
- the dimensions (the size) of this box
- Mappings:
Namespace Name Mixin selector named getDimensionsLnet/minecraft/util/math/BlockBox;getDimensions()Lnet/minecraft/util/math/Vec3i;intermediary method_14659Lnet/minecraft/class_3341;method_14659()Lnet/minecraft/class_2382;official cLelp;c()Lkl;
-
getBlockCountX
public int getBlockCountX()Returns the number of blocks on the X axis.This is equal to
maxX - minX + 1.- Returns:
- the number of blocks on the X axis
- Mappings:
Namespace Name Mixin selector named getBlockCountXLnet/minecraft/util/math/BlockBox;getBlockCountX()Iintermediary method_35414Lnet/minecraft/class_3341;method_35414()Iofficial dLelp;d()I
-
getBlockCountY
public int getBlockCountY()Returns the number of blocks on the Y axis.This is equal to
maxY - minY + 1.- Returns:
- the number of blocks on the Y axis
- Mappings:
Namespace Name Mixin selector named getBlockCountYLnet/minecraft/util/math/BlockBox;getBlockCountY()Iintermediary method_14660Lnet/minecraft/class_3341;method_14660()Iofficial eLelp;e()I
-
getBlockCountZ
public int getBlockCountZ()Returns the number of blocks on the Z axis.This is equal to
maxZ - minZ + 1.- Returns:
- the number of blocks on the Z axis
- Mappings:
Namespace Name Mixin selector named getBlockCountZLnet/minecraft/util/math/BlockBox;getBlockCountZ()Iintermediary method_14663Lnet/minecraft/class_3341;method_14663()Iofficial fLelp;f()I
-
getCenter
Returns the center of this box.- Returns:
- the center of this box
- API Note:
- This is biased toward the minimum bound corner of the box.
- Mappings:
Namespace Name Mixin selector named getCenterLnet/minecraft/util/math/BlockBox;getCenter()Lnet/minecraft/util/math/BlockPos;intermediary method_22874Lnet/minecraft/class_3341;method_22874()Lnet/minecraft/class_2338;official gLelp;g()Ljh;
-
forEachVertex
Callsconsumerfor each vertex (corner) of this box.- Mappings:
Namespace Name Mixin selector named forEachVertexLnet/minecraft/util/math/BlockBox;forEachVertex(Ljava/util/function/Consumer;)Vintermediary method_34391Lnet/minecraft/class_3341;method_34391(Ljava/util/function/Consumer;)Vofficial aLelp;a(Ljava/util/function/Consumer;)V
-
toString
-
equals
-
hashCode
public int hashCode() -
getMinX
public int getMinX()- Mappings:
Namespace Name Mixin selector named getMinXLnet/minecraft/util/math/BlockBox;getMinX()Iintermediary method_35415Lnet/minecraft/class_3341;method_35415()Iofficial hLelp;h()I
-
getMinY
public int getMinY()- Mappings:
Namespace Name Mixin selector named getMinYLnet/minecraft/util/math/BlockBox;getMinY()Iintermediary method_35416Lnet/minecraft/class_3341;method_35416()Iofficial iLelp;i()I
-
getMinZ
public int getMinZ()- Mappings:
Namespace Name Mixin selector named getMinZLnet/minecraft/util/math/BlockBox;getMinZ()Iintermediary method_35417Lnet/minecraft/class_3341;method_35417()Iofficial jLelp;j()I
-
getMaxX
public int getMaxX()- Mappings:
Namespace Name Mixin selector named getMaxXLnet/minecraft/util/math/BlockBox;getMaxX()Iintermediary method_35418Lnet/minecraft/class_3341;method_35418()Iofficial kLelp;k()I
-
getMaxY
public int getMaxY()- Mappings:
Namespace Name Mixin selector named getMaxYLnet/minecraft/util/math/BlockBox;getMaxY()Iintermediary method_35419Lnet/minecraft/class_3341;method_35419()Iofficial lLelp;l()I
-
getMaxZ
public int getMaxZ()- Mappings:
Namespace Name Mixin selector named getMaxZLnet/minecraft/util/math/BlockBox;getMaxZ()Iintermediary method_35420Lnet/minecraft/class_3341;method_35420()Iofficial mLelp;m()I
-