mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 06:48:34 +00:00
resolve conflicts
This commit is contained in:
@ -21,30 +21,36 @@ package com.sk89q.worldedit.math;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import com.google.common.collect.ComparisonChain;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* An immutable 3-dimensional vector.
|
||||
*/
|
||||
public class BlockVector3 {
|
||||
public abstract class BlockVector3 {
|
||||
|
||||
public static final BlockVector3 ZERO = new BlockVector3(0, 0, 0);
|
||||
public static final BlockVector3 UNIT_X = new BlockVector3(1, 0, 0);
|
||||
public static final BlockVector3 UNIT_Y = new BlockVector3(0, 1, 0);
|
||||
public static final BlockVector3 UNIT_Z = new BlockVector3(0, 0, 1);
|
||||
public static final BlockVector3 UNIT_MINUS_X = new BlockVector3(-1, 0, 0);
|
||||
public static final BlockVector3 UNIT_MINUS_Y = new BlockVector3(0, -1, 0);
|
||||
public static final BlockVector3 UNIT_MINUS_Z = new BlockVector3(0, 0, -1);
|
||||
public static final BlockVector3 ONE = new BlockVector3(1, 1, 1);
|
||||
public static final BlockVector3 ZERO = BlockVector3.at(0, 0, 0);
|
||||
public static final BlockVector3 UNIT_X = BlockVector3.at(1, 0, 0);
|
||||
public static final BlockVector3 UNIT_Y = BlockVector3.at(0, 1, 0);
|
||||
public static final BlockVector3 UNIT_Z = BlockVector3.at(0, 0, 1);
|
||||
public static final BlockVector3 UNIT_MINUS_X = BlockVector3.at(-1, 0, 0);
|
||||
public static final BlockVector3 UNIT_MINUS_Y = BlockVector3.at(0, -1, 0);
|
||||
public static final BlockVector3 UNIT_MINUS_Z = BlockVector3.at(0, 0, -1);
|
||||
public static final BlockVector3 ONE = BlockVector3.at(1, 1, 1);
|
||||
|
||||
public static BlockVector3 at(double x, double y, double z) {
|
||||
return at((int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z));
|
||||
}
|
||||
|
||||
public static BlockVector3 at(int x, int y, int z) {
|
||||
return new BlockVector3(x, y, z);
|
||||
return new BlockVector3Imp(x, y, z);
|
||||
}
|
||||
|
||||
// thread-safe initialization idiom
|
||||
@ -65,23 +71,6 @@ public class BlockVector3 {
|
||||
return YzxOrderComparator.YZX_ORDER;
|
||||
}
|
||||
|
||||
protected int x, y, z;
|
||||
|
||||
protected BlockVector3(){}
|
||||
|
||||
/**
|
||||
* Construct an instance.
|
||||
*
|
||||
* @param x the X coordinate
|
||||
* @param y the Y coordinate
|
||||
* @param z the Z coordinate
|
||||
*/
|
||||
protected BlockVector3(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public MutableBlockVector3 setComponents(double x, double y, double z) {
|
||||
return new MutableBlockVector3((int) x, (int) y, (int) z);
|
||||
}
|
||||
@ -91,37 +80,71 @@ public class BlockVector3 {
|
||||
}
|
||||
|
||||
public MutableBlockVector3 mutX(double x) {
|
||||
return new MutableBlockVector3((int) x, y, z);
|
||||
return new MutableBlockVector3((int) x, getY(), getZ());
|
||||
}
|
||||
|
||||
public MutableBlockVector3 mutY(double y) {
|
||||
return new MutableBlockVector3(x, (int) y, z);
|
||||
return new MutableBlockVector3(getX(), (int) y, getZ());
|
||||
}
|
||||
|
||||
public MutableBlockVector3 mutZ(double z) {
|
||||
return new MutableBlockVector3(x, y, (int) z);
|
||||
return new MutableBlockVector3(getX(), getY(), (int) z);
|
||||
}
|
||||
|
||||
public MutableBlockVector3 mutX(int x) {
|
||||
return new MutableBlockVector3(x, y, z);
|
||||
return new MutableBlockVector3(x, getY(), getZ());
|
||||
}
|
||||
|
||||
public MutableBlockVector3 mutY(int y) {
|
||||
return new MutableBlockVector3(x, y, z);
|
||||
return new MutableBlockVector3(getX(), y, getZ());
|
||||
}
|
||||
|
||||
public MutableBlockVector3 mutZ(int z) {
|
||||
return new MutableBlockVector3(x, y, z);
|
||||
return new MutableBlockVector3(getX(), getY(), z);
|
||||
}
|
||||
|
||||
public BlockVector3 toImmutable() {
|
||||
return BlockVector3.at(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get the BlockVector3 to the north<br>
|
||||
// * Normal use you would use north(this),
|
||||
// * To avoid constructing a new Vector, pass e.g. north(some MutableBlockVector3)
|
||||
// * There is no gaurantee it will use this provided vector
|
||||
// * @param orDefault the vector to use as the result<br>
|
||||
// * @return BlockVector3
|
||||
// */
|
||||
// public BlockVector3 north(BlockVector3 orDefault) {
|
||||
// return orDefault.setComponents(getX(), getY(), getZ() - 1);
|
||||
// }
|
||||
//
|
||||
// public BlockVector3 east(BlockVector3 orDefault) {
|
||||
// return orDefault.setComponents(getX() + 1, getY(), getZ());
|
||||
// }
|
||||
//
|
||||
// public BlockVector3 south(BlockVector3 orDefault) {
|
||||
// return orDefault.setComponents(getX(), getY(), getZ() + 1);
|
||||
// }
|
||||
//
|
||||
// public BlockVector3 west(BlockVector3 orDefault) {
|
||||
// return orDefault.setComponents(getX() - 1, getY(), getZ());
|
||||
// }
|
||||
//
|
||||
// public BlockVector3 up(BlockVector3 orDefault) {
|
||||
// return orDefault.setComponents(getX(), getY() + 1, getZ());
|
||||
// }
|
||||
//
|
||||
// public BlockVector3 down(BlockVector3 orDefault) {
|
||||
// return orDefault.setComponents(getX(), getY() - 1, getZ());
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the X coordinate.
|
||||
*
|
||||
* @return the x coordinate
|
||||
*/
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
public abstract int getX();
|
||||
|
||||
/**
|
||||
* Get the X coordinate.
|
||||
@ -129,7 +152,7 @@ public class BlockVector3 {
|
||||
* @return the x coordinate
|
||||
*/
|
||||
public int getBlockX() {
|
||||
return x;
|
||||
return getX();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,7 +162,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 withX(int x) {
|
||||
return BlockVector3.at(x, y, z);
|
||||
return BlockVector3.at(x, getY(), getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,9 +170,7 @@ public class BlockVector3 {
|
||||
*
|
||||
* @return the y coordinate
|
||||
*/
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
public abstract int getY();
|
||||
|
||||
/**
|
||||
* Get the Y coordinate.
|
||||
@ -157,7 +178,7 @@ public class BlockVector3 {
|
||||
* @return the y coordinate
|
||||
*/
|
||||
public int getBlockY() {
|
||||
return y;
|
||||
return getY();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,7 +188,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 withY(int y) {
|
||||
return BlockVector3.at(x, y, z);
|
||||
return BlockVector3.at(getX(), y, getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,9 +196,7 @@ public class BlockVector3 {
|
||||
*
|
||||
* @return the z coordinate
|
||||
*/
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
public abstract int getZ();
|
||||
|
||||
/**
|
||||
* Get the Z coordinate.
|
||||
@ -185,7 +204,7 @@ public class BlockVector3 {
|
||||
* @return the z coordinate
|
||||
*/
|
||||
public int getBlockZ() {
|
||||
return z;
|
||||
return getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -195,7 +214,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 withZ(int z) {
|
||||
return BlockVector3.at(x, y, z);
|
||||
return BlockVector3.at(getX(), getY(), z);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -205,7 +224,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 add(BlockVector3 other) {
|
||||
return add(other.x, other.y, other.z);
|
||||
return add(other.getX(), other.getY(), other.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -217,7 +236,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 add(int x, int y, int z) {
|
||||
return BlockVector3.at(this.x + x, this.y + y, this.z + z);
|
||||
return BlockVector3.at(this.getX() + x, this.getY() + y, this.getZ() + z);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -228,12 +247,12 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 add(BlockVector3... others) {
|
||||
int newX = x, newY = y, newZ = z;
|
||||
int newX = getX(), newY = getY(), newZ = getZ();
|
||||
|
||||
for (BlockVector3 other : others) {
|
||||
newX += other.x;
|
||||
newY += other.y;
|
||||
newZ += other.z;
|
||||
newX += other.getX();
|
||||
newY += other.getY();
|
||||
newZ += other.getZ();
|
||||
}
|
||||
|
||||
return BlockVector3.at(newX, newY, newZ);
|
||||
@ -247,7 +266,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 subtract(BlockVector3 other) {
|
||||
return subtract(other.x, other.y, other.z);
|
||||
return subtract(other.getX(), other.getY(), other.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -260,7 +279,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 subtract(int x, int y, int z) {
|
||||
return BlockVector3.at(this.x - x, this.y - y, this.z - z);
|
||||
return BlockVector3.at(this.getX() - x, this.getY() - y, this.getZ() - z);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -271,12 +290,12 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 subtract(BlockVector3... others) {
|
||||
int newX = x, newY = y, newZ = z;
|
||||
int newX = getX(), newY = getY(), newZ = getZ();
|
||||
|
||||
for (BlockVector3 other : others) {
|
||||
newX -= other.x;
|
||||
newY -= other.y;
|
||||
newZ -= other.z;
|
||||
newX -= other.getX();
|
||||
newY -= other.getY();
|
||||
newZ -= other.getZ();
|
||||
}
|
||||
|
||||
return BlockVector3.at(newX, newY, newZ);
|
||||
@ -289,7 +308,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 multiply(BlockVector3 other) {
|
||||
return multiply(other.x, other.y, other.z);
|
||||
return multiply(other.getX(), other.getY(), other.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -301,7 +320,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 multiply(int x, int y, int z) {
|
||||
return BlockVector3.at(this.x * x, this.y * y, this.z * z);
|
||||
return BlockVector3.at(this.getX() * x, this.getY() * y, this.getZ() * z);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -311,12 +330,12 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 multiply(BlockVector3... others) {
|
||||
int newX = x, newY = y, newZ = z;
|
||||
int newX = getX(), newY = getY(), newZ = getZ();
|
||||
|
||||
for (BlockVector3 other : others) {
|
||||
newX *= other.x;
|
||||
newY *= other.y;
|
||||
newZ *= other.z;
|
||||
newX *= other.getX();
|
||||
newY *= other.getY();
|
||||
newZ *= other.getZ();
|
||||
}
|
||||
|
||||
return BlockVector3.at(newX, newY, newZ);
|
||||
@ -339,7 +358,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 divide(BlockVector3 other) {
|
||||
return divide(other.x, other.y, other.z);
|
||||
return divide(other.getX(), other.getY(), other.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -351,7 +370,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 divide(int x, int y, int z) {
|
||||
return BlockVector3.at(this.x / x, this.y / y, this.z / z);
|
||||
return BlockVector3.at(this.getX() / x, this.getY() / y, this.getZ() / z);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -423,7 +442,7 @@ public class BlockVector3 {
|
||||
* @return length, squared
|
||||
*/
|
||||
public int lengthSq() {
|
||||
return x * x + y * y + z * z;
|
||||
return getX() * getX() + getY() * getY() + getZ() * getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -443,9 +462,9 @@ public class BlockVector3 {
|
||||
* @return distance
|
||||
*/
|
||||
public int distanceSq(BlockVector3 other) {
|
||||
int dx = other.x - x;
|
||||
int dy = other.y - y;
|
||||
int dz = other.z - z;
|
||||
int dx = other.getX() - getX();
|
||||
int dy = other.getY() - getY();
|
||||
int dz = other.getZ() - getZ();
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
|
||||
@ -457,9 +476,9 @@ public class BlockVector3 {
|
||||
*/
|
||||
public BlockVector3 normalize() {
|
||||
double len = length();
|
||||
double x = this.x / len;
|
||||
double y = this.y / len;
|
||||
double z = this.z / len;
|
||||
double x = this.getX() / len;
|
||||
double y = this.getY() / len;
|
||||
double z = this.getZ() / len;
|
||||
return BlockVector3.at(x, y, z);
|
||||
}
|
||||
|
||||
@ -470,7 +489,7 @@ public class BlockVector3 {
|
||||
* @return the dot product of this and the other vector
|
||||
*/
|
||||
public double dot(BlockVector3 other) {
|
||||
return x * other.x + y * other.y + z * other.z;
|
||||
return getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -480,10 +499,10 @@ public class BlockVector3 {
|
||||
* @return the cross product of this and the other vector
|
||||
*/
|
||||
public BlockVector3 cross(BlockVector3 other) {
|
||||
return new BlockVector3(
|
||||
y * other.z - z * other.y,
|
||||
z * other.x - x * other.z,
|
||||
x * other.y - y * other.x
|
||||
return new BlockVector3Imp(
|
||||
getY() * other.getZ() - getZ() * other.getY(),
|
||||
getZ() * other.getX() - getX() * other.getZ(),
|
||||
getX() * other.getY() - getY() * other.getX()
|
||||
);
|
||||
}
|
||||
|
||||
@ -495,7 +514,7 @@ public class BlockVector3 {
|
||||
* @return true if the vector is contained
|
||||
*/
|
||||
public boolean containedWithin(BlockVector3 min, BlockVector3 max) {
|
||||
return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z;
|
||||
return getX() >= min.getX() && getX() <= max.getX() && getY() >= min.getY() && getY() <= max.getY() && getZ() >= min.getZ() && getZ() <= max.getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -507,11 +526,11 @@ public class BlockVector3 {
|
||||
*/
|
||||
public BlockVector3 clampY(int min, int max) {
|
||||
checkArgument(min <= max, "minimum cannot be greater than maximum");
|
||||
if (y < min) {
|
||||
return BlockVector3.at(x, min, z);
|
||||
if (getY() < min) {
|
||||
return BlockVector3.at(getX(), min, getZ());
|
||||
}
|
||||
if (y > max) {
|
||||
return BlockVector3.at(x, max, z);
|
||||
if (getY() > max) {
|
||||
return BlockVector3.at(getX(), max, getZ());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@ -555,7 +574,7 @@ public class BlockVector3 {
|
||||
* @return a new vector
|
||||
*/
|
||||
public BlockVector3 abs() {
|
||||
return BlockVector3.at(Math.abs(x), Math.abs(y), Math.abs(z));
|
||||
return BlockVector3.at(Math.abs(getX()), Math.abs(getY()), Math.abs(getZ()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -571,8 +590,8 @@ public class BlockVector3 {
|
||||
*/
|
||||
public BlockVector3 transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) {
|
||||
angle = Math.toRadians(angle);
|
||||
double x = this.x - aboutX;
|
||||
double z = this.z - aboutZ;
|
||||
double x = this.getX() - aboutX;
|
||||
double z = this.getZ() - aboutZ;
|
||||
double cos = Math.cos(angle);
|
||||
double sin = Math.sin(angle);
|
||||
double x2 = x * cos - z * sin;
|
||||
@ -580,7 +599,7 @@ public class BlockVector3 {
|
||||
|
||||
return BlockVector3.at(
|
||||
x2 + aboutX + translateX,
|
||||
y,
|
||||
getY(),
|
||||
z2 + aboutZ + translateZ
|
||||
);
|
||||
}
|
||||
@ -626,10 +645,10 @@ public class BlockVector3 {
|
||||
* @return minimum
|
||||
*/
|
||||
public BlockVector3 getMinimum(BlockVector3 v2) {
|
||||
return new BlockVector3(
|
||||
Math.min(x, v2.x),
|
||||
Math.min(y, v2.y),
|
||||
Math.min(z, v2.z)
|
||||
return new BlockVector3Imp(
|
||||
Math.min(getX(), v2.getX()),
|
||||
Math.min(getY(), v2.getY()),
|
||||
Math.min(getZ(), v2.getZ())
|
||||
);
|
||||
}
|
||||
|
||||
@ -640,44 +659,110 @@ public class BlockVector3 {
|
||||
* @return maximum
|
||||
*/
|
||||
public BlockVector3 getMaximum(BlockVector3 v2) {
|
||||
return new BlockVector3(
|
||||
Math.max(x, v2.x),
|
||||
Math.max(y, v2.y),
|
||||
Math.max(z, v2.z)
|
||||
return new BlockVector3Imp(
|
||||
Math.max(getX(), v2.getX()),
|
||||
Math.max(getY(), v2.getY()),
|
||||
Math.max(getZ(), v2.getZ())
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Methods for getting/setting blocks
|
||||
|
||||
Why are these methods here?
|
||||
- Getting a block at a position requires various operations
|
||||
(bounds checks, cache checks, ensuring loaded chunk, get ChunkSection, etc.)
|
||||
- When iterating over a region, it will provide custom BlockVector3 positions
|
||||
- These override the below set/get and avoid lookups (as the iterator shifts it to the chunk level)
|
||||
*/
|
||||
|
||||
public boolean setOrdinal(Extent orDefault, int ordinal) {
|
||||
return orDefault.setBlock(this, BlockState.getFromOrdinal(ordinal));
|
||||
}
|
||||
|
||||
public boolean setBlock(Extent orDefault, BlockState state) {
|
||||
return orDefault.setBlock(this, state);
|
||||
}
|
||||
|
||||
public boolean setFullBlock(Extent orDefault, BaseBlock block) {
|
||||
return orDefault.setBlock(this, block);
|
||||
}
|
||||
|
||||
public boolean setBiome(Extent orDefault, BiomeType biome) {
|
||||
return orDefault.setBiome(getX(), getY(), getZ(), biome);
|
||||
}
|
||||
|
||||
public int getOrdinal(Extent orDefault) {
|
||||
return getBlock(orDefault).getOrdinal();
|
||||
}
|
||||
|
||||
public char getOrdinalChar(Extent orDefault) {
|
||||
return (char) getOrdinal(orDefault);
|
||||
}
|
||||
|
||||
public BlockState getBlock(Extent orDefault) {
|
||||
return orDefault.getBlock(this);
|
||||
}
|
||||
|
||||
public BaseBlock getFullBlock(Extent orDefault) {
|
||||
return orDefault.getFullBlock(this);
|
||||
}
|
||||
|
||||
public CompoundTag getNbtData(Extent orDefault) {
|
||||
return orDefault.getFullBlock(getX(), getY(), getZ()).getNbtData();
|
||||
}
|
||||
|
||||
public BlockState getOrdinalBelow(Extent orDefault) {
|
||||
return orDefault.getBlock(getX(), getY() - 1, getZ());
|
||||
}
|
||||
|
||||
public BlockState getStateAbove(Extent orDefault) {
|
||||
return orDefault.getBlock(getX(), getY() + 1, getZ());
|
||||
}
|
||||
|
||||
public BlockState getStateRelativeY(Extent orDefault, final int y) {
|
||||
return orDefault.getBlock(getX(), getY() + y, getZ());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Adapt
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a 2D vector by dropping the Y component from this vector.
|
||||
*
|
||||
* @return a new {@link BlockVector2}
|
||||
*/
|
||||
public BlockVector2 toBlockVector2() {
|
||||
return BlockVector2.at(x, z);
|
||||
return BlockVector2.at(getX(), getZ());
|
||||
}
|
||||
|
||||
public Vector3 toVector3() {
|
||||
return Vector3.at(x, y, z);
|
||||
return Vector3.at(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public final boolean equals(Object obj) {
|
||||
if (!(obj instanceof BlockVector3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockVector3 other = (BlockVector3) obj;
|
||||
return other.x == this.x && other.y == this.y && other.z == this.z;
|
||||
return equals((BlockVector3) obj);
|
||||
}
|
||||
|
||||
public final boolean equals(BlockVector3 other) {
|
||||
return other.getX() == this.getX() && other.getY() == this.getY() && other.getZ() == this.getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (x ^ (z << 12)) ^ (y << 24);
|
||||
return (getX() ^ (getZ() << 12)) ^ (getY() << 24);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(" + x + ", " + y + ", " + z + ")";
|
||||
return "(" + getX() + ", " + getY() + ", " + getZ() + ")";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,18 @@
|
||||
package com.sk89q.worldedit.math;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
|
||||
public class MutableVector3 extends Vector3 {
|
||||
|
||||
public MutableVector3() {
|
||||
}
|
||||
public static MutableVector3 get(int x, int y, int z) {
|
||||
return FaweCache.MUTABLE_VECTOR3.get().setComponents(x, y, z);
|
||||
}
|
||||
|
||||
public static MutableVector3 get(double x, double y, double z) {
|
||||
return FaweCache.MUTABLE_VECTOR3.get().setComponents(x, y, z);
|
||||
}
|
||||
|
||||
public MutableVector3(double x, double y, double z) {
|
||||
super(x, y, z);
|
||||
@ -77,7 +86,4 @@ public class MutableVector3 extends Vector3 {
|
||||
return this;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user