rearrange fields and constructors

This commit is contained in:
Leijurv 2018-10-16 20:05:18 -07:00
parent 3aa8f51015
commit 11ed8a2f21
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 17 additions and 24 deletions

View File

@ -30,14 +30,13 @@ import java.util.Optional;
* @since 8/25/2018 * @since 8/25/2018
*/ */
public final class RayTraceUtils { public final class RayTraceUtils {
private RayTraceUtils() {}
/** /**
* The {@link Minecraft} instance * The {@link Minecraft} instance
*/ */
private static final Minecraft mc = Minecraft.getMinecraft(); private static final Minecraft mc = Minecraft.getMinecraft();
private RayTraceUtils() {}
/** /**
* Simulates a "vanilla" raytrace. A RayTraceResult returned by this method * Simulates a "vanilla" raytrace. A RayTraceResult returned by this method
* will be that of the next render pass given that the local player's yaw and * will be that of the next render pass given that the local player's yaw and

View File

@ -31,8 +31,6 @@ import java.util.Optional;
*/ */
public final class RotationUtils { public final class RotationUtils {
private RotationUtils() {}
/** /**
* The {@link Minecraft} instance * The {@link Minecraft} instance
*/ */
@ -60,6 +58,8 @@ public final class RotationUtils {
new Vec3d(1, 0.5, 0.5) // East new Vec3d(1, 0.5, 0.5) // East
}; };
private RotationUtils() {}
/** /**
* Clamps the specified pitch value between -90 and 90. * Clamps the specified pitch value between -90 and 90.
* *

View File

@ -30,21 +30,19 @@ import net.minecraft.util.math.Vec3d;
* @since 10/13/2018 * @since 10/13/2018
*/ */
public final class VecUtils { public final class VecUtils {
private VecUtils() {}
/** /**
* The {@link Minecraft} instance * The {@link Minecraft} instance
*/ */
private static final Minecraft mc = Minecraft.getMinecraft(); private static final Minecraft mc = Minecraft.getMinecraft();
private VecUtils() {}
/** /**
* Calculates the center of the block at the specified position's bounding box * Calculates the center of the block at the specified position's bounding box
* *
* @see #getBlockPosCenter(BlockPos)
*
* @param pos The block position * @param pos The block position
* @return The center of the block's bounding box * @return The center of the block's bounding box
* @see #getBlockPosCenter(BlockPos)
*/ */
public static Vec3d calculateBlockCenter(BlockPos pos) { public static Vec3d calculateBlockCenter(BlockPos pos) {
IBlockState b = mc.world.getBlockState(pos); IBlockState b = mc.world.getBlockState(pos);
@ -68,10 +66,9 @@ public final class VecUtils {
* <p> * <p>
* TODO: We may want to consider replacing many usages of this method with #calculateBlockCenter(BlockPos) * TODO: We may want to consider replacing many usages of this method with #calculateBlockCenter(BlockPos)
* *
* @see #calculateBlockCenter(BlockPos)
*
* @param pos The block position * @param pos The block position
* @return The assumed center of the position * @return The assumed center of the position
* @see #calculateBlockCenter(BlockPos)
*/ */
public static Vec3d getBlockPosCenter(BlockPos pos) { public static Vec3d getBlockPosCenter(BlockPos pos) {
return new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); return new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
@ -80,13 +77,12 @@ public final class VecUtils {
/** /**
* Gets the distance from the specified position to the assumed center of the specified block position. * Gets the distance from the specified position to the assumed center of the specified block position.
* *
* @see #getBlockPosCenter(BlockPos)
*
* @param pos The block position * @param pos The block position
* @param x The x pos * @param x The x pos
* @param y The y pos * @param y The y pos
* @param z The z pos * @param z The z pos
* @return The distance from the assumed block center to the position * @return The distance from the assumed block center to the position
* @see #getBlockPosCenter(BlockPos)
*/ */
public static double distanceToCenter(BlockPos pos, double x, double y, double z) { public static double distanceToCenter(BlockPos pos, double x, double y, double z) {
Vec3d center = getBlockPosCenter(pos); Vec3d center = getBlockPosCenter(pos);
@ -100,11 +96,10 @@ public final class VecUtils {
* Gets the distance from the specified entity's position to the assumed * Gets the distance from the specified entity's position to the assumed
* center of the specified block position. * center of the specified block position.
* *
* @see #getBlockPosCenter(BlockPos)
*
* @param entity The entity * @param entity The entity
* @param pos The block position * @param pos The block position
* @return The distance from the entity to the block's assumed center * @return The distance from the entity to the block's assumed center
* @see #getBlockPosCenter(BlockPos)
*/ */
public static double entityDistanceToCenter(Entity entity, BlockPos pos) { public static double entityDistanceToCenter(Entity entity, BlockPos pos) {
return distanceToCenter(pos, entity.posX, entity.posY, entity.posZ); return distanceToCenter(pos, entity.posX, entity.posY, entity.posZ);
@ -114,11 +109,10 @@ public final class VecUtils {
* Gets the distance from the specified entity's position to the assumed * Gets the distance from the specified entity's position to the assumed
* center of the specified block position, ignoring the Y axis. * center of the specified block position, ignoring the Y axis.
* *
* @see #getBlockPosCenter(BlockPos)
*
* @param entity The entity * @param entity The entity
* @param pos The block position * @param pos The block position
* @return The horizontal distance from the entity to the block's assumed center * @return The horizontal distance from the entity to the block's assumed center
* @see #getBlockPosCenter(BlockPos)
*/ */
public static double entityFlatDistanceToCenter(Entity entity, BlockPos pos) { public static double entityFlatDistanceToCenter(Entity entity, BlockPos pos) {
return distanceToCenter(pos, entity.posX, pos.getY() + 0.5, entity.posZ); return distanceToCenter(pos, entity.posX, pos.getY() + 0.5, entity.posZ);