Class BlockBox

java.lang.Object
me.hsgamer.hscore.minecraft.block.box.BlockBox

public class BlockBox extends Object
A custom box to bound blocks
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    The maximum x coordinate
    final int
    The maximum y coordinate
    final int
    The maximum z coordinate
    final int
    The minimum x coordinate
    final int
    The minimum y coordinate
    final int
    The minimum z coordinate
  • Constructor Summary

    Constructors
    Constructor
    Description
    BlockBox(int x1, int y1, int z1, int x2, int y2, int z2)
    Create a new block box
    BlockBox(Position pos1, Position pos2)
    Create a new block box
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the center of the box
    boolean
    contains(double x, double y, double z)
    Check if the location is in the box
    boolean
    Check if the location is in the box
    boolean
     
    expand(int x, int y, int z)
    Create a new block box that expands the minimum and maximum position by the given offset
    expandMax(int x, int y, int z)
    Create a new block box that increases the maximum position by the given offset
    expandMin(int x, int y, int z)
    Create a new block box that decreases the minimum position by the given offset
    int
     
    max()
    Get the maximum position
    Create a new block box that increases the maximum position by one.
    min()
    Get the minimum position
    double
    Get the X-size of the box
    double
    Get the Y-size of the box
    double
    Get the Z-size of the box

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • minX

      public final int minX
      The minimum x coordinate
    • minY

      public final int minY
      The minimum y coordinate
    • minZ

      public final int minZ
      The minimum z coordinate
    • maxX

      public final int maxX
      The maximum x coordinate
    • maxY

      public final int maxY
      The maximum y coordinate
    • maxZ

      public final int maxZ
      The maximum z coordinate
  • Constructor Details

    • BlockBox

      public BlockBox(int x1, int y1, int z1, int x2, int y2, int z2)
      Create a new block box
      Parameters:
      x1 - the first x
      y1 - the first y
      z1 - the first z
      x2 - the second x
      y2 - the second y
      z2 - the second z
    • BlockBox

      public BlockBox(Position pos1, Position pos2)
      Create a new block box
      Parameters:
      pos1 - the first position
      pos2 - the second position
  • Method Details

    • expandMax

      public BlockBox expandMax(int x, int y, int z)
      Create a new block box that increases the maximum position by the given offset
      Parameters:
      x - the x-axis offset
      y - the y-axis offset
      z - the z-axis offset
      Returns:
      the new box
    • expandMin

      public BlockBox expandMin(int x, int y, int z)
      Create a new block box that decreases the minimum position by the given offset
      Parameters:
      x - the x-axis offset
      y - the y-axis offset
      z - the z-axis offset
      Returns:
      the new box
    • expand

      public BlockBox expand(int x, int y, int z)
      Create a new block box that expands the minimum and maximum position by the given offset
      Parameters:
      x - the x-axis offset
      y - the y-axis offset
      z - the z-axis offset
      Returns:
      the new box
    • maxInclusive

      public BlockBox maxInclusive()
      Create a new block box that increases the maximum position by one. Use this to include the block at the maximum position as a part of the box.
      Returns:
      the new box
    • contains

      public boolean contains(double x, double y, double z)
      Check if the location is in the box
      Parameters:
      x - the x
      y - the y
      z - the z
      Returns:
      true if it is in the box
    • contains

      public boolean contains(Position pos)
      Check if the location is in the box
      Parameters:
      pos - the position
      Returns:
      true if it is in the box
    • center

      public Position center()
      Get the center of the box
      Returns:
      the center
    • min

      public Position min()
      Get the minimum position
      Returns:
      the minimum position
    • max

      public Position max()
      Get the maximum position
      Returns:
      the maximum position
    • sizeX

      public double sizeX()
      Get the X-size of the box
      Returns:
      the size
    • sizeY

      public double sizeY()
      Get the Y-size of the box
      Returns:
      the size
    • sizeZ

      public double sizeZ()
      Get the Z-size of the box
      Returns:
      the size
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object