Move vectors to static creators, for caching

Dieser Commit ist enthalten in:
Kenzie Togami 2018-10-19 13:13:32 -07:00 committet von IronApollo
Ursprung a9919d130c
Commit 4d6045813c
138 geänderte Dateien mit 670 neuen und 531 gelöschten Zeilen

Datei anzeigen

@ -69,7 +69,7 @@ subprojects {
repositories {
mavenCentral()
maven { url "http://ci.athion.net/job/FAWE-WorldGuard-1.13/ws/mvn/" }
//maven { url "http://ci.athion.net/job/FAWE-WorldGuard-1.13/ws/mvn/" }
maven { url "http://repo.bukkit.org/content/groups/public" }
maven { url "http://maven.sk89q.com/repo/" }
maven { url "http://repo.maven.apache.org/maven2" }

Datei anzeigen

@ -35,8 +35,8 @@ public class GriefPreventionFilter extends CuboidRegionFilter {
org.bukkit.Location bot = claim.getGreaterBoundaryCorner();
if (world.equals(bot.getWorld())) {
org.bukkit.Location top = claim.getGreaterBoundaryCorner();
BlockVector2 pos1 = new BlockVector2(bot.getBlockX(), bot.getBlockZ());
BlockVector2 pos2 = new BlockVector2(top.getBlockX(), top.getBlockZ());
BlockVector2 pos1 = BlockVector2.at(bot.getBlockX(), bot.getBlockZ());
BlockVector2 pos2 = BlockVector2.at(top.getBlockX(), top.getBlockZ());
add(pos1, pos2);
}
}

Datei anzeigen

@ -49,8 +49,8 @@ public class WorldGuardFilter extends CuboidRegionFilter {
@Override
public boolean containsChunk(int chunkX, int chunkZ) {
if (!large) return super.containsChunk(chunkX, chunkZ);
BlockVector3 pos1 = new BlockVector3(chunkX << 4, 0, chunkZ << 4);
BlockVector3 pos2 = new BlockVector3(pos1.getBlockX() + 15, 255, pos1.getBlockZ() + 15);
BlockVector3 pos1 = BlockVector3.at(chunkX << 4, 0, chunkZ << 4);
BlockVector3 pos2 = BlockVector3.at(pos1.getBlockX() + 15, 255, pos1.getBlockZ() + 15);
ProtectedCuboidRegion chunkRegion = new ProtectedCuboidRegion("unimportant", pos1, pos2);
ApplicableRegionSet set = manager.getApplicableRegions(chunkRegion);
return set.size() > 0 && !set.getRegions().iterator().next().getId().equals("__global__");
@ -59,8 +59,8 @@ public class WorldGuardFilter extends CuboidRegionFilter {
@Override
public boolean containsRegion(int mcaX, int mcaZ) {
if (!large) return super.containsRegion(mcaX, mcaZ);
BlockVector3 pos1 = new BlockVector3(mcaX << 9, 0, mcaZ << 9);
BlockVector3 pos2 = new BlockVector3(pos1.getBlockX() + 511, 255, pos1.getBlockZ() + 511);
BlockVector3 pos1 = BlockVector3.at(mcaX << 9, 0, mcaZ << 9);
BlockVector3 pos2 = BlockVector3.at(pos1.getBlockX() + 511, 255, pos1.getBlockZ() + 511);
ProtectedCuboidRegion regionRegion = new ProtectedCuboidRegion("unimportant", pos1, pos2);
ApplicableRegionSet set = manager.getApplicableRegions(regionRegion);
return set.size() > 0 && !set.getRegions().iterator().next().getId().equals("__global__");

Datei anzeigen

@ -253,7 +253,7 @@ public class BukkitImageListener implements Listener {
fp.runAction(new Runnable() {
@Override
public void run() {
BlockVector3 wPos = new BlockVector3(worldX, 0, worldZ);
BlockVector3 wPos = BlockVector3.at(worldX, 0, worldZ);
viewer.refresh();
int topY = generator.getNearestSurfaceTerrainBlock(wPos.getBlockX(), wPos.getBlockZ(), 255, 0, 255);
wPos = wPos.withY(topY);

Datei anzeigen

@ -139,7 +139,7 @@ public class CFIPacketListener implements Listener {
int ocx = origin.getBlockX() >> 4;
int ocz = origin.getBlockZ() >> 4;
if (gen.contains(new BlockVector3((cx - ocx) << 4, 0, (cz - ocz) << 4))) {
if (gen.contains(BlockVector3.at((cx - ocx) << 4, 0, (cz - ocz) << 4))) {
event.setCancelled(true);
Player plr = event.getPlayer();
@ -166,7 +166,7 @@ public class CFIPacketListener implements Listener {
VirtualWorld gen = getGenerator(event);
if (gen != null) {
BlockVector3 origin = gen.getOrigin().toBlockPoint();
BlockVector3 pt = new BlockVector3(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
BlockVector3 pt = BlockVector3.at(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
StructureModifier<Integer> ints = event.getPacket().getIntegers();
int id = ints.read(0);
@ -191,11 +191,11 @@ public class CFIPacketListener implements Listener {
VirtualWorld gen = getGenerator(event);
if (gen != null) {
BlockVector3 origin = gen.getOrigin().toBlockPoint();
BlockVector3 from = new BlockVector3(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
BlockVector3 from = BlockVector3.at(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
PacketContainer packet = event.getPacket();
StructureModifier<Double> doubles = packet.getDoubles();
BlockVector3 to = new BlockVector3(doubles.read(0), doubles.read(1), doubles.read(2));
BlockVector3 to = BlockVector3.at(doubles.read(0), doubles.read(1), doubles.read(2));
if (gen.contains(to.subtract(origin)) && from.distanceSq(to) < 8) {
int id = packet.getIntegers().read(0);
PacketContainer reply = new PacketContainer(PacketType.Play.Client.TELEPORT_ACCEPT);
@ -225,7 +225,7 @@ public class CFIPacketListener implements Listener {
BlockVector3 origin = gen.getOrigin().toBlockPoint();
int cx = chunk.getChunkX() - (origin.getBlockX() >> 4);
int cz = chunk.getChunkZ() - (origin.getBlockX() >> 4);
if (gen.contains(new BlockVector3(cx << 4, 0, cz << 4))) {
if (gen.contains(BlockVector3.at(cx << 4, 0, cz << 4))) {
event.setCancelled(true);
}
}
@ -288,7 +288,7 @@ public class CFIPacketListener implements Listener {
BlockPosition loc = position.readSafely(0);
if (loc == null) return null;
BlockVector3 origin = generator.getOrigin().toBlockPoint();
BlockVector3 pt = new BlockVector3(loc.getX() - origin.getBlockX(), loc.getY() - origin.getBlockY(), loc.getZ() - origin.getBlockZ());
BlockVector3 pt = BlockVector3.at(loc.getX() - origin.getBlockX(), loc.getY() - origin.getBlockY(), loc.getZ() - origin.getBlockZ());
return pt;
}

Datei anzeigen

@ -12,6 +12,6 @@ public class BukkitMask extends FaweMask {
}
public BukkitMask(Location pos1, Location pos2, String name) {
super(new BlockVector3(pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()), new BlockVector3(pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()), name);
super(BlockVector3.at(pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()), BlockVector3.at(pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()), name);
}
}

Datei anzeigen

@ -55,7 +55,7 @@ public class FreeBuildRegion extends BukkitMaskManager {
World bukkitWorld = player.parent.getWorld();
AsyncWorld asyncWorld = AsyncWorld.wrap(bukkitWorld);
BlockVector3 vec1 = new BlockVector3(0, 0, 0);
BlockVector3 vec1 = BlockVector3.at(0, 0, 0);
BlockVector3 vec2 = vec1;
Location pos1 = BukkitAdapter.adapt(bukkitWorld, vec1);
Location pos2 = BukkitAdapter.adapt(bukkitWorld, vec2);

Datei anzeigen

@ -41,8 +41,8 @@ public class PreciousStonesFeature extends BukkitMaskManager implements Listener
boolean member = fp.hasPermission("fawe.preciousstones.member");
for (final Field myField : fields) {
if (isAllowed(player, myField, type, member)) {
BlockVector3 pos1 = new BlockVector3(myField.getMinx(), myField.getMiny(), myField.getMinz());
BlockVector3 pos2 = new BlockVector3(myField.getMaxx(), myField.getMaxy(), myField.getMaxz());
BlockVector3 pos1 = BlockVector3.at(myField.getMinx(), myField.getMiny(), myField.getMinz());
BlockVector3 pos2 = BlockVector3.at(myField.getMaxx(), myField.getMaxy(), myField.getMaxz());
return new FaweMask(pos1, pos2, "FIELD: " + myField) {
@Override
public boolean isValid(FawePlayer player, MaskType type) {

Datei anzeigen

@ -61,7 +61,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
if (global != null && isAllowed(player, global)) {
return global;
}
final ApplicableRegionSet regions = manager.getApplicableRegions(new BlockVector3(loc.getX(), loc.getY(), loc.getZ()));
final ApplicableRegionSet regions = manager.getApplicableRegions(BlockVector3.at(loc.getX(), loc.getY(), loc.getZ()));
for (final ProtectedRegion region : regions) {
if (isAllowed(player, region)) {
return region;

Datei anzeigen

@ -57,7 +57,7 @@ public class StructureCUI extends CUI {
int x = Integer.parseInt(param[1]);
int y = Integer.parseInt(param[2]);
int z = Integer.parseInt(param[3]);
BlockVector3 pos = new BlockVector3(x, y, z);
BlockVector3 pos = BlockVector3.at(x, y, z);
if (id == 0) {
pos1 = pos;
} else {
@ -188,7 +188,7 @@ public class StructureCUI extends CUI {
NbtCompound compound = constructStructureNbt(x, y, z, posX, posY, posZ, sizeX, sizeY, sizeZ);
Block block = player.getWorld().getBlockAt(x, y, z);
remove = new BlockVector3(x, y, z);
remove = BlockVector3.at(x, y, z);
state = BukkitAdapter.adapt(block.getBlockData());
removeTag = compound;

Datei anzeigen

@ -211,7 +211,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
return;
}
setPosition(new Vector3(x + 0.5, y, z + 0.5));
setPosition(Vector3.at(x + 0.5, y, z + 0.5));
player.setFlying(true);
}

Datei anzeigen

@ -200,7 +200,7 @@ public class BukkitWorld extends AbstractWorld {
com.sk89q.worldedit.world.block.BlockStateHolder[] history = new com.sk89q.worldedit.world.block.BlockState[16 * 16 * (getMaxY() + 1)];
for (BlockVector2 chunk : region.getChunks()) {
BlockVector3 min = new BlockVector3(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
BlockVector3 min = BlockVector3.at(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
// First save all the blocks inside
for (int x = 0; x < 16; ++x) {

Datei anzeigen

@ -40,7 +40,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
@Override
public boolean setBlockData(int x, int y, int z, BlockData blockData) {
try {
editSession.setBlock(new BlockVector3(x, y, z), BukkitAdapter.adapt(blockData));
editSession.setBlock(BlockVector3.at(x, y, z), BukkitAdapter.adapt(blockData));
} catch (MaxChangedBlocksException e) {
return false;
}
@ -49,7 +49,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
@Override
public BlockData getBlockData(int x, int y, int z) {
return BukkitAdapter.adapt(editSession.getBlock(new BlockVector3(x, y, z)));
return BukkitAdapter.adapt(editSession.getBlock(BlockVector3.at(x, y, z)));
}
@Override
@ -59,7 +59,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
@Override
public boolean isEmpty(int x, int y, int z) {
return editSession.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isAir();
return editSession.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isAir();
}
}

Datei anzeigen

@ -165,7 +165,7 @@ public interface IBukkitAdapter {
*/
default Vector3 asVector(org.bukkit.Location location) {
checkNotNull(location);
return new Vector3(location.getX(), location.getY(), location.getZ());
return Vector3.at(location.getX(), location.getY(), location.getZ());
}
/**
@ -176,7 +176,7 @@ public interface IBukkitAdapter {
*/
default BlockVector3 asBlockVector(org.bukkit.Location location) {
checkNotNull(location);
return new BlockVector3(location.getX(), location.getY(), location.getZ());
return BlockVector3.at(location.getX(), location.getY(), location.getZ());
}
/**

Datei anzeigen

@ -279,7 +279,7 @@ public class FawePrimitiveBinding extends BindingHelper {
default:
throw new ParameterException("You must either specify 1 or 3 radius values.");
}
return new Vector3(radiusX, radiusY, radiusZ);
return Vector3.at(radiusX, radiusY, radiusZ);
}
@ -311,7 +311,7 @@ public class FawePrimitiveBinding extends BindingHelper {
default:
throw new ParameterException("You must either specify 1 or 2 radius values.");
}
return new Vector2(radiusX, radiusZ);
return Vector2.at(radiusX, radiusZ);
}
/**

Datei anzeigen

@ -268,19 +268,19 @@ public class CorruptSchematicStreamer {
private BlockVector3 guessDimensions(int volume, int width, int height, int length) {
if (volume == 0) {
return new BlockVector3(width, height, length);
return BlockVector3.at(width, height, length);
}
if (volume == width * height * length) {
return new BlockVector3(width, height, length);
return BlockVector3.at(width, height, length);
}
if (width == 0 && height != 0 && length != 0 && volume % (height * length) == 0 && height * length <= volume) {
return new BlockVector3(volume / (height * length), height, length);
return BlockVector3.at(volume / (height * length), height, length);
}
if (height == 0 && width != 0 && length != 0 && volume % (width * length) == 0 && width * length <= volume) {
return new BlockVector3(width, volume / (width * length), length);
return BlockVector3.at(width, volume / (width * length), length);
}
if (length == 0 && height != 0 && width != 0 && volume % (height * width) == 0 && height * width <= volume) {
return new BlockVector3(width, height, volume / (width * height));
return BlockVector3.at(width, height, volume / (width * height));
}
List<Integer> factors = new ArrayList<>();
for (int i = (int) Math.sqrt(volume); i > 0; i--) {
@ -308,7 +308,7 @@ public class CorruptSchematicStreamer {
}
}
}
return new BlockVector3(vx, vz, vy);
return BlockVector3.at(vx, vz, vy);
}
public interface CorruptReader {

Datei anzeigen

@ -49,7 +49,7 @@ public class SchematicStreamer extends NBTStreamer {
public SchematicStreamer(NBTInputStream stream, UUID uuid) {
super(stream);
this.uuid = uuid;
clipboard = new BlockArrayClipboard(new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(0, 0, 0)), fc);
clipboard = new BlockArrayClipboard(new CuboidRegion(BlockVector3.at(0, 0, 0), BlockVector3.at(0, 0, 0)), fc);
}
public void addBlockReaders() throws IOException {
@ -419,7 +419,7 @@ public class SchematicStreamer extends NBTStreamer {
private FaweClipboard setupClipboard(int size) {
if (fc != null) {
if (fc.getDimensions().getX() == 0) {
fc.setDimensions(new BlockVector3(size, 1, 1));
fc.setDimensions(BlockVector3.at(size, 1, 1));
}
return fc;
}
@ -433,15 +433,15 @@ public class SchematicStreamer extends NBTStreamer {
}
public BlockVector3 getOrigin() {
return new BlockVector3(originX, originY, originZ);
return BlockVector3.at(originX, originY, originZ);
}
public BlockVector3 getOffset() {
return new BlockVector3(offsetX, offsetY, offsetZ);
return BlockVector3.at(offsetX, offsetY, offsetZ);
}
public BlockVector3 getDimensions() {
return new BlockVector3(width, height, length);
return BlockVector3.at(width, height, length);
}
public void setClipboard(FaweClipboard clipboard) {
@ -453,10 +453,10 @@ public class SchematicStreamer extends NBTStreamer {
addDimensionReaders();
addBlockReaders();
readFully();
BlockVector3 min = new BlockVector3(originX, originY, originZ);
BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ);
BlockVector3 min = BlockVector3.at(originX, originY, originZ);
BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ);
BlockVector3 origin = min.subtract(offset);
BlockVector3 dimensions = new BlockVector3(width, height, length);
BlockVector3 dimensions = BlockVector3.at(width, height, length);
fc.setDimensions(dimensions);
fixStates();
CuboidRegion region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));

Datei anzeigen

@ -234,7 +234,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
@Override
public Vector3 getOrigin() {
return new Vector3(chunkOffset.getBlockX() << 4, 0, chunkOffset.getBlockZ() << 4);
return Vector3.at(chunkOffset.getBlockX() << 4, 0, chunkOffset.getBlockZ() << 4);
}
public boolean hasPacketViewer() {
@ -245,7 +245,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
this.player = player;
if (player != null) {
FaweLocation pos = player.getLocation();
this.chunkOffset = new BlockVector2(1 + (pos.x >> 4), 1 + (pos.z >> 4));
this.chunkOffset = BlockVector2.at(1 + (pos.x >> 4), 1 + (pos.z >> 4));
}
}
@ -554,13 +554,13 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
}
public void addCaves() throws WorldEditException {
CuboidRegion region = new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(getWidth() -1, 255, getLength() -1));
CuboidRegion region = new CuboidRegion(BlockVector3.at(0, 0, 0), BlockVector3.at(getWidth() -1, 255, getLength() -1));
addCaves(region);
}
@Deprecated
public void addSchems(Mask mask, List<ClipboardHolder> clipboards, int rarity, boolean rotate) throws WorldEditException {
CuboidRegion region = new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(getWidth() -1, 255, getLength() -1));
CuboidRegion region = new CuboidRegion(BlockVector3.at(0, 0, 0), BlockVector3.at(getWidth() -1, 255, getLength() -1));
addSchems(region, mask, clipboards, rarity, rotate);
}
@ -665,17 +665,17 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
}
public void addOre(Mask mask, Pattern material, int size, int frequency, int rarity, int minY, int maxY) throws WorldEditException {
CuboidRegion region = new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(getWidth() -1, 255, getLength() -1));
CuboidRegion region = new CuboidRegion(BlockVector3.at(0, 0, 0), BlockVector3.at(getWidth() -1, 255, getLength() -1));
addOre(region, mask, material, size, frequency, rarity, minY, maxY);
}
public void addDefaultOres(Mask mask) throws WorldEditException {
addOres(new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(getWidth() -1, 255, getLength() -1)), mask);
addOres(new CuboidRegion(BlockVector3.at(0, 0, 0), BlockVector3.at(getWidth() -1, 255, getLength() -1)), mask);
}
@Override
public BlockVector3 getMinimumPoint() {
return new BlockVector3(0, 0, 0);
return BlockVector3.at(0, 0, 0);
}
@Override
@ -685,7 +685,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
@Override
public BlockVector3 getMaximumPoint() {
return new BlockVector3(getWidth() - 1, 255, getLength() - 1);
return BlockVector3.at(getWidth() - 1, 255, getLength() - 1);
}
@Override

Datei anzeigen

@ -62,12 +62,12 @@ public interface FaweQueue extends HasFaweQueue, Extent {
@Override
default BlockVector3 getMinimumPoint() {
return new BlockVector3(-30000000, 0, -30000000);
return BlockVector3.at(-30000000, 0, -30000000);
}
@Override
default BlockVector3 getMaximumPoint() {
return new BlockVector3(30000000, getMaxY(), 30000000);
return BlockVector3.at(30000000, getMaxY(), 30000000);
}
@Override

Datei anzeigen

@ -117,7 +117,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
@Override
public boolean setBiome(int x, int y, int z, BaseBiome newBiome) {
BaseBiome oldBiome = this.getBiome(new BlockVector2(x, z));
BaseBiome oldBiome = this.getBiome(BlockVector2.at(x, z));
if (oldBiome.getId() != newBiome.getId()) {
this.changeSet.addBiomeChange(x, z, oldBiome, newBiome);
return getExtent().setBiome(x, y, z, newBiome);

Datei anzeigen

@ -23,7 +23,7 @@ public class RegionWrapper extends CuboidRegion {
}
public RegionWrapper(final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) {
this(new BlockVector3(minX, 0, minZ), new BlockVector3(maxX, 255, maxZ));
this(BlockVector3.at(minX, 0, minZ), BlockVector3.at(maxX, 255, maxZ));
}
public RegionWrapper(final BlockVector3 pos1, final BlockVector3 pos2) {

Datei anzeigen

@ -26,7 +26,7 @@ public class CircleBrush implements Brush {
private Vector3 any90Rotate(Vector3 normal) {
normal = normal.normalize();
if (normal.getX() == 1 || normal.getY() == 1 || normal.getZ() == 1) {
return new Vector3(normal.getZ(), normal.getX(), normal.getY());
return Vector3.at(normal.getZ(), normal.getX(), normal.getY());
}
AffineTransform affine = new AffineTransform();
affine = affine.rotateX(90);

Datei anzeigen

@ -23,7 +23,7 @@ public class ErodeBrush implements Brush {
private PseudoRandom rand = new PseudoRandom();
private static final BlockVector3[] FACES_TO_CHECK = {new BlockVector3(0, 0, 1), new BlockVector3(0, 0, -1), new BlockVector3(0, 1, 0), new BlockVector3(0, -1, 0), new BlockVector3(1, 0, 0), new BlockVector3(-1, 0, 0)};
private static final BlockVector3[] FACES_TO_CHECK = {BlockVector3.at(0, 0, 1), BlockVector3.at(0, 0, -1), BlockVector3.at(0, 1, 0), BlockVector3.at(0, -1, 0), BlockVector3.at(1, 0, 0), BlockVector3.at(-1, 0, 0)};
@Override
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {

Datei anzeigen

@ -133,14 +133,14 @@ public class HeightBrush implements Brush {
}
if (smooth) {
BlockVector2 min = new BlockVector2(Math.max(0, bx - size), Math.max(0, bz - size));
BlockVector2 max = new BlockVector2(Math.min(hmmg.getWidth() - 1, bx + size), Math.min(hmmg.getLength() - 1, bz + size));
BlockVector2 min = BlockVector2.at(Math.max(0, bx - size), Math.max(0, bz - size));
BlockVector2 max = BlockVector2.at(Math.min(hmmg.getWidth() - 1, bx + size), Math.min(hmmg.getLength() - 1, bz + size));
hmmg.smooth(min, max, 8, 1);
if (size > 20) {
int smoothSize = size + 8;
min = new BlockVector2(Math.max(0, bx - smoothSize), Math.max(0, bz - smoothSize));
max = new BlockVector2(Math.min(hmmg.getWidth() - 1, bx + smoothSize), Math.min(hmmg.getLength() - 1, bz + smoothSize));
min = BlockVector2.at(Math.max(0, bx - smoothSize), Math.max(0, bz - smoothSize));
max = BlockVector2.at(Math.min(hmmg.getWidth() - 1, bx + smoothSize), Math.min(hmmg.getLength() - 1, bz + smoothSize));
hmmg.smooth(min, max, 1, 1);
}
}

Datei anzeigen

@ -84,7 +84,7 @@ public class SplineBrush implements Brush, ResettableTool {
for (int y = -1; y <= 1; y++) {
for (int z = -1; z <= 1; z++) {
if (x != 0 || y != 0 || z != 0) {
BlockVector3 pos = new BlockVector3(x, y, z);
BlockVector3 pos = BlockVector3.at(x, y, z);
if (!directions.contains(pos)) {
directions.add(pos);
}
@ -206,15 +206,15 @@ public class SplineBrush implements Brush, ResettableTool {
if (det_max == det_x) {
double a = (xz * yz - xy * zz) / det_x;
double b = (xy * yz - xz * yy) / det_x;
dir = new BlockVector3(1.0, a, b);
dir = BlockVector3.at(1.0, a, b);
} else if (det_max == det_y) {
double a = (yz * xz - xy * zz) / det_y;
double b = (xy * xz - yz * xx) / det_y;
dir = new BlockVector3(a, 1.0, b);
dir = BlockVector3.at(a, 1.0, b);
} else {
double a = (yz * xy - xz * yy) / det_z;
double b = (xz * xy - yz * xx) / det_z;
dir = new BlockVector3(a, b, 1.0);
dir = BlockVector3.at(a, b, 1.0);
}
;
return dir.normalize();

Datei anzeigen

@ -35,7 +35,7 @@ public class SurfaceSpline implements Brush {
int max = editSession.getNearestSurfaceTerrainBlock(pos.getBlockX(), pos.getBlockZ(), pos.getBlockY(), 0, editSession.getMaxY());
if (max == -1) return;
// pos.mutY(max);
path.add(new Vector3(pos.getBlockX(), max, pos.getBlockZ()));
path.add(Vector3.at(pos.getBlockX(), max, pos.getBlockZ()));
editSession.getPlayer().sendMessage(BBC.getPrefix() + BBC.BRUSH_SPLINE_PRIMARY_2.s());
if (!vis) return;
}

Datei anzeigen

@ -21,7 +21,7 @@ import java.util.List;
*/
public abstract class Spline {
private BlockVector2 direction = new BlockVector2(1, 0);
private BlockVector2 direction = BlockVector2.at(1, 0);
private final int nodeCount;
protected EditSession editSession;
@ -134,7 +134,7 @@ public abstract class Spline {
// Calculate rotation from spline
Vector3 deriv = interpolation.get1stDerivative(position);
Vector2 deriv2D = new Vector2(deriv.getX(), deriv.getZ()).normalize();
Vector2 deriv2D = Vector2.at(deriv.getX(), deriv.getZ()).normalize();
double angle = Math.toDegrees(
Math.atan2(direction.getZ(), direction.getX()) - Math.atan2(deriv2D.getZ(), deriv2D.getX())
);

Datei anzeigen

@ -126,7 +126,7 @@ public class CPUOptimizedClipboard extends FaweClipboard {
@Override
public BlockVector3 getDimensions() {
return new BlockVector3(width, height, length);
return BlockVector3.at(width, height, length);
}
private int ylast;

Datei anzeigen

@ -167,17 +167,17 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
@Override
public BlockVector3 getDimensions() {
return new BlockVector3(width, height, length);
return BlockVector3.at(width, height, length);
}
public BlockArrayClipboard toClipboard() {
try {
CuboidRegion region = new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(width - 1, height - 1, length - 1));
CuboidRegion region = new CuboidRegion(BlockVector3.at(0, 0, 0), BlockVector3.at(width - 1, height - 1, length - 1));
int ox = mbb.getShort(8);
int oy = mbb.getShort(10);
int oz = mbb.getShort(12);
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, this);
clipboard.setOrigin(new BlockVector3(ox, oy, oz));
clipboard.setOrigin(BlockVector3.at(ox, oy, oz));
return clipboard;
} catch (Throwable e) {
MainUtil.handleError(e);

Datei anzeigen

@ -175,7 +175,7 @@ public class MemoryOptimizedClipboard extends FaweClipboard {
@Override
public BlockVector3 getDimensions() {
return new BlockVector3(width, height, length);
return BlockVector3.at(width, height, length);
}
private int lastI;

Datei anzeigen

@ -60,8 +60,8 @@ public class ResizableClipboardBuilder extends MemoryOptimizedHistory {
}
public Clipboard build() {
BlockVector3 pos1 = new BlockVector3(minX, minY, minZ);
BlockVector3 pos2 = new BlockVector3(maxX, maxY, maxZ);
BlockVector3 pos1 = BlockVector3.at(minX, minY, minZ);
BlockVector3 pos2 = BlockVector3.at(maxX, maxY, maxZ);
CuboidRegion region = new CuboidRegion(pos1, pos2);
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
Iterator<Change> iter = getIterator(true);

Datei anzeigen

@ -154,7 +154,7 @@ public class LocalBlockVector2DSet implements Set<BlockVector2> {
index = set.nextSetBit(index);
int x = MathMan.unpairSearchCoordsX(index);
int y = MathMan.unpairSearchCoordsY(index);
array[i] = (T) new BlockVector2(x, y);
array[i] = (T) BlockVector2.at(x, y);
index++;
}
return array;

Datei anzeigen

@ -179,7 +179,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
int y = b1;
int z = offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21);
array[i] = (T) new BlockVector3(x, y, z);
array[i] = (T) BlockVector3.at(x, y, z);
index++;
}
return array;

Datei anzeigen

@ -99,12 +99,12 @@ public class NullExtent extends FaweRegionExtent {
@Override
public BlockVector3 getMaximumPoint() {
return new BlockVector3(0, 0, 0);
return BlockVector3.at(0, 0, 0);
}
@Override
public BlockVector3 getMinimumPoint() {
return new BlockVector3(0, 0, 0);
return BlockVector3.at(0, 0, 0);
}
@Override

Datei anzeigen

@ -51,7 +51,7 @@ public class PositionTransformExtent extends ResettableExtent {
private BlockVector3 getPos(int x, int y, int z) {
if (min == null) {
min = new BlockVector3(x, y, z);
min = BlockVector3.at(x, y, z);
}
mutable.mutX(((x - min.getX())));
mutable.mutY(((y - min.getY())));

Datei anzeigen

@ -51,7 +51,7 @@ public class ScaleTransform extends ResettableExtent {
private BlockVector3 getPos(int x, int y, int z) {
if (min == null) {
min = new BlockVector3(x, y, z);
min = BlockVector3.at(x, y, z);
}
mutable.mutX((min.getX() + (x - min.getX()) * dx));
mutable.mutY((min.getY() + (y - min.getY()) * dy));

Datei anzeigen

@ -67,7 +67,7 @@ public class TransformExtent extends BlockTransformExtent {
public BlockVector3 getPos(int x, int y, int z) {
if (min == null) {
min = new BlockVector3(x, y, z);
min = BlockVector3.at(x, y, z);
}
mutable.mutX(((x - min.getX())));
mutable.mutY(((y - min.getY())));

Datei anzeigen

@ -31,7 +31,7 @@ public class OffsetPattern extends AbstractPattern {
// mutable.mutY((position.getY() + dy));
// mutable.mutZ((position.getZ() + dz));
// return pattern.apply(mutable);
return pattern.apply(new BlockVector3(position.getX() + dx, position.getY() + dy, position.getZ() + dz));
return pattern.apply(BlockVector3.at(position.getX() + dx, position.getY() + dy, position.getZ() + dz));
}
@Override
@ -40,7 +40,7 @@ public class OffsetPattern extends AbstractPattern {
// mutable.mutY((get.getY() + dy));
// mutable.mutZ((get.getZ() + dz));
// return pattern.apply(extent, set, mutable);
return pattern.apply(extent, set, new BlockVector3(get.getX() + dx, get.getY() + dy, get.getZ() + dz));
return pattern.apply(extent, set, BlockVector3.at(get.getX() + dx, get.getY() + dy, get.getZ() + dz));
}
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {

Datei anzeigen

@ -24,7 +24,7 @@ import javax.annotation.Nullable;
public class PatternExtent extends AbstractPattern implements Extent {
private final Pattern pattern;
private transient BlockStateHolder block;
private transient BlockVector3 target = new BlockVector3(0, 0, 0);
private transient BlockVector3 target = BlockVector3.at(0, 0, 0);
public PatternExtent(Pattern pattern) {
this.pattern = pattern;
@ -32,17 +32,17 @@ public class PatternExtent extends AbstractPattern implements Extent {
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
target = new BlockVector3(0, 0, 0);
target = BlockVector3.at(0, 0, 0);
}
@Override
public BlockVector3 getMinimumPoint() {
return new BlockVector3(Integer.MIN_VALUE, 0, Integer.MIN_VALUE);
return BlockVector3.at(Integer.MIN_VALUE, 0, Integer.MIN_VALUE);
}
@Override
public BlockVector3 getMaximumPoint() {
return new BlockVector3(Integer.MAX_VALUE, 255, Integer.MAX_VALUE);
return BlockVector3.at(Integer.MAX_VALUE, 255, Integer.MAX_VALUE);
}
@Override

Datei anzeigen

@ -44,7 +44,7 @@ public class RandomFullClipboardPattern extends AbstractPattern {
holder.setTransform(new AffineTransform().rotateY(PseudoRandom.random.random(4) * 90));
}
if (randomFlip) {
transform = transform.scale(new Vector3(1, 0, 0).multiply(-2).add(1, 1, 1));
transform = transform.scale(Vector3.at(1, 0, 0).multiply(-2).add(1, 1, 1));
}
if (!transform.isIdentity()) {
holder.setTransform(transform);

Datei anzeigen

@ -58,7 +58,7 @@ public class FaweQueueDelegateExtent extends DelegateFaweQueue {
@Override
public int getBiomeId(int x, int z) throws FaweException.FaweChunkLoadException {
return parentExtent.getBiome(new BlockVector2(x, z)).getId();
return parentExtent.getBiome(BlockVector2.at(x, z)).getId();
}
@Override

Datei anzeigen

@ -53,7 +53,7 @@ public class FuzzyRegion extends AbstractRegion {
}
}, 256, extent instanceof HasFaweQueue ? (HasFaweQueue) extent : null);
search.setVisited(set);
search.visit(new BlockVector3(x, y, z));
search.visit(BlockVector3.at(x, y, z));
Operations.completeBlindly(search);
}
@ -94,12 +94,12 @@ public class FuzzyRegion extends AbstractRegion {
@Override
public BlockVector3 getMinimumPoint() {
return new BlockVector3(minX, minY, minZ);
return BlockVector3.at(minX, minY, minZ);
}
@Override
public BlockVector3 getMaximumPoint() {
return new BlockVector3(maxX, maxY, maxZ);
return BlockVector3.at(maxX, maxY, maxZ);
}
@Override

Datei anzeigen

@ -45,9 +45,9 @@ public class Triangle {
public Edge getEdge(int index) {
if (index == this.verts.length - 1) {
return new Edge(new Vector3(this.verts[index][0], this.verts[index][1],this.verts[index][2]), new Vector3(this.verts[0][0], this.verts[0][1], this.verts[0][2]));
return new Edge(Vector3.at(this.verts[index][0], this.verts[index][1],this.verts[index][2]), Vector3.at(this.verts[0][0], this.verts[0][1], this.verts[0][2]));
} else {
return new Edge(new Vector3(this.verts[index][0], this.verts[index][1],this.verts[index][2]), new Vector3(this.verts[index + 1][0], this.verts[index + 1][1], this.verts[index + 1][2]));
return new Edge(Vector3.at(this.verts[index][0], this.verts[index][1],this.verts[index][2]), Vector3.at(this.verts[index + 1][0], this.verts[index + 1][1], this.verts[index + 1][2]));
}
}
@ -57,7 +57,7 @@ public class Triangle {
}
public Vector3 getVertex(int index) {
return new Vector3(verts[index][0], verts[index][1], verts[index][2]);
return Vector3.at(verts[index][0], verts[index][1], verts[index][2]);
}
public boolean contains(BlockVector3 pos) {

Datei anzeigen

@ -259,7 +259,7 @@ public class Schematic {
if (copyBiomes && xx != mpos2d.getBlockX() && zz != mpos2d.getBlockZ()) {
mpos2d.setComponents(xx, zz);
// extent.setBiome(mpos2d, clipboard.getBiome(mpos2d_2.setComponents(mutable.getBlockX(), mutable.getBlockZ())));
extent.setBiome(mpos2d.toBlockVector2(), clipboard.getBiome(new BlockVector2(mutable.getBlockX(), mutable.getBlockZ())));
extent.setBiome(mpos2d.toBlockVector2(), clipboard.getBiome(BlockVector2.at(mutable.getBlockX(), mutable.getBlockZ())));
}
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
return false;

Datei anzeigen

@ -77,7 +77,7 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
int length = size.getInt(2);
// Init clipboard
BlockVector3 origin = new BlockVector3(0, 0, 0);
BlockVector3 origin = BlockVector3.at(0, 0, 0);
CuboidRegion region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, clipboardId);
// Blocks

Datei anzeigen

@ -80,12 +80,12 @@ public class SchemVis extends ImmutableVirtualWorld {
// Set the origin to somewhere around where the player currently is
FaweLocation pos = player.getLocation();
this.origin = player.getPlayer().getLocation();
this.chunkOffset = new BlockVector2(pos.x >> 4,pos.z >> 4);
this.chunkOffset = BlockVector2.at(pos.x >> 4,pos.z >> 4);
}
private Set<File> getFiles(BlockVector2 chunkPosA, BlockVector2 chunkPosB) {
BlockVector2 pos1 = new BlockVector2(Math.min(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.min(chunkPosA.getBlockZ(), chunkPosB.getBlockZ()));
BlockVector2 pos2 = new BlockVector2(Math.max(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.max(chunkPosA.getBlockZ(), chunkPosB.getBlockZ()));
BlockVector2 pos1 = BlockVector2.at(Math.min(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.min(chunkPosA.getBlockZ(), chunkPosB.getBlockZ()));
BlockVector2 pos2 = BlockVector2.at(Math.max(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.max(chunkPosA.getBlockZ(), chunkPosB.getBlockZ()));
Set<File> contained = new HashSet<>();
for (Long2ObjectMap.Entry<Map.Entry<File, Long>> entry : files.long2ObjectEntrySet()) {
long key = entry.getLongKey();
@ -121,7 +121,7 @@ public class SchemVis extends ImmutableVirtualWorld {
synchronized (this) {
try {
BlockVector2 tmpLastPosition = lastPosition;
lastPosition = new BlockVector2(chunkX, chunkZ);
lastPosition = BlockVector2.at(chunkX, chunkZ);
boolean sneaking = this.player.isSneaking();
if (event.getInputType() == InputType.PRIMARY && !sneaking) {
@ -256,7 +256,7 @@ public class SchemVis extends ImmutableVirtualWorld {
*/
@Override
public Vector3 getOrigin() {
return new Vector3(chunkOffset.getBlockX() << 4, 0, chunkOffset.getBlockZ() << 4);
return Vector3.at(chunkOffset.getBlockX() << 4, 0, chunkOffset.getBlockZ() << 4);
}
/**
@ -371,13 +371,13 @@ public class SchemVis extends ImmutableVirtualWorld {
if (dimensionPair != null) {
int width = (char) MathMan.unpairX(dimensionPair);
int length = (char) MathMan.unpairY(dimensionPair);
BlockVector2 dimensions = new BlockVector2(width, length);
BlockVector2 dimensions = BlockVector2.at(width, length);
BlockVector2 offset = registerAndGetChunkOffset(dimensions, cached);
return;
}
if (cached.exists() && file.lastModified() <= cached.lastModified()) {
try (InputStream fis = new BufferedInputStream(new FileInputStream(cached), 4)) {
BlockVector2 dimensions = new BlockVector2(IOUtil.readVarInt(fis), IOUtil.readVarInt(fis));
BlockVector2 dimensions = BlockVector2.at(IOUtil.readVarInt(fis), IOUtil.readVarInt(fis));
DIMENSION_CACHE.put(file, MathMan.pair((short) dimensions.getBlockX(), (short) dimensions.getBlockZ()));
BlockVector2 offset = registerAndGetChunkOffset(dimensions, cached);
}
@ -472,7 +472,7 @@ public class SchemVis extends ImmutableVirtualWorld {
int OCZ = MathMan.unpairIntY(origin);
try {
try (FileInputStream fis = new FileInputStream(cached)) {
BlockVector2 dimensions = new BlockVector2(IOUtil.readVarInt(fis), IOUtil.readVarInt(fis));
BlockVector2 dimensions = BlockVector2.at(IOUtil.readVarInt(fis), IOUtil.readVarInt(fis));
try (FaweInputStream in = MainUtil.getCompressedIS(fis)) {
NonCloseableInputStream nonCloseable = new NonCloseableInputStream(in);
try (NBTInputStream nis = new NBTInputStream(nonCloseable)) {

Datei anzeigen

@ -41,12 +41,12 @@ public class AboveVisitor extends RecursiveVisitor {
Collection<BlockVector3> directions = getDirections();
directions.clear();
directions.add(new BlockVector3(1, 0, 0));
directions.add(new BlockVector3(-1, 0, 0));
directions.add(new BlockVector3(0, 0, 1));
directions.add(new BlockVector3(0, 0, -1));
directions.add(new BlockVector3(0, 1, 0));
directions.add(new BlockVector3(0, -1, 0));
directions.add(BlockVector3.at(1, 0, 0));
directions.add(BlockVector3.at(-1, 0, 0));
directions.add(BlockVector3.at(0, 0, 1));
directions.add(BlockVector3.at(0, 0, -1));
directions.add(BlockVector3.at(0, 1, 0));
directions.add(BlockVector3.at(0, -1, 0));
}
@Override

Datei anzeigen

@ -38,12 +38,12 @@ public abstract class DFSVisitor implements Operation {
this.hashQueue = new LinkedHashSet<>();
this.visited = new LinkedHashMap<>();
this.function = function;
this.directions.add(new BlockVector3(0, -1, 0));
this.directions.add(new BlockVector3(0, 1, 0));
this.directions.add(new BlockVector3(-1, 0, 0));
this.directions.add(new BlockVector3(1, 0, 0));
this.directions.add(new BlockVector3(0, 0, -1));
this.directions.add(new BlockVector3(0, 0, 1));
this.directions.add(BlockVector3.at(0, -1, 0));
this.directions.add(BlockVector3.at(0, 1, 0));
this.directions.add(BlockVector3.at(-1, 0, 0));
this.directions.add(BlockVector3.at(1, 0, 0));
this.directions.add(BlockVector3.at(0, 0, -1));
this.directions.add(BlockVector3.at(0, 0, 1));
this.maxDepth = maxDepth;
this.maxBranch = maxBranching;
}
@ -92,7 +92,7 @@ public abstract class DFSVisitor implements Operation {
// mutable.mutX(from.getX());
// mutable.mutY(from.getY());
// mutable.mutZ(from.getZ());
BlockVector3 bv = new BlockVector3(from.getX(), from.getY(), from.getZ());
BlockVector3 bv = BlockVector3.at(from.getX(), from.getY(), from.getZ());
function.apply(bv);
countAdd = 0;
countAttempt = 0;
@ -100,7 +100,7 @@ public abstract class DFSVisitor implements Operation {
// mutable2.mutX(from.getX() + direction.x);
// mutable2.mutY(from.getY() + direction.y);
// mutable2.mutZ(from.getZ() + direction.z);
BlockVector3 bv2 = new BlockVector3(from.getX() + direction.x, from.getY() + direction.y, from.getZ() + direction.z);
BlockVector3 bv2 = BlockVector3.at(from.getX() + direction.x, from.getY() + direction.y, from.getZ() + direction.z);
if (isVisitable(bv, bv2)) {
adjacent = new Node(bv2.getBlockX(), bv2.getBlockY(), bv2.getBlockZ());
if ((current.from == null || !adjacent.equals(current.from))) {

Datei anzeigen

@ -50,8 +50,8 @@ public class FaweChunkManager extends ChunkManager {
synchronized (FaweChunkManager.class) {
EditSession sessionA = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
EditSession sessionB = new EditSessionBuilder(pos3.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
CuboidRegion regionA = new CuboidRegion(new BlockVector3(pos1.getX(), pos1.getY(), pos1.getZ()), new BlockVector3(pos2.getX(), pos2.getY(), pos2.getZ()));
CuboidRegion regionB = new CuboidRegion(new BlockVector3(pos3.getX(), pos3.getY(), pos3.getZ()), new BlockVector3(pos4.getX(), pos4.getY(), pos4.getZ()));
CuboidRegion regionA = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
CuboidRegion regionB = new CuboidRegion(BlockVector3.at(pos3.getX(), pos3.getY(), pos3.getZ()), BlockVector3.at(pos4.getX(), pos4.getY(), pos4.getZ()));
ForwardExtentCopy copyA = new ForwardExtentCopy(sessionA, regionA, sessionB, regionB.getMinimumPoint());
ForwardExtentCopy copyB = new ForwardExtentCopy(sessionB, regionB, sessionA, regionA.getMinimumPoint());
try {
@ -76,8 +76,8 @@ public class FaweChunkManager extends ChunkManager {
synchronized (FaweChunkManager.class) {
EditSession from = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
EditSession to = new EditSessionBuilder(pos3.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
CuboidRegion region = new CuboidRegion(new BlockVector3(pos1.getX(), pos1.getY(), pos1.getZ()), new BlockVector3(pos2.getX(), pos2.getY(), pos2.getZ()));
ForwardExtentCopy copy = new ForwardExtentCopy(from, region, to, new BlockVector3(pos3.getX(), pos3.getY(), pos3.getZ()));
CuboidRegion region = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
ForwardExtentCopy copy = new ForwardExtentCopy(from, region, to, BlockVector3.at(pos3.getX(), pos3.getY(), pos3.getZ()));
try {
Operations.completeLegacy(copy);
to.flushQueue();
@ -99,7 +99,7 @@ public class FaweChunkManager extends ChunkManager {
synchronized (FaweChunkManager.class) {
EditSession editSession = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
World world = editSession.getWorld();
CuboidRegion region = new CuboidRegion(new BlockVector3(pos1.getX(), pos1.getY(), pos1.getZ()), new BlockVector3(pos2.getX(), pos2.getY(), pos2.getZ()));
CuboidRegion region = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
world.regenerate(region, editSession);
editSession.flushQueue();
TaskManager.IMP.task(whenDone);

Datei anzeigen

@ -53,7 +53,7 @@ public class FaweSchematicHandler extends SchematicHandler {
Location[] corners = MainUtil.getCorners(world, regions);
Location pos1 = corners[0];
Location pos2 = corners[1];
final CuboidRegion region = new CuboidRegion(new BlockVector3(pos1.getX(), pos1.getY(), pos1.getZ()), new BlockVector3(pos2.getX(), pos2.getY(), pos2.getZ()));
final CuboidRegion region = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
final EditSession editSession = new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
final int mx = pos1.getX();

Datei anzeigen

@ -24,7 +24,7 @@ public class PlotRegionFilter extends CuboidRegionFilter {
for (Plot plot : plots) {
Location pos1 = plot.getBottom();
Location pos2 = plot.getTop();
add(new BlockVector2(pos1.getX(), pos1.getZ()), new BlockVector2(pos2.getX(), pos2.getZ()));
add(BlockVector2.at(pos1.getX(), pos1.getZ()), BlockVector2.at(pos2.getX(), pos2.getZ()));
}
}
}

Datei anzeigen

@ -84,7 +84,7 @@ public class PlotSetBiome extends Command {
.build();
long seed = PseudoRandom.random.nextLong();
for (RegionWrapper region : regions) {
CuboidRegion cuboid = new CuboidRegion(new BlockVector3(region.minX, 0, region.minZ), new BlockVector3(region.maxX, 256, region.maxZ));
CuboidRegion cuboid = new CuboidRegion(BlockVector3.at(region.minX, 0, region.minZ), BlockVector3.at(region.maxX, 256, region.maxZ));
session.regenerate(cuboid, biome, seed);
}
session.flushQueue();

Datei anzeigen

@ -125,8 +125,8 @@ public class PlotSquaredFeature extends FaweMaskManager {
faweRegions.add(new com.boydti.fawe.object.RegionWrapper(current.minX, current.maxX, min, max, current.minZ, current.maxZ));
}
final RegionWrapper region = regions.iterator().next();
final BlockVector3 pos1 = new BlockVector3(region.minX, min, region.minZ);
final BlockVector3 pos2 = new BlockVector3(region.maxX, max, region.maxZ);
final BlockVector3 pos1 = BlockVector3.at(region.minX, min, region.minZ);
final BlockVector3 pos2 = BlockVector3.at(region.maxX, max, region.maxZ);
final Plot finalPlot = plot;
if (Settings.Done.RESTRICT_BUILDING && Flags.DONE.isSet(finalPlot) || regions.isEmpty()) {
return null;

Datei anzeigen

@ -235,13 +235,13 @@ public class PlayerWrapper extends AbstractPlayerActor {
Extent world = getLocation().getExtent();
// No free space above
if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isAir()) {
if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isAir()) {
return false;
}
while (y <= world.getMaximumPoint().getY()) {
// Found a ceiling!
if (world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
int platformY = Math.max(initialY, y - 3 - clearance);
floatAt(x, platformY + 1, z, alwaysGlass);
return true;
@ -269,7 +269,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
final Extent world = getLocation().getExtent();
while (y <= world.getMaximumPoint().getY() + 2) {
if (world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
break; // Hit something
} else if (y > maxY + 1) {
break;
@ -289,7 +289,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
RuntimeException caught = null;
try {
EditSession edit = new EditSessionBuilder(parent.getWorld()).player(FawePlayer.wrap(this)).build();
edit.setBlock(new BlockVector3(x, y - 1, z), BlockTypes.GLASS);
edit.setBlock(BlockVector3.at(x, y - 1, z), BlockTypes.GLASS);
edit.flushQueue();
LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this);
if (session != null) {
@ -301,7 +301,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override
public void run(Object value) {
setPosition(new Vector3(x + 0.5, y, z + 0.5));
setPosition(Vector3.at(x + 0.5, y, z + 0.5));
}
});
if (caught != null) {
@ -361,7 +361,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
boolean inFree = false;
while ((block = hitBlox.getNextBlock()) != null) {
boolean free = !world.getBlock(new BlockVector3(block.getBlockX(), block.getBlockY(), block.getBlockZ())).getBlockType().getMaterial().isMovementBlocker();
boolean free = !world.getBlock(BlockVector3.at(block.getBlockX(), block.getBlockY(), block.getBlockZ())).getBlockType().getMaterial().isMovementBlocker();
if (firstBlock) {
firstBlock = false;

Datei anzeigen

@ -171,7 +171,7 @@ public final class NBTUtils {
*/
public static Vector3 toVector(ListTag listTag) {
checkNotNull(listTag);
return new Vector3(listTag.asDouble(0), listTag.asDouble(1), listTag.asDouble(2));
return Vector3.at(listTag.asDouble(0), listTag.asDouble(1), listTag.asDouble(2));
}
/**

Datei anzeigen

@ -214,7 +214,7 @@ public class YAMLNode {
return null;
}
return new Vector3(x, y, z);
return Vector3.at(x, y, z);
}
/**
@ -238,7 +238,7 @@ public class YAMLNode {
return null;
}
return new Vector2(x, z);
return Vector2.at(x, z);
}
/**
@ -570,7 +570,7 @@ public class YAMLNode {
continue;
}
list.add(new Vector3(x, y, z));
list.add(Vector3.at(x, y, z));
}
return list;
@ -600,7 +600,7 @@ public class YAMLNode {
continue;
}
list.add(new Vector2(x, z));
list.add(Vector2.at(x, z));
}
return list;
@ -630,7 +630,7 @@ public class YAMLNode {
continue;
}
list.add(new BlockVector2(x, z));
list.add(BlockVector2.at(x, z));
}
return list;

Datei anzeigen

@ -249,7 +249,7 @@ public class CuboidClipboard {
for (int x = 0; x < size.getBlockX(); ++x) {
for (int y = 0; y < size.getBlockY(); ++y) {
for (int z = 0; z < size.getBlockZ(); ++z) {
setBlock(x, y, z, editSession.getBlock(new BlockVector3(x, y, z).add(getOrigin())));
setBlock(x, y, z, editSession.getBlock(BlockVector3.at(x, y, z).add(getOrigin())));
}
}
}
@ -265,7 +265,7 @@ public class CuboidClipboard {
for (int x = 0; x < size.getBlockX(); ++x) {
for (int y = 0; y < size.getBlockY(); ++y) {
for (int z = 0; z < size.getBlockZ(); ++z) {
final BlockVector3 pt = new BlockVector3(x, y, z).add(getOrigin());
final BlockVector3 pt = BlockVector3.at(x, y, z).add(getOrigin());
if (region.contains(pt)) {
setBlock(x, y, z, editSession.getBlock(pt));
} else {

Datei anzeigen

@ -999,7 +999,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
for (int y = maxY; y >= minY; --y) {
BlockVector3 pt = new BlockVector3(x, y, z);
BlockVector3 pt = BlockVector3.at(x, y, z);
BlockState block = getBlock(pt);
if (block.getBlockType().getMaterial().isMovementBlocker()) {
return y;
@ -1246,7 +1246,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
if (extent != null) {
return this.extent.getMinimumPoint();
} else {
return new BlockVector3(-30000000, 0, -30000000);
return BlockVector3.at(-30000000, 0, -30000000);
}
}
@ -1255,7 +1255,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
if (extent != null) {
return this.extent.getMaximumPoint();
} else {
return new BlockVector3(30000000, 255, 30000000);
return BlockVector3.at(30000000, 255, 30000000);
}
}
@ -1426,10 +1426,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
checkNotNull(pattern);
checkArgument(radius >= 0, "radius >= 0");
checkArgument(depth >= 1, "depth >= 1");
if (direction.equals(new BlockVector3(0, -1, 0))) {
if (direction.equals(BlockVector3.at(0, -1, 0))) {
return fillXZ(origin, pattern, radius, depth, false);
}
final MaskIntersection mask = new MaskIntersection(new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))), Masks.negate(new ExistingBlockMask(EditSession.this)));
final MaskIntersection mask = new MaskIntersection(new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), Masks.negate(new ExistingBlockMask(EditSession.this)));
// Want to replace blocks
final BlockReplace replace = new BlockReplace(EditSession.this, pattern);
@ -1477,10 +1477,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
checkNotNull(pattern);
checkArgument(radius >= 0, "radius >= 0");
checkArgument(depth >= 1, "depth >= 1");
final MaskIntersection mask = new MaskIntersection(new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))), new BoundedHeightMask(Math.max(
final MaskIntersection mask = new MaskIntersection(new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), new BoundedHeightMask(Math.max(
(origin.getBlockY() - depth) + 1, getMinimumPoint().getBlockY()), Math.min(getMaximumPoint().getBlockY(), origin.getBlockY())), Masks.negate(new ExistingBlockMask(EditSession.this)));
// MaskIntersection mask = new MaskIntersection(
// new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))),
// new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
// new BoundedHeightMask(
// Math.max(origin.getBlockY() - depth + 1, 0),
// Math.min(getWorld().getMaxY(), origin.getBlockY())),
@ -1559,7 +1559,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
checkNotNull(position);
checkArgument(apothem >= 1, "apothem >= 1");
final BlockVector3 adjustment = new BlockVector3(1, 1, 1).multiply(apothem - 1);
final BlockVector3 adjustment = BlockVector3.at(1, 1, 1).multiply(apothem - 1);
final Region region = new CuboidRegion(this.getWorld(), // Causes clamping of Y range
position.add(adjustment.multiply(-1)), position.add(adjustment));
final Pattern pattern = BlockTypes.AIR.getDefaultState();
@ -1742,8 +1742,8 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
// Vector3 center = region.getCenter();
// Region centerRegion = new CuboidRegion(
// getWorld(), // Causes clamping of Y range
// new BlockVector3(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())),
// new BlockVector3(MathUtils.roundHalfUp(center.getX()),
// BlockVector3.at(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())),
// BlockVector3.at(MathUtils.roundHalfUp(center.getX()),
// center.getY(), MathUtils.roundHalfUp(center.getZ())));
// return setBlocks(centerRegion, pattern);
}
@ -1892,7 +1892,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
checkNotNull(region);
checkNotNull(pattern);
final BlockReplace replace = new BlockReplace(EditSession.this, pattern);
final RegionOffset offset = new RegionOffset(new BlockVector3(0, 1, 0), replace);
final RegionOffset offset = new RegionOffset(BlockVector3.at(0, 1, 0), replace);
int minY = region.getMinimumPoint().getBlockY();
int maxY = Math.min(getMaximumPoint().getBlockY(), region.getMaximumPoint().getBlockY() + 1);
SurfaceRegionFunction surface = new SurfaceRegionFunction(this, offset, minY, maxY);
@ -1900,7 +1900,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
Operations.completeBlindly(visitor);
return this.changes = visitor.getAffected();
// BlockReplace replace = new BlockReplace(this, pattern);
// RegionOffset offset = new RegionOffset(new BlockVector3(0, 1, 0), replace);
// RegionOffset offset = new RegionOffset(BlockVector3.at(0, 1, 0), replace);
// GroundFunction ground = new GroundFunction(new ExistingBlockMask(this), offset);
// LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground);
// Operations.completeLegacy(visitor);
@ -2066,7 +2066,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
new BoundedHeightMask(0, EditSession.this.getMaximumPoint().getBlockY()),
new RegionMask(
new EllipsoidRegion(null, origin,
new Vector3(radius, radius, radius))), liquidMask);
Vector3.at(radius, radius, radius))), liquidMask);
final BlockReplace replace = new BlockReplace(EditSession.this, BlockTypes.AIR.getDefaultState());
final RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1), this);
@ -2079,7 +2079,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
//
// MaskIntersection mask = new MaskIntersection(
// new BoundedHeightMask(0, getWorld().getMaxY()),
// new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))),
// new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
// getWorld().createLiquidMask());
//
// BlockReplace replace = new BlockReplace(this, new BlockPattern(BlockTypes.AIR.getDefaultState()));
@ -2111,7 +2111,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
// There are boundaries that the routine needs to stay in
MaskIntersection mask = new MaskIntersection(
new BoundedHeightMask(0, Math.min(origin.getBlockY(), getMaximumPoint().getBlockY())),
new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))),
new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
liquidMask);
BlockReplace replace = new BlockReplace(this, pattern);
@ -2528,12 +2528,12 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
// int ceilRadius = (int) Math.ceil(radius);
// for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
// for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
// if ((new BlockVector3(x, oy, z)).distanceSq(position) > radiusSq) {
// if ((BlockVector3.at(x, oy, z)).distanceSq(position) > radiusSq) {
// continue;
// }
//
// for (int y = world.getMaxY(); y >= 1; --y) {
// BlockVector3 pt = new BlockVector3(x, y, z);
// BlockVector3 pt = BlockVector3.at(x, y, z);
// BlockType id = getBlock(pt).getBlockType();
//
// if (id == BlockTypes.ICE) {
@ -2601,12 +2601,12 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
// int ceilRadius = (int) Math.ceil(radius);
// for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
// for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
// if ((new BlockVector3(x, oy, z)).distanceSq(position) > radiusSq) {
// if ((BlockVector3.at(x, oy, z)).distanceSq(position) > radiusSq) {
// continue;
// }
//
// for (int y = world.getMaxY(); y >= 1; --y) {
// BlockVector3 pt = new BlockVector3(x, y, z);
// BlockVector3 pt = BlockVector3.at(x, y, z);
// BlockType id = getBlock(pt).getBlockType();
//
// if (id.getMaterial().isAir()) {
@ -2693,12 +2693,12 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
}
// for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
// for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
// if ((new BlockVector3(x, oy, z)).distanceSq(position) > radiusSq) {
// if ((BlockVector3.at(x, oy, z)).distanceSq(position) > radiusSq) {
// continue;
// }
//
// for (int y = world.getMaxY(); y >= 1; --y) {
// final BlockVector3 pt = new BlockVector3(x, y, z);
// final BlockVector3 pt = BlockVector3.at(x, y, z);
// final BlockState block = getBlock(pt);
//
// if (block.getBlockType() == BlockTypes.DIRT ||
@ -2783,11 +2783,11 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
switch (type.getTypeEnum()) {
case GRASS:
case DIRT:
treeType.generate(this, new BlockVector3(x, y + 1, z));
treeType.generate(this, BlockVector3.at(x, y + 1, z));
this.changes++;
break;
case SNOW:
setBlock(new BlockVector3(x, y, z), BlockTypes.AIR.getDefaultState());
setBlock(BlockVector3.at(x, y, z), BlockTypes.AIR.getDefaultState());
break;
case AIR:
case CAVE_AIR:
@ -2804,7 +2804,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
// for (int z = basePosition.getBlockZ() - size; z <= basePosition.getBlockZ()
// + size; ++z) {
// // Don't want to be in the ground
// if (!getBlock(new BlockVector3(x, basePosition.getBlockY(), z)).getBlockType().getMaterial().isAir()) {
// if (!getBlock(BlockVector3.at(x, basePosition.getBlockY(), z)).getBlockType().getMaterial().isAir()) {
// continue;
// }
// // The gods don't want a tree here
@ -2814,13 +2814,13 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
//
// for (int y = basePosition.getBlockY(); y >= basePosition.getBlockY() - 10; --y) {
// // Check if we hit the ground
// BlockType t = getBlock(new BlockVector3(x, y, z)).getBlockType();
// BlockType t = getBlock(BlockVector3.at(x, y, z)).getBlockType();
// if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) {
// treeType.generate(this, new BlockVector3(x, y + 1, z));
// treeType.generate(this, BlockVector3.at(x, y + 1, z));
// ++affected;
// break;
// } else if (t == BlockTypes.SNOW) {
// setBlock(new BlockVector3(x, y, z), BlockTypes.AIR.getDefaultState());
// setBlock(BlockVector3.at(x, y, z), BlockTypes.AIR.getDefaultState());
// } else if (!t.getMaterial().isAir()) { // Trees won't grow on this!
// break;
}
@ -2959,7 +2959,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
//TODO Optimize - avoid vector creation (math)
// final Vector3 current = mutablev.setComponents(x, y, z);
// protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) {
final Vector3 current = new Vector3(x, y, z);
final Vector3 current = Vector3.at(x, y, z);
environment.setCurrentBlock(current);
final Vector3 scaled = current.subtract(zero).divide(unit);
@ -3069,22 +3069,22 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
for (int x = minX; x <= maxX; ++x) {
for (int y = minY; y <= maxY; ++y) {
this.recurseHollow(region, new BlockVector3(x, y, minZ), outside);
this.recurseHollow(region, new BlockVector3(x, y, maxZ), outside);
this.recurseHollow(region, BlockVector3.at(x, y, minZ), outside);
this.recurseHollow(region, BlockVector3.at(x, y, maxZ), outside);
}
}
for (int y = minY; y <= maxY; ++y) {
for (int z = minZ; z <= maxZ; ++z) {
this.recurseHollow(region, new BlockVector3(minX, y, z), outside);
this.recurseHollow(region, new BlockVector3(maxX, y, z), outside);
this.recurseHollow(region, BlockVector3.at(minX, y, z), outside);
this.recurseHollow(region, BlockVector3.at(maxX, y, z), outside);
}
}
for (int z = minZ; z <= maxZ; ++z) {
for (int x = minX; x <= maxX; ++x) {
this.recurseHollow(region, new BlockVector3(x, minY, z), outside);
this.recurseHollow(region, new BlockVector3(x, maxY, z), outside);
this.recurseHollow(region, BlockVector3.at(x, minY, z), outside);
this.recurseHollow(region, BlockVector3.at(x, maxY, z), outside);
}
}
@ -3352,7 +3352,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) {
@Override
protected BaseBiome getBiome(final int x, final int z, final BaseBiome defaultBiomeType) {
final Vector2 current = new Vector2(x, z);
final Vector2 current = Vector2.at(x, z);
environment.setCurrentBlock(current.toVector3(0));
final Vector2 scaled = current.subtract(zero2D).divide(unit2D);
@ -3459,7 +3459,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
final int cz = chunk.getBlockZ();
final int bx = cx << 4;
final int bz = cz << 4;
final BlockVector3 cmin = new BlockVector3(bx, 0, bz);
final BlockVector3 cmin = BlockVector3.at(bx, 0, bz);
final BlockVector3 cmax = cmin.add(15, getMaxY(), 15);
final boolean containsBot1 = (fe == null || fe.contains(cmin.getBlockX(), cmin.getBlockY(), cmin.getBlockZ()));
final boolean containsBot2 = region.contains(cmin);
@ -3481,7 +3481,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
int zz = z + bz;
for (int y = 0; y < getMaxY() + 1; y++) {
// BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
BlockVector3 bv = new BlockVector3(xx, y, zz);
BlockVector3 bv = BlockVector3.at(xx, y, zz);
BlockStateHolder block = getFullBlock(bv);
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState());
}
@ -3490,13 +3490,13 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
}
} else {
if (!conNextX) {
setExistingBlocks(new BlockVector3(bx + 16, 0, bz), new BlockVector3(bx + 31, getMaxY(), bz + 15));
setExistingBlocks(BlockVector3.at(bx + 16, 0, bz), BlockVector3.at(bx + 31, getMaxY(), bz + 15));
}
if (!conNextZ) {
setExistingBlocks(new BlockVector3(bx, 0, bz + 16), new BlockVector3(bx + 15, getMaxY(), bz + 31));
setExistingBlocks(BlockVector3.at(bx, 0, bz + 16), BlockVector3.at(bx + 15, getMaxY(), bz + 31));
}
if (!chunks.contains(mutable2D.setComponents(cx + 1, cz + 1)) && !conNextX && !conNextZ) {
setExistingBlocks(new BlockVector3(bx + 16, 0, bz + 16), new BlockVector3(bx + 31, getMaxY(), bz + 31));
setExistingBlocks(BlockVector3.at(bx + 16, 0, bz + 16), BlockVector3.at(bx + 31, getMaxY(), bz + 31));
}
for (int x = 0; x < 16; x++) {
int xx = x + bx;
@ -3506,7 +3506,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
mutable.mutZ(zz);
for (int y = 0; y < getMaxY() + 1; y++) {
mutable.mutY(y);
BlockVector3 mbv = new BlockVector3(xx, y, zz);
BlockVector3 mbv = BlockVector3.at(xx, y, zz);
boolean contains = (fe == null || fe.contains(xx, y, zz)) && region.contains(mbv);
if (contains) {
containsAny = true;

Datei anzeigen

@ -1154,7 +1154,7 @@ public class LocalSession implements TextureHolder {
if (block != null) {
// If it's null, we don't need to do anything. The old was already removed.
Map<String, Tag> tags = block.getNbtData().getValue();
cuiTemporaryBlock = new BlockVector3(
cuiTemporaryBlock = BlockVector3.at(
((IntTag) tags.get("x")).getValue(),
((IntTag) tags.get("y")).getValue(),
((IntTag) tags.get("z")).getValue()

Datei anzeigen

@ -29,16 +29,16 @@ import com.sk89q.worldedit.util.Direction;
*/
public enum PlayerDirection {
NORTH(new Vector3(0, 0, -1), true),
NORTH_EAST((new Vector3(1, 0, -1)).normalize(), false),
EAST(new Vector3(1, 0, 0), true),
SOUTH_EAST((new Vector3(1, 0, 1)).normalize(), false),
SOUTH(new Vector3(0, 0, 1), true),
SOUTH_WEST((new Vector3(-1, 0, 1)).normalize(), false),
WEST(new Vector3(-1, 0, 0), true),
NORTH_WEST((new Vector3(-1, 0, -1)).normalize(), false),
UP(new Vector3(0, 1, 0), true),
DOWN(new Vector3(0, -1, 0), true);
NORTH(Vector3.at(0, 0, -1), true),
NORTH_EAST((Vector3.at(1, 0, -1)).normalize(), false),
EAST(Vector3.at(1, 0, 0), true),
SOUTH_EAST((Vector3.at(1, 0, 1)).normalize(), false),
SOUTH(Vector3.at(0, 0, 1), true),
SOUTH_WEST((Vector3.at(-1, 0, 1)).normalize(), false),
WEST(Vector3.at(-1, 0, 0), true),
NORTH_WEST((Vector3.at(-1, 0, -1)).normalize(), false),
UP(Vector3.at(0, 1, 0), true),
DOWN(Vector3.at(0, -1, 0), true);
private final Vector3 dir;
private final boolean isOrthogonal;

Datei anzeigen

@ -78,7 +78,7 @@ public class ChunkCommands {
player.print(BBC.getPrefix() + "Chunk: " + chunkX + ", " + chunkZ);
player.print(BBC.getPrefix() + "Old format: " + folder1 + "/" + folder2 + "/" + filename);
player.print(BBC.getPrefix() + "McRegion: region/" + McRegionChunkStore.getFilename(
new BlockVector2(chunkX, chunkZ)));
BlockVector2.at(chunkX, chunkZ)));
}
@Command(

Datei anzeigen

@ -91,7 +91,7 @@ public class FlattenedClipboardTransform {
maximum.withZ(minimum.getZ()) };
for (int i = 0; i < corners.length; i++) {
corners[i] = transformAround.apply(new Vector3(corners[i]));
corners[i] = transformAround.apply(corners[i]);
}
MutableVector newMinimum = new MutableVector(corners[0]);
@ -109,7 +109,7 @@ public class FlattenedClipboardTransform {
newMinimum.mutY(Math.ceil(Math.floor(newMinimum.getY())));
newMinimum.mutZ(Math.ceil(Math.floor(newMinimum.getZ())));
return new CuboidRegion(new BlockVector3(newMinimum.getX(), newMinimum.getY(), newMinimum.getZ()), new BlockVector3(newMaximum.getX(), newMaximum.getY(), newMaximum.getZ()));
return new CuboidRegion(BlockVector3.at(newMinimum.getX(), newMinimum.getY(), newMinimum.getZ()), BlockVector3.at(newMaximum.getX(), newMaximum.getY(), newMaximum.getZ()));
}
/**

Datei anzeigen

@ -114,7 +114,7 @@ public class HistoryCommands extends MethodCommands {
RollbackOptimizedHistory rollback = new RollbackOptimizedHistory(world, uuid, Integer.parseInt(name.substring(0, name.length() - 3)));
DiskStorageHistory.DiskStorageSummary summary = rollback.summarize(RegionWrapper.GLOBAL(), false);
if (summary != null) {
rollback.setDimensions(new BlockVector3(summary.minX, 0, summary.minZ), new BlockVector3(summary.maxX, 255, summary.maxZ));
rollback.setDimensions(BlockVector3.at(summary.minX, 0, summary.minZ), BlockVector3.at(summary.maxX, 255, summary.maxZ));
rollback.setTime(historyFile.lastModified());
RollbackDatabase db = DBHandler.IMP.getDatabase(world);
db.logEdit(rollback);

Datei anzeigen

@ -130,7 +130,7 @@ public class MaskCommands extends MethodCommands {
max = 4
)
public Mask offset(double x, double y, double z, Mask mask) {
return new OffsetMask(mask, new BlockVector3(x, y, z));
return new OffsetMask(mask, BlockVector3.at(x, y, z));
}
@Command(
@ -390,7 +390,7 @@ public class MaskCommands extends MethodCommands {
max = 1
)
public Mask below(Mask mask) throws ExpressionException {
OffsetMask offsetMask = new OffsetMask(mask, new BlockVector3(0, 1, 0));
OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0));
return new MaskIntersection(offsetMask, Masks.negate(mask));
}
@ -402,7 +402,7 @@ public class MaskCommands extends MethodCommands {
max = 1
)
public Mask above(Mask mask) throws ExpressionException {
OffsetMask offsetMask = new OffsetMask(mask, new BlockVector3(0, -1, 0));
OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0));
return new MaskIntersection(offsetMask, Masks.negate(mask));
}

Datei anzeigen

@ -120,7 +120,7 @@ public class RegionCommands extends MethodCommands {
if (selection == null) {
final int cx = loc.x >> 4;
final int cz = loc.z >> 4;
selection = new CuboidRegion(new BlockVector3(cx - 8, 0, cz - 8).multiply(16), new BlockVector3(cx + 8, 0, cz + 8).multiply(16));
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
}
int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.ALL);
BBC.LIGHTING_PROPOGATE_SELECTION.send(fp, count);
@ -154,7 +154,7 @@ public class RegionCommands extends MethodCommands {
if (selection == null) {
final int cx = loc.x >> 4;
final int cz = loc.z >> 4;
selection = new CuboidRegion(new BlockVector3(cx - 8, 0, cz - 8).multiply(16), new BlockVector3(cx + 8, 0, cz + 8).multiply(16));
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
}
int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.NONE);
BBC.UPDATED_LIGHTING_SELECTION.send(fp, count);
@ -624,7 +624,7 @@ public class RegionCommands extends MethodCommands {
if (moveSelection) {
try {
final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
BlockVector3 shiftVector = new BlockVector3(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count);
BlockVector3 shiftVector = BlockVector3.at(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count);
region.shift(shiftVector);
session.getRegionSelector(player.getWorld()).learnChanges();

Datei anzeigen

@ -110,7 +110,7 @@ public class SelectionCommands {
if (args.argsLength() == 1) {
if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) {
String[] coords = args.getString(0).split(",");
pos = new BlockVector3(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2]));
pos = BlockVector3.at(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2]));
} else {
BBC.SELECTOR_INVALID_COORDINATES.send(player, args.getString(0));
return;
@ -141,7 +141,7 @@ public class SelectionCommands {
if (args.argsLength() == 1) {
if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) {
String[] coords = args.getString(0).split(",");
pos = new BlockVector3(Integer.parseInt(coords[0]),
pos = BlockVector3.at(Integer.parseInt(coords[0]),
Integer.parseInt(coords[1]),
Integer.parseInt(coords[2]));
} else {
@ -237,8 +237,8 @@ public class SelectionCommands {
final BlockVector2 min2D = ChunkStore.toChunk(region.getMinimumPoint());
final BlockVector2 max2D = ChunkStore.toChunk(region.getMaximumPoint());
min = new BlockVector3(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
max = new BlockVector3(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15);
min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
max = BlockVector3.at(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15);
BBC.SELECTION_CHUNKS.send(player, min2D.getBlockX() + ", " + min2D.getBlockZ(), max2D.getBlockX() + ", " + max2D.getBlockZ());
} else {
@ -251,14 +251,14 @@ public class SelectionCommands {
}
int x = Integer.parseInt(coords[0]);
int z = Integer.parseInt(coords[1]);
BlockVector2 pos = new BlockVector2(x, z);
BlockVector2 pos = BlockVector2.at(x, z);
min2D = (args.hasFlag('c')) ? pos : ChunkStore.toChunk(pos.toBlockVector3());
} else {
// use player loc
min2D = ChunkStore.toChunk(player.getBlockIn().toVector().toBlockPoint());
}
min = new BlockVector3(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
max = min.add(15, world.getMaxY(), 15);
BBC.SELECTION_CHUNK.send(player, min2D.getBlockX() + ", " + min2D.getBlockZ());
@ -328,8 +328,8 @@ public class SelectionCommands {
try {
int oldSize = region.getArea();
region.expand(
new BlockVector3(0, (player.getWorld().getMaxY() + 1), 0),
new BlockVector3(0, -(player.getWorld().getMaxY() + 1), 0));
BlockVector3.at(0, (player.getWorld().getMaxY() + 1), 0),
BlockVector3.at(0, -(player.getWorld().getMaxY() + 1), 0));
session.getRegionSelector(player.getWorld()).learnChanges();
int newSize = region.getArea();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
@ -567,15 +567,15 @@ public class SelectionCommands {
int change = args.getInteger(0);
if (!args.hasFlag('h')) {
changes.add((new BlockVector3(0, 1, 0)).multiply(change));
changes.add((new BlockVector3(0, -1, 0)).multiply(change));
changes.add((BlockVector3.at(0, 1, 0)).multiply(change));
changes.add((BlockVector3.at(0, -1, 0)).multiply(change));
}
if (!args.hasFlag('v')) {
changes.add((new BlockVector3(1, 0, 0)).multiply(change));
changes.add((new BlockVector3(-1, 0, 0)).multiply(change));
changes.add((new BlockVector3(0, 0, 1)).multiply(change));
changes.add((new BlockVector3(0, 0, -1)).multiply(change));
changes.add((BlockVector3.at(1, 0, 0)).multiply(change));
changes.add((BlockVector3.at(-1, 0, 0)).multiply(change));
changes.add((BlockVector3.at(0, 0, 1)).multiply(change));
changes.add((BlockVector3.at(0, 0, -1)).multiply(change));
}
return changes.toArray(new BlockVector3[0]);

Datei anzeigen

@ -204,7 +204,7 @@ public class DefaultMaskParser extends FaweParser<Mask> {
// } else {
// submask = new ExistingBlockMask(extent);
// }
// OffsetMask offsetMask = new OffsetMask(submask, new BlockVector3(0, firstChar == '>' ? -1 : 1, 0));
// OffsetMask offsetMask = new OffsetMask(submask, BlockVector3.at(0, firstChar == '>' ? -1 : 1, 0));
// return new MaskIntersection(offsetMask, Masks.negate(submask));
//
// case '$':
@ -217,7 +217,7 @@ public class DefaultMaskParser extends FaweParser<Mask> {
// BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry);
// if (biome == null) {
// throw new InputParseException("Unknown biome '" + biomeName + '\'');
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
//>>>>>>> 2c8b2fe0... Move vectors to static creators, for caching
}
}
//<<<<<<< HEAD

Datei anzeigen

@ -115,7 +115,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
byte free = 0;
while (y <= world.getMaximumPoint().getBlockY() + 2) {
if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
++free;
} else {
free = 0;
@ -123,10 +123,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
if (free == 2) {
if (y - 1 != origY) {
final BlockVector3 pos = new BlockVector3(x, y - 2, z);
final BlockVector3 pos = BlockVector3.at(x, y - 2, z);
final BlockStateHolder state = world.getBlock(pos);
setPosition(new Vector3(x + 0.5, y - 2 + BlockType.centralTopLimit(state), z + 0.5));
// setPosition(new Vector3(x + 0.5, y - 2 + 1, z + 0.5));
setPosition(Vector3.at(x + 0.5, y - 2 + BlockType.centralTopLimit(state), z + 0.5));
// setPosition(Vector3.at(x + 0.5, y - 2 + 1, z + 0.5));
}
return;
@ -144,10 +144,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
int z = searchPos.getBlockZ();
while (y >= 0) {
final BlockVector3 pos = new BlockVector3(x, y, z);
final BlockVector3 pos = BlockVector3.at(x, y, z);
final BlockState id = world.getBlock(pos);
if (id.getBlockType().getMaterial().isMovementBlocker()) {
setPosition(new Vector3(x + 0.5, y + + BlockType.centralTopLimit(id), z + 0.5));
setPosition(Vector3.at(x + 0.5, y + + BlockType.centralTopLimit(id), z + 0.5));
return;
}
@ -171,7 +171,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
int maxY = world.getMaxY();
if (y >= maxY) return false;
BlockMaterial initialMaterial = world.getBlockType(new BlockVector3(x, y, z)).getMaterial();
BlockMaterial initialMaterial = world.getBlockType(BlockVector3.at(x, y, z)).getMaterial();
boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube();
@ -181,7 +181,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
for (int level = y + 1; level <= maxY + 2; level++) {
BlockState state;
if (level >= maxY) state = BlockTypes.VOID_AIR.getDefaultState();
else state = world.getBlock(new BlockVector3(x, level, z));
else state = world.getBlock(BlockVector3.at(x, level, z));
BlockTypes type = state.getBlockType();
BlockMaterial material = type.getMaterial();
@ -196,7 +196,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
double bottomLimit = BlockType.centralBottomLimit(state);
double space = level + bottomLimit - freeStart;
if (space >= height) {
setPosition(new Vector3(x + 0.5, freeStart, z + 0.5));
setPosition(Vector3.at(x + 0.5, freeStart, z + 0.5));
return true;
}
// Not enough room, reset the free position
@ -220,7 +220,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
final int z = pos.getBlockZ();
final Extent world = pos.getExtent();
BlockMaterial initialMaterial = world.getBlockType(new BlockVector3(x, y, z)).getMaterial();
BlockMaterial initialMaterial = world.getBlockType(BlockVector3.at(x, y, z)).getMaterial();
boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube();
@ -233,7 +233,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
for (int level = y + 1; level > 0; level--) {
BlockState state;
if (level >= maxY) state = BlockTypes.VOID_AIR.getDefaultState();
else state = world.getBlock(new BlockVector3(x, level, z));
else state = world.getBlock(BlockVector3.at(x, level, z));
BlockTypes type = state.getBlockType();
BlockMaterial material = type.getMaterial();
@ -249,7 +249,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
double freeStart = level + topLimit;
double space = freeEnd - freeStart;
if (space >= height) {
setPosition(new Vector3(x + 0.5, freeStart, z + 0.5));
setPosition(Vector3.at(x + 0.5, freeStart, z + 0.5));
return true;
}
// Not enough room, reset the free position
@ -280,13 +280,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
Extent world = getLocation().getExtent();
// No free space above
if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isAir()) {
if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isAir()) {
return false;
}
while (y <= world.getMaximumPoint().getY()) {
// Found a ceiling!
if (world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
int platformY = Math.max(initialY, y - 3 - clearance);
floatAt(x, platformY + 1, z, alwaysGlass);
return true;
@ -314,7 +314,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
final Extent world = getLocation().getExtent();
while (y <= world.getMaximumPoint().getY() + 2) {
if (world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
break; // Hit something
} else if (y > maxY + 1) {
break;
@ -332,14 +332,14 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
try {
BlockVector3 spot = new BlockVector3(x, y - 1, z);
BlockVector3 spot = BlockVector3.at(x, y - 1, z);
if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) {
getLocation().getExtent().setBlock(spot, BlockTypes.GLASS.getDefaultState());
}
}catch (WorldEditException e) {
e.printStackTrace();
}
setPosition(new Vector3(x + 0.5, y, z + 0.5));
setPosition(Vector3.at(x + 0.5, y, z + 0.5));
}
@Override

Datei anzeigen

@ -129,7 +129,7 @@ public class AbstractDelegateExtent implements LightingExtent {
// mutable.mutX(x);
// mutable.mutY(y);
// mutable.mutZ(z);
return extent.getLazyBlock(new BlockVector3(x, y, z));
return extent.getLazyBlock(BlockVector3.at(x, y, z));
}
@Override
@ -142,7 +142,7 @@ public class AbstractDelegateExtent implements LightingExtent {
// mutable.mutX(x);
// mutable.mutY(y);
// mutable.mutZ(z);
return setBlock(new BlockVector3(x, y, z), block);
return setBlock(BlockVector3.at(x, y, z), block);
}
public BlockState getBlock(BlockVector3 position) {

Datei anzeigen

@ -127,15 +127,15 @@ public interface Extent extends InputExtent, OutputExtent {
}
default BlockState getLazyBlock(int x, int y, int z) {
return getLazyBlock(new BlockVector3(x, y, z));
return getLazyBlock(BlockVector3.at(x, y, z));
}
default boolean setBlock(int x, int y, int z, BlockStateHolder state) throws WorldEditException {
return setBlock(new BlockVector3(x, y, z), state);
return setBlock(BlockVector3.at(x, y, z), state);
}
default boolean setBiome(int x, int y, int z, BaseBiome biome) {
return setBiome(new BlockVector2(x, z), biome);
return setBiome(BlockVector2.at(x, z), biome);
}
default int getHighestTerrainBlock(final int x, final int z, int minY, int maxY) {

Datei anzeigen

@ -84,7 +84,7 @@ public class MaskingExtent extends AbstractDelegateExtent {
@Override
public boolean setBiome(int x, int y, int z, BaseBiome biome) {
return mask.test(new BlockVector3(x, y, z)) && super.setBiome(x, y, z, biome);
return mask.test(BlockVector3.at(x, y, z)) && super.setBiome(x, y, z, biome);
}

Datei anzeigen

@ -52,7 +52,7 @@ import java.util.List;
*/
public class NullExtent implements Extent {
private final BlockVector3 nullPoint = new BlockVector3(0, 0, 0);
private final BlockVector3 nullPoint = BlockVector3.at(0, 0, 0);
public static final NullExtent INSTANCE = new NullExtent();

Datei anzeigen

@ -31,7 +31,6 @@ import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.Masks;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException;

Datei anzeigen

@ -22,7 +22,6 @@ package com.sk89q.worldedit.extent.cache;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.world.block.BlockState;
/**

Datei anzeigen

@ -312,11 +312,11 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
@Override
public int getOpacity(int x, int y, int z) {
return getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().getLightOpacity();
return getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().getLightOpacity();
}
@Override
public int getBrightness(int x, int y, int z) {
return getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().getLightValue();
return getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().getLightValue();
}
}

Datei anzeigen

@ -117,12 +117,12 @@ public class MCEditSchematicReader extends NBTSchematicReader {
int originX = requireTag(schematic, "WEOriginX", IntTag.class).getValue();
int originY = requireTag(schematic, "WEOriginY", IntTag.class).getValue();
int originZ = requireTag(schematic, "WEOriginZ", IntTag.class).getValue();
BlockVector3 min = new BlockVector3(originX, originY, originZ);
BlockVector3 min = BlockVector3.at(originX, originY, originZ);
int offsetX = requireTag(schematic, "WEOffsetX", IntTag.class).getValue();
int offsetY = requireTag(schematic, "WEOffsetY", IntTag.class).getValue();
int offsetZ = requireTag(schematic, "WEOffsetZ", IntTag.class).getValue();
BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ);
BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ);
origin = min.subtract(offset);
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
@ -206,7 +206,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
}
}
BlockVector3 vec = new BlockVector3(x, y, z);
BlockVector3 vec = BlockVector3.at(x, y, z);
tileEntitiesMap.put(vec, values);
}
@ -220,7 +220,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
for (int y = 0; y < height; ++y) {
for (int z = 0; z < length; ++z) {
int index = y * width * length + z * width + x;
BlockVector3 pt = new BlockVector3(x, y, z);
BlockVector3 pt = BlockVector3.at(x, y, z);
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(blocks[index], blockData[index]);
try {

Datei anzeigen

@ -122,14 +122,28 @@ public class SpongeSchematicReader extends NBTSchematicReader {
private FaweClipboard setupClipboard(int size, UUID uuid) {
if (fc != null) {
if (fc.getDimensions().getX() == 0) {
fc.setDimensions(new BlockVector3(size, 1, 1));
fc.setDimensions(BlockVector3.at(size, 1, 1));
}
return fc;
}
//<<<<<<< HEAD
if (Settings.IMP.CLIPBOARD.USE_DISK) {
return fc = new DiskOptimizedClipboard(size, 1, 1, uuid);
} else if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL == 0) {
return fc = new CPUOptimizedClipboard(size, 1, 1);
//=======
//
// BlockVector3 min = BlockVector3.at(offsetParts[0], offsetParts[1], offsetParts[2]);
//
// if (metadata.containsKey("WEOffsetX")) {
// // We appear to have WorldEdit Metadata
// int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue();
// int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue();
// int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue();
// BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ);
// origin = min.subtract(offset);
// region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
//>>>>>>> 2c8b2fe0... Move vectors to static creators, for caching
} else {
return fc = new MemoryOptimizedClipboard(size, 1, 1);
}
@ -310,7 +324,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
private Clipboard readVersion1(UUID uuid) throws IOException {
width = height = length = offsetX = offsetY = offsetZ = Integer.MIN_VALUE;
final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(0, 0, 0)), fc);
final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(BlockVector3.at(0, 0, 0), BlockVector3.at(0, 0, 0)), fc);
FastByteArrayOutputStream blocksOut = new FastByteArrayOutputStream();
FastByteArrayOutputStream biomesOut = new FastByteArrayOutputStream();
@ -318,7 +332,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
streamer.addReader("Schematic.Width", (BiConsumer<Integer, Short>) (i, v) -> width = v);
streamer.addReader("Schematic.Height", (BiConsumer<Integer, Short>) (i, v) -> height = v);
streamer.addReader("Schematic.Length", (BiConsumer<Integer, Short>) (i, v) -> length = v);
streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector3(v[0], v[1], v[2]));
streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = BlockVector3.at(v[0], v[1], v[2]));
streamer.addReader("Schematic.Metadata.WEOffsetX", (BiConsumer<Integer, Integer>) (i, v) -> offsetX = v);
streamer.addReader("Schematic.Metadata.WEOffsetY", (BiConsumer<Integer, Integer>) (i, v) -> offsetY = v);
streamer.addReader("Schematic.Metadata.WEOffsetZ", (BiConsumer<Integer, Integer>) (i, v) -> offsetZ = v);
@ -329,6 +343,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
int index = ((IntTag) entry.getValue()).getValue();
palette[index] = (char) state.getOrdinal();
}
//<<<<<<< HEAD
});
streamer.addReader("Schematic.BlockData.#", new NBTStreamer.LazyReader() {
@Override
@ -338,6 +353,23 @@ public class SpongeSchematicReader extends NBTSchematicReader {
} catch (IOException e) {
e.printStackTrace();
}
//=======
// palette.put(id, state);
// }
//
// byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue();
//
// Map<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
// try {
// List<Map<String, Tag>> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream()
// .map(tag -> (CompoundTag) tag)
// .map(CompoundTag::getValue)
// .collect(Collectors.toList());
//
// for (Map<String, Tag> tileEntity : tileEntityTags) {
// int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
// tileEntitiesMap.put(BlockVector3.at(pos[0], pos[1], pos[2]), tileEntity);
//>>>>>>> 2c8b2fe0... Move vectors to static creators, for caching
}
});
streamer.addReader("Schematic.Biomes.#", new NBTStreamer.LazyReader() {
@ -362,6 +394,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
int z = pos[2];
fc.setTile(x, y, z, value);
}
//<<<<<<< HEAD
});
streamer.addReader("Schematic.Entities.#", new BiConsumer<Integer, CompoundTag>() {
@Override
@ -390,7 +423,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
BlockVector3 origin = min;
CuboidRegion region;
if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
origin = origin.subtract(new BlockVector3(offsetX, offsetY, offsetZ));
origin = origin.subtract(BlockVector3.at(offsetX, offsetY, offsetZ));
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
} else {
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
@ -402,6 +435,21 @@ public class SpongeSchematicReader extends NBTSchematicReader {
for (int index = 0; index < volume; index++) {
BlockState state = BlockTypes.states[palette[fis.read()]];
fc.setBlock(index, state);
//=======
// // index = (y * length + z) * width + x
// int y = index / (width * length);
// int z = (index % (width * length)) / width;
// int x = (index % (width * length)) % width;
// BlockState state = palette.get(value);
// BlockVector3 pt = BlockVector3.at(x, y, z);
// try {
// if (tileEntitiesMap.containsKey(pt)) {
// Map<String, Tag> values = Maps.newHashMap(tileEntitiesMap.get(pt));
// for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) {
// if (handler.isAffectedBlock(state)) {
// handler.updateNBT(state, values);
// }
//>>>>>>> 2c8b2fe0... Move vectors to static creators, for caching
}
} else {
for (int index = 0; index < volume; index++) {
@ -419,7 +467,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
}
}
}
fc.setDimensions(new BlockVector3(width, height, length));
fc.setDimensions(BlockVector3.at(width, height, length));
clipboard.init(region, fc);
clipboard.setOrigin(origin);
return clipboard;

Datei anzeigen

@ -178,13 +178,13 @@ public class SpongeSchematicWriter implements ClipboardWriter {
// int z0 = min.getBlockZ() + z;
// for (int x = 0; x < width; x++) {
// int x0 = min.getBlockX() + x;
// BlockVector3 point = new BlockVector3(x0, y0, z0);
// BlockVector3 point = BlockVector3.at(x0, y0, z0);
// BaseBlock block = clipboard.getFullBlock(point);
// if (block.getNbtData() != null) {
// Map<String, Tag> values = new HashMap<>();
// for (Map.Entry<String, Tag> entry : block.getNbtData().getValue().entrySet()) {
// values.put(entry.getKey(), entry.getValue());
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
//>>>>>>> 2c8b2fe0... Move vectors to static creators, for caching
}
int ordinal = block.getOrdinal();
char value = palette[ordinal];

Datei anzeigen

@ -77,7 +77,7 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent {
if (!enabled) {
return getExtent().setBlock(location, block);
}
BlockVector2 chunkPos = new BlockVector2(location.getBlockX() >> 4, location.getBlockZ() >> 4);
BlockVector2 chunkPos = BlockVector2.at(location.getBlockX() >> 4, location.getBlockZ() >> 4);
batches.computeIfAbsent(chunkPos, k -> new LocatedBlockList()).add(location, block);
return true;
}

Datei anzeigen

@ -89,7 +89,7 @@ public class FastModeExtent extends AbstractDelegateExtent {
@Override
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
if (enabled) {
dirtyChunks.add(new BlockVector2(location.getBlockX() >> 4, location.getBlockZ() >> 4));
dirtyChunks.add(BlockVector2.at(location.getBlockX() >> 4, location.getBlockZ() >> 4));
return world.setBlock(location, block, false);
} else {
return world.setBlock(location, block, true);

Datei anzeigen

@ -93,7 +93,7 @@ public class SurvivalModeExtent extends AbstractDelegateExtent {
@Override
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
if (toolUse && block.getBlockType().getMaterial().isAir()) {
world.simulateBlockMine(new BlockVector3(x, y, z));
world.simulateBlockMine(BlockVector3.at(x, y, z));
return true;
} else {
return super.setBlock(x, y, z, block);

Datei anzeigen

@ -163,12 +163,16 @@ public class ExtentEntityCopy implements EntityFunction {
boolean hasFacing = tag.containsKey("Facing");
if (hasTilePosition) {
<<<<<<< HEAD
//<<<<<<< HEAD
changed = true;
// Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
// Vector newTilePosition = transform.apply(tilePosition.subtract(from)).add(to);
//=======
Vector3 tilePosition = new Vector3(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
=======
Vector3 tilePosition = Vector3.at(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
>>>>>>> 2c8b2fe0... Move vectors to static creators, for caching
BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint();
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner

Datei anzeigen

@ -43,14 +43,14 @@ public class BackwardsExtentBlockCopy implements Operation {
}
private CuboidRegion transform(Transform transform, Region region) {
BlockVector3 min = new BlockVector3(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
BlockVector3 max = new BlockVector3(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
BlockVector3 min = BlockVector3.at(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
BlockVector3 max = BlockVector3.at(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
BlockVector3 pos1 = region.getMinimumPoint();
BlockVector3 pos2 = region.getMaximumPoint();
for (int x : new int[] { pos1.getBlockX(), pos2.getBlockX() }) {
for (int y : new int[] { pos1.getBlockY(), pos2.getBlockY() }) {
for (int z : new int[] { pos1.getBlockZ(), pos2.getBlockZ() }) {
BlockVector3 pt = transform(transform, new BlockVector3(x, y, z));
BlockVector3 pt = transform(transform, BlockVector3.at(x, y, z));
min = min.getMinimum(pt);
max = max.getMaximum(pt);
}
@ -68,7 +68,7 @@ public class BackwardsExtentBlockCopy implements Operation {
// tmp.mutY((tmp.getBlockY() + origin.getBlockY()));
// tmp.mutZ((tmp.getBlockZ() + origin.getBlockZ()));
// return tmp;
return transform.apply(new Vector3(pt.getBlockX() - origin.getBlockX(), pt.getBlockY() - origin.getBlockY(), pt.getBlockZ() - origin.getBlockZ())).toBlockPoint().add(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
return transform.apply(Vector3.at(pt.getBlockX() - origin.getBlockX(), pt.getBlockY() - origin.getBlockY(), pt.getBlockZ() - origin.getBlockZ())).toBlockPoint().add(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
}
@Override

Datei anzeigen

@ -48,7 +48,6 @@ import com.sk89q.worldedit.function.visitor.IntersectRegionFunction;
import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.Identity;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.regions.Region;
@ -322,7 +321,7 @@ public class ForwardExtentCopy implements Operation {
int z = translation.getBlockZ();
maskFunc = position -> {
BlockVector3 bv = new BlockVector3(position.getBlockX() + x, position.getBlockY() + y, position.getBlockZ() + z);
BlockVector3 bv = BlockVector3.at(position.getBlockX() + x, position.getBlockY() + y, position.getBlockZ() + z);
if (region.contains(bv)) {
return sourceFunction.apply(bv);
}
@ -330,7 +329,7 @@ public class ForwardExtentCopy implements Operation {
};
copySrcFunc = position -> {
BlockVector3 bv = new BlockVector3(position.getBlockX() - x, position.getBlockY() - y, position.getBlockZ() - z);
BlockVector3 bv = BlockVector3.at(position.getBlockX() - x, position.getBlockY() - y, position.getBlockZ() - z);
if (!region.contains(bv)) {
return sourceFunction.apply(position);
}

Datei anzeigen

@ -45,7 +45,7 @@ public class ClipboardPattern extends AbstractPattern {
if (xp < 0) xp += sx;
if (yp < 0) yp += sy;
if (zp < 0) zp += sz;
return clipboard.getBlock(new BlockVector3(min.getX() + xp, min.getY() + yp, min.getZ() + zp));
return clipboard.getBlock(BlockVector3.at(min.getX() + xp, min.getY() + yp, min.getZ() + zp));
//=======
// public BlockStateHolder apply(BlockVector3 position) {
// int xp = Math.abs(position.getBlockX()) % size.getBlockX();

Datei anzeigen

@ -46,7 +46,7 @@ public interface Pattern extends com.sk89q.worldedit.patterns.Pattern{
@Override
default BaseBlock next(int x, int y, int z) {
return new BaseBlock(apply(new BlockVector3(x, y, z)));
return new BaseBlock(apply(BlockVector3.at(x, y, z)));
}
/**

Datei anzeigen

@ -93,10 +93,6 @@ public class RepeatingExtentPattern extends AbstractPattern {
int x = base.getBlockX() % size.getBlockX();
int y = base.getBlockY() % size.getBlockY();
int z = base.getBlockZ() % size.getBlockZ();
//<<<<<<< HEAD
// return extent.getBlock(new Vector(x, y, z));
//=======
return extent.getFullBlock(new BlockVector3(x, y, z));
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
return extent.getFullBlock(BlockVector3.at(x, y, z));
}
}

Datei anzeigen

@ -44,18 +44,18 @@ public abstract class BreadthFirstSearch implements Operation {
public static final BlockVector3[] DIAGONAL_DIRECTIONS;
static {
DEFAULT_DIRECTIONS[0] = (new BlockVector3(0, -1, 0));
DEFAULT_DIRECTIONS[1] = (new BlockVector3(0, 1, 0));
DEFAULT_DIRECTIONS[2] = (new BlockVector3(-1, 0, 0));
DEFAULT_DIRECTIONS[3] = (new BlockVector3(1, 0, 0));
DEFAULT_DIRECTIONS[4] = (new BlockVector3(0, 0, -1));
DEFAULT_DIRECTIONS[5] = (new BlockVector3(0, 0, 1));
DEFAULT_DIRECTIONS[0] = (BlockVector3.at(0, -1, 0));
DEFAULT_DIRECTIONS[1] = (BlockVector3.at(0, 1, 0));
DEFAULT_DIRECTIONS[2] = (BlockVector3.at(-1, 0, 0));
DEFAULT_DIRECTIONS[3] = (BlockVector3.at(1, 0, 0));
DEFAULT_DIRECTIONS[4] = (BlockVector3.at(0, 0, -1));
DEFAULT_DIRECTIONS[5] = (BlockVector3.at(0, 0, 1));
List<BlockVector3> list = new ArrayList<>();
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
for (int z = -1; z <= 1; z++) {
if (x != 0 || y != 0 || z != 0) {
BlockVector3 pos = new BlockVector3(x, y, z);
BlockVector3 pos = BlockVector3.at(x, y, z);
if (!list.contains(pos)) {
list.add(pos);
}
@ -100,10 +100,6 @@ public abstract class BreadthFirstSearch implements Operation {
this.maxDepth = maxDepth;
}
public Collection<BlockVector3> getDirections() {
return this.directions;
}
public void setDirections(List<BlockVector3> directions) {
this.directions = directions;
}
@ -117,6 +113,44 @@ public abstract class BreadthFirstSearch implements Operation {
return array;
}
/**
* Get the list of directions will be visited.
*
* <p>Directions are {@link BlockVector3}s that determine
* what adjacent points area available. Vectors should not be
* unit vectors. An example of a valid direction is
* {@code BlockVector3.at(1, 0, 1)}.</p>
*
* <p>The list of directions can be cleared.</p>
*
* @return the list of directions
*/
protected Collection<BlockVector3> getDirections() {
return directions;
}
/**
* Add the directions along the axes as directions to visit.
*/
protected void addAxes() {
directions.add(BlockVector3.at(0, -1, 0));
directions.add(BlockVector3.at(0, 1, 0));
directions.add(BlockVector3.at(-1, 0, 0));
directions.add(BlockVector3.at(1, 0, 0));
directions.add(BlockVector3.at(0, 0, -1));
directions.add(BlockVector3.at(0, 0, 1));
}
/**
* Add the diagonal directions as directions to visit.
*/
protected void addDiagonal() {
directions.add(BlockVector3.at(1, 0, 1));
directions.add(BlockVector3.at(-1, 0, -1));
directions.add(BlockVector3.at(1, 0, -1));
directions.add(BlockVector3.at(-1, 0, 1));
}
public void visit(final BlockVector3 pos) {
if (!isVisited(pos)) {
isVisitable(pos, pos); // Ignore this, just to initialize mask on this point
@ -223,7 +257,7 @@ public abstract class BreadthFirstSearch implements Operation {
int x = from.getBlockX() + direction.x;
int z = from.getBlockZ() + direction.z;
if (!visited.contains(x, y, z)) {
if (isVisitable(from, new BlockVector3(x, y, z))) {
if (isVisitable(from, BlockVector3.at(x, y, z))) {
j++;
visited.add(x, y, z);
tempQueue.add(x, y, z);

Datei anzeigen

@ -53,12 +53,12 @@ public class DirectionalVisitor extends RecursiveVisitor {
this.dirVec = direction;
final Collection<BlockVector3> directions = this.getDirections();
directions.clear();
directions.add(new BlockVector3(1, 0, 0));
directions.add(new BlockVector3(-1, 0, 0));
directions.add(new BlockVector3(0, 0, 1));
directions.add(new BlockVector3(0, 0, -1));
directions.add(new BlockVector3(0, -1, 0));
directions.add(new BlockVector3(0, 1, 0));
directions.add(BlockVector3.at(1, 0, 0));
directions.add(BlockVector3.at(-1, 0, 0));
directions.add(BlockVector3.at(0, 0, 1));
directions.add(BlockVector3.at(0, 0, -1));
directions.add(BlockVector3.at(0, -1, 0));
directions.add(BlockVector3.at(0, 1, 0));
}
@Override

Datei anzeigen

@ -62,11 +62,11 @@ public class DownwardVisitor extends RecursiveVisitor {
Collection<BlockVector3> directions = getDirections();
directions.clear();
directions.add(new BlockVector3(1, 0, 0));
directions.add(new BlockVector3(-1, 0, 0));
directions.add(new BlockVector3(0, 0, 1));
directions.add(new BlockVector3(0, 0, -1));
directions.add(new BlockVector3(0, -1, 0));
directions.add(BlockVector3.at(1, 0, 0));
directions.add(BlockVector3.at(-1, 0, 0));
directions.add(BlockVector3.at(0, 0, 1));
directions.add(BlockVector3.at(0, 0, -1));
directions.add(BlockVector3.at(0, -1, 0));
}
@Override

Datei anzeigen

@ -48,11 +48,11 @@ public class NonRisingVisitor extends RecursiveVisitor {
super(mask, function, depth, hasFaweQueue);
Collection<BlockVector3> directions = getDirections();
directions.clear();
directions.add(new BlockVector3(1, 0, 0));
directions.add(new BlockVector3(-1, 0, 0));
directions.add(new BlockVector3(0, 0, 1));
directions.add(new BlockVector3(0, 0, -1));
directions.add(new BlockVector3(0, -1, 0));
directions.add(BlockVector3.at(1, 0, 0));
directions.add(BlockVector3.at(-1, 0, 0));
directions.add(BlockVector3.at(0, 0, 1));
directions.add(BlockVector3.at(0, 0, -1));
directions.add(BlockVector3.at(0, -1, 0));
}

Datei anzeigen

@ -397,7 +397,7 @@ public final class Functions {
} catch (IllegalArgumentException e) {
throw new EvaluationException(0, "Perlin noise error: " + e.getMessage());
}
return perlin.noise(new Vector3(x.getValue(), y.getValue(), z.getValue()));
return perlin.noise(Vector3.at(x.getValue(), y.getValue(), z.getValue()));
}
private static final ThreadLocal<VoronoiNoise> localVoronoi = ThreadLocal.withInitial(VoronoiNoise::new);
@ -410,7 +410,7 @@ public final class Functions {
} catch (IllegalArgumentException e) {
throw new EvaluationException(0, "Voronoi error: " + e.getMessage());
}
return voronoi.noise(new Vector3(x.getValue(), y.getValue(), z.getValue()));
return voronoi.noise(Vector3.at(x.getValue(), y.getValue(), z.getValue()));
}
private static final ThreadLocal<RidgedMultiFractalNoise> localRidgedMulti = ThreadLocal.withInitial(RidgedMultiFractalNoise::new);
@ -424,7 +424,7 @@ public final class Functions {
} catch (IllegalArgumentException e) {
throw new EvaluationException(0, "Ridged multi error: " + e.getMessage());
}
return ridgedMulti.noise(new Vector3(x.getValue(), y.getValue(), z.getValue()));
return ridgedMulti.noise(Vector3.at(x.getValue(), y.getValue(), z.getValue()));
}
private static double queryInternal(RValue type, RValue data, double typeId, double dataValue) throws EvaluationException {

Datei anzeigen

@ -55,6 +55,26 @@ public class BlockVector2 {
.result();
};
public static BlockVector2 at(double x, double z) {
return at((int) Math.floor(x), (int) Math.floor(z));
}
public static BlockVector2 at(int x, int z) {
switch (x) {
case 0:
if (z == 0) {
return ZERO;
}
break;
case 1:
if (z == 1) {
return ONE;
}
break;
}
return new BlockVector2(x, z);
}
private final int x, z;
/**
@ -63,17 +83,7 @@ public class BlockVector2 {
* @param x the X coordinate
* @param z the Z coordinate
*/
public BlockVector2(double x, double z) {
this((int) Math.floor(x), (int) Math.floor(z));
}
/**
* Construct an instance.
*
* @param x the X coordinate
* @param z the Z coordinate
*/
public BlockVector2(int x, int z) {
private BlockVector2(int x, int z) {
this.x = x;
this.z = z;
}
@ -103,7 +113,7 @@ public class BlockVector2 {
* @return a new vector
*/
public BlockVector2 withX(int x) {
return new BlockVector2(x, z);
return BlockVector2.at(x, z);
}
/**
@ -131,7 +141,7 @@ public class BlockVector2 {
* @return a new vector
*/
public BlockVector2 withZ(int z) {
return new BlockVector2(x, z);
return BlockVector2.at(x, z);
}
/**
@ -152,7 +162,7 @@ public class BlockVector2 {
* @return a new vector
*/
public BlockVector2 add(int x, int z) {
return new BlockVector2(this.x + x, this.z + z);
return BlockVector2.at(this.x + x, this.z + z);
}
/**
@ -170,7 +180,7 @@ public class BlockVector2 {
newZ += other.z;
}
return new BlockVector2(newX, newZ);
return BlockVector2.at(newX, newZ);
}
/**
@ -193,7 +203,7 @@ public class BlockVector2 {
* @return a new vector
*/
public BlockVector2 subtract(int x, int z) {
return new BlockVector2(this.x - x, this.z - z);
return BlockVector2.at(this.x - x, this.z - z);
}
/**
@ -211,7 +221,7 @@ public class BlockVector2 {
newZ -= other.z;
}
return new BlockVector2(newX, newZ);
return BlockVector2.at(newX, newZ);
}
/**
@ -232,7 +242,7 @@ public class BlockVector2 {
* @return a new vector
*/
public BlockVector2 multiply(int x, int z) {
return new BlockVector2(this.x * x, this.z * z);
return BlockVector2.at(this.x * x, this.z * z);
}
/**
@ -249,7 +259,7 @@ public class BlockVector2 {
newZ *= other.z;
}
return new BlockVector2(newX, newZ);
return BlockVector2.at(newX, newZ);
}
/**
@ -280,7 +290,7 @@ public class BlockVector2 {
* @return a new vector
*/
public BlockVector2 divide(int x, int z) {
return new BlockVector2(this.x / x, this.z / z);
return BlockVector2.at(this.x / x, this.z / z);
}
/**
@ -343,7 +353,7 @@ public class BlockVector2 {
double len = length();
double x = this.x / len;
double z = this.z / len;
return new BlockVector2(x, z);
return BlockVector2.at(x, z);
}
/**
@ -407,7 +417,7 @@ public class BlockVector2 {
* @return a new vector
*/
public BlockVector2 abs() {
return new BlockVector2(Math.abs(x), Math.abs(z));
return BlockVector2.at(Math.abs(x), Math.abs(z));
}
/**
@ -429,7 +439,7 @@ public class BlockVector2 {
double sin = Math.sin(angle);
double x2 = x * cos - z * sin;
double z2 = x * sin + z * cos;
return new BlockVector2(
return BlockVector2.at(
x2 + aboutX + translateX,
z2 + aboutZ + translateZ);
}
@ -461,7 +471,7 @@ public class BlockVector2 {
}
public Vector2 toVector2() {
return new Vector2(x, z);
return Vector2.at(x, z);
}
/**
@ -480,7 +490,7 @@ public class BlockVector2 {
* @return a new vector
*/
public Vector3 toVector3(double y) {
return new Vector3(x, y, z);
return Vector3.at(x, y, z);
}
/**
@ -499,7 +509,7 @@ public class BlockVector2 {
* @return a new vector
*/
public BlockVector3 toBlockVector3(int y) {
return new BlockVector3(x, y, z);
return BlockVector3.at(x, y, z);
}
@Override

Datei anzeigen

@ -37,6 +37,28 @@ public class BlockVector3 {
public static final BlockVector3 UNIT_Z = new BlockVector3(0, 0, 1);
public static final BlockVector3 ONE = new BlockVector3(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) {
// switch for efficiency on typical cases
// in MC y is rarely 0/1 on selections
switch (y) {
case 0:
if (x == 0 && z == 0) {
return ZERO;
}
break;
case 1:
if (x == 1 && z == 1) {
return ONE;
}
break;
}
return new BlockVector3(x, y, z);
}
// thread-safe initialization idiom
private static final class YzxOrderComparator {
private static final Comparator<BlockVector3> YZX_ORDER = (a, b) -> {
@ -67,18 +89,7 @@ public class BlockVector3 {
* @param y the Y coordinate
* @param z the Z coordinate
*/
public BlockVector3(double x, double y, double z) {
this((int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z));
}
/**
* Construct an instance.
*
* @param x the X coordinate
* @param y the Y coordinate
* @param z the Z coordinate
*/
public BlockVector3(int x, int y, int z) {
private BlockVector3(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
@ -109,7 +120,7 @@ public class BlockVector3 {
* @return a new vector
*/
public BlockVector3 withX(int x) {
return new BlockVector3(x, y, z);
return BlockVector3.at(x, y, z);
}
/**
@ -137,7 +148,7 @@ public class BlockVector3 {
* @return a new vector
*/
public BlockVector3 withY(int y) {
return new BlockVector3(x, y, z);
return BlockVector3.at(x, y, z);
}
/**
@ -165,7 +176,7 @@ public class BlockVector3 {
* @return a new vector
*/
public BlockVector3 withZ(int z) {
return new BlockVector3(x, y, z);
return BlockVector3.at(x, y, z);
}
/**
@ -187,7 +198,7 @@ public class BlockVector3 {
* @return a new vector
*/
public BlockVector3 add(int x, int y, int z) {
return new BlockVector3(this.x + x, this.y + y, this.z + z);
return BlockVector3.at(this.x + x, this.y + y, this.z + z);
}
/**
@ -206,7 +217,7 @@ public class BlockVector3 {
newZ += other.z;
}
return new BlockVector3(newX, newY, newZ);
return BlockVector3.at(newX, newY, newZ);
}
/**
@ -230,7 +241,7 @@ public class BlockVector3 {
* @return a new vector
*/
public BlockVector3 subtract(int x, int y, int z) {
return new BlockVector3(this.x - x, this.y - y, this.z - z);
return BlockVector3.at(this.x - x, this.y - y, this.z - z);
}
/**
@ -249,7 +260,7 @@ public class BlockVector3 {
newZ -= other.z;
}
return new BlockVector3(newX, newY, newZ);
return BlockVector3.at(newX, newY, newZ);
}
/**
@ -271,7 +282,7 @@ public class BlockVector3 {
* @return a new vector
*/
public BlockVector3 multiply(int x, int y, int z) {
return new BlockVector3(this.x * x, this.y * y, this.z * z);
return BlockVector3.at(this.x * x, this.y * y, this.z * z);
}
/**
@ -289,7 +300,7 @@ public class BlockVector3 {
newZ *= other.z;
}
return new BlockVector3(newX, newY, newZ);
return BlockVector3.at(newX, newY, newZ);
}
/**
@ -321,7 +332,7 @@ public class BlockVector3 {
* @return a new vector
*/
public BlockVector3 divide(int x, int y, int z) {
return new BlockVector3(this.x / x, this.y / y, this.z / z);
return BlockVector3.at(this.x / x, this.y / y, this.z / z);
}
/**
@ -386,7 +397,7 @@ public class BlockVector3 {
double x = this.x / len;
double y = this.y / len;
double z = this.z / len;
return new BlockVector3(x, y, z);
return BlockVector3.at(x, y, z);
}
/**
@ -434,10 +445,10 @@ public class BlockVector3 {
public BlockVector3 clampY(int min, int max) {
checkArgument(min <= max, "minimum cannot be greater than maximum");
if (y < min) {
return new BlockVector3(x, min, z);
return BlockVector3.at(x, min, z);
}
if (y > max) {
return new BlockVector3(x, max, z);
return BlockVector3.at(x, max, z);
}
return this;
}
@ -481,7 +492,7 @@ public class BlockVector3 {
* @return a new vector
*/
public BlockVector3 abs() {
return new BlockVector3(Math.abs(x), Math.abs(y), Math.abs(z));
return BlockVector3.at(Math.abs(x), Math.abs(y), Math.abs(z));
}
/**
@ -504,7 +515,7 @@ public class BlockVector3 {
double x2 = x * cos - z * sin;
double z2 = x * sin + z * cos;
return new BlockVector3(
return BlockVector3.at(
x2 + aboutX + translateX,
y,
z2 + aboutZ + translateZ
@ -579,11 +590,11 @@ public class BlockVector3 {
* @return a new {@link BlockVector2}
*/
public BlockVector2 toBlockVector2() {
return new BlockVector2(x, z);
return BlockVector2.at(x, z);
}
public Vector3 toVector3() {
return new Vector3(x, y, z);
return Vector3.at(x, y, z);
}
@Override

Datei anzeigen

@ -126,7 +126,7 @@ public final class MathUtils {
* @return midpoint Vector3
*/
public static Vector3 midpoint(Vector3 v1, Vector3 v2) {
return new Vector3(
return Vector3.at(
(v1.getX() + v2.getX()) / 2,
(v1.getY() + v2.getY()) / 2,
(v1.getZ() + v2.getZ()) / 2
@ -141,7 +141,7 @@ public final class MathUtils {
* @return midpoint BlockVector3
*/
public static BlockVector3 midpoint(BlockVector3 v1, BlockVector3 v2) {
return new BlockVector3(
return BlockVector3.at(
(v1.getBlockX() + v2.getBlockX()) / 2,
(v1.getBlockY() + v2.getBlockY()) / 2,
(v1.getBlockZ() + v2.getBlockZ()) / 2

Datei anzeigen

@ -580,15 +580,15 @@ public class MutableBlockVector implements Serializable {
* @return a new {@link BlockVector2}
*/
public BlockVector2 toBlockVector2() {
return new BlockVector2(x, z);
return BlockVector2.at(x, z);
}
public Vector3 toVector3() {
return new Vector3(x, y, z);
return Vector3.at(x, y, z);
}
public BlockVector3 toBlockVector3() {
return new BlockVector3(x, y, z);
return BlockVector3.at(x, y, z);
}
@Override

Datei anzeigen

@ -453,7 +453,7 @@ public final class MutableBlockVector2D implements Serializable {
* @return a new vector
*/
public Vector2 toVector2() {
return new Vector2(x, z);
return Vector2.at(x, z);
}
/**
@ -472,7 +472,7 @@ public final class MutableBlockVector2D implements Serializable {
* @return a new vector
*/
public Vector3 toVector3(double y) {
return new Vector3(x, y, z);
return Vector3.at(x, y, z);
}
/**
@ -491,7 +491,7 @@ public final class MutableBlockVector2D implements Serializable {
* @return a new vector
*/
public BlockVector3 toBlockVector3(int y) {
return new BlockVector3(x, y, z);
return BlockVector3.at(x, y, z);
}
/**
@ -500,7 +500,7 @@ public final class MutableBlockVector2D implements Serializable {
* @return a new vector
*/
public BlockVector2 toBlockVector2() {
return new BlockVector2(x, z);
return BlockVector2.at(x, z);
}
@Override

Datei anzeigen

@ -338,7 +338,7 @@ public class MutableVector implements Serializable {
* @return the cross product of this and the other vector
*/
public Vector3 cross(MutableVector other) {
return new Vector3(
return Vector3.at(
y * other.z - z * other.y,
z * other.x - x * other.z,
x * other.y - y * other.x
@ -518,7 +518,7 @@ public class MutableVector implements Serializable {
* @return a new {@code BlockVector}
*/
public static BlockVector3 toBlockPoint(double x, double y, double z) {
return new BlockVector3(x, y, z);
return BlockVector3.at(x, y, z);
}
/**
@ -536,11 +536,11 @@ public class MutableVector implements Serializable {
* @return a new {@link Vector2}
*/
public Vector2 toVector2() {
return new Vector2(x, z);
return Vector2.at(x, z);
}
public Vector3 toVector3() {
return new Vector3(x, y, z);
return Vector3.at(x, y, z);
}
@Override

Datei anzeigen

@ -31,6 +31,23 @@ public final class Vector2 {
public static final Vector2 UNIT_Z = new Vector2(0, 1);
public static final Vector2 ONE = new Vector2(1, 1);
public static Vector2 at(double x, double z) {
int xTrunc = (int) x;
switch (xTrunc) {
case 0:
if (x == 0 && z == 0) {
return ZERO;
}
break;
case 1:
if (x == 1 && z == 1) {
return ONE;
}
break;
}
return new Vector2(x, z);
}
private final double x, z;
/**
@ -39,21 +56,11 @@ public final class Vector2 {
* @param x the X coordinate
* @param z the Z coordinate
*/
public Vector2(double x, double z) {
private Vector2(double x, double z) {
this.x = x;
this.z = z;
}
/**
* Copy another vector.
*
* @param other the other vector
*/
public Vector2(Vector2 other) {
this.x = other.x;
this.z = other.z;
}
/**
* Get the X coordinate.
*
@ -70,7 +77,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector2 withX(double x) {
return new Vector2(x, z);
return Vector2.at(x, z);
}
/**
@ -89,7 +96,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector2 withZ(double z) {
return new Vector2(x, z);
return Vector2.at(x, z);
}
/**
@ -110,7 +117,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector2 add(double x, double z) {
return new Vector2(this.x + x, this.z + z);
return Vector2.at(this.x + x, this.z + z);
}
/**
@ -128,7 +135,7 @@ public final class Vector2 {
newZ += other.z;
}
return new Vector2(newX, newZ);
return Vector2.at(newX, newZ);
}
/**
@ -151,7 +158,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector2 subtract(double x, double z) {
return new Vector2(this.x - x, this.z - z);
return Vector2.at(this.x - x, this.z - z);
}
/**
@ -169,7 +176,7 @@ public final class Vector2 {
newZ -= other.z;
}
return new Vector2(newX, newZ);
return Vector2.at(newX, newZ);
}
/**
@ -190,7 +197,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector2 multiply(double x, double z) {
return new Vector2(this.x * x, this.z * z);
return Vector2.at(this.x * x, this.z * z);
}
/**
@ -207,7 +214,7 @@ public final class Vector2 {
newZ *= other.z;
}
return new Vector2(newX, newZ);
return Vector2.at(newX, newZ);
}
/**
@ -238,7 +245,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector2 divide(double x, double z) {
return new Vector2(this.x / x, this.z / z);
return Vector2.at(this.x / x, this.z / z);
}
/**
@ -329,7 +336,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector2 floor() {
return new Vector2(Math.floor(x), Math.floor(z));
return Vector2.at(Math.floor(x), Math.floor(z));
}
/**
@ -338,7 +345,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector2 ceil() {
return new Vector2(Math.ceil(x), Math.ceil(z));
return Vector2.at(Math.ceil(x), Math.ceil(z));
}
/**
@ -349,7 +356,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector2 round() {
return new Vector2(Math.floor(x + 0.5), Math.floor(z + 0.5));
return Vector2.at(Math.floor(x + 0.5), Math.floor(z + 0.5));
}
/**
@ -359,7 +366,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector2 abs() {
return new Vector2(Math.abs(x), Math.abs(z));
return Vector2.at(Math.abs(x), Math.abs(z));
}
/**
@ -413,7 +420,7 @@ public final class Vector2 {
}
public static BlockVector2 toBlockPoint(double x, double z) {
return new BlockVector2(x, z);
return BlockVector2.at(x, z);
}
/**
@ -441,7 +448,7 @@ public final class Vector2 {
* @return a new vector
*/
public Vector3 toVector3(double y) {
return new Vector3(x, y, z);
return Vector3.at(x, y, z);
}
@Override

Datei anzeigen

@ -37,6 +37,25 @@ public class Vector3 {
public static final Vector3 UNIT_Z = new Vector3(0, 0, 1);
public static final Vector3 ONE = new Vector3(1, 1, 1);
public static Vector3 at(double x, double y, double z) {
// switch for efficiency on typical cases
// in MC y is rarely 0/1 on selections
int yTrunc = (int) y;
switch (yTrunc) {
case 0:
if (x == 0 && y == 0 && z == 0) {
return ZERO;
}
break;
case 1:
if (x == 1 && y == 1 && z == 1) {
return ONE;
}
break;
}
return new Vector3(x, y, z);
}
// thread-safe initialization idiom
private static final class YzxOrderComparator {
private static final Comparator<Vector3> YZX_ORDER = (a, b) -> {
@ -67,23 +86,12 @@ public class Vector3 {
* @param y the Y coordinate
* @param z the Z coordinate
*/
public Vector3(double x, double y, double z) {
private Vector3(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
/**
* Copy another vector.
*
* @param other another vector to make a copy of
*/
public Vector3(Vector3 other) {
this.x = other.x;
this.y = other.y;
this.z = other.z;
}
/**
* Get the X coordinate.
*
@ -100,7 +108,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 withX(double x) {
return new Vector3(x, y, z);
return Vector3.at(x, y, z);
}
/**
@ -119,7 +127,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 withY(double y) {
return new Vector3(x, y, z);
return Vector3.at(x, y, z);
}
/**
@ -138,7 +146,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 withZ(double z) {
return new Vector3(x, y, z);
return Vector3.at(x, y, z);
}
/**
@ -160,7 +168,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 add(double x, double y, double z) {
return new Vector3(this.x + x, this.y + y, this.z + z);
return Vector3.at(this.x + x, this.y + y, this.z + z);
}
/**
@ -179,7 +187,7 @@ public class Vector3 {
newZ += other.z;
}
return new Vector3(newX, newY, newZ);
return Vector3.at(newX, newY, newZ);
}
/**
@ -203,7 +211,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 subtract(double x, double y, double z) {
return new Vector3(this.x - x, this.y - y, this.z - z);
return Vector3.at(this.x - x, this.y - y, this.z - z);
}
/**
@ -222,7 +230,7 @@ public class Vector3 {
newZ -= other.z;
}
return new Vector3(newX, newY, newZ);
return Vector3.at(newX, newY, newZ);
}
/**
@ -244,7 +252,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 multiply(double x, double y, double z) {
return new Vector3(this.x * x, this.y * y, this.z * z);
return Vector3.at(this.x * x, this.y * y, this.z * z);
}
/**
@ -262,7 +270,7 @@ public class Vector3 {
newZ *= other.z;
}
return new Vector3(newX, newY, newZ);
return Vector3.at(newX, newY, newZ);
}
/**
@ -294,7 +302,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 divide(double x, double y, double z) {
return new Vector3(this.x / x, this.y / y, this.z / z);
return Vector3.at(this.x / x, this.y / y, this.z / z);
}
/**
@ -403,10 +411,10 @@ public class Vector3 {
public Vector3 clampY(int min, int max) {
checkArgument(min <= max, "minimum cannot be greater than maximum");
if (y < min) {
return new Vector3(x, min, z);
return Vector3.at(x, min, z);
}
if (y > max) {
return new Vector3(x, max, z);
return Vector3.at(x, max, z);
}
return this;
}
@ -417,7 +425,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 floor() {
return new Vector3(Math.floor(x), Math.floor(y), Math.floor(z));
return Vector3.at(Math.floor(x), Math.floor(y), Math.floor(z));
}
/**
@ -426,7 +434,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 ceil() {
return new Vector3(Math.ceil(x), Math.ceil(y), Math.ceil(z));
return Vector3.at(Math.ceil(x), Math.ceil(y), Math.ceil(z));
}
/**
@ -437,7 +445,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 round() {
return new Vector3(Math.floor(x + 0.5), Math.floor(y + 0.5), Math.floor(z + 0.5));
return Vector3.at(Math.floor(x + 0.5), Math.floor(y + 0.5), Math.floor(z + 0.5));
}
/**
@ -447,7 +455,7 @@ public class Vector3 {
* @return a new vector
*/
public Vector3 abs() {
return new Vector3(Math.abs(x), Math.abs(y), Math.abs(z));
return Vector3.at(Math.abs(x), Math.abs(y), Math.abs(z));
}
/**
@ -548,7 +556,7 @@ public class Vector3 {
* @return a new {@code BlockVector}
*/
public static BlockVector3 toBlockPoint(double x, double y, double z) {
return new BlockVector3(x, y, z);
return BlockVector3.at(x, y, z);
}
/**
@ -566,7 +574,7 @@ public class Vector3 {
* @return a new {@link Vector2}
*/
public Vector2 toVector2() {
return new Vector2(x, z);
return Vector2.at(x, z);
}
@Override

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen