mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-18 01:05:00 +00:00
Deprecate the StableAPI annotations, switch to JB annotations
This commit is contained in:
96 files changed
+1079
-762
No files matched your search
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
package com.falsepattern.lib.compat;
|
||||
|
||||
import com.falsepattern.lib.StableAPI;
|
||||
import com.falsepattern.lib.util.MathUtil;
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
import lombok.Getter;
|
||||
@@ -47,12 +46,10 @@ import static net.minecraft.util.EnumFacing.UP;
|
||||
import static net.minecraft.util.EnumFacing.WEST;
|
||||
|
||||
@Immutable
|
||||
@StableAPI(since = "0.6.0")
|
||||
public class BlockPos extends Vec3i {
|
||||
/**
|
||||
* An immutable block pos with zero as all coordinates.
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static final BlockPos ORIGIN = new BlockPos(0, 0, 0);
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final int NUM_X_BITS = 1 + MathUtil.log2(MathUtil.smallestEncompassingPowerOfTwo(30000000));
|
||||
@@ -64,27 +61,22 @@ public class BlockPos extends Vec3i {
|
||||
private static final long Z_MASK = (1L << NUM_Z_BITS) - 1L;
|
||||
private static final long X_MASK = (1L << NUM_X_BITS) - 1L;
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos(@NonNull Entity source) {
|
||||
this(source.posX, source.posY, source.posZ);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos(double x, double y, double z) {
|
||||
super(x, y, z);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos(@NonNull Vec3 vec) {
|
||||
this(vec.xCoord, vec.yCoord, vec.zCoord);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos(@NonNull Vec3i source) {
|
||||
this(source.getX(), source.getY(), source.getZ());
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos(int x, int y, int z) {
|
||||
super(x, y, z);
|
||||
}
|
||||
@@ -92,7 +84,6 @@ public class BlockPos extends Vec3i {
|
||||
/**
|
||||
* Create a BlockPos from a serialized long value (created by toLong)
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static BlockPos fromLong(long serialized) {
|
||||
return new BlockPos((int) (serialized << 64 - X_SHIFT - NUM_X_BITS >> 64 - NUM_X_BITS),
|
||||
(int) (serialized << 64 - Y_SHIFT - NUM_Y_BITS >> 64 - NUM_Y_BITS),
|
||||
@@ -114,7 +105,6 @@ public class BlockPos extends Vec3i {
|
||||
* @see #getAllInBox(int, int, int, int, int, int)
|
||||
* @see #getAllInBoxMutable(BlockPos, BlockPos)
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static Iterable<BlockPos> getAllInBox(@NonNull BlockPos from, @NonNull BlockPos to) {
|
||||
return getAllInBox(Math.min(from.getX(), to.getX()),
|
||||
Math.min(from.getY(), to.getY()),
|
||||
@@ -143,7 +133,6 @@ public class BlockPos extends Vec3i {
|
||||
* @see #getAllInBox(BlockPos, BlockPos)
|
||||
* @see #getAllInBoxMutable(BlockPos, BlockPos)
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static Iterable<BlockPos> getAllInBox(final int x0, final int y0, final int z0, final int x1, final int y1, final int z1) {
|
||||
return () -> new AbstractIterator<BlockPos>() {
|
||||
private boolean first = true;
|
||||
@@ -194,7 +183,6 @@ public class BlockPos extends Vec3i {
|
||||
* @see #getAllInBox(int, int, int, int, int, int)
|
||||
* @see #getAllInBoxMutable(BlockPos, BlockPos)
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static Iterable<BlockPos.MutableBlockPos> getAllInBoxMutable(@NonNull BlockPos from, @NonNull BlockPos to) {
|
||||
return getAllInBoxMutable(Math.min(from.getX(), to.getX()),
|
||||
Math.min(from.getY(), to.getY()),
|
||||
@@ -224,7 +212,6 @@ public class BlockPos extends Vec3i {
|
||||
* @see #getAllInBox(int, int, int, int, int, int)
|
||||
* @see #getAllInBoxMutable(BlockPos, BlockPos)
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static Iterable<BlockPos.MutableBlockPos> getAllInBoxMutable(final int x0, final int y0, final int z0, final int x1, final int y1, final int z1) {
|
||||
return () -> new AbstractIterator<MutableBlockPos>() {
|
||||
private MutableBlockPos pos;
|
||||
@@ -253,7 +240,6 @@ public class BlockPos extends Vec3i {
|
||||
};
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public long toLong() {
|
||||
return ((long) x & X_MASK) << X_SHIFT | ((long) y & Y_MASK) << Y_SHIFT | ((long) z & Z_MASK);
|
||||
}
|
||||
@@ -261,7 +247,6 @@ public class BlockPos extends Vec3i {
|
||||
/**
|
||||
* Add the given coordinates to the coordinates of this BlockPos
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public BlockPos add(double x, double y, double z) {
|
||||
if (x == 0.0D && y == 0.0D && z == 0.0D) {
|
||||
return this;
|
||||
@@ -272,7 +257,6 @@ public class BlockPos extends Vec3i {
|
||||
/**
|
||||
* Add the given Vector to this BlockPos
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public BlockPos add(@NonNull Vec3i vec) {
|
||||
return add(vec.getX(), vec.getY(), vec.getZ());
|
||||
}
|
||||
@@ -280,7 +264,6 @@ public class BlockPos extends Vec3i {
|
||||
/**
|
||||
* Add the given coordinates to the coordinates of this BlockPos
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public BlockPos add(int x, int y, int z) {
|
||||
if (x == 0 && y == 0 && z == 0) {
|
||||
return this;
|
||||
@@ -291,22 +274,18 @@ public class BlockPos extends Vec3i {
|
||||
/**
|
||||
* Subtract the given Vector from this BlockPos
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public BlockPos subtract(@NonNull Vec3i vec) {
|
||||
return add(-vec.getX(), -vec.getY(), -vec.getZ());
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos up() {
|
||||
return up(1);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos up(int blocks) {
|
||||
return offset(UP, blocks);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos offset(@NonNull EnumFacing facing, int blocks) {
|
||||
if (blocks == 0) {
|
||||
return this;
|
||||
@@ -316,73 +295,61 @@ public class BlockPos extends Vec3i {
|
||||
z + facing.getFrontOffsetZ() * blocks);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos down() {
|
||||
return down(1);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos down(int blocks) {
|
||||
return offset(DOWN, blocks);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos north() {
|
||||
return north(1);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos north(int blocks) {
|
||||
return offset(NORTH, blocks);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos south() {
|
||||
return south(1);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos south(int blocks) {
|
||||
return offset(SOUTH, blocks);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos west() {
|
||||
return west(1);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos west(int blocks) {
|
||||
return offset(WEST, blocks);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos east() {
|
||||
return east(1);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos east(int blocks) {
|
||||
return offset(EAST, blocks);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos offset(@NonNull EnumFacing facing) {
|
||||
return offset(facing, 1);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos rotate(@NonNull Rotation rotation) {
|
||||
switch (rotation) {
|
||||
case NONE:
|
||||
default:
|
||||
return this;
|
||||
case CLOCKWISE_90:
|
||||
return new BlockPos(-this.getZ(), this.getY(), this.getX());
|
||||
case CLOCKWISE_180:
|
||||
return new BlockPos(-this.getX(), this.getY(), -this.getZ());
|
||||
case COUNTERCLOCKWISE_90:
|
||||
return new BlockPos(this.getZ(), this.getY(), -this.getX());
|
||||
case NONE:
|
||||
default:
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,14 +360,15 @@ public class BlockPos extends Vec3i {
|
||||
x * vec.getY() - y * vec.getX());
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos toImmutable() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Setter(onMethod_ = @StableAPI.Expose)
|
||||
@Getter(onMethod_ = @StableAPI.Expose)
|
||||
@StableAPI(since = "0.10.0")
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public static class MutableBlockPos extends BlockPos {
|
||||
/**
|
||||
* Mutable X Coordinate
|
||||
@@ -415,17 +383,14 @@ public class BlockPos extends Vec3i {
|
||||
*/
|
||||
protected int z;
|
||||
|
||||
@StableAPI.Expose
|
||||
public MutableBlockPos() {
|
||||
this(ORIGIN);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public MutableBlockPos(@NonNull BlockPos blockPos) {
|
||||
this(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public MutableBlockPos(int x, int y, int z) {
|
||||
super(ORIGIN);
|
||||
this.x = x;
|
||||
@@ -454,7 +419,6 @@ public class BlockPos extends Vec3i {
|
||||
}
|
||||
|
||||
@Override
|
||||
@StableAPI.Expose
|
||||
public BlockPos toImmutable() {
|
||||
return new BlockPos(this);
|
||||
}
|
||||
@@ -463,12 +427,10 @@ public class BlockPos extends Vec3i {
|
||||
return this.setPos(entity.posX, entity.posY, entity.posZ);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos.MutableBlockPos setPos(double x, double y, double z) {
|
||||
return setPos(MathUtil.floor(x), MathUtil.floor(y), MathUtil.floor(z));
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos.MutableBlockPos setPos(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -476,17 +438,14 @@ public class BlockPos extends Vec3i {
|
||||
return this;
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos.MutableBlockPos setPos(@NonNull Vec3i vec) {
|
||||
return this.setPos(vec.getX(), vec.getY(), vec.getZ());
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos.MutableBlockPos move(@NonNull EnumFacing facing) {
|
||||
return this.move(facing, 1);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public BlockPos.MutableBlockPos move(@NonNull EnumFacing facing, int blocks) {
|
||||
return this.setPos(x + facing.getFrontOffsetX() * blocks,
|
||||
y + facing.getFrontOffsetY() * blocks,
|
||||
@@ -494,7 +453,9 @@ public class BlockPos extends Vec3i {
|
||||
}
|
||||
}
|
||||
|
||||
@StableAPI(since = "0.10.0")
|
||||
/**
|
||||
* @since 0.10.0
|
||||
*/
|
||||
public static final class PooledMutableBlockPos extends BlockPos.MutableBlockPos {
|
||||
private static final List<BlockPos.PooledMutableBlockPos> POOL = new ArrayList<>();
|
||||
private boolean released;
|
||||
@@ -503,12 +464,10 @@ public class BlockPos extends Vec3i {
|
||||
super(x, y, z);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public static BlockPos.PooledMutableBlockPos retain() {
|
||||
return retain(0, 0, 0);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public static BlockPos.PooledMutableBlockPos retain(int x, int y, int z) {
|
||||
synchronized (POOL) {
|
||||
if (!POOL.isEmpty()) {
|
||||
@@ -523,17 +482,14 @@ public class BlockPos extends Vec3i {
|
||||
return new BlockPos.PooledMutableBlockPos(x, y, z);
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public static BlockPos.PooledMutableBlockPos retain(double x, double y, double z) {
|
||||
return retain(MathUtil.floor(x), MathUtil.floor(y), MathUtil.floor(z));
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public static BlockPos.PooledMutableBlockPos retain(@NonNull Vec3i vec) {
|
||||
return retain(vec.getX(), vec.getY(), vec.getZ());
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public void release() {
|
||||
synchronized (POOL) {
|
||||
if (POOL.size() < 100) {
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
package com.falsepattern.lib.compat;
|
||||
|
||||
import com.falsepattern.lib.StableAPI;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
@@ -37,17 +36,14 @@ import javax.annotation.concurrent.Immutable;
|
||||
@Immutable
|
||||
@EqualsAndHashCode
|
||||
@AllArgsConstructor
|
||||
@StableAPI(since = "0.6.0")
|
||||
public class ChunkPos {
|
||||
/**
|
||||
* The x position of the chunk.
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public final int x;
|
||||
/**
|
||||
* The z position of the chunk.
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public final int z;
|
||||
|
||||
/**
|
||||
@@ -55,7 +51,6 @@ public class ChunkPos {
|
||||
*
|
||||
* @param blockPos the block pos
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public ChunkPos(@NonNull BlockPos blockPos) {
|
||||
x = blockPos.getX() >> 4;
|
||||
z = blockPos.getZ() >> 4;
|
||||
@@ -69,7 +64,6 @@ public class ChunkPos {
|
||||
*
|
||||
* @return the unique chunk long
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static long asLong(int x, int z) {
|
||||
return (long) x & 0xFFFFFFFFL | ((long) z & 0xFFFFFFFFL) << 32;
|
||||
}
|
||||
@@ -81,7 +75,6 @@ public class ChunkPos {
|
||||
*
|
||||
* @return the distance sq
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public double getDistanceSq(@NonNull Entity entity) {
|
||||
val dX = ((x << 4) + 8) - entity.posX;
|
||||
val dY = ((z << 4) + 8) - entity.posZ;
|
||||
@@ -93,7 +86,6 @@ public class ChunkPos {
|
||||
*
|
||||
* @return the x start
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public int getXStart() {
|
||||
return x << 4;
|
||||
}
|
||||
@@ -103,7 +95,6 @@ public class ChunkPos {
|
||||
*
|
||||
* @return the z start
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public int getZStart() {
|
||||
return z << 4;
|
||||
}
|
||||
@@ -113,7 +104,6 @@ public class ChunkPos {
|
||||
*
|
||||
* @return the x end
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public int getXEnd() {
|
||||
return (x << 4) + 15;
|
||||
}
|
||||
@@ -123,7 +113,6 @@ public class ChunkPos {
|
||||
*
|
||||
* @return the z end
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public int getZEnd() {
|
||||
return (z << 4) + 15;
|
||||
}
|
||||
@@ -137,7 +126,6 @@ public class ChunkPos {
|
||||
*
|
||||
* @return the relative block position
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public BlockPos getBlock(int x, int y, int z) {
|
||||
return new BlockPos((this.x << 4) + x, y, (this.z << 4) + z);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
package com.falsepattern.lib.compat;
|
||||
|
||||
import com.falsepattern.lib.StableAPI;
|
||||
import lombok.NonNull;
|
||||
import lombok.val;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -39,9 +38,10 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* A functional equivalent to GuiLabel present in Minecraft 1.12.
|
||||
*
|
||||
* @since 0.8.0
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@StableAPI(since = "0.8.0")
|
||||
public class GuiLabel extends Gui {
|
||||
private final List<String> lines = new ArrayList<>();
|
||||
private final FontRenderer fontRenderer;
|
||||
@@ -49,32 +49,26 @@ public class GuiLabel extends Gui {
|
||||
/**
|
||||
* The id of the label.
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public int id;
|
||||
/**
|
||||
* The x position of the label.
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public int x;
|
||||
/**
|
||||
* The y position of the label.
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public int y;
|
||||
/**
|
||||
* The visibility of the label.
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public boolean visible = true;
|
||||
/**
|
||||
* The label width.
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
protected int width;
|
||||
/**
|
||||
* The label height.
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
protected int height;
|
||||
private boolean centered = false;
|
||||
|
||||
@@ -89,7 +83,6 @@ public class GuiLabel extends Gui {
|
||||
* @param height the height
|
||||
* @param textColour the text colour
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public GuiLabel(@NonNull FontRenderer fontRenderer, int id, int x, int y, int width, int height, int textColour) {
|
||||
this.fontRenderer = fontRenderer;
|
||||
this.id = id;
|
||||
@@ -105,7 +98,6 @@ public class GuiLabel extends Gui {
|
||||
*
|
||||
* @param text string to add
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public void addLine(@NonNull String text) {
|
||||
lines.add(I18n.format(text));
|
||||
}
|
||||
@@ -115,7 +107,6 @@ public class GuiLabel extends Gui {
|
||||
*
|
||||
* @return the GuiLabel itself
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public GuiLabel setCentered() {
|
||||
centered = true;
|
||||
return this;
|
||||
@@ -129,7 +120,6 @@ public class GuiLabel extends Gui {
|
||||
* @param mouseX the mouse x
|
||||
* @param mouseY the mouse y
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public void drawLabel(@NonNull Minecraft minecraft, int mouseX, int mouseY) {
|
||||
if (!visible) {
|
||||
return;
|
||||
|
||||
@@ -21,26 +21,22 @@
|
||||
*/
|
||||
package com.falsepattern.lib.compat;
|
||||
|
||||
import com.falsepattern.lib.StableAPI;
|
||||
import lombok.NonNull;
|
||||
import lombok.val;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
@StableAPI(since = "0.6.0")
|
||||
public enum Rotation {
|
||||
@StableAPI.Expose NONE,
|
||||
@StableAPI.Expose CLOCKWISE_90,
|
||||
@StableAPI.Expose CLOCKWISE_180,
|
||||
@StableAPI.Expose COUNTERCLOCKWISE_90;
|
||||
NONE,
|
||||
CLOCKWISE_90,
|
||||
CLOCKWISE_180,
|
||||
COUNTERCLOCKWISE_90;
|
||||
|
||||
@StableAPI.Expose
|
||||
public Rotation add(@NonNull Rotation rotation) {
|
||||
val values = Rotation.values();
|
||||
return values[(ordinal() + rotation.ordinal()) % values.length];
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public EnumFacing rotate(@NonNull EnumFacing facing) {
|
||||
if (facing == EnumFacing.UP || facing == EnumFacing.DOWN) {
|
||||
return facing;
|
||||
@@ -90,7 +86,6 @@ public enum Rotation {
|
||||
}
|
||||
}
|
||||
|
||||
@StableAPI.Expose
|
||||
public int rotate(int x, int z) {
|
||||
switch (this) {
|
||||
case CLOCKWISE_90:
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
package com.falsepattern.lib.compat;
|
||||
|
||||
import com.falsepattern.lib.StableAPI;
|
||||
import com.falsepattern.lib.util.MathUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -38,19 +37,14 @@ import javax.annotation.concurrent.Immutable;
|
||||
@Immutable
|
||||
@EqualsAndHashCode
|
||||
@AllArgsConstructor
|
||||
@StableAPI(since = "0.6.0")
|
||||
public class Vec3i implements Comparable<Vec3i> {
|
||||
/**
|
||||
* A static zero vector
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public static final Vec3i NULL_VECTOR = new Vec3i(0, 0, 0);
|
||||
|
||||
@StableAPI.Expose
|
||||
protected final int x;
|
||||
@StableAPI.Expose
|
||||
protected final int y;
|
||||
@StableAPI.Expose
|
||||
protected final int z;
|
||||
|
||||
/**
|
||||
@@ -60,7 +54,6 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
* @param y the y
|
||||
* @param z the z
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public Vec3i(double x, double y, double z) {
|
||||
this(MathUtil.floor(x), MathUtil.floor(y), MathUtil.floor(z));
|
||||
}
|
||||
@@ -77,7 +70,6 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
*
|
||||
* @return the new resulting vector
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public Vec3i crossProduct(@NonNull Vec3i vec) {
|
||||
return new Vec3i(y * vec.getZ() - z * vec.getY(),
|
||||
z * vec.getX() - x * vec.getZ(),
|
||||
@@ -93,7 +85,6 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
*
|
||||
* @return the distance
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public double getDistance(int x, int y, int z) {
|
||||
return Math.sqrt(distanceSq(x, y, z));
|
||||
}
|
||||
@@ -107,7 +98,6 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
*
|
||||
* @return the square distance
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public double distanceSq(int x, int y, int z) {
|
||||
val dX = this.x - x;
|
||||
val dY = this.y - y;
|
||||
@@ -122,7 +112,6 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
*
|
||||
* @return the square distance
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public double distanceSq(@NonNull Vec3i vec) {
|
||||
return distanceSq(vec.getX(), vec.getY(), vec.getZ());
|
||||
}
|
||||
@@ -136,7 +125,6 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||
*
|
||||
* @return the square distance to center
|
||||
*/
|
||||
@StableAPI.Expose
|
||||
public double distanceSqToCenter(double x, double y, double z) {
|
||||
val dX = this.x + 0.5D - x;
|
||||
val dY = this.y + 0.5D - y;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* This file is part of FalsePatternLib.
|
||||
*
|
||||
* Copyright (C) 2022-2025 FalsePattern
|
||||
* All Rights Reserved
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* FalsePatternLib is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, only version 3 of the License.
|
||||
*
|
||||
* FalsePatternLib is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with FalsePatternLib. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 0.6.0
|
||||
*/
|
||||
package com.falsepattern.lib.compat;
|
||||
Reference in new issue
Block a user