Class BlockBox

java.lang.Object
net.minecraft.util.math.BlockBox

public class BlockBox extends Object
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/BlockBox
intermediary net/minecraft/class_3341
official enf
  • Field Details Link icon

    • LOGGER Link icon

      private static final Logger LOGGER
      Mappings:
      Namespace Name Mixin selector
      named LOGGER Lnet/minecraft/util/math/BlockBox;LOGGER:Lorg/slf4j/Logger;
      intermediary field_31548 Lnet/minecraft/class_3341;field_31548:Lorg/slf4j/Logger;
      official b Lenf;b:Lorg/slf4j/Logger;
    • CODEC Link icon

      public static final com.mojang.serialization.Codec<BlockBox> CODEC
      A codec that stores a block box as an int array. In the serialized array, the ordered elements are minX, minY, minZ, maxX, maxY, maxZ.
      Mappings:
      Namespace Name Mixin selector
      named CODEC Lnet/minecraft/util/math/BlockBox;CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_29325 Lnet/minecraft/class_3341;field_29325:Lcom/mojang/serialization/Codec;
      official a Lenf;a:Lcom/mojang/serialization/Codec;
    • minX Link icon

      private int minX
      Mappings:
      Namespace Name Mixin selector
      named minX Lnet/minecraft/util/math/BlockBox;minX:I
      intermediary field_14380 Lnet/minecraft/class_3341;field_14380:I
      official c Lenf;c:I
    • minY Link icon

      private int minY
      Mappings:
      Namespace Name Mixin selector
      named minY Lnet/minecraft/util/math/BlockBox;minY:I
      intermediary field_14379 Lnet/minecraft/class_3341;field_14379:I
      official d Lenf;d:I
    • minZ Link icon

      private int minZ
      Mappings:
      Namespace Name Mixin selector
      named minZ Lnet/minecraft/util/math/BlockBox;minZ:I
      intermediary field_14378 Lnet/minecraft/class_3341;field_14378:I
      official e Lenf;e:I
    • maxX Link icon

      private int maxX
      Mappings:
      Namespace Name Mixin selector
      named maxX Lnet/minecraft/util/math/BlockBox;maxX:I
      intermediary field_14377 Lnet/minecraft/class_3341;field_14377:I
      official f Lenf;f:I
    • maxY Link icon

      private int maxY
      Mappings:
      Namespace Name Mixin selector
      named maxY Lnet/minecraft/util/math/BlockBox;maxY:I
      intermediary field_14376 Lnet/minecraft/class_3341;field_14376:I
      official g Lenf;g:I
    • maxZ Link icon

      private int maxZ
      Mappings:
      Namespace Name Mixin selector
      named maxZ Lnet/minecraft/util/math/BlockBox;maxZ:I
      intermediary field_14381 Lnet/minecraft/class_3341;field_14381:I
      official h Lenf;h:I
  • Constructor Details Link icon

    • BlockBox Link icon

      public BlockBox(BlockPos pos)
      Creates a box enclosing only pos.
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/util/math/BlockBox;<init>(Lnet/minecraft/util/math/BlockPos;)V
      intermediary <init> Lnet/minecraft/class_3341;<init>(Lnet/minecraft/class_2338;)V
      official <init> Lenf;<init>(Lji;)V
    • BlockBox Link icon

      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)V
      intermediary <init> Lnet/minecraft/class_3341;<init>(IIIIII)V
      official <init> Lenf;<init>(IIIIII)V
  • Method Details Link icon

    • create Link icon

      public static BlockBox create(Vec3i first, Vec3i second)
      Returns a new box from two corners, first and second.
      Returns:
      a new box from two corners, first and second
      Mappings:
      Namespace Name Mixin selector
      named create Lnet/minecraft/util/math/BlockBox;create(Lnet/minecraft/util/math/Vec3i;Lnet/minecraft/util/math/Vec3i;)Lnet/minecraft/util/math/BlockBox;
      intermediary method_34390 Lnet/minecraft/class_3341;method_34390(Lnet/minecraft/class_2382;Lnet/minecraft/class_2382;)Lnet/minecraft/class_3341;
      official a Lenf;a(Lkm;Lkm;)Lenf;
    • infinite Link icon

      public static BlockBox infinite()
      Returns a new all-encompassing, infinite box.
      Returns:
      a new all-encompassing, infinite box
      Mappings:
      Namespace Name Mixin selector
      named infinite Lnet/minecraft/util/math/BlockBox;infinite()Lnet/minecraft/util/math/BlockBox;
      intermediary method_14665 Lnet/minecraft/class_3341;method_14665()Lnet/minecraft/class_3341;
      official a Lenf;a()Lenf;
    • rotated Link icon

      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 rotated Lnet/minecraft/util/math/BlockBox;rotated(IIIIIIIIILnet/minecraft/util/math/Direction;)Lnet/minecraft/util/math/BlockBox;
      intermediary method_14667 Lnet/minecraft/class_3341;method_14667(IIIIIIIIILnet/minecraft/class_2350;)Lnet/minecraft/class_3341;
      official a Lenf;a(IIIIIIIIILjn;)Lenf;
    • streamChunkPos Link icon

      public Stream<ChunkPos> streamChunkPos()
      Mappings:
      Namespace Name Mixin selector
      named streamChunkPos Lnet/minecraft/util/math/BlockBox;streamChunkPos()Ljava/util/stream/Stream;
      intermediary method_54883 Lnet/minecraft/class_3341;method_54883()Ljava/util/stream/Stream;
      official b Lenf;b()Ljava/util/stream/Stream;
    • intersects Link icon

      public boolean intersects(BlockBox other)
      Returns whether other intersects with this box.
      Returns:
      whether other intersects with this box
      Mappings:
      Namespace Name Mixin selector
      named intersects Lnet/minecraft/util/math/BlockBox;intersects(Lnet/minecraft/util/math/BlockBox;)Z
      intermediary method_14657 Lnet/minecraft/class_3341;method_14657(Lnet/minecraft/class_3341;)Z
      official a Lenf;a(Lenf;)Z
    • intersectsXZ Link icon

      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 intersectsXZ Lnet/minecraft/util/math/BlockBox;intersectsXZ(IIII)Z
      intermediary method_14669 Lnet/minecraft/class_3341;method_14669(IIII)Z
      official a Lenf;a(IIII)Z
    • encompassPositions Link icon

      public static Optional<BlockBox> encompassPositions(Iterable<BlockPos> positions)
      Returns the minimum box encompassing all of the given positions, or an empty optional if positions is empty.
      Returns:
      the minimum box encompassing all of the given positions, or an empty optional if positions is empty
      Mappings:
      Namespace Name Mixin selector
      named encompassPositions Lnet/minecraft/util/math/BlockBox;encompassPositions(Ljava/lang/Iterable;)Ljava/util/Optional;
      intermediary method_35411 Lnet/minecraft/class_3341;method_35411(Ljava/lang/Iterable;)Ljava/util/Optional;
      official a Lenf;a(Ljava/lang/Iterable;)Ljava/util/Optional;
    • encompass Link icon

      public static Optional<BlockBox> encompass(Iterable<BlockBox> boxes)
      Returns the minimum box encompassing all of the given boxes, or an empty optional if boxes is empty.
      Returns:
      the minimum box encompassing all of the given boxes, or an empty optional if boxes is empty
      Mappings:
      Namespace Name Mixin selector
      named encompass Lnet/minecraft/util/math/BlockBox;encompass(Ljava/lang/Iterable;)Ljava/util/Optional;
      intermediary method_35413 Lnet/minecraft/class_3341;method_35413(Ljava/lang/Iterable;)Ljava/util/Optional;
      official b Lenf;b(Ljava/lang/Iterable;)Ljava/util/Optional;
    • encompass Link icon

      @Deprecated public BlockBox encompass(BlockBox box)
      Deprecated.
      Mappings:
      Namespace Name Mixin selector
      named encompass Lnet/minecraft/util/math/BlockBox;encompass(Lnet/minecraft/util/math/BlockBox;)Lnet/minecraft/util/math/BlockBox;
      intermediary method_35412 Lnet/minecraft/class_3341;method_35412(Lnet/minecraft/class_3341;)Lnet/minecraft/class_3341;
      official b Lenf;b(Lenf;)Lenf;
    • encompass Link icon

      @Deprecated public BlockBox encompass(BlockPos pos)
      Deprecated.
      Expands this box to encompass the pos.
      Parameters:
      pos - the pos to encompass
      Returns:
      this box, for chaining
      Mappings:
      Namespace Name Mixin selector
      named encompass Lnet/minecraft/util/math/BlockBox;encompass(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/BlockBox;
      intermediary method_34389 Lnet/minecraft/class_3341;method_34389(Lnet/minecraft/class_2338;)Lnet/minecraft/class_3341;
      official a Lenf;a(Lji;)Lenf;
    • move Link icon

      @Deprecated public BlockBox move(int dx, int dy, int dz)
      Deprecated.
      Mappings:
      Namespace Name Mixin selector
      named move Lnet/minecraft/util/math/BlockBox;move(III)Lnet/minecraft/util/math/BlockBox;
      intermediary method_14661 Lnet/minecraft/class_3341;method_14661(III)Lnet/minecraft/class_3341;
      official a Lenf;a(III)Lenf;
    • move Link icon

      @Deprecated public BlockBox move(Vec3i vec)
      Deprecated.
      Mappings:
      Namespace Name Mixin selector
      named move Lnet/minecraft/util/math/BlockBox;move(Lnet/minecraft/util/math/Vec3i;)Lnet/minecraft/util/math/BlockBox;
      intermediary method_29299 Lnet/minecraft/class_3341;method_29299(Lnet/minecraft/class_2382;)Lnet/minecraft/class_3341;
      official a Lenf;a(Lkm;)Lenf;
    • offset Link icon

      public BlockBox offset(int x, int y, int z)
      Returns a new box that is translated by x, y, z on each axis from this box.
      Returns:
      a new box that is translated by x, y, z on each axis from this box
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named offset Lnet/minecraft/util/math/BlockBox;offset(III)Lnet/minecraft/util/math/BlockBox;
      intermediary method_19311 Lnet/minecraft/class_3341;method_19311(III)Lnet/minecraft/class_3341;
      official b Lenf;b(III)Lenf;
    • expand Link icon

      public BlockBox expand(int offset)
      Returns a new box that is expanded on each direction by offset.
      Returns:
      a new box that is expanded on each direction by offset
      Mappings:
      Namespace Name Mixin selector
      named expand Lnet/minecraft/util/math/BlockBox;expand(I)Lnet/minecraft/util/math/BlockBox;
      intermediary method_35410 Lnet/minecraft/class_3341;method_35410(I)Lnet/minecraft/class_3341;
      official a Lenf;a(I)Lenf;
    • expand Link icon

      public BlockBox expand(int x, int y, int z)
      Returns a new box that is expanded by x, y, z on each axis.
      Returns:
      a new box that is expanded by x, y, z on each axis
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named expand Lnet/minecraft/util/math/BlockBox;expand(III)Lnet/minecraft/util/math/BlockBox;
      intermediary method_59718 Lnet/minecraft/class_3341;method_59718(III)Lnet/minecraft/class_3341;
      official c Lenf;c(III)Lenf;
    • contains Link icon

      public boolean contains(Vec3i pos)
      Returns whether this box contains pos.
      Returns:
      whether this box contains pos
      Mappings:
      Namespace Name Mixin selector
      named contains Lnet/minecraft/util/math/BlockBox;contains(Lnet/minecraft/util/math/Vec3i;)Z
      intermediary method_14662 Lnet/minecraft/class_3341;method_14662(Lnet/minecraft/class_2382;)Z
      official b Lenf;b(Lkm;)Z
    • contains Link icon

      public boolean contains(int x, int y, int z)
      Mappings:
      Namespace Name Mixin selector
      named contains Lnet/minecraft/util/math/BlockBox;contains(III)Z
      intermediary method_47593 Lnet/minecraft/class_3341;method_47593(III)Z
      official d Lenf;d(III)Z
    • getDimensions Link icon

      public Vec3i getDimensions()
      Returns the dimensions (the size) of this box.
      Returns:
      the dimensions (the size) of this box
      Mappings:
      Namespace Name Mixin selector
      named getDimensions Lnet/minecraft/util/math/BlockBox;getDimensions()Lnet/minecraft/util/math/Vec3i;
      intermediary method_14659 Lnet/minecraft/class_3341;method_14659()Lnet/minecraft/class_2382;
      official c Lenf;c()Lkm;
    • getBlockCountX Link icon

      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 getBlockCountX Lnet/minecraft/util/math/BlockBox;getBlockCountX()I
      intermediary method_35414 Lnet/minecraft/class_3341;method_35414()I
      official d Lenf;d()I
    • getBlockCountY Link icon

      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 getBlockCountY Lnet/minecraft/util/math/BlockBox;getBlockCountY()I
      intermediary method_14660 Lnet/minecraft/class_3341;method_14660()I
      official e Lenf;e()I
    • getBlockCountZ Link icon

      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 getBlockCountZ Lnet/minecraft/util/math/BlockBox;getBlockCountZ()I
      intermediary method_14663 Lnet/minecraft/class_3341;method_14663()I
      official f Lenf;f()I
    • getCenter Link icon

      public BlockPos 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 getCenter Lnet/minecraft/util/math/BlockBox;getCenter()Lnet/minecraft/util/math/BlockPos;
      intermediary method_22874 Lnet/minecraft/class_3341;method_22874()Lnet/minecraft/class_2338;
      official g Lenf;g()Lji;
    • forEachVertex Link icon

      public void forEachVertex(Consumer<BlockPos> consumer)
      Calls consumer for each vertex (corner) of this box.
      Mappings:
      Namespace Name Mixin selector
      named forEachVertex Lnet/minecraft/util/math/BlockBox;forEachVertex(Ljava/util/function/Consumer;)V
      intermediary method_34391 Lnet/minecraft/class_3341;method_34391(Ljava/util/function/Consumer;)V
      official a Lenf;a(Ljava/util/function/Consumer;)V
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • equals Link icon

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      Mappings:
      Namespace Name Mixin selector
      named equals Lnet/minecraft/util/math/BlockBox;equals(Ljava/lang/Object;)Z
      intermediary equals Lnet/minecraft/class_3341;equals(Ljava/lang/Object;)Z
      official equals Lenf;equals(Ljava/lang/Object;)Z
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getMinX Link icon

      public int getMinX()
      Mappings:
      Namespace Name Mixin selector
      named getMinX Lnet/minecraft/util/math/BlockBox;getMinX()I
      intermediary method_35415 Lnet/minecraft/class_3341;method_35415()I
      official h Lenf;h()I
    • getMinY Link icon

      public int getMinY()
      Mappings:
      Namespace Name Mixin selector
      named getMinY Lnet/minecraft/util/math/BlockBox;getMinY()I
      intermediary method_35416 Lnet/minecraft/class_3341;method_35416()I
      official i Lenf;i()I
    • getMinZ Link icon

      public int getMinZ()
      Mappings:
      Namespace Name Mixin selector
      named getMinZ Lnet/minecraft/util/math/BlockBox;getMinZ()I
      intermediary method_35417 Lnet/minecraft/class_3341;method_35417()I
      official j Lenf;j()I
    • getMaxX Link icon

      public int getMaxX()
      Mappings:
      Namespace Name Mixin selector
      named getMaxX Lnet/minecraft/util/math/BlockBox;getMaxX()I
      intermediary method_35418 Lnet/minecraft/class_3341;method_35418()I
      official k Lenf;k()I
    • getMaxY Link icon

      public int getMaxY()
      Mappings:
      Namespace Name Mixin selector
      named getMaxY Lnet/minecraft/util/math/BlockBox;getMaxY()I
      intermediary method_35419 Lnet/minecraft/class_3341;method_35419()I
      official l Lenf;l()I
    • getMaxZ Link icon

      public int getMaxZ()
      Mappings:
      Namespace Name Mixin selector
      named getMaxZ Lnet/minecraft/util/math/BlockBox;getMaxZ()I
      intermediary method_35420 Lnet/minecraft/class_3341;method_35420()I
      official m Lenf;m()I