Package baritone.api.utils
Class RotationUtils
java.lang.Object
baritone.api.utils.RotationUtils
- Since:
- 9/25/2018
- Author:
- Brady
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleConstant that a degree value is multiplied by to get the equivalent radian valuestatic final floatstatic final doubleConstant that a radian value is multiplied by to get the equivalent degree valuestatic final float -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.world.phys.Vec3calcLookDirectionFromRotation(Rotation rotation) Calculates the look vector for the specified yaw/pitch rotations.static RotationcalcRotationFromCoords(net.minecraft.core.BlockPos orig, net.minecraft.core.BlockPos dest) Calculates the rotation from BlockPosdest to BlockPosorigstatic RotationcalcRotationFromVec3d(net.minecraft.world.phys.Vec3 orig, net.minecraft.world.phys.Vec3 dest, Rotation current) Calculates the rotation from Vecdest to Vecorig and makes the return value relative to the specified current rotations.static net.minecraft.world.phys.Vec3calcVec3dFromRotation(Rotation rotation) Deprecated.reachable(IPlayerContext ctx, net.minecraft.core.BlockPos pos) reachable(IPlayerContext ctx, net.minecraft.core.BlockPos pos, boolean wouldSneak) reachable(IPlayerContext ctx, net.minecraft.core.BlockPos pos, double blockReachDistance) Determines if the specified entity is able to reach the center of any of the sides of the specified block.reachable(IPlayerContext ctx, net.minecraft.core.BlockPos pos, double blockReachDistance, boolean wouldSneak) reachable(net.minecraft.client.player.LocalPlayer entity, net.minecraft.core.BlockPos pos, double blockReachDistance) Deprecated.reachable(net.minecraft.client.player.LocalPlayer entity, net.minecraft.core.BlockPos pos, double blockReachDistance, boolean wouldSneak) Deprecated.reachableCenter(IPlayerContext ctx, net.minecraft.core.BlockPos pos, double blockReachDistance, boolean wouldSneak) Determines if the specified entity is able to reach the specified block where it is looking at the direct center of it's hitbox.reachableCenter(net.minecraft.world.entity.Entity entity, net.minecraft.core.BlockPos pos, double blockReachDistance, boolean wouldSneak) Deprecated.reachableOffset(IPlayerContext ctx, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 offsetPos, double blockReachDistance, boolean wouldSneak) Determines if the specified entity is able to reach the specified block with the given offsetted position.reachableOffset(net.minecraft.world.entity.Entity entity, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 offsetPos, double blockReachDistance, boolean wouldSneak) Deprecated.static RotationwrapAnglesToRelative(Rotation current, Rotation target) Wraps the target angles to a relative value from the current angles.
-
Field Details
-
DEG_TO_RAD
Constant that a degree value is multiplied by to get the equivalent radian value- See Also:
-
DEG_TO_RAD_F
- See Also:
-
RAD_TO_DEG
Constant that a radian value is multiplied by to get the equivalent degree value- See Also:
-
RAD_TO_DEG_F
- See Also:
-
-
Method Details
-
calcRotationFromCoords
public static Rotation calcRotationFromCoords(net.minecraft.core.BlockPos orig, net.minecraft.core.BlockPos dest) Calculates the rotation from BlockPosdest to BlockPosorig- Parameters:
orig- The origin positiondest- The destination position- Returns:
- The rotation from the origin to the destination
-
wrapAnglesToRelative
Wraps the target angles to a relative value from the current angles. This is done by subtracting the current from the target, normalizing it, and then adding the current angles back to it.- Parameters:
current- The current anglestarget- The target angles- Returns:
- The wrapped angles
-
calcRotationFromVec3d
public static Rotation calcRotationFromVec3d(net.minecraft.world.phys.Vec3 orig, net.minecraft.world.phys.Vec3 dest, Rotation current) Calculates the rotation from Vecdest to Vecorig and makes the return value relative to the specified current rotations.- Parameters:
orig- The origin positiondest- The destination positioncurrent- The current rotations- Returns:
- The rotation from the origin to the destination
- See Also:
-
calcLookDirectionFromRotation
Calculates the look vector for the specified yaw/pitch rotations.- Parameters:
rotation- The input rotation- Returns:
- Look vector for the rotation
-
calcVec3dFromRotation
Deprecated. -
reachable
- Parameters:
ctx- Context for the viewing entitypos- The target block position- Returns:
- The optional rotation
- See Also:
-
reachable
public static Optional<Rotation> reachable(IPlayerContext ctx, net.minecraft.core.BlockPos pos, boolean wouldSneak) -
reachable
public static Optional<Rotation> reachable(IPlayerContext ctx, net.minecraft.core.BlockPos pos, double blockReachDistance) Determines if the specified entity is able to reach the center of any of the sides of the specified block. It first checks if the block center is reachable, and if so, that rotation will be returned. If not, it will return the first center of a given side that is reachable. The return type will beOptional.empty()if the entity is unable to reach any of the sides of the block.- Parameters:
ctx- Context for the viewing entitypos- The target block positionblockReachDistance- The block reach distance of the entity- Returns:
- The optional rotation
-
reachable
public static Optional<Rotation> reachable(IPlayerContext ctx, net.minecraft.core.BlockPos pos, double blockReachDistance, boolean wouldSneak) -
reachableOffset
public static Optional<Rotation> reachableOffset(IPlayerContext ctx, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 offsetPos, double blockReachDistance, boolean wouldSneak) Determines if the specified entity is able to reach the specified block with the given offsetted position. The return type will beOptional.empty()if the entity is unable to reach the block with the offset applied.- Parameters:
ctx- Context for the viewing entitypos- The target block positionoffsetPos- The position of the block with the offset applied.blockReachDistance- The block reach distance of the entity- Returns:
- The optional rotation
-
reachableCenter
public static Optional<Rotation> reachableCenter(IPlayerContext ctx, net.minecraft.core.BlockPos pos, double blockReachDistance, boolean wouldSneak) Determines if the specified entity is able to reach the specified block where it is looking at the direct center of it's hitbox.- Parameters:
ctx- Context for the viewing entitypos- The target block positionblockReachDistance- The block reach distance of the entity- Returns:
- The optional rotation
-
reachable
@Deprecated public static Optional<Rotation> reachable(net.minecraft.client.player.LocalPlayer entity, net.minecraft.core.BlockPos pos, double blockReachDistance) Deprecated. -
reachable
@Deprecated public static Optional<Rotation> reachable(net.minecraft.client.player.LocalPlayer entity, net.minecraft.core.BlockPos pos, double blockReachDistance, boolean wouldSneak) Deprecated. -
reachableOffset
@Deprecated public static Optional<Rotation> reachableOffset(net.minecraft.world.entity.Entity entity, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 offsetPos, double blockReachDistance, boolean wouldSneak) Deprecated. -
reachableCenter
@Deprecated public static Optional<Rotation> reachableCenter(net.minecraft.world.entity.Entity entity, net.minecraft.core.BlockPos pos, double blockReachDistance, boolean wouldSneak) Deprecated.
-