Class BoundingBoxes

java.lang.Object
net.bitbylogic.packetblocks.util.BoundingBoxes

public class BoundingBoxes extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<org.bukkit.util.BoundingBox>
    getBoxes(@NonNull org.bukkit.block.Block block)
    Retrieves a list of bounding boxes associated with the given block.
    static List<org.bukkit.util.BoundingBox>
    getBoxes(@NonNull org.bukkit.block.data.BlockData blockData)
    Retrieves a list of bounding boxes associated with the given block data.
    static List<org.bukkit.util.BoundingBox>
    getBoxesAt(@NonNull org.bukkit.Location location)
    Retrieves a list of bounding boxes associated with the given location.
    static List<org.bukkit.util.BoundingBox>
    getBoxesAt(@NonNull org.bukkit.block.Block block)
    Retrieves a list of world-space bounding boxes at the specified block's location.
    static List<org.bukkit.util.BoundingBox>
    getBoxesAt(@NonNull org.bukkit.block.data.BlockData blockData, @NonNull org.bukkit.Location location)
    Calculates a list of world-space bounding boxes for the provided block data at the given location.
    static void
    init(@NonNull PacketBlocks plugin)
     
    static org.bukkit.util.RayTraceResult
    rayTraceAt(@NonNull org.bukkit.block.Block block, @NonNull org.bukkit.block.data.BlockData blockData, @NonNull org.bukkit.util.Vector start, @NonNull org.bukkit.util.Vector direction, double maxDistance)
    Performs a ray trace operation against the bounding boxes of the specified block and block data.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BoundingBoxes

      public BoundingBoxes()
  • Method Details

    • init

      public static void init(@NonNull @NonNull PacketBlocks plugin)
    • getBoxes

      public static List<org.bukkit.util.BoundingBox> getBoxes(@NonNull @NonNull org.bukkit.block.data.BlockData blockData)
      Retrieves a list of bounding boxes associated with the given block data. The method fetches cached bounding boxes if available, otherwise parses and generates bounding boxes from a predefined JSON structure.
      Parameters:
      blockData - the block data for which the bounding boxes are retrieved; must not be null
      Returns:
      a list of bounding boxes associated with the given block data, or null if no bounding boxes are defined
    • getBoxes

      public static List<org.bukkit.util.BoundingBox> getBoxes(@NonNull @NonNull org.bukkit.block.Block block)
      Retrieves a list of bounding boxes associated with the given block. This method internally resolves block data from the provided block and delegates the operation to fetch the bounding boxes.
      Parameters:
      block - the block for which the bounding boxes are retrieved; must not be null
      Returns:
      a list of bounding boxes associated with the provided block, or null if no bounding boxes are defined
    • getBoxesAt

      public static List<org.bukkit.util.BoundingBox> getBoxesAt(@NonNull @NonNull org.bukkit.block.data.BlockData blockData, @NonNull @NonNull org.bukkit.Location location)
      Calculates a list of world-space bounding boxes for the provided block data at the given location. The method retrieves bounding boxes defined for the block data, adjusts their positions based on the block's location in the world, and returns the resulting list.
      Parameters:
      blockData - the block data used to retrieve and calculate bounding boxes; must not be null
      location - the location of the block in the world, used to translate the bounding boxes; must not be null
      Returns:
      a list of bounding boxes translated to world coordinates; an empty list if no bounding boxes are defined
    • getBoxesAt

      public static List<org.bukkit.util.BoundingBox> getBoxesAt(@NonNull @NonNull org.bukkit.block.Block block)
      Retrieves a list of world-space bounding boxes at the specified block's location. This method resolves the block data from the provided block and calculates the bounding boxes based on the block's location in the world.
      Parameters:
      block - the block for which the bounding boxes are to be calculated; must not be null
      Returns:
      a list of bounding boxes aligned to the world-space location of the specified block, or an empty list if no bounding boxes are defined
    • getBoxesAt

      public static List<org.bukkit.util.BoundingBox> getBoxesAt(@NonNull @NonNull org.bukkit.Location location)
      Retrieves a list of bounding boxes associated with the given location. The method resolves the block at the specified location and retrieves its bounding boxes by delegating the operation to another method.
      Parameters:
      location - the location for which the bounding boxes are retrieved; must not be null
      Returns:
      a list of bounding boxes associated with the block at the given location
    • rayTraceAt

      public static org.bukkit.util.RayTraceResult rayTraceAt(@NonNull @NonNull org.bukkit.block.Block block, @NonNull @NonNull org.bukkit.block.data.BlockData blockData, @NonNull @NonNull org.bukkit.util.Vector start, @NonNull @NonNull org.bukkit.util.Vector direction, double maxDistance)
      Performs a ray trace operation against the bounding boxes of the specified block and block data. This method calculates the world-space bounding boxes for the given block data at the block's location, then performs a ray trace on each bounding box to find the closest intersection point.
      Parameters:
      block - the block for which the ray trace is performed; must not be null
      blockData - the block data of the block; must not be null
      start - the starting position of the ray; must not be null
      direction - the direction vector of the ray; must not be null
      maxDistance - the maximum distance to trace; must be a positive double
      Returns:
      the closest RayTraceResult if an intersection is found, or null if no intersection occurs within the specified bounds