Class LocationHelpers

java.lang.Object
org.cyclops.cyclopscore.helper.LocationHelpers

public class LocationHelpers extends Object
Helper methods involving BlockPosS and PacketDistributor.TargetPointS.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.core.BlockPos
    addToDimension(net.minecraft.core.BlockPos blockPos, int dimension, int value)
     
    static net.minecraft.core.BlockPos
    copyLocation(net.minecraft.core.BlockPos blockPos)
     
    static net.minecraft.core.Vec3i
    copyLocation(net.minecraft.core.Vec3i blockPos)
     
    static net.neoforged.neoforge.network.PacketDistributor.TargetPoint
    createTargetPointFromEntity(net.minecraft.world.entity.Entity entity, int range)
    Creates a PacketDistributor.TargetPoint for the dimension and position of the given Entity and a given range.
    static net.neoforged.neoforge.network.PacketDistributor.TargetPoint
    createTargetPointFromLocation(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos location, int range)
    Creates a PacketDistributor.TargetPoint for the dimension of the given world and the given BlockPos.
    static net.minecraft.core.BlockPos
    fromArray(int[] coordinates)
     
    static double
    getPitch(net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end)
    Get pitch from the start location to the end location.
    static net.minecraft.core.BlockPos
    getRandomPointInSphere(net.minecraft.core.BlockPos center, int radius)
    Get a random point inside a sphere in an efficient way.
    static double
    getYaw(net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end)
    Get yaw from the start location to the end location.
    static net.minecraft.core.BlockPos
    subtract(net.minecraft.core.BlockPos blockPos, net.minecraft.core.Vec3i vec)
     
    static net.minecraft.core.Vec3i
    subtract(net.minecraft.core.Vec3i vec1, net.minecraft.core.Vec3i vec2)
     
    static int[]
    toArray(net.minecraft.core.Vec3i blockPos)
     
    static String
    toCompactString(net.minecraft.core.BlockPos pos)
    Compactly format a position.
    static String
    toCompactString(net.minecraft.core.Vec3i vec)
    Compactly format a vector.

    Methods inherited from class java.lang.Object

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

    • LocationHelpers

      public LocationHelpers()
  • Method Details

    • createTargetPointFromEntity

      public static net.neoforged.neoforge.network.PacketDistributor.TargetPoint createTargetPointFromEntity(net.minecraft.world.entity.Entity entity, int range)
      Creates a PacketDistributor.TargetPoint for the dimension and position of the given Entity and a given range.
      Parameters:
      entity - Entity who's dimension and position will be used to create the PacketDistributor.TargetPoint.
      range - The range of the PacketDistributor.TargetPoint.
      Returns:
      A PacketDistributor.TargetPoint with the position and dimension of the entity and the given range.
    • createTargetPointFromLocation

      public static net.neoforged.neoforge.network.PacketDistributor.TargetPoint createTargetPointFromLocation(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos location, int range)
      Creates a PacketDistributor.TargetPoint for the dimension of the given world and the given BlockPos.
      Parameters:
      world - The world from which the dimension will be used.
      location - The location for the target.
      range - The range of the PacketDistributor.TargetPoint.
      Returns:
      A PacketDistributor.TargetPoint with the position and dimension of the entity and the given range.
    • getRandomPointInSphere

      public static net.minecraft.core.BlockPos getRandomPointInSphere(net.minecraft.core.BlockPos center, int radius)
      Get a random point inside a sphere in an efficient way.
      Parameters:
      center - The center coordinates of the sphere.
      radius - The radius of the sphere.
      Returns:
      The coordinates of the random point.
    • copyLocation

      public static net.minecraft.core.BlockPos copyLocation(net.minecraft.core.BlockPos blockPos)
    • copyLocation

      public static net.minecraft.core.Vec3i copyLocation(net.minecraft.core.Vec3i blockPos)
    • addToDimension

      public static net.minecraft.core.BlockPos addToDimension(net.minecraft.core.BlockPos blockPos, int dimension, int value)
    • fromArray

      public static net.minecraft.core.BlockPos fromArray(int[] coordinates)
    • toArray

      public static int[] toArray(net.minecraft.core.Vec3i blockPos)
    • subtract

      public static net.minecraft.core.BlockPos subtract(net.minecraft.core.BlockPos blockPos, net.minecraft.core.Vec3i vec)
    • subtract

      public static net.minecraft.core.Vec3i subtract(net.minecraft.core.Vec3i vec1, net.minecraft.core.Vec3i vec2)
    • getYaw

      public static double getYaw(net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end)
      Get yaw from the start location to the end location.
      Parameters:
      start - Start
      end - End
      Returns:
      The yaw
    • getPitch

      public static double getPitch(net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end)
      Get pitch from the start location to the end location.
      Parameters:
      start - Start
      end - End
      Returns:
      The pitch
    • toCompactString

      public static String toCompactString(net.minecraft.core.BlockPos pos)
      Compactly format a position.
      Parameters:
      pos - The position.
      Returns:
      The string.
    • toCompactString

      public static String toCompactString(net.minecraft.core.Vec3i vec)
      Compactly format a vector.
      Parameters:
      vec - The vector.
      Returns:
      The string.