Class BlockSphereUtil

java.lang.Object
com.hypixel.hytale.math.block.BlockSphereUtil

public class BlockSphereUtil extends Object
Since:
04.02.2018
  • Constructor Details

    • BlockSphereUtil

      public BlockSphereUtil()
  • Method Details

    • forEachBlockExact

      public static <T> void forEachBlockExact(int originX, int originY, int originZ, double radius, @Nullable T t, @Nonnull TriIntObjPredicate<T> consumer)
      Runs the specified operation on all blocks in the sphere specified by the parameters.
      Parameters:
      originX - The center of the sphere on the X axis
      originY - The center of the sphere on the Y axis
      originZ - The center of the sphere on the Z axis
      radius - The radius of the sphere. Must be greater than 0.
      consumer - The operation to execute on each of the coordinates' values
    • forEachBlock

      public static <T> void forEachBlock(int originX, int originY, int originZ, int radius, @Nullable T t, @Nonnull TriIntObjPredicate<T> consumer)
      Runs the specified operation on all blocks in the sphere specified by the parameters.
      Parameters:
      originX - The center of the sphere on the X axis
      originY - The center of the sphere on the Y axis
      originZ - The center of the sphere on the Z axis
      radius - The radius of the sphere. Must be greater than 0.
      consumer - The operation to execute on each of the coordinates' values
    • forEachBlock

      public static <T> boolean forEachBlock(int originX, int originY, int originZ, int radiusX, int radiusY, int radiusZ, @Nullable T t, @Nonnull TriIntObjPredicate<T> consumer)
    • forEachBlock

      public static <T> boolean forEachBlock(int originX, int originY, int originZ, int radiusX, int radiusY, int radiusZ, boolean evenXZ, boolean evenY, @Nullable T t, @Nonnull TriIntObjPredicate<T> consumer)
      Runs the specified operation on all blocks in the sphere specified by the parameters. The algorithm does not iterate over blocks outside the sphere. The iteration count is equal to the reported block count.

      When evenXZ or evenY is true, supports shapes whose extent is even along X/Z and/or Y by sampling block centers with a half-block offset when evenXZ / evenY is true, and iterating the full coordinate range (no octant mirroring).

      Parameters:
      originX - The center of the sphere on the X axis
      originY - The center of the sphere on the Y axis
      originZ - The center of the sphere on the Z axis
      radiusX - The radius of the sphere on the X axis. Must be greater than 0.
      radiusY - The radius of the sphere on the Y axis. Must be greater than 0.
      radiusZ - The radius of the sphere on the Z axis. Must be greater than 0.
      evenXZ - When true, treat extent as even along X and Z (half-block offset, full range on X/Z).
      evenY - When true, treat extent as even along Y (half-block offset, full range on Y).
      consumer - The operation to execute on each of the coordinates' values
    • forEachBlock

      public static <T> void forEachBlock(int originX, int originY, int originZ, int radius, int thickness, @Nullable T t, @Nonnull TriIntObjPredicate<T> consumer)
      Runs the specified operation on all blocks in the hollow sphere specified by the parameters.
      Parameters:
      originX - The center of the sphere on the X axis
      originY - The center of the sphere on the Y axis
      originZ - The center of the sphere on the Z axis
      radius - The radius of the sphere. Must be greater than 0.
      thickness - The thickness of the hollow sphere. Must be greater 0.
      consumer - The operation to execute on each of the coordinates' values
    • forEachBlock

      public static <T> boolean forEachBlock(int originX, int originY, int originZ, int radiusX, int radiusY, int radiusZ, int thickness, @Nullable T t, @Nonnull TriIntObjPredicate<T> consumer)
      Runs the specified operation on all blocks in the hollow sphere specified by the parameters.
      Parameters:
      originX - The center of the sphere on the X axis
      originY - The center of the sphere on the Y axis
      originZ - The center of the sphere on the Z axis
      radiusX - The radius of the sphere on the X axis. Must be greater than 0.
      radiusY - The radius of the sphere on the Y axis. Must be greater than 0.
      radiusZ - The radius of the sphere on the Z axis. Must be greater than 0.
      thickness - The thickness of the hollow sphere. Must be greater 0.
      consumer - The operation to execute on each of the coordinates' values
    • forEachBlock

      public static <T> boolean forEachBlock(int originX, int originY, int originZ, int radiusX, int radiusY, int radiusZ, int thickness, boolean evenXZ, boolean evenY, @Nullable T t, @Nonnull TriIntObjPredicate<T> consumer)