Class BlockPosHelper

java.lang.Object
team.lodestar.lodestone.helpers.block.BlockPosHelper

public class BlockPosHelper extends Object
A collection of various helper methods related to block positions
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.world.phys.Vec3
    fromBlockPos(net.minecraft.core.BlockPos pos)
    Converts a block position into a Vec3 entry.
    static Collection<net.minecraft.core.BlockPos>
    getBlocks(net.minecraft.core.BlockPos pos, int x, int y, int z)
    Returns a list of block positions within a XYZ radius around a position.
    static Collection<net.minecraft.core.BlockPos>
    getBlocks(net.minecraft.core.BlockPos pos, int x1, int y1, int z1, int x2, int y2, int z2)
    Returns a list of block positions within set coordinates.
    static Collection<net.minecraft.core.BlockPos>
    getBlocks(net.minecraft.core.BlockPos pos, int x, int y, int z, Predicate<net.minecraft.core.BlockPos> predicate)
    Returns a list of block positions within a XYZ radius around a position, with a predicate for conditional checks.
    static Collection<net.minecraft.core.BlockPos>
    getBlocks(net.minecraft.core.BlockPos pos, int range, Predicate<net.minecraft.core.BlockPos> predicate)
    Returns a list of block positions within a radius around a position, with a predicate for conditional checks.
    static Stream<net.minecraft.core.BlockPos>
    getBlocksStream(net.minecraft.core.BlockPos pos, int x, int y, int z)
    Returns a list of block positions within a XYZ radius around a position, as stream
    static Stream<net.minecraft.core.BlockPos>
    getBlocksStream(net.minecraft.core.BlockPos pos, int x1, int y1, int z1, int x2, int y2, int z2)
    Returns a list of block positions within set coordinates, as stream
    static Stream<net.minecraft.core.BlockPos>
    getBlocksStream(net.minecraft.core.BlockPos pos, int x, int y, int z, Predicate<net.minecraft.core.BlockPos> predicate)
    Returns a list of block positions within a XYZ radius around a position, with a predicate for conditional checks, as stream
    static Stream<net.minecraft.core.BlockPos>
    getBlocksStream(net.minecraft.core.BlockPos pos, int range, Predicate<net.minecraft.core.BlockPos> predicate)
    Returns a list of block positions within a radius around a position, with a predicate for conditional checks, as stream
    static Collection<net.minecraft.core.BlockPos>
    getNeighboringBlocks(net.minecraft.core.BlockPos current)
    Quick method to get all blocks neighboring a block.
    static Stream<net.minecraft.core.BlockPos>
    getNeighboringBlocksStream(net.minecraft.core.BlockPos current)
    Quick method to get all blocks neighboring a block, as stream.
    static Collection<net.minecraft.core.BlockPos>
    getPlaneOfBlocks(net.minecraft.core.BlockPos pos, int x, int z)
    Returns a list of block positions within a XZ radius around a position, with a predicate for conditional checks, as stream
    static Collection<net.minecraft.core.BlockPos>
    getPlaneOfBlocks(net.minecraft.core.BlockPos pos, int x1, int z1, int x2, int z2)
    Returns a list of block positions within set coordinates.
    static Collection<net.minecraft.core.BlockPos>
    getPlaneOfBlocks(net.minecraft.core.BlockPos pos, int x, int z, Predicate<net.minecraft.core.BlockPos> predicate)
    Returns a list of block positions within a XYZ radius around a position, with a predicate for conditional checks.
    static Collection<net.minecraft.core.BlockPos>
    getPlaneOfBlocks(net.minecraft.core.BlockPos pos, int range, Predicate<net.minecraft.core.BlockPos> predicate)
    Returns a list of block positions within a radius around a position, with a predicate for conditional checks.
    static Stream<net.minecraft.core.BlockPos>
    getPlaneOfBlocksStream(net.minecraft.core.BlockPos pos, int x, int z)
    Returns a list of block positions within a XZ radius around a position, as stream
    static Stream<net.minecraft.core.BlockPos>
    getPlaneOfBlocksStream(net.minecraft.core.BlockPos pos, int x1, int z1, int x2, int z2)
    Returns a list of block positions within set coordinates, as stream
    static Stream<net.minecraft.core.BlockPos>
    getPlaneOfBlocksStream(net.minecraft.core.BlockPos pos, int x, int z, Predicate<net.minecraft.core.BlockPos> predicate)
    Returns a list of block positions within a XZ radius around a position, with a predicate for conditional checks.
    static Stream<net.minecraft.core.BlockPos>
    getPlaneOfBlocksStream(net.minecraft.core.BlockPos pos, int range, Predicate<net.minecraft.core.BlockPos> predicate)
    Returns a list of block positions within a radius around a position, with a predicate for conditional checks, as stream
    static Collection<net.minecraft.core.BlockPos>
    getSphereOfBlocks(net.minecraft.core.BlockPos pos, float range)
     
    static Collection<net.minecraft.core.BlockPos>
    getSphereOfBlocks(net.minecraft.core.BlockPos pos, float width, float height)
     
    static Collection<net.minecraft.core.BlockPos>
    getSphereOfBlocks(net.minecraft.core.BlockPos pos, float width, float height, Predicate<net.minecraft.core.BlockPos> predicate)
     
    static Collection<net.minecraft.core.BlockPos>
    getSphereOfBlocks(net.minecraft.core.BlockPos pos, float range, Predicate<net.minecraft.core.BlockPos> predicate)
     
    static Stream<net.minecraft.core.BlockPos>
    getSphereOfBlocksStream(net.minecraft.core.BlockPos pos, float range)
     
    static Stream<net.minecraft.core.BlockPos>
    getSphereOfBlocksStream(net.minecraft.core.BlockPos pos, float width, float height)
     
    static Stream<net.minecraft.core.BlockPos>
    getSphereOfBlocksStream(net.minecraft.core.BlockPos pos, float width, float height, Predicate<net.minecraft.core.BlockPos> predicate)
     
    static Stream<net.minecraft.core.BlockPos>
    getSphereOfBlocksStream(net.minecraft.core.BlockPos pos, float range, Predicate<net.minecraft.core.BlockPos> predicate)
     
    static net.minecraft.world.phys.Vec3
    withinBlock(net.minecraft.util.RandomSource rand, net.minecraft.core.BlockPos pos)
    Generates a randomly picked position within a block

    Methods inherited from class java.lang.Object

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

    • BlockPosHelper

      public BlockPosHelper()
  • Method Details

    • fromBlockPos

      public static net.minecraft.world.phys.Vec3 fromBlockPos(net.minecraft.core.BlockPos pos)
      Converts a block position into a Vec3 entry.
      Parameters:
      pos - the block position
      Returns:
      the vec3 representation.
    • withinBlock

      public static net.minecraft.world.phys.Vec3 withinBlock(net.minecraft.util.RandomSource rand, net.minecraft.core.BlockPos pos)
      Generates a randomly picked position within a block
      Parameters:
      rand - an instance of random
      pos - the position the block is centered around
      Returns:
      The randomized vector position
    • getBlocks

      public static Collection<net.minecraft.core.BlockPos> getBlocks(net.minecraft.core.BlockPos pos, int range, Predicate<net.minecraft.core.BlockPos> predicate)
      Returns a list of block positions within a radius around a position, with a predicate for conditional checks.
    • getBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getBlocksStream(net.minecraft.core.BlockPos pos, int range, Predicate<net.minecraft.core.BlockPos> predicate)
      Returns a list of block positions within a radius around a position, with a predicate for conditional checks, as stream
    • getBlocks

      public static Collection<net.minecraft.core.BlockPos> getBlocks(net.minecraft.core.BlockPos pos, int x, int y, int z, Predicate<net.minecraft.core.BlockPos> predicate)
      Returns a list of block positions within a XYZ radius around a position, with a predicate for conditional checks.
    • getBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getBlocksStream(net.minecraft.core.BlockPos pos, int x, int y, int z, Predicate<net.minecraft.core.BlockPos> predicate)
      Returns a list of block positions within a XYZ radius around a position, with a predicate for conditional checks, as stream
    • getBlocks

      public static Collection<net.minecraft.core.BlockPos> getBlocks(net.minecraft.core.BlockPos pos, int x, int y, int z)
      Returns a list of block positions within a XYZ radius around a position.
    • getBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getBlocksStream(net.minecraft.core.BlockPos pos, int x, int y, int z)
      Returns a list of block positions within a XYZ radius around a position, as stream
    • getBlocks

      public static Collection<net.minecraft.core.BlockPos> getBlocks(net.minecraft.core.BlockPos pos, int x1, int y1, int z1, int x2, int y2, int z2)
      Returns a list of block positions within set coordinates.
    • getBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getBlocksStream(net.minecraft.core.BlockPos pos, int x1, int y1, int z1, int x2, int y2, int z2)
      Returns a list of block positions within set coordinates, as stream
    • getPlaneOfBlocks

      public static Collection<net.minecraft.core.BlockPos> getPlaneOfBlocks(net.minecraft.core.BlockPos pos, int range, Predicate<net.minecraft.core.BlockPos> predicate)
      Returns a list of block positions within a radius around a position, with a predicate for conditional checks.
    • getPlaneOfBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getPlaneOfBlocksStream(net.minecraft.core.BlockPos pos, int range, Predicate<net.minecraft.core.BlockPos> predicate)
      Returns a list of block positions within a radius around a position, with a predicate for conditional checks, as stream
    • getPlaneOfBlocks

      public static Collection<net.minecraft.core.BlockPos> getPlaneOfBlocks(net.minecraft.core.BlockPos pos, int x, int z, Predicate<net.minecraft.core.BlockPos> predicate)
      Returns a list of block positions within a XYZ radius around a position, with a predicate for conditional checks.
    • getPlaneOfBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getPlaneOfBlocksStream(net.minecraft.core.BlockPos pos, int x, int z, Predicate<net.minecraft.core.BlockPos> predicate)
      Returns a list of block positions within a XZ radius around a position, with a predicate for conditional checks.
    • getPlaneOfBlocks

      public static Collection<net.minecraft.core.BlockPos> getPlaneOfBlocks(net.minecraft.core.BlockPos pos, int x, int z)
      Returns a list of block positions within a XZ radius around a position, with a predicate for conditional checks, as stream
    • getPlaneOfBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getPlaneOfBlocksStream(net.minecraft.core.BlockPos pos, int x, int z)
      Returns a list of block positions within a XZ radius around a position, as stream
    • getPlaneOfBlocks

      public static Collection<net.minecraft.core.BlockPos> getPlaneOfBlocks(net.minecraft.core.BlockPos pos, int x1, int z1, int x2, int z2)
      Returns a list of block positions within set coordinates.
    • getPlaneOfBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getPlaneOfBlocksStream(net.minecraft.core.BlockPos pos, int x1, int z1, int x2, int z2)
      Returns a list of block positions within set coordinates, as stream
    • getSphereOfBlocks

      public static Collection<net.minecraft.core.BlockPos> getSphereOfBlocks(net.minecraft.core.BlockPos pos, float range, Predicate<net.minecraft.core.BlockPos> predicate)
    • getSphereOfBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getSphereOfBlocksStream(net.minecraft.core.BlockPos pos, float range, Predicate<net.minecraft.core.BlockPos> predicate)
    • getSphereOfBlocks

      public static Collection<net.minecraft.core.BlockPos> getSphereOfBlocks(net.minecraft.core.BlockPos pos, float width, float height, Predicate<net.minecraft.core.BlockPos> predicate)
    • getSphereOfBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getSphereOfBlocksStream(net.minecraft.core.BlockPos pos, float width, float height, Predicate<net.minecraft.core.BlockPos> predicate)
    • getSphereOfBlocks

      public static Collection<net.minecraft.core.BlockPos> getSphereOfBlocks(net.minecraft.core.BlockPos pos, float range)
    • getSphereOfBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getSphereOfBlocksStream(net.minecraft.core.BlockPos pos, float range)
    • getSphereOfBlocks

      public static Collection<net.minecraft.core.BlockPos> getSphereOfBlocks(net.minecraft.core.BlockPos pos, float width, float height)
    • getSphereOfBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getSphereOfBlocksStream(net.minecraft.core.BlockPos pos, float width, float height)
    • getNeighboringBlocks

      public static Collection<net.minecraft.core.BlockPos> getNeighboringBlocks(net.minecraft.core.BlockPos current)
      Quick method to get all blocks neighboring a block.
    • getNeighboringBlocksStream

      public static Stream<net.minecraft.core.BlockPos> getNeighboringBlocksStream(net.minecraft.core.BlockPos current)
      Quick method to get all blocks neighboring a block, as stream.