Package org.cyclops.cyclopscore.helper
Class LocationHelpers
java.lang.Object
org.cyclops.cyclopscore.helper.LocationHelpers
Helper methods involving
BlockPosS and PacketDistributor.TargetPointS.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.core.BlockPosaddToDimension(net.minecraft.core.BlockPos blockPos, int dimension, int value) static net.minecraft.core.BlockPoscopyLocation(net.minecraft.core.BlockPos blockPos) static net.minecraft.core.Vec3icopyLocation(net.minecraft.core.Vec3i blockPos) static net.minecraftforge.network.PacketDistributor.TargetPointcreateTargetPointFromEntity(net.minecraft.world.entity.Entity entity, int range) Creates aPacketDistributor.TargetPointfor the dimension and position of the givenEntityand a given range.static net.minecraftforge.network.PacketDistributor.TargetPointcreateTargetPointFromLocation(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos location, int range) Creates aPacketDistributor.TargetPointfor the dimension of the given world and the givenBlockPos.static net.minecraft.core.BlockPosfromArray(int[] coordinates) static doublegetPitch(net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end) Get pitch from the start location to the end location.static net.minecraft.core.BlockPosgetRandomPointInSphere(net.minecraft.core.BlockPos center, int radius) Get a random point inside a sphere in an efficient way.static doublegetYaw(net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos end) Get yaw from the start location to the end location.static net.minecraft.core.BlockPossubtract(net.minecraft.core.BlockPos blockPos, net.minecraft.core.Vec3i vec) static net.minecraft.core.Vec3isubtract(net.minecraft.core.Vec3i vec1, net.minecraft.core.Vec3i vec2) static int[]toArray(net.minecraft.core.Vec3i blockPos) static StringtoCompactString(net.minecraft.core.BlockPos pos) Compactly format a position.static StringtoCompactString(net.minecraft.core.Vec3i vec) Compactly format a vector.
-
Constructor Details
-
LocationHelpers
public LocationHelpers()
-
-
Method Details
-
createTargetPointFromEntity
public static net.minecraftforge.network.PacketDistributor.TargetPoint createTargetPointFromEntity(net.minecraft.world.entity.Entity entity, int range) Creates aPacketDistributor.TargetPointfor the dimension and position of the givenEntityand a given range.- Parameters:
entity- Entity who's dimension and position will be used to create thePacketDistributor.TargetPoint.range- The range of thePacketDistributor.TargetPoint.- Returns:
- A
PacketDistributor.TargetPointwith the position and dimension of the entity and the given range.
-
createTargetPointFromLocation
public static net.minecraftforge.network.PacketDistributor.TargetPoint createTargetPointFromLocation(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos location, int range) Creates aPacketDistributor.TargetPointfor the dimension of the given world and the givenBlockPos.- Parameters:
world- The world from which the dimension will be used.location- The location for the target.range- The range of thePacketDistributor.TargetPoint.- Returns:
- A
PacketDistributor.TargetPointwith 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- Startend- 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- Startend- End- Returns:
- The pitch
-
toCompactString
Compactly format a position.- Parameters:
pos- The position.- Returns:
- The string.
-
toCompactString
Compactly format a vector.- Parameters:
vec- The vector.- Returns:
- The string.
-