public final class VecUtils extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static net.minecraft.util.math.Vec3d |
calculateBlockCenter(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
Calculates the center of the block at the specified position's bounding box
|
static double |
distanceToCenter(net.minecraft.util.math.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 double |
entityDistanceToCenter(net.minecraft.entity.Entity entity,
net.minecraft.util.math.BlockPos pos)
Gets the distance from the specified entity's position to the assumed
center of the specified block position.
|
static double |
entityFlatDistanceToCenter(net.minecraft.entity.Entity entity,
net.minecraft.util.math.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.util.math.Vec3d |
getBlockPosCenter(net.minecraft.util.math.BlockPos pos)
Gets the assumed center position of the given block position.
|
public static net.minecraft.util.math.Vec3d calculateBlockCenter(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos)
world
- The world that the block is in, used to provide the bounding boxpos
- The block positiongetBlockPosCenter(BlockPos)
public static net.minecraft.util.math.Vec3d getBlockPosCenter(net.minecraft.util.math.BlockPos pos)
TODO: We may want to consider replacing many usages of this method with #calculateBlockCenter(BlockPos)
pos
- The block positioncalculateBlockCenter(World, BlockPos)
public static double distanceToCenter(net.minecraft.util.math.BlockPos pos, double x, double y, double z)
pos
- The block positionx
- The x posy
- The y posz
- The z posgetBlockPosCenter(BlockPos)
public static double entityDistanceToCenter(net.minecraft.entity.Entity entity, net.minecraft.util.math.BlockPos pos)
entity
- The entitypos
- The block positiongetBlockPosCenter(BlockPos)
public static double entityFlatDistanceToCenter(net.minecraft.entity.Entity entity, net.minecraft.util.math.BlockPos pos)
entity
- The entitypos
- The block positiongetBlockPosCenter(BlockPos)