Package baritone.api.utils
Class VecUtils
java.lang.Object
baritone.api.utils.VecUtils
- Since:
- 10/13/2018
- Author:
- Brady
-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.world.phys.Vec3calculateBlockCenter(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Calculates the center of the block at the specified position's bounding boxstatic doubledistanceToCenter(net.minecraft.core.BlockPos pos, double x, double y, double z) Gets the distance from the specified position to the assumed center of the specified block position.static doubleentityDistanceToCenter(net.minecraft.world.entity.Entity entity, net.minecraft.core.BlockPos pos) Gets the distance from the specified entity's position to the assumed center of the specified block position.static doubleentityFlatDistanceToCenter(net.minecraft.world.entity.Entity entity, net.minecraft.core.BlockPos pos) Gets the distance from the specified entity's position to the assumed center of the specified block position, ignoring the Y axis.static net.minecraft.world.phys.Vec3getBlockPosCenter(net.minecraft.core.BlockPos pos) Gets the assumed center position of the given block position.
-
Method Details
-
calculateBlockCenter
public static net.minecraft.world.phys.Vec3 calculateBlockCenter(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Calculates the center of the block at the specified position's bounding box- Parameters:
world- The world that the block is in, used to provide the bounding boxpos- The block position- Returns:
- The center of the block's bounding box
- See Also:
-
getBlockPosCenter
Gets the assumed center position of the given block position. This is done by adding 0.5 to the X, Y, and Z axes.TODO: We may want to consider replacing many usages of this method with #calculateBlockCenter(BlockPos)
- Parameters:
pos- The block position- Returns:
- The assumed center of the position
- See Also:
-
distanceToCenter
public static double distanceToCenter(net.minecraft.core.BlockPos pos, double x, double y, double z) Gets the distance from the specified position to the assumed center of the specified block position.- Parameters:
pos- The block positionx- The x posy- The y posz- The z pos- Returns:
- The distance from the assumed block center to the position
- See Also:
-
entityDistanceToCenter
public static double entityDistanceToCenter(net.minecraft.world.entity.Entity entity, net.minecraft.core.BlockPos pos) Gets the distance from the specified entity's position to the assumed center of the specified block position.- Parameters:
entity- The entitypos- The block position- Returns:
- The distance from the entity to the block's assumed center
- See Also:
-
entityFlatDistanceToCenter
public static double entityFlatDistanceToCenter(net.minecraft.world.entity.Entity entity, net.minecraft.core.BlockPos pos) Gets the distance from the specified entity's position to the assumed center of the specified block position, ignoring the Y axis.- Parameters:
entity- The entitypos- The block position- Returns:
- The horizontal distance from the entity to the block's assumed center
- See Also:
-