public class PositionUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PositionUtil.Line |
static class |
PositionUtil.LineSkewResult |
static interface |
PositionUtil.PathIterator2d |
Constructor and Description |
---|
PositionUtil() |
Modifier and Type | Method and Description |
---|---|
static net.minecraft.util.math.Vec3d |
closestPointOnLineToPoint(net.minecraft.util.math.Vec3d point,
net.minecraft.util.math.Vec3d linePoint,
net.minecraft.util.math.Vec3d lineVector) |
static PositionUtil.LineSkewResult |
findLineSkewPoint(PositionUtil.Line line,
net.minecraft.util.math.Vec3d start,
net.minecraft.util.math.Vec3d direction) |
static void |
forAllOnArc2d(int a,
int b,
int degrees,
PositionUtil.PathIterator2d iter) |
static void |
forAllOnPath(net.minecraft.util.math.BlockPos from,
net.minecraft.util.math.BlockPos to,
java.util.function.Consumer<net.minecraft.util.math.BlockPos> iter) |
static void |
forAllOnPath2d(int a1,
int b1,
int a2,
int b2,
PositionUtil.PathIterator2d iter) |
static com.google.common.collect.ImmutableList<net.minecraft.util.math.BlockPos> |
getAllOnEdge(net.minecraft.util.math.BlockPos min,
net.minecraft.util.math.BlockPos max)
Returns a list of all the block positions on the edge of the given box.
|
static com.google.common.collect.ImmutableList<net.minecraft.util.math.BlockPos> |
getAllOnPath(net.minecraft.util.math.BlockPos from,
net.minecraft.util.math.BlockPos to)
Returns a list of all the block positions between from and to (mostly).
|
static java.util.Set<net.minecraft.util.math.BlockPos> |
getCorners(net.minecraft.util.math.BlockPos min,
net.minecraft.util.math.BlockPos max) |
static int |
getCountOnEdge(net.minecraft.util.math.BlockPos min,
net.minecraft.util.math.BlockPos max)
Calculates the total number of blocks on the edge.
|
static java.lang.Integer |
getDirectFacingDistance(net.minecraft.util.math.BlockPos from,
net.minecraft.util.math.BlockPos to) |
static net.minecraft.util.EnumFacing |
getDirectFacingOffset(net.minecraft.util.math.BlockPos from,
net.minecraft.util.math.BlockPos to) |
static net.minecraft.util.Rotation |
getRotatedFacing(net.minecraft.util.EnumFacing from,
net.minecraft.util.EnumFacing to,
net.minecraft.util.EnumFacing.Axis axis)
Finds a rotation that
#rotateFacing(EnumFacing, Axis, Rotation) will use on "from" to get "to", with a
given axis around. |
static boolean |
isCorner(net.minecraft.util.math.BlockPos min,
net.minecraft.util.math.BlockPos max,
net.minecraft.util.math.BlockPos pos)
Checks to see if the given position is a corner for the box given by min and max
|
static boolean |
isNextTo(net.minecraft.util.math.BlockPos one,
net.minecraft.util.math.BlockPos two) |
static boolean |
isOnEdge(net.minecraft.util.math.BlockPos min,
net.minecraft.util.math.BlockPos max,
net.minecraft.util.math.BlockPos pos)
Checks to see if the given position is on one of the edges of the box given by min and max
|
static boolean |
isOnFace(net.minecraft.util.math.BlockPos min,
net.minecraft.util.math.BlockPos max,
net.minecraft.util.math.BlockPos pos)
Checks to see if the given position is on one of the faces of the box given by min and max
|
static net.minecraft.util.math.BlockPos |
randomBlockPos(java.util.Random rand,
net.minecraft.util.math.BlockPos size) |
static net.minecraft.util.math.BlockPos |
randomBlockPos(java.util.Random rand,
net.minecraft.util.math.BlockPos min,
net.minecraft.util.math.BlockPos max) |
static net.minecraft.util.EnumFacing |
rotateFacing(net.minecraft.util.EnumFacing from,
net.minecraft.util.EnumFacing.Axis axis,
net.minecraft.util.Rotation rotation)
Rotates a given
EnumFacing by the given rotation, in a given axis. |
static net.minecraft.util.math.BlockPos |
rotatePos(net.minecraft.util.math.Vec3i from,
net.minecraft.util.EnumFacing.Axis axis,
net.minecraft.util.Rotation rotation)
Rotates a given position by the given rotation, in a given axis.
|
static net.minecraft.util.math.Vec3d |
rotateVec(net.minecraft.util.math.Vec3d from,
net.minecraft.util.EnumFacing.Axis axis,
net.minecraft.util.Rotation rotation)
Rotates a given vector by the given rotation, in a given axis.
|
@Nullable public static net.minecraft.util.EnumFacing getDirectFacingOffset(net.minecraft.util.math.BlockPos from, net.minecraft.util.math.BlockPos to)
@Nullable public static java.lang.Integer getDirectFacingDistance(net.minecraft.util.math.BlockPos from, net.minecraft.util.math.BlockPos to)
getDirectFacingOffset(BlockPos, BlockPos)
returned null. The distance will be negative if
returned EnumFacing
is negative.public static java.util.Set<net.minecraft.util.math.BlockPos> getCorners(net.minecraft.util.math.BlockPos min, net.minecraft.util.math.BlockPos max)
public static boolean isCorner(net.minecraft.util.math.BlockPos min, net.minecraft.util.math.BlockPos max, net.minecraft.util.math.BlockPos pos)
min
- The minimum co-ordinate of the boxmax
- The maximum co-ordinate of the boxpos
- The position to testpublic static boolean isOnEdge(net.minecraft.util.math.BlockPos min, net.minecraft.util.math.BlockPos max, net.minecraft.util.math.BlockPos pos)
min
- The minimum co-ordinate of the boxmax
- The maximum co-ordinate of the boxpos
- The position to testpublic static boolean isOnFace(net.minecraft.util.math.BlockPos min, net.minecraft.util.math.BlockPos max, net.minecraft.util.math.BlockPos pos)
min
- The minimum co-ordinate of the boxmax
- The maximum co-ordinate of the boxpos
- The position to testpublic static boolean isNextTo(net.minecraft.util.math.BlockPos one, net.minecraft.util.math.BlockPos two)
public static net.minecraft.util.Rotation getRotatedFacing(net.minecraft.util.EnumFacing from, net.minecraft.util.EnumFacing to, net.minecraft.util.EnumFacing.Axis axis)
#rotateFacing(EnumFacing, Axis, Rotation)
will use on "from" to get "to", with a
given axis around.public static net.minecraft.util.EnumFacing rotateFacing(net.minecraft.util.EnumFacing from, net.minecraft.util.EnumFacing.Axis axis, net.minecraft.util.Rotation rotation)
EnumFacing
by the given rotation, in a given axis. This relies on the behaviour defined
in EnumFacing.rotateAround(Axis)
.public static net.minecraft.util.math.Vec3d rotateVec(net.minecraft.util.math.Vec3d from, net.minecraft.util.EnumFacing.Axis axis, net.minecraft.util.Rotation rotation)
#rotateFacing(EnumFacing, Axis, Rotation)
.public static net.minecraft.util.math.BlockPos rotatePos(net.minecraft.util.math.Vec3i from, net.minecraft.util.EnumFacing.Axis axis, net.minecraft.util.Rotation rotation)
#rotateFacing(EnumFacing, Axis, Rotation)
.public static PositionUtil.LineSkewResult findLineSkewPoint(PositionUtil.Line line, net.minecraft.util.math.Vec3d start, net.minecraft.util.math.Vec3d direction)
public static net.minecraft.util.math.Vec3d closestPointOnLineToPoint(net.minecraft.util.math.Vec3d point, net.minecraft.util.math.Vec3d linePoint, net.minecraft.util.math.Vec3d lineVector)
public static com.google.common.collect.ImmutableList<net.minecraft.util.math.BlockPos> getAllOnEdge(net.minecraft.util.math.BlockPos min, net.minecraft.util.math.BlockPos max)
public static int getCountOnEdge(net.minecraft.util.math.BlockPos min, net.minecraft.util.math.BlockPos max)
getAllOnEdge(BlockPos, BlockPos)
.size()
getAllOnEdge(BlockPos, BlockPos)
.public static com.google.common.collect.ImmutableList<net.minecraft.util.math.BlockPos> getAllOnPath(net.minecraft.util.math.BlockPos from, net.minecraft.util.math.BlockPos to)
Does not return the "from" co-ordinate, but does include the "to" co-ordinate (provided that from does not equal to)
public static void forAllOnPath(net.minecraft.util.math.BlockPos from, net.minecraft.util.math.BlockPos to, java.util.function.Consumer<net.minecraft.util.math.BlockPos> iter)
public static void forAllOnPath2d(int a1, int b1, int a2, int b2, PositionUtil.PathIterator2d iter)
public static void forAllOnArc2d(int a, int b, int degrees, PositionUtil.PathIterator2d iter)
public static net.minecraft.util.math.BlockPos randomBlockPos(java.util.Random rand, net.minecraft.util.math.BlockPos size)
public static net.minecraft.util.math.BlockPos randomBlockPos(java.util.Random rand, net.minecraft.util.math.BlockPos min, net.minecraft.util.math.BlockPos max)