Class BoundingBox3i

java.lang.Object
dev.ryanhcode.sable.companion.math.BoundingBox3i
All Implemented Interfaces:
BoundingBox3ic

public final class BoundingBox3i extends Object implements BoundingBox3ic
An inclusive integer bounding box with JOML interaction.
Since:
1.0.0
  • Field Details

    • EMPTY

      public static final BoundingBox3ic EMPTY
    • CODEC

      public static com.mojang.serialization.Codec<BoundingBox3i> CODEC
    • minX

      public int minX
    • minY

      public int minY
    • minZ

      public int minZ
    • maxX

      public int maxX
    • maxY

      public int maxY
    • maxZ

      public int maxZ
  • Constructor Details

    • BoundingBox3i

      public BoundingBox3i(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
      Creates a new bounding box with the given values
    • BoundingBox3i

      public BoundingBox3i(net.minecraft.core.BlockPos min, net.minecraft.core.BlockPos max)
      Creates a new bounding box with the given values
    • BoundingBox3i

      public BoundingBox3i(BoundingBox3ic other)
      Creates a new bounding box with the given values
    • BoundingBox3i

      public BoundingBox3i(net.minecraft.world.level.levelgen.structure.BoundingBox other)
      Creates a new bounding box with the given values
    • BoundingBox3i

      public BoundingBox3i()
      Creates a new bounding box with all values set to 0
    • BoundingBox3i

      public BoundingBox3i(BoundingBox3d other)
      Creates a new bounding box with the given values
  • Method Details

    • from

      @Nullable public static @Nullable BoundingBox3i from(Iterable<net.minecraft.core.BlockPos> blocks)
    • set

      @Contract(value="_->this", mutates="this") public BoundingBox3i set(BoundingBox3d other)
      Sets the bounding box to the given values
    • set

      @Contract(value="_->this", mutates="this") public BoundingBox3i set(BoundingBox3ic other)
      Sets the bounding box to the given values
    • set

      @Contract(value="_,_,_,_,_,_->this", mutates="this") public BoundingBox3i set(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
      Sets the bounding box to the given values
    • setUnchecked

      @Contract(value="_,_,_,_,_,_->this", mutates="this") public BoundingBox3i setUnchecked(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
      Sets the bounding box to the given values.
      Does NOT automatically swap mins/maxes if swapped.
    • setUnchecked

      @Contract(value="_->this", mutates="this") public BoundingBox3i setUnchecked(BoundingBox3ic other)
      Sets the bounding box to the given values.
      Does NOT automatically swap mins/maxes if swapped.
    • expand

      @Contract(value="_,_,_->this", mutates="this") public BoundingBox3i expand(int xExpansion, int yExpansion, int zExpansion)
    • expandTo

      @Contract(value="_->this", mutates="this") public BoundingBox3i expandTo(org.joml.Vector3ic point)
      Expands this box to include the given point
      Parameters:
      point - the point to include
      Returns:
      the result stored in this
    • expandTo

      @Contract(value="_,_,_->this", mutates="this") public BoundingBox3i expandTo(int x, int y, int z)
      Expands this box to include the given point
      Parameters:
      x - the x value of the point
      y - the y value of the point
      z - the z value of the point
      Returns:
      the result stored in this
    • expandTo

      @Contract(value="_->this", mutates="this") public BoundingBox3i expandTo(BoundingBox3ic other)
      Expands this box to include the given box
      Parameters:
      other - the box to include
      Returns:
      the result stored in this
    • move

      @Contract(value="_->this", mutates="this") public BoundingBox3i move(org.joml.Vector3ic vec)
      Translates this box by the given vector
      Parameters:
      vec - the vector to translate by
      Returns:
      the result stored in this
    • move

      @Contract(value="_,_,_->this", mutates="this") public BoundingBox3i move(int x, int y, int z)
      Translates this box by the given vector
      Parameters:
      x - the x value of the vector
      y - the y value of the vector
      z - the z value of the vector
      Returns:
      the result stored in this
    • intersect

      @Contract(value="_->this", mutates="this") public BoundingBox3i intersect(BoundingBox3ic box)
      Calculates the bounding box intersect between this box and the specified box.
      Parameters:
      box - The box to intersect with
      Returns:
      the result stored in this
    • minX

      public int minX()
      Specified by:
      minX in interface BoundingBox3ic
      Returns:
      the minimum x value of this box
    • minY

      public int minY()
      Specified by:
      minY in interface BoundingBox3ic
      Returns:
      the minimum y value of this box
    • minZ

      public int minZ()
      Specified by:
      minZ in interface BoundingBox3ic
      Returns:
      the minimum z value of this box
    • maxX

      public int maxX()
      Specified by:
      maxX in interface BoundingBox3ic
      Returns:
      the maximum x value of this box
    • maxY

      public int maxY()
      Specified by:
      maxY in interface BoundingBox3ic
      Returns:
      the maximum y value of this box
    • maxZ

      public int maxZ()
      Specified by:
      maxZ in interface BoundingBox3ic
      Returns:
      the maximum z value of this box
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object