mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 12:06:41 +00:00
This commit is contained in:
@ -339,11 +339,11 @@ public class FaweAPI {
|
||||
final BlockVector3 bot = selection.getMinimumPoint();
|
||||
final BlockVector3 top = selection.getMaximumPoint();
|
||||
|
||||
final int minX = bot.getBlockX() >> 4;
|
||||
final int minZ = bot.getBlockZ() >> 4;
|
||||
final int minX = bot.x() >> 4;
|
||||
final int minZ = bot.z() >> 4;
|
||||
|
||||
final int maxX = top.getBlockX() >> 4;
|
||||
final int maxZ = top.getBlockZ() >> 4;
|
||||
final int maxX = top.x() >> 4;
|
||||
final int maxZ = top.z() >> 4;
|
||||
|
||||
int count = 0;
|
||||
|
||||
|
@ -50,9 +50,9 @@ public class BlendBall implements Brush {
|
||||
final int outsetSize = (int) (size + 1);
|
||||
double brushSizeSquared = size * size;
|
||||
|
||||
int tx = position.getBlockX();
|
||||
int ty = position.getBlockY();
|
||||
int tz = position.getBlockZ();
|
||||
int tx = position.x();
|
||||
int ty = position.y();
|
||||
int tz = position.z();
|
||||
|
||||
int[] frequency = new int[BlockTypes.size()];
|
||||
|
||||
|
@ -81,9 +81,9 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
||||
return pos1.add(pos2).divide(2).toBlockPoint();
|
||||
}
|
||||
double curveLen = pos1.distance(pos2) * lenPercent;
|
||||
double dy = pos2.getY() - pos1.getY();
|
||||
double dx = pos2.getX() - pos1.getX();
|
||||
double dz = pos2.getZ() - pos1.getZ();
|
||||
double dy = pos2.y() - pos1.y();
|
||||
double dx = pos2.x() - pos1.x();
|
||||
double dz = pos2.z() - pos1.z();
|
||||
double dh = Math.sqrt(dx * dx + dz * dz);
|
||||
double g = Math.sqrt(curveLen * curveLen - dy * dy) / 2;
|
||||
double a = 0.00001;
|
||||
|
@ -54,9 +54,9 @@ public class CommandBrush implements Brush {
|
||||
position.subtract(radius, radius, radius),
|
||||
position.add(radius, radius, radius)
|
||||
);
|
||||
String replaced = command.replace("{x}", Integer.toString(position.getBlockX()))
|
||||
.replace("{y}", Integer.toString(position.getBlockY()))
|
||||
.replace("{z}", Integer.toString(position.getBlockZ()))
|
||||
String replaced = command.replace("{x}", Integer.toString(position.x()))
|
||||
.replace("{y}", Integer.toString(position.y()))
|
||||
.replace("{z}", Integer.toString(position.z()))
|
||||
.replace("{world}", editSession.getWorld().getName())
|
||||
.replace("{size}", Integer.toString(radius));
|
||||
|
||||
|
@ -65,11 +65,11 @@ public class CopyPastaBrush implements Brush, ResettableTool {
|
||||
mask = Masks.alwaysTrue();
|
||||
}
|
||||
final ResizableClipboardBuilder builder = new ResizableClipboardBuilder(editSession.getWorld());
|
||||
final int minY = position.getBlockY();
|
||||
final int minY = position.y();
|
||||
mask = new AbstractDelegateMask(mask) {
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (super.test(vector) && vector.getBlockY() >= minY) {
|
||||
if (super.test(vector) && vector.y() >= minY) {
|
||||
BaseBlock block = editSession.getFullBlock(vector);
|
||||
if (!block.getBlockType().getMaterial().isAir()) {
|
||||
builder.add(vector, BlockTypes.AIR.getDefaultState().toBaseBlock(), block);
|
||||
|
@ -63,9 +63,9 @@ public class ErodeBrush implements Brush {
|
||||
Clipboard buffer1 = new CPUOptimizedClipboard(region);
|
||||
Clipboard buffer2 = new CPUOptimizedClipboard(region);
|
||||
|
||||
final int bx = target.getBlockX();
|
||||
final int by = target.getBlockY();
|
||||
final int bz = target.getBlockZ();
|
||||
final int bx = target.x();
|
||||
final int by = target.y();
|
||||
final int bz = target.z();
|
||||
|
||||
for (int x = -brushSize, relx = 0; x <= brushSize && relx < buffer1.getWidth(); x++, relx++) {
|
||||
int x0 = x + bx;
|
||||
@ -106,7 +106,7 @@ public class ErodeBrush implements Brush {
|
||||
|
||||
for (BlockVector3 pos : finalBuffer) {
|
||||
BlockState block = pos.getBlock(finalBuffer);
|
||||
es.setBlock(pos.getX() + bx - brushSize, pos.getY() + by - brushSize, pos.getZ() + bz - brushSize, block);
|
||||
es.setBlock(pos.x() + bx - brushSize, pos.y() + by - brushSize, pos.z() + bz - brushSize, block);
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,9 +139,9 @@ public class ErodeBrush implements Brush {
|
||||
int highest = 1;
|
||||
for (BlockVector3 offs : FACES_TO_CHECK) {
|
||||
BaseBlock next = current.getFullBlock(
|
||||
relx + offs.getBlockX(),
|
||||
rely + offs.getBlockY(),
|
||||
relz + offs.getBlockZ()
|
||||
relx + offs.x(),
|
||||
rely + offs.y(),
|
||||
relz + offs.z()
|
||||
);
|
||||
if (!next.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
continue;
|
||||
@ -190,9 +190,9 @@ public class ErodeBrush implements Brush {
|
||||
int total = 0;
|
||||
for (BlockVector3 offs : FACES_TO_CHECK) {
|
||||
BaseBlock next = current.getFullBlock(
|
||||
relx + offs.getBlockX(),
|
||||
rely + offs.getBlockY(),
|
||||
relz + offs.getBlockZ()
|
||||
relx + offs.x(),
|
||||
rely + offs.y(),
|
||||
relz + offs.z()
|
||||
);
|
||||
if (next.getMaterial().isMovementBlocker()) {
|
||||
continue;
|
||||
|
@ -12,9 +12,9 @@ public class FallingSphere implements Brush {
|
||||
@Override
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws
|
||||
MaxChangedBlocksException {
|
||||
int px = position.getBlockX();
|
||||
int py = position.getBlockY();
|
||||
int pz = position.getBlockZ();
|
||||
int px = position.x();
|
||||
int py = position.y();
|
||||
int pz = position.z();
|
||||
int maxY = editSession.getMaxY();
|
||||
int minY = editSession.getMinY();
|
||||
|
||||
|
@ -14,7 +14,6 @@ import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -25,7 +24,6 @@ import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
@ -80,9 +78,9 @@ public class InspectBrush extends BrushTool {
|
||||
return true;
|
||||
}
|
||||
BlockVector3 target = targetVector.toBlockPoint();
|
||||
final int x = target.getBlockX();
|
||||
final int y = target.getBlockY();
|
||||
final int z = target.getBlockZ();
|
||||
final int x = target.x();
|
||||
final int y = target.y();
|
||||
final int z = target.z();
|
||||
World world = player.getWorld();
|
||||
RollbackDatabase db = DBHandler.dbHandler().getDatabase(world);
|
||||
int count = 0;
|
||||
|
@ -35,7 +35,7 @@ public record RecurseBrush(boolean dfs) implements Brush {
|
||||
DFSRecursiveVisitor visitor = new DFSRecursiveVisitor(mask, replace, Integer.MAX_VALUE, Integer.MAX_VALUE) {
|
||||
@Override
|
||||
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||
int y = to.getBlockY();
|
||||
int y = to.y();
|
||||
return y < maxY && radMask.test(to) && super.isVisitable(from, to);
|
||||
}
|
||||
};
|
||||
@ -45,7 +45,7 @@ public record RecurseBrush(boolean dfs) implements Brush {
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, radius, editSession.getMinY(), editSession.getMaxY()) {
|
||||
@Override
|
||||
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||
int y = to.getBlockY();
|
||||
int y = to.y();
|
||||
return y < maxY && super.isVisitable(from, to);
|
||||
}
|
||||
};
|
||||
|
@ -19,15 +19,15 @@ public record RockBrush(double amplitude, double frequency, Vector3 radius) impl
|
||||
double seedY = ThreadLocalRandom.current().nextDouble();
|
||||
double seedZ = ThreadLocalRandom.current().nextDouble();
|
||||
|
||||
int px = position.getBlockX();
|
||||
int py = position.getBlockY();
|
||||
int pz = position.getBlockZ();
|
||||
int px = position.x();
|
||||
int py = position.y();
|
||||
int pz = position.z();
|
||||
|
||||
double distort = this.frequency / size;
|
||||
|
||||
double modX = 1D / radius.getX();
|
||||
double modY = 1D / radius.getY();
|
||||
double modZ = 1D / radius.getZ();
|
||||
double modX = 1D / radius.x();
|
||||
double modY = 1D / radius.y();
|
||||
double modZ = 1D / radius.z();
|
||||
|
||||
int radiusSqr = (int) (size * size);
|
||||
int sizeInt = (int) size * 2;
|
||||
|
@ -67,15 +67,15 @@ public class ScatterBrush implements Brush {
|
||||
}
|
||||
BlockVector3 patternSize = pattern.size();
|
||||
BlockVector3Set placed = BlockVector3Set.getAppropriateVectorSet(patternSize.add(distance, distance, distance));
|
||||
placed.setOffset(position.getX(), position.getY(), position.getZ());
|
||||
placed.setOffset(position.x(), position.y(), position.z());
|
||||
int maxFails = 1000;
|
||||
for (int i = 0; i < count; i++) {
|
||||
int index = ThreadLocalRandom.current().nextInt(length);
|
||||
BlockVector3 pos = visited.get(index);
|
||||
if (pos != null && canApply(pos)) {
|
||||
int x = pos.getBlockX();
|
||||
int y = pos.getBlockY();
|
||||
int z = pos.getBlockZ();
|
||||
int x = pos.x();
|
||||
int y = pos.y();
|
||||
int z = pos.z();
|
||||
if (placed.containsRadius(x, y, z, distance)) {
|
||||
if (maxFails-- <= 0) {
|
||||
break;
|
||||
|
@ -45,9 +45,9 @@ public class ScatterCommand extends ScatterBrush {
|
||||
position.subtract(radius, radius, radius),
|
||||
position.add(radius, radius, radius)
|
||||
);
|
||||
String replaced = command.replace("{x}", Integer.toString(position.getBlockX()))
|
||||
.replace("{y}", Integer.toString(position.getBlockY()))
|
||||
.replace("{z}", Integer.toString(position.getBlockZ()))
|
||||
String replaced = command.replace("{x}", Integer.toString(position.x()))
|
||||
.replace("{y}", Integer.toString(position.y()))
|
||||
.replace("{z}", Integer.toString(position.z()))
|
||||
.replace("{world}", editSession.getWorld().getName())
|
||||
.replace("{size}", Integer.toString(radius));
|
||||
|
||||
|
@ -16,9 +16,9 @@ public class ScatterOverlayBrush extends ScatterBrush {
|
||||
@Override
|
||||
public void apply(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pt, Pattern p, double size) throws
|
||||
MaxChangedBlocksException {
|
||||
final int x = pt.getBlockX();
|
||||
final int y = pt.getBlockY();
|
||||
final int z = pt.getBlockZ();
|
||||
final int x = pt.x();
|
||||
final int y = pt.y();
|
||||
final int z = pt.z();
|
||||
BlockVector3 dir = getDirection(pt);
|
||||
if (dir == null) {
|
||||
getDir:
|
||||
@ -37,7 +37,7 @@ public class ScatterOverlayBrush extends ScatterBrush {
|
||||
return;
|
||||
}
|
||||
}
|
||||
editSession.setBlock(x + dir.getBlockX(), y + dir.getBlockY(), z + dir.getBlockZ(), p);
|
||||
editSession.setBlock(x + dir.x(), y + dir.y(), z + dir.z(), p);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -80,13 +80,13 @@ public class ShatterBrush extends ScatterBrush {
|
||||
}
|
||||
for (int i1 = 0; i1 < BreadthFirstSearch.DIAGONAL_DIRECTIONS.length; i1++) {
|
||||
BlockVector3 direction = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i1];
|
||||
int x2 = x + direction.getBlockX();
|
||||
int y2 = y + direction.getBlockY();
|
||||
int z2 = z + direction.getBlockZ();
|
||||
int x2 = x + direction.x();
|
||||
int y2 = y + direction.y();
|
||||
int z2 = z + direction.z();
|
||||
// Check boundary
|
||||
int dx = position.getBlockX() - x2;
|
||||
int dy = position.getBlockY() - y2;
|
||||
int dz = position.getBlockZ() - z2;
|
||||
int dx = position.x() - x2;
|
||||
int dy = position.y() - y2;
|
||||
int dz = position.z() - z2;
|
||||
int dSqr = (dx * dx) + (dy * dy) + (dz * dz);
|
||||
if (dSqr <= radius2) {
|
||||
BlockVector3 bv = mutable.setComponents(x2, y2, z2);
|
||||
|
@ -130,9 +130,9 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
private Vector3 getCentroid(Collection<BlockVector3> points) {
|
||||
MutableVector3 sum = new MutableVector3();
|
||||
for (BlockVector3 p : points) {
|
||||
sum.mutX(sum.getX() + p.getX());
|
||||
sum.mutY(sum.getY() + p.getY());
|
||||
sum.mutZ(sum.getZ() + p.getZ());
|
||||
sum.mutX(sum.x() + p.x());
|
||||
sum.mutY(sum.y() + p.y());
|
||||
sum.mutZ(sum.z() + p.z());
|
||||
}
|
||||
return sum.multiply(1.0 / points.size());
|
||||
}
|
||||
|
@ -38,16 +38,16 @@ public class SurfaceSpline implements Brush {
|
||||
int minY = editSession.getMinY();
|
||||
if (path.isEmpty() || !pos.equals(path.get(path.size() - 1))) {
|
||||
int max = editSession.getNearestSurfaceTerrainBlock(
|
||||
pos.getBlockX(),
|
||||
pos.getBlockZ(),
|
||||
pos.getBlockY(),
|
||||
pos.x(),
|
||||
pos.z(),
|
||||
pos.y(),
|
||||
minY,
|
||||
maxY
|
||||
);
|
||||
if (max == -1) {
|
||||
return;
|
||||
}
|
||||
path.add(BlockVector3.at(pos.getBlockX(), max, pos.getBlockZ()));
|
||||
path.add(BlockVector3.at(pos.x(), max, pos.z()));
|
||||
if (editSession.getActor() != null) {
|
||||
editSession.getActor().print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
|
||||
}
|
||||
@ -69,9 +69,9 @@ public class SurfaceSpline implements Brush {
|
||||
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
||||
for (double loop = 0; loop <= 1; loop += 1D / splinelength / quality) {
|
||||
final Vector3 tipv = interpol.getPosition(loop);
|
||||
final int tipx = MathMan.roundInt(tipv.getX());
|
||||
final int tipz = (int) tipv.getZ();
|
||||
int tipy = MathMan.roundInt(tipv.getY());
|
||||
final int tipx = MathMan.roundInt(tipv.x());
|
||||
final int tipz = (int) tipv.z();
|
||||
int tipy = MathMan.roundInt(tipv.y());
|
||||
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, minY, maxY, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
if (tipy == Integer.MIN_VALUE || tipy == Integer.MAX_VALUE) {
|
||||
continue;
|
||||
@ -88,15 +88,15 @@ public class SurfaceSpline implements Brush {
|
||||
LocalBlockVectorSet newSet = new LocalBlockVectorSet();
|
||||
final int ceilrad = (int) Math.ceil(radius);
|
||||
for (BlockVector3 v : vset) {
|
||||
final int tipx = v.getBlockX();
|
||||
final int tipz = v.getBlockZ();
|
||||
final int tipx = v.x();
|
||||
final int tipz = v.z();
|
||||
for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) {
|
||||
for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) {
|
||||
if (MathMan.hypot2(loopx - tipx, 0, loopz - tipz) <= radius2) {
|
||||
int y = editSession.getNearestSurfaceTerrainBlock(
|
||||
loopx,
|
||||
loopz,
|
||||
v.getBlockY(),
|
||||
v.y(),
|
||||
minY,
|
||||
maxY,
|
||||
Integer.MIN_VALUE,
|
||||
|
@ -13,7 +13,7 @@ public class ScrollRange extends Scroll {
|
||||
|
||||
@Override
|
||||
public boolean increment(Player player, int amount) {
|
||||
int max = WorldEdit.getInstance().getConfiguration().maxBrushRadius;
|
||||
int max = player.getLimit().MAX_BRUSH_RADIUS;
|
||||
int newSize = MathMan.wrap(getTool().getRange() + amount, (int) (getTool().getSize() + 1), max);
|
||||
getTool().setRange(newSize);
|
||||
return true;
|
||||
|
@ -12,7 +12,7 @@ public class ScrollSize extends Scroll {
|
||||
|
||||
@Override
|
||||
public boolean increment(Player player, int amount) {
|
||||
int max = WorldEdit.getInstance().getConfiguration().maxRadius;
|
||||
int max = player.getLimit().MAX_RADIUS;
|
||||
double newSize = Math.max(0, Math.min(max == -1 ? 4095 : max, getTool().getSize() + amount));
|
||||
getTool().setSize(newSize);
|
||||
return true;
|
||||
|
@ -83,7 +83,7 @@ public class ClipboardSpline extends Spline {
|
||||
Region region = clipboard.getRegion();
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
// center = region.getCenter().setY(origin.getY() - 1);
|
||||
center = region.getCenter().withY(origin.getY() - 1).toBlockPoint();
|
||||
center = region.getCenter().withY(origin.y() - 1).toBlockPoint();
|
||||
this.centerOffset = center.subtract(center.round());
|
||||
this.center = center.subtract(centerOffset);
|
||||
this.transform = transform;
|
||||
@ -108,15 +108,15 @@ public class ClipboardSpline extends Spline {
|
||||
clipboardHolder.setTransform(transform);
|
||||
|
||||
BlockVector3 functionOffset = target.subtract(clipboard.getOrigin());
|
||||
final int offX = functionOffset.getBlockX();
|
||||
final int offY = functionOffset.getBlockY();
|
||||
final int offZ = functionOffset.getBlockZ();
|
||||
final int offX = functionOffset.x();
|
||||
final int offY = functionOffset.y();
|
||||
final int offZ = functionOffset.z();
|
||||
|
||||
Operation operation = clipboardHolder
|
||||
.createPaste(editSession)
|
||||
.to(target)
|
||||
.ignoreAirBlocks(true)
|
||||
.filter(v -> buffer.add(v.getBlockX() + offX, v.getBlockY() + offY, v.getBlockZ() + offZ))
|
||||
.filter(v -> buffer.add(v.x() + offX, v.y() + offY, v.z() + offZ))
|
||||
.build();
|
||||
Operations.completeLegacy(operation);
|
||||
|
||||
|
@ -121,7 +121,7 @@ public abstract class Spline {
|
||||
* 2 dimensional "cross" product. cross2D(v1, v2) = |v1|*|v2|*sin(theta) or v1 X v2 taking Y to be 0
|
||||
*/
|
||||
private double cross2D(Vector2 v1, Vector2 v2) {
|
||||
return v1.getX() * v2.getZ() - v2.getX() * v1.getZ();
|
||||
return v1.x() * v2.z() - v2.x() * v1.z();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,7 +144,7 @@ public abstract class Spline {
|
||||
// Calculate rotation from spline
|
||||
|
||||
Vector3 deriv = interpolation.get1stDerivative(position);
|
||||
Vector2 deriv2D = Vector2.at(deriv.getX(), deriv.getZ()).normalize();
|
||||
Vector2 deriv2D = Vector2.at(deriv.x(), deriv.z()).normalize();
|
||||
double angle = Math.toDegrees(
|
||||
-Math.atan2(cross2D(direction, deriv2D), direction.dot(deriv2D))
|
||||
);
|
||||
|
@ -79,13 +79,13 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
|
||||
BlockVector3 dimensions = clipboard.getDimensions();
|
||||
double quality = Math.max(dimensions.getBlockX(), dimensions.getBlockZ());
|
||||
double quality = Math.max(dimensions.x(), dimensions.z());
|
||||
|
||||
AffineTransform transform = new AffineTransform();
|
||||
|
||||
ClipboardSpline spline = new ClipboardSpline(editSession, holder, interpol, transform, nodes.size());
|
||||
|
||||
if (dimensions.getBlockX() > dimensions.getBlockZ()) {
|
||||
if (dimensions.x() > dimensions.z()) {
|
||||
spline.setDirection(Vector2.at(0, 1));
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,9 @@ public class Config {
|
||||
}
|
||||
|
||||
public boolean load(File file) {
|
||||
if (!file.exists()) {
|
||||
return false;
|
||||
}
|
||||
existingMigrateNodes = new ArrayList<>();
|
||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(file);
|
||||
for (String key : yml.getKeys(true)) {
|
||||
|
@ -2,6 +2,7 @@ package com.fastasyncworldedit.core.configuration;
|
||||
|
||||
import com.fastasyncworldedit.core.limit.FaweLimit;
|
||||
import com.fastasyncworldedit.core.limit.PropertyRemap;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
@ -140,8 +141,22 @@ public class Settings extends Config {
|
||||
);
|
||||
limit.MAX_FAILS = Math.max(limit.MAX_FAILS, newLimit.MAX_FAILS != -1 ? newLimit.MAX_FAILS : Integer.MAX_VALUE);
|
||||
limit.MAX_ITERATIONS = Math.max(
|
||||
limit.MAX_ITERATIONS,
|
||||
newLimit.MAX_ITERATIONS != -1 ? newLimit.MAX_ITERATIONS : Integer.MAX_VALUE
|
||||
limit.MAX_ITERATIONS, newLimit.MAX_ITERATIONS != -1 ? newLimit.MAX_ITERATIONS : Integer.MAX_VALUE);
|
||||
limit.MAX_RADIUS = Math.max(
|
||||
limit.MAX_RADIUS,
|
||||
newLimit.MAX_RADIUS != -1 ? newLimit.MAX_RADIUS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_SUPER_PICKAXE_SIZE = Math.max(
|
||||
limit.MAX_SUPER_PICKAXE_SIZE,
|
||||
newLimit.MAX_SUPER_PICKAXE_SIZE != -1 ? newLimit.MAX_SUPER_PICKAXE_SIZE : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_BRUSH_RADIUS = Math.max(
|
||||
limit.MAX_BRUSH_RADIUS,
|
||||
newLimit.MAX_BRUSH_RADIUS != -1 ? newLimit.MAX_BRUSH_RADIUS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_BUTCHER_RADIUS = Math.max(
|
||||
limit.MAX_BUTCHER_RADIUS,
|
||||
newLimit.MAX_BUTCHER_RADIUS != -1 ? newLimit.MAX_BUTCHER_RADIUS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_HISTORY = Math.max(
|
||||
limit.MAX_HISTORY,
|
||||
@ -352,6 +367,14 @@ public class Settings extends Config {
|
||||
public int MAX_ITERATIONS = 1000;
|
||||
@Comment("Max allowed entities (e.g. cows)")
|
||||
public int MAX_ENTITIES = 1337;
|
||||
@Comment("Max allowed radius (e.g. for //sphere)")
|
||||
public int MAX_RADIUS = LocalConfiguration.MAX_RADIUS;
|
||||
@Comment("Max allowed superpickaxe size")
|
||||
public int MAX_SUPER_PICKAXE_SIZE = LocalConfiguration.MAX_SUPER_RADIUS;
|
||||
@Comment("Max allowed brush radius")
|
||||
public int MAX_BRUSH_RADIUS = LocalConfiguration.MAX_BRUSH_RADIUS;
|
||||
@Comment("Max allowed butcher radius")
|
||||
public int MAX_BUTCHER_RADIUS = LocalConfiguration.MAX_BUTCHER_RADIUS;
|
||||
@Comment({
|
||||
"Blockstates include Banner, Beacon, BrewingStand, Chest, CommandBlock, ",
|
||||
"CreatureSpawner, Dispenser, Dropper, EndGateway, Furnace, Hopper, Jukebox, ",
|
||||
@ -645,6 +668,13 @@ public class Settings extends Config {
|
||||
@Comment({"The web interface for clipboards", " - All schematics are anonymous and private", " - Downloads can be deleted by the user", " - Supports clipboard uploads, downloads and saves",})
|
||||
public String URL = "https://schem.intellectualsites.com/fawe/";
|
||||
|
||||
@Comment({"The url of the backend server (Arkitektonika)"})
|
||||
public String ARKITEKTONIKA_BACKEND_URL = "https://api.schematic.cloud/";
|
||||
@Comment({"The url used to generate a download link from.", "{key} will be replaced with the generated key"})
|
||||
public String ARKITEKTONIKA_DOWNLOAD_URL = "https://schematic.cloud/download/{key}";
|
||||
@Comment({"The url used to generate a deletion link from.", "{key} will be replaced with the generated key"})
|
||||
public String ARKITEKTONIKA_DELETE_URL = "https://schematic.cloud/delete/{key}";
|
||||
|
||||
@Comment("The maximum amount of time in seconds the plugin can attempt to load images for.")
|
||||
public int MAX_IMAGE_LOAD_TIME = 5;
|
||||
|
||||
|
@ -68,6 +68,7 @@ public class YamlConfiguration extends FileConfiguration {
|
||||
LOGGER.error("Could not read {}\n" + "Renamed to {}", file, dest.getAbsolutePath(), ex);
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,13 +179,13 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
}
|
||||
try (PreparedStatement stmt = connection.prepareStatement(stmtStr.formatted(this.prefix))) {
|
||||
stmt.setInt(1, (int) (minTime / 1000));
|
||||
stmt.setInt(2, pos1.getBlockX());
|
||||
stmt.setInt(3, pos2.getBlockX());
|
||||
stmt.setInt(4, pos1.getBlockZ());
|
||||
stmt.setInt(5, pos2.getBlockZ());
|
||||
stmt.setInt(2, pos1.x());
|
||||
stmt.setInt(3, pos2.x());
|
||||
stmt.setInt(4, pos1.z());
|
||||
stmt.setInt(5, pos2.z());
|
||||
// Keep 128 offset for backwards-compatibility
|
||||
stmt.setInt(6, pos1.getBlockY() - 128);
|
||||
stmt.setInt(7, pos2.getBlockY() - 128);
|
||||
stmt.setInt(6, pos1.y() - 128);
|
||||
stmt.setInt(7, pos2.y() - 128);
|
||||
if (uuid != null) {
|
||||
byte[] uuidBytes = toBytes(uuid);
|
||||
stmt.setBytes(8, uuidBytes);
|
||||
@ -210,13 +210,13 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
.array();
|
||||
stmt.setBytes(1, uuidBytes);
|
||||
stmt.setInt(2, (int) (minTime / 1000));
|
||||
stmt.setInt(3, pos1.getBlockX());
|
||||
stmt.setInt(4, pos2.getBlockX());
|
||||
stmt.setInt(5, pos1.getBlockZ());
|
||||
stmt.setInt(6, pos2.getBlockZ());
|
||||
stmt.setInt(3, pos1.x());
|
||||
stmt.setInt(4, pos2.x());
|
||||
stmt.setInt(5, pos1.z());
|
||||
stmt.setInt(6, pos2.z());
|
||||
// Keep 128 offset for backwards-compatibility
|
||||
stmt.setInt(7, pos1.getBlockY() - 128);
|
||||
stmt.setInt(8, pos2.getBlockY() - 128);
|
||||
stmt.setInt(7, pos1.y() - 128);
|
||||
stmt.setInt(8, pos2.y() - 128);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
@ -262,13 +262,13 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
BlockVector3 pos1 = change.getMinimumPoint();
|
||||
BlockVector3 pos2 = change.getMaximumPoint();
|
||||
|
||||
stmt.setInt(4, pos1.getX());
|
||||
stmt.setInt(5, pos2.getX());
|
||||
stmt.setInt(6, pos1.getZ());
|
||||
stmt.setInt(7, pos2.getZ());
|
||||
stmt.setInt(4, pos1.x());
|
||||
stmt.setInt(5, pos2.x());
|
||||
stmt.setInt(6, pos1.z());
|
||||
stmt.setInt(7, pos2.z());
|
||||
// Keep 128 offset for backwards-compatibility
|
||||
stmt.setInt(8, pos1.getY() - 128);
|
||||
stmt.setInt(9, pos2.getY() - 128);
|
||||
stmt.setInt(8, pos1.y() - 128);
|
||||
stmt.setInt(9, pos2.y() - 128);
|
||||
stmt.setString(10, change.getCommand());
|
||||
stmt.setInt(11, change.size());
|
||||
stmt.executeUpdate();
|
||||
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.fastasyncworldedit.core.exception;
|
||||
|
||||
/**
|
||||
* Thrown when a maximum radius for a brush is reached.
|
||||
*/
|
||||
public class BrushRadiusLimitException extends RadiusLimitException {
|
||||
|
||||
public BrushRadiusLimitException(int maxBrushRadius) {
|
||||
super(maxBrushRadius);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.fastasyncworldedit.core.exception;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
|
||||
/**
|
||||
* Thrown when a maximum radius is reached, such as, for example,
|
||||
* in the case of a sphere command.
|
||||
*/
|
||||
public class RadiusLimitException extends WorldEditException {
|
||||
|
||||
private final int maxRadius;
|
||||
|
||||
public RadiusLimitException(int maxRadius) {
|
||||
this.maxRadius = maxRadius;
|
||||
}
|
||||
|
||||
public int getMaxRadius() {
|
||||
return maxRadius;
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.fastasyncworldedit.core.extension.factory.parser.common;
|
||||
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.extent.inventory.SlottableBlockBag;
|
||||
import com.fastasyncworldedit.core.limit.FaweLimit;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.input.DisallowedUsageException;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.internal.registry.SimpleInputParser;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public abstract class HotbarParser<T> extends SimpleInputParser<T> {
|
||||
|
||||
private final List<String> aliases = ImmutableList.of("#hotbar");
|
||||
|
||||
protected HotbarParser(final WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMatchedAliases() {
|
||||
return aliases;
|
||||
}
|
||||
|
||||
protected List<BlockType> getBlockTypes(ParserContext context) {
|
||||
Player player = context.requirePlayer();
|
||||
BlockBag bag = player.getInventoryBlockBag();
|
||||
if (!(bag instanceof final SlottableBlockBag slottable)) {
|
||||
// Matches DefaultBlockParser
|
||||
throw new InputParseException(Caption.of("fawe.error.unsupported"));
|
||||
}
|
||||
List<BlockType> types = new ArrayList<>();
|
||||
FaweLimit limit = player.getLimit();
|
||||
boolean anyBlock = player.hasPermission("worldedit.anyblock");
|
||||
for (int slot = 0; slot < 9; slot++) {
|
||||
BaseItem item = slottable.getItem(slot);
|
||||
if (item != null && item.getType().hasBlockType()) {
|
||||
BlockType type = item.getType().getBlockType();
|
||||
if (!anyBlock && worldEdit.getConfiguration().disallowedBlocks.contains(type.id().toLowerCase(Locale.ROOT))) {
|
||||
throw new DisallowedUsageException(Caption.of(
|
||||
"worldedit.error.disallowed-block",
|
||||
TextComponent.of(type.getId())
|
||||
));
|
||||
}
|
||||
if (!limit.isUnlimited()) {
|
||||
if (limit.DISALLOWED_BLOCKS.contains(type.id().toLowerCase(Locale.ROOT))) {
|
||||
throw new DisallowedUsageException(Caption.of(
|
||||
"fawe.error.limit.disallowed-block",
|
||||
TextComponent.of(type.getId())
|
||||
));
|
||||
}
|
||||
}
|
||||
types.add(type);
|
||||
}
|
||||
}
|
||||
if (types.isEmpty()) {
|
||||
throw new InputParseException(Caption.of("fawe.error.no-valid-on-hotbar"));
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.fastasyncworldedit.core.extension.factory.parser.mask;
|
||||
|
||||
import com.fastasyncworldedit.core.extension.factory.parser.common.HotbarParser;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
|
||||
public class HotbarMaskParser extends HotbarParser<Mask> {
|
||||
|
||||
public HotbarMaskParser(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mask parseFromSimpleInput(String input, ParserContext context) {
|
||||
return new BlockTypeMask(context.getExtent(), getBlockTypes(context));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.fastasyncworldedit.core.extension.factory.parser.pattern;
|
||||
|
||||
import com.fastasyncworldedit.core.extension.factory.parser.common.HotbarParser;
|
||||
import com.fastasyncworldedit.core.math.random.TrueRandom;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
public class HotbarPatternParser extends HotbarParser<Pattern> {
|
||||
|
||||
public HotbarPatternParser(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pattern parseFromSimpleInput(String input, ParserContext context) {
|
||||
RandomPattern random = new RandomPattern(new TrueRandom());
|
||||
for (BlockType type : getBlockTypes(context)) {
|
||||
random.add(type, 1);
|
||||
}
|
||||
return random;
|
||||
}
|
||||
|
||||
}
|
@ -24,7 +24,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
||||
return getExtent().setBlock(location.getX() + dx, location.getY() + dy, location.getZ() + dz, block);
|
||||
return getExtent().setBlock(location.x() + dx, location.y() + dy, location.z() + dz, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -49,7 +49,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 location) {
|
||||
return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
return getBlock(location.x(), location.y(), location.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,7 +101,7 @@ public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IB
|
||||
@SuppressWarnings("unchecked")
|
||||
private <B extends BlockStateHolder<B>> B checkBlock(B block) {
|
||||
if (blockedBlocks != null) {
|
||||
if (blockedBlocks.contains(block.getBlockType().getId())) {
|
||||
if (blockedBlocks.contains(block.getBlockType().id())) {
|
||||
return (B) (block instanceof BlockState ? RESERVED : RESERVED.toBaseBlock()); // set to reserved/empty
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IB
|
||||
}
|
||||
BlockState state = BlockTypesCache.states[block];
|
||||
if (blockedBlocks != null) {
|
||||
if (blockedBlocks.contains(state.getBlockType().getId())) {
|
||||
if (blockedBlocks.contains(state.getBlockType().id())) {
|
||||
blocks[i] = BlockTypesCache.ReservedIDs.__RESERVED__;
|
||||
continue;
|
||||
}
|
||||
|
@ -64,11 +64,11 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
|
||||
@Override
|
||||
public final boolean contains(BlockVector3 p) {
|
||||
return contains(p.getBlockX(), p.getBlockY(), p.getBlockZ());
|
||||
return contains(p.x(), p.y(), p.z());
|
||||
}
|
||||
|
||||
public final boolean contains(BlockVector2 p) {
|
||||
return contains(p.getBlockX(), p.getBlockZ());
|
||||
return contains(p.x(), p.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -96,7 +96,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return getBiomeType(position.getX(), position.getY(), position.getZ());
|
||||
return getBiomeType(position.x(), position.y(), position.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -112,7 +112,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return getFullBlock(position.getX(), position.getY(), position.getZ());
|
||||
return getFullBlock(position.x(), position.y(), position.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,7 +128,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return getBlock(position.getX(), position.getY(), position.getZ());
|
||||
return getBlock(position.x(), position.y(), position.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,7 +66,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
|
||||
return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
return setBlock(location.x(), location.y(), location.z(), block);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -110,8 +110,8 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType newBiome) {
|
||||
BiomeType oldBiome = this.getBiome(position);
|
||||
if (!oldBiome.getId().equals(newBiome.getId())) {
|
||||
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockY(), position.getBlockZ(), oldBiome, newBiome);
|
||||
if (!oldBiome.id().equals(newBiome.id())) {
|
||||
this.changeSet.addBiomeChange(position.x(), position.y(), position.z(), oldBiome, newBiome);
|
||||
return getExtent().setBiome(position, newBiome);
|
||||
} else {
|
||||
return false;
|
||||
@ -121,7 +121,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType newBiome) {
|
||||
BiomeType oldBiome = this.getBiome(mutable.setComponents(x, y, z));
|
||||
if (!oldBiome.getId().equals(newBiome.getId())) {
|
||||
if (!oldBiome.id().equals(newBiome.id())) {
|
||||
this.changeSet.addBiomeChange(x, y, z, oldBiome, newBiome);
|
||||
return getExtent().setBiome(x, y, z, newBiome);
|
||||
} else {
|
||||
|
@ -373,12 +373,12 @@ public class LimitExtent extends AbstractDelegateExtent {
|
||||
size = ((Collection<BlockVector3>) positions).size();
|
||||
} else if (positions instanceof Region) {
|
||||
BlockVector3 dim = ((Region) positions).getDimensions();
|
||||
size = dim.getX() * dim.getY() * dim.getZ();
|
||||
size = dim.x() * dim.y() * dim.z();
|
||||
} else if (positions instanceof Extent) {
|
||||
BlockVector3 min = ((Extent) positions).getMinimumPoint();
|
||||
BlockVector3 max = ((Extent) positions).getMinimumPoint();
|
||||
BlockVector3 dim = max.subtract(min).add(BlockVector3.ONE);
|
||||
size = dim.getX() * dim.getY() * dim.getZ();
|
||||
size = dim.x() * dim.y() * dim.z();
|
||||
} else {
|
||||
ExtentFilterBlock block = new ExtentFilterBlock(this);
|
||||
for (BlockVector3 pos : positions) {
|
||||
|
@ -38,9 +38,9 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
if (min == null) {
|
||||
min = pos;
|
||||
}
|
||||
mutable.mutX(pos.getX() - min.getX());
|
||||
mutable.mutY(pos.getY() - min.getY());
|
||||
mutable.mutZ(pos.getZ() - min.getZ());
|
||||
mutable.mutX(pos.x() - min.x());
|
||||
mutable.mutY(pos.y() - min.y());
|
||||
mutable.mutZ(pos.z() - min.z());
|
||||
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
|
||||
return min.add(tmp.roundHalfUp().toBlockPoint());
|
||||
}
|
||||
@ -49,9 +49,9 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
if (min == null) {
|
||||
min = BlockVector3.at(x, y, z);
|
||||
}
|
||||
mutable.mutX(x - min.getX());
|
||||
mutable.mutY(y - min.getY());
|
||||
mutable.mutZ(z - min.getZ());
|
||||
mutable.mutX(x - min.x());
|
||||
mutable.mutY(y - min.y());
|
||||
mutable.mutZ(z - min.z());
|
||||
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
|
||||
return min.add(tmp.roundHalfUp().toBlockPoint());
|
||||
}
|
||||
@ -73,10 +73,10 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(position.getBlockY());
|
||||
return super.getBiome(getPos(mutable.getX(), mutable.getY(), mutable.getZ()));
|
||||
mutable.mutX(position.x());
|
||||
mutable.mutZ(position.z());
|
||||
mutable.mutY(position.y());
|
||||
return super.getBiome(getPos(mutable.x(), mutable.y(), mutable.z()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,10 +92,10 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(position.getBlockY());
|
||||
return super.setBiome(getPos(mutable.getX(), mutable.getY(), mutable.getZ()), biome);
|
||||
mutable.mutX(position.x());
|
||||
mutable.mutZ(position.z());
|
||||
mutable.mutY(position.y());
|
||||
return super.setBiome(getPos(mutable.x(), mutable.y(), mutable.z()), biome);
|
||||
}
|
||||
|
||||
public void setTransform(Transform transform) {
|
||||
|
@ -80,12 +80,12 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block)
|
||||
throws WorldEditException {
|
||||
return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
return setBlock(location.x(), location.y(), location.z(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 location) {
|
||||
return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
return getBlock(location.x(), location.y(), location.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,8 +41,8 @@ public class SourceMaskExtent extends TemporalExtent {
|
||||
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
||||
set(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
return mask.test(location) && super.setBlock(location.getX(), location.getY(), location.getZ(), block);
|
||||
set(location.x(), location.y(), location.z(), block);
|
||||
return mask.test(location) && super.setBlock(location.x(), location.y(), location.z(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class TemporalExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
if (position.getX() == x && position.getY() == y && position.getZ() == z) {
|
||||
if (position.x() == x && position.y() == y && position.z() == z) {
|
||||
return block.toImmutableState();
|
||||
}
|
||||
return super.getBlock(position);
|
||||
@ -60,7 +60,7 @@ public class TemporalExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
if (position.getX() == x && position.getY() == y && position.getZ() == z) {
|
||||
if (position.x() == x && position.y() == y && position.z() == z) {
|
||||
if (block instanceof BaseBlock) {
|
||||
return (BaseBlock) block;
|
||||
} else {
|
||||
@ -72,7 +72,7 @@ public class TemporalExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
if (position.getX() == bx && position.getZ() == bz) {
|
||||
if (position.x() == bx && position.z() == bz) {
|
||||
return biome;
|
||||
}
|
||||
return super.getBiome(position);
|
||||
|
@ -55,13 +55,13 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
if (min == null) {
|
||||
min = pos;
|
||||
}
|
||||
mutable1.mutX(pos.getX() - min.getX());
|
||||
mutable1.mutY(pos.getY() - min.getY());
|
||||
mutable1.mutZ(pos.getZ() - min.getZ());
|
||||
mutable1.mutX(pos.x() - min.x());
|
||||
mutable1.mutY(pos.y() - min.y());
|
||||
mutable1.mutZ(pos.z() - min.z());
|
||||
Vector3 tmp = getTransform().apply(mutable1);
|
||||
mutable2.mutX(tmp.getX() + min.getX());
|
||||
mutable2.mutY(tmp.getY() + min.getY());
|
||||
mutable2.mutZ(tmp.getZ() + min.getZ());
|
||||
mutable2.mutX(tmp.x() + min.x());
|
||||
mutable2.mutY(tmp.y() + min.y());
|
||||
mutable2.mutZ(tmp.z() + min.z());
|
||||
return mutable2;
|
||||
}
|
||||
|
||||
@ -69,20 +69,20 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
if (min == null) {
|
||||
min = BlockVector3.at(x, y, z);
|
||||
}
|
||||
mutable1.mutX(x - min.getX());
|
||||
mutable1.mutY(y - min.getY());
|
||||
mutable1.mutZ(z - min.getZ());
|
||||
mutable1.mutX(x - min.x());
|
||||
mutable1.mutY(y - min.y());
|
||||
mutable1.mutZ(z - min.z());
|
||||
Vector3 tmp = getTransform().apply(mutable1);
|
||||
mutable2.mutX(tmp.getX() + min.getX());
|
||||
mutable2.mutY(tmp.getY() + min.getY());
|
||||
mutable2.mutZ(tmp.getZ() + min.getZ());
|
||||
mutable2.mutX(tmp.x() + min.x());
|
||||
mutable2.mutY(tmp.y() + min.y());
|
||||
mutable2.mutZ(tmp.z() + min.z());
|
||||
return tmp.toBlockPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
BlockVector3 p = getPos(x, y, z);
|
||||
return transform(super.getBlock(p.getX(), p.getY(), p.getZ()));
|
||||
return transform(super.getBlock(p.x(), p.y(), p.z()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -93,7 +93,7 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
@Override
|
||||
public BiomeType getBiomeType(int x, int y, int z) {
|
||||
BlockVector3 p = getPos(x, y, z);
|
||||
return super.getBiomeType(p.getX(), y, p.getZ());
|
||||
return super.getBiomeType(p.x(), y, p.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,7 +114,7 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
BlockVector3 p = getPos(x, y, z);
|
||||
return super.setBiome(p.getX(), p.getY(), p.getZ(), biome);
|
||||
return super.setBiome(p.x(), p.y(), p.z(), biome);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
return setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
||||
return setBiome(position.x(), position.y(), position.z(), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,7 +92,7 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return getBiome(getBiomeIndex(position.getX(), position.getY(), position.getZ()));
|
||||
return getBiome(getBiomeIndex(position.x(), position.y(), position.z()));
|
||||
}
|
||||
|
||||
public void convertTilesToIndex() {
|
||||
|
@ -359,7 +359,7 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
return setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
||||
return setBiome(position.x(), position.y(), position.z(), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -417,7 +417,7 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return getBiome(getBiomeIndex(position.getX(), position.getY(), position.getZ()));
|
||||
return getBiome(getBiomeIndex(position.x(), position.y(), position.z()));
|
||||
}
|
||||
|
||||
public BlockArrayClipboard toClipboard() {
|
||||
@ -438,9 +438,9 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
||||
super.setOrigin(origin);
|
||||
origin = origin.subtract(offset);
|
||||
try {
|
||||
byteBuffer.putShort(10, (short) origin.getBlockX());
|
||||
byteBuffer.putShort(12, (short) origin.getBlockY());
|
||||
byteBuffer.putShort(14, (short) origin.getBlockZ());
|
||||
byteBuffer.putShort(10, (short) origin.x());
|
||||
byteBuffer.putShort(12, (short) origin.y());
|
||||
byteBuffer.putShort(14, (short) origin.z());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -450,9 +450,9 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
||||
protected void setOffset(BlockVector3 offset) {
|
||||
super.setOffset(offset);
|
||||
try {
|
||||
byteBuffer.putShort(16, (short) offset.getBlockX());
|
||||
byteBuffer.putShort(18, (short) offset.getBlockY());
|
||||
byteBuffer.putShort(20, (short) offset.getBlockZ());
|
||||
byteBuffer.putShort(16, (short) offset.x());
|
||||
byteBuffer.putShort(18, (short) offset.y());
|
||||
byteBuffer.putShort(20, (short) offset.z());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -588,9 +588,9 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
||||
CompoundTag data = entity.getState().getNbtData();
|
||||
HashMap<String, Tag> value = new HashMap<>(data.getValue());
|
||||
List<DoubleTag> pos = new ArrayList<>(3);
|
||||
pos.add(new DoubleTag(entity.getLocation().getX()));
|
||||
pos.add(new DoubleTag(entity.getLocation().getX()));
|
||||
pos.add(new DoubleTag(entity.getLocation().getX()));
|
||||
pos.add(new DoubleTag(entity.getLocation().x()));
|
||||
pos.add(new DoubleTag(entity.getLocation().x()));
|
||||
pos.add(new DoubleTag(entity.getLocation().x()));
|
||||
value.put("Pos", new ListTag(DoubleTag.class, pos));
|
||||
nbtOS.writeTag(new CompoundTag(value));
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
return setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
||||
return setBiome(position.x(), position.y(), position.z(), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -115,7 +115,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return getBiome(getBiomeIndex(position.getX(), position.getY(), position.getZ()));
|
||||
return getBiome(getBiomeIndex(position.x(), position.y(), position.z()));
|
||||
}
|
||||
|
||||
private int getOrdinal(int index) {
|
||||
|
@ -70,17 +70,17 @@ public abstract class SimpleClipboard implements Clipboard {
|
||||
|
||||
@Override
|
||||
public final int getWidth() {
|
||||
return size.getBlockX();
|
||||
return size.x();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getHeight() {
|
||||
return size.getBlockY();
|
||||
return size.y();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getLength() {
|
||||
return size.getBlockZ();
|
||||
return size.z();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return getExtent().getBiomeType(position.getX(), position.getY(), position.getZ());
|
||||
return getExtent().getBiomeType(position.x(), position.y(), position.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -396,8 +396,8 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
int locY = loc.getBlockY();
|
||||
int locZ = loc.getBlockZ();
|
||||
BlockVector3 max = min.add(dimensions).subtract(BlockVector3.ONE);
|
||||
if (locX < min.getX() || locY < min.getY() || locZ < min.getZ()
|
||||
|| locX > max.getX() || locY > max.getY() || locZ > max.getZ()) {
|
||||
if (locX < min.x() || locY < min.y() || locZ < min.z()
|
||||
|| locX > max.x() || locY > max.y() || locZ > max.z()) {
|
||||
for (Entity e : clipboard.getEntities()) {
|
||||
clipboard.removeEntity(e);
|
||||
}
|
||||
|
@ -114,15 +114,15 @@ public class FastSchematicWriter implements ClipboardWriter {
|
||||
|
||||
// The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin'
|
||||
out.writeNamedTag("Offset", new int[]{
|
||||
min.getBlockX(),
|
||||
min.getBlockY(),
|
||||
min.getBlockZ(),
|
||||
min.x(),
|
||||
min.y(),
|
||||
min.z(),
|
||||
});
|
||||
|
||||
out.writeLazyCompoundTag("Metadata", out1 -> {
|
||||
out1.writeNamedTag("WEOffsetX", offset.getBlockX());
|
||||
out1.writeNamedTag("WEOffsetY", offset.getBlockY());
|
||||
out1.writeNamedTag("WEOffsetZ", offset.getBlockZ());
|
||||
out1.writeNamedTag("WEOffsetX", offset.x());
|
||||
out1.writeNamedTag("WEOffsetY", offset.y());
|
||||
out1.writeNamedTag("WEOffsetZ", offset.z());
|
||||
out1.writeNamedTag("FAWEVersion", Fawe.instance().getVersion().build);
|
||||
});
|
||||
|
||||
@ -162,9 +162,9 @@ public class FastSchematicWriter implements ClipboardWriter {
|
||||
// Dum.
|
||||
values.remove("id");
|
||||
values.put("Pos", new IntArrayTag(new int[]{
|
||||
pos.getX(),
|
||||
pos.getY(),
|
||||
pos.getZ()
|
||||
pos.x(),
|
||||
pos.y(),
|
||||
pos.z()
|
||||
}));
|
||||
numTiles++;
|
||||
|
||||
@ -237,7 +237,7 @@ public class FastSchematicWriter implements ClipboardWriter {
|
||||
if (!brokenEntities) {
|
||||
loc = loc.setPosition(loc.add(min.toVector3()));
|
||||
}
|
||||
values.put("Id", new StringTag(state.getType().getId()));
|
||||
values.put("Id", new StringTag(state.getType().id()));
|
||||
values.put("Pos", writeVector(loc));
|
||||
values.put("Rotation", writeRotation(entity.getLocation()));
|
||||
|
||||
@ -282,10 +282,10 @@ public class FastSchematicWriter implements ClipboardWriter {
|
||||
int length = clipboard.getRegion().getLength();
|
||||
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||
for (int z = 0, i = 0; z < length; z++) {
|
||||
int z0 = min.getBlockZ() + z;
|
||||
int z0 = min.z() + z;
|
||||
for (int x = 0; x < width; x++, i++) {
|
||||
int x0 = min.getBlockX() + x;
|
||||
BiomeType biome = clipboard.getBiome(mutable.setComponents(x0, min.getY(), z0));
|
||||
int x0 = min.x() + x;
|
||||
BiomeType biome = clipboard.getBiome(mutable.setComponents(x0, min.y(), z0));
|
||||
task.applyInt(i, biome.getInternalId());
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ public class FastSchematicWriter implements ClipboardWriter {
|
||||
for (int i = 0; i < paletteList.size(); i++) {
|
||||
int ordinal = paletteList.get(i);
|
||||
BiomeType state = BiomeTypes.get(ordinal);
|
||||
out12.writeNamedTag(state.getId(), i);
|
||||
out12.writeNamedTag(state.id(), i);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -183,7 +183,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
|
||||
indexes.put(combined, (Integer) palette.size());
|
||||
HashMap<String, Object> paletteEntry = new HashMap<>();
|
||||
paletteEntry.put("Name", type.getId());
|
||||
paletteEntry.put("Name", type.id());
|
||||
if (block.getInternalId() != type.getInternalId()) {
|
||||
Map<String, Object> properties = null;
|
||||
for (AbstractProperty property : (List<AbstractProperty<?>>) type.getProperties()) {
|
||||
@ -213,8 +213,8 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
if (block.getBlockType() != BlockTypes.STRUCTURE_VOID) {
|
||||
int combined = block.getInternalId();
|
||||
int index = indexes.get(combined);
|
||||
List<Integer> pos = Arrays.asList(point.getX() - min.getX(),
|
||||
point.getY() - min.getY(), point.getZ() - min.getZ()
|
||||
List<Integer> pos = Arrays.asList(point.x() - min.x(),
|
||||
point.y() - min.y(), point.z() - min.z()
|
||||
);
|
||||
if (!block.hasNbtData()) {
|
||||
blocks.add(FaweCache.INSTANCE.asMap("state", index, "pos", pos));
|
||||
@ -231,16 +231,16 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
ArrayList<Map<String, Object>> entities = new ArrayList<>();
|
||||
for (Entity entity : clipboard.getEntities()) {
|
||||
Location loc = entity.getLocation();
|
||||
List<Double> pos = Arrays.asList(loc.getX(), loc.getY(), loc.getZ());
|
||||
List<Double> pos = Arrays.asList(loc.x(), loc.y(), loc.z());
|
||||
List<Integer> blockPos = Arrays.asList(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
BaseEntity state = entity.getState();
|
||||
if (state != null) {
|
||||
CompoundTag nbt = state.getNbtData();
|
||||
Map<String, Tag> nbtMap = nbt.getValue();
|
||||
Map<String, Tag> nbtMap = new HashMap<>(nbt.getValue());
|
||||
// Replace rotation data
|
||||
nbtMap.put("Rotation", writeRotation(entity.getLocation()));
|
||||
nbtMap.put("id", new StringTag(state.getType().getId()));
|
||||
Map<String, Object> entityMap = FaweCache.INSTANCE.asMap("pos", pos, "blockPos", blockPos, "nbt", nbt);
|
||||
nbtMap.put("id", new StringTag(state.getType().id()));
|
||||
Map<String, Object> entityMap = FaweCache.INSTANCE.asMap("pos", pos, "blockPos", blockPos, "nbt", new CompoundTag(nbtMap));
|
||||
entities.add(entityMap);
|
||||
}
|
||||
}
|
||||
|
@ -75,9 +75,9 @@ public class PNGWriter implements ClipboardWriter {
|
||||
MutableBlockVector3 mutableLeft = new MutableBlockVector3(0, 0, 0);
|
||||
|
||||
BlockVector3 min = clipboard.getMinimumPoint();
|
||||
int y0 = min.getBlockY();
|
||||
int z0 = min.getBlockZ();
|
||||
int x0 = min.getBlockX();
|
||||
int y0 = min.y();
|
||||
int z0 = min.z();
|
||||
int x0 = min.x();
|
||||
for (int x = x0; x < x0 + width; x++) {
|
||||
mutable.mutX(x);
|
||||
mutableTop.mutX(x);
|
||||
|
@ -20,7 +20,7 @@ public class ArrayImageMask implements FilterBlockMask {
|
||||
|
||||
@Override
|
||||
public boolean applyBlock(FilterBlock block) {
|
||||
int height = image.getRGB(block.getX(), block.getZ()) & 0xFF;
|
||||
int height = image.getRGB(block.x(), block.z()) & 0xFF;
|
||||
return height == 255 || height > 0 && !white && random.nextInt(256) <= height;
|
||||
}
|
||||
|
||||
|
@ -31,18 +31,18 @@ public abstract class AbstractFilterBlock extends FilterBlock {
|
||||
public abstract Extent getExtent();
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return getPosition().getX();
|
||||
public int x() {
|
||||
return getPosition().x();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY() {
|
||||
return getPosition().getY();
|
||||
public int y() {
|
||||
return getPosition().y();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZ() {
|
||||
return getPosition().getZ();
|
||||
public int z() {
|
||||
return getPosition().z();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -72,12 +72,12 @@ public abstract class AbstractFilterBlock extends FilterBlock {
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return at(getX(), getY(), getZ());
|
||||
return at(x(), y(), z());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return at(getX(), getY(), getZ());
|
||||
return at(x(), y(), z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,7 +88,7 @@ public abstract class AbstractFilterBlock extends FilterBlock {
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block)
|
||||
throws WorldEditException {
|
||||
if (x == this.getX() && y == this.getY() && z == this.getZ()) {
|
||||
if (x == this.x() && y == this.y() && z == this.z()) {
|
||||
setFullBlock(block.toBaseBlock());
|
||||
return true;
|
||||
}
|
||||
@ -97,7 +97,7 @@ public abstract class AbstractFilterBlock extends FilterBlock {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
if (x == this.getX() && y == this.getY() && z == this.getZ()) {
|
||||
if (x == this.x() && y == this.y() && z == this.z()) {
|
||||
setBiome(biome);
|
||||
return true;
|
||||
}
|
||||
|
@ -83,18 +83,18 @@ public abstract class AbstractSingleFilterBlock extends FilterBlock {
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return at(getX(), getY(), getZ());
|
||||
return at(x(), y(), z());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return at(getX(), getY(), getZ());
|
||||
return at(x(), y(), z());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block)
|
||||
throws WorldEditException {
|
||||
if (x == this.getX() && y == this.getY() && z == this.getZ()) {
|
||||
if (x == this.x() && y == this.y() && z == this.z()) {
|
||||
setFullBlock(block.toBaseBlock());
|
||||
return true;
|
||||
}
|
||||
|
@ -80,17 +80,17 @@ public class ArrayFilterBlock extends AbstractExtentFilterBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
public int x() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY() {
|
||||
public int y() {
|
||||
return (heights[index] & 0xFF) + yOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZ() {
|
||||
public int z() {
|
||||
return z;
|
||||
}
|
||||
|
||||
@ -112,12 +112,12 @@ public class ArrayFilterBlock extends AbstractExtentFilterBlock {
|
||||
|
||||
@Override
|
||||
public void setBiome(final BiomeType biome) {
|
||||
getExtent().setBiome(getX(), getY(), getZ(), biome);
|
||||
getExtent().setBiome(x(), y(), z(), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome() {
|
||||
return getExtent().getBiomeType(getX(), getY(), getZ());
|
||||
return getExtent().getBiomeType(x(), y(), z());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -190,17 +190,17 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getX() {
|
||||
public final int x() {
|
||||
return xx + x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getY() {
|
||||
public final int y() {
|
||||
return yy + y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getZ() {
|
||||
public final int z() {
|
||||
return zz + z;
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
||||
if (z > 0) {
|
||||
return states[getArr[index - 16]];
|
||||
}
|
||||
return getExtent().getBlock(getX(), getY(), getZ() - 1);
|
||||
return getExtent().getBlock(x(), y(), z() - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -312,7 +312,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
||||
if (x < 15) {
|
||||
return states[getArr[index + 1]];
|
||||
}
|
||||
return getExtent().getBlock(getX() + 1, getY(), getZ());
|
||||
return getExtent().getBlock(x() + 1, y(), z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -320,7 +320,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
||||
if (z < 15) {
|
||||
return states[getArr[index + 16]];
|
||||
}
|
||||
return getExtent().getBlock(getX(), getY(), getZ() + 1);
|
||||
return getExtent().getBlock(x(), y(), z() + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -328,7 +328,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
||||
if (x > 0) {
|
||||
return states[getArr[index - 1]];
|
||||
}
|
||||
return getExtent().getBlock(getX() - 1, getY(), getZ());
|
||||
return getExtent().getBlock(x() - 1, y(), z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -401,7 +401,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
return setBiome(position.getX(), position.getY(), position.getBlockZ(), biome);
|
||||
return setBiome(position.x(), position.y(), position.z(), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,60 +73,60 @@ public abstract class FilterBlock extends BlockVector3 implements Extent, TileEn
|
||||
}
|
||||
|
||||
public BlockState getBlockBelow() {
|
||||
return getBlock(getX(), getY() - 1, getZ());
|
||||
return getBlock(x(), y() - 1, z());
|
||||
}
|
||||
|
||||
public BlockState getBlockAbove() {
|
||||
return getBlock(getX(), getY() + 1, getZ());
|
||||
return getBlock(x(), y() + 1, z());
|
||||
}
|
||||
|
||||
public BlockState getBlockNorth() {
|
||||
return getBlock(getX(), getY(), getZ() - 1);
|
||||
return getBlock(x(), y(), z() - 1);
|
||||
}
|
||||
|
||||
public BlockState getBlockEast() {
|
||||
return getBlock(getX() + 1, getY(), getZ());
|
||||
return getBlock(x() + 1, y(), z());
|
||||
}
|
||||
|
||||
public BlockState getBlockSouth() {
|
||||
return getBlock(getX(), getY(), getZ() + 1);
|
||||
return getBlock(x(), y(), z() + 1);
|
||||
}
|
||||
|
||||
public BlockState getBlockWest() {
|
||||
return getBlock(getX() - 1, getY(), getZ());
|
||||
return getBlock(x() - 1, y(), z());
|
||||
}
|
||||
|
||||
public BlockState getBlockRelativeY(int y) {
|
||||
return getBlock(getX(), getY() + y, getZ());
|
||||
return getBlock(x(), y() + y, z());
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract int getX();
|
||||
public abstract int x();
|
||||
|
||||
@Override
|
||||
public abstract int getY();
|
||||
public abstract int y();
|
||||
|
||||
@Override
|
||||
public abstract int getZ();
|
||||
public abstract int z();
|
||||
|
||||
public int getLocalX() {
|
||||
return getX() & 15;
|
||||
return x() & 15;
|
||||
}
|
||||
|
||||
public int getLocalY() {
|
||||
return getY() & 15;
|
||||
return y() & 15;
|
||||
}
|
||||
|
||||
public int getLocalZ() {
|
||||
return getZ() & 15;
|
||||
return z() & 15;
|
||||
}
|
||||
|
||||
public int getChunkX() {
|
||||
return getX() >> 4;
|
||||
return x() >> 4;
|
||||
}
|
||||
|
||||
public int getChunkZ() {
|
||||
return getZ() >> 4;
|
||||
return z() >> 4;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -204,7 +204,7 @@ public abstract class FilterBlock extends BlockVector3 implements Extent, TileEn
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
return setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
||||
return setBiome(position.x(), position.y(), position.z(), biome);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,17 +17,17 @@ public class SingleFilterBlock extends AbstractSingleFilterBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
public int x() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY() {
|
||||
public int y() {
|
||||
return y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZ() {
|
||||
public int z() {
|
||||
return z;
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,9 @@ public class EntityInBlockRemovingProcessor implements IBatchProcessor {
|
||||
continue;
|
||||
}
|
||||
BlockVector3 pos = tag.getEntityPosition().toBlockPoint();
|
||||
int x = pos.getX() & 15;
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ() & 15;
|
||||
int x = pos.x() & 15;
|
||||
int y = pos.y();
|
||||
int z = pos.z() & 15;
|
||||
if (!set.hasSection(y >> 4)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -273,9 +273,9 @@ public class NMSRelighter implements Relighter {
|
||||
int lightLevel = (int) val[1];
|
||||
|
||||
this.computeRemoveBlockLight(
|
||||
node.getX() - 1,
|
||||
node.getY(),
|
||||
node.getZ(),
|
||||
node.x() - 1,
|
||||
node.y(),
|
||||
node.z(),
|
||||
lightLevel,
|
||||
lightRemovalQueue,
|
||||
lightPropagationQueue,
|
||||
@ -283,20 +283,20 @@ public class NMSRelighter implements Relighter {
|
||||
visited
|
||||
);
|
||||
this.computeRemoveBlockLight(
|
||||
node.getX() + 1,
|
||||
node.getY(),
|
||||
node.getZ(),
|
||||
node.x() + 1,
|
||||
node.y(),
|
||||
node.z(),
|
||||
lightLevel,
|
||||
lightRemovalQueue,
|
||||
lightPropagationQueue,
|
||||
removalVisited,
|
||||
visited
|
||||
);
|
||||
if (node.getY() > minY) {
|
||||
if (node.y() > minY) {
|
||||
this.computeRemoveBlockLight(
|
||||
node.getX(),
|
||||
node.getY() - 1,
|
||||
node.getZ(),
|
||||
node.x(),
|
||||
node.y() - 1,
|
||||
node.z(),
|
||||
lightLevel,
|
||||
lightRemovalQueue,
|
||||
lightPropagationQueue,
|
||||
@ -304,11 +304,11 @@ public class NMSRelighter implements Relighter {
|
||||
visited
|
||||
);
|
||||
}
|
||||
if (node.getY() < maxY) {
|
||||
if (node.y() < maxY) {
|
||||
this.computeRemoveBlockLight(
|
||||
node.getX(),
|
||||
node.getY() + 1,
|
||||
node.getZ(),
|
||||
node.x(),
|
||||
node.y() + 1,
|
||||
node.z(),
|
||||
lightLevel,
|
||||
lightRemovalQueue,
|
||||
lightPropagationQueue,
|
||||
@ -317,9 +317,9 @@ public class NMSRelighter implements Relighter {
|
||||
);
|
||||
}
|
||||
this.computeRemoveBlockLight(
|
||||
node.getX(),
|
||||
node.getY(),
|
||||
node.getZ() - 1,
|
||||
node.x(),
|
||||
node.y(),
|
||||
node.z() - 1,
|
||||
lightLevel,
|
||||
lightRemovalQueue,
|
||||
lightPropagationQueue,
|
||||
@ -327,9 +327,9 @@ public class NMSRelighter implements Relighter {
|
||||
visited
|
||||
);
|
||||
this.computeRemoveBlockLight(
|
||||
node.getX(),
|
||||
node.getY(),
|
||||
node.getZ() + 1,
|
||||
node.x(),
|
||||
node.y(),
|
||||
node.z() + 1,
|
||||
lightLevel,
|
||||
lightRemovalQueue,
|
||||
lightPropagationQueue,
|
||||
@ -340,27 +340,27 @@ public class NMSRelighter implements Relighter {
|
||||
|
||||
while (!lightPropagationQueue.isEmpty()) {
|
||||
MutableBlockVector3 node = lightPropagationQueue.poll();
|
||||
ChunkHolder<?> iChunk = (ChunkHolder<?>) queue.getOrCreateChunk(node.getX() >> 4, node.getZ() >> 4);
|
||||
ChunkHolder<?> iChunk = (ChunkHolder<?>) queue.getOrCreateChunk(node.x() >> 4, node.z() >> 4);
|
||||
if (!iChunk.isInit()) {
|
||||
iChunk.init(queue, node.getX() >> 4, node.getZ() >> 4);
|
||||
iChunk.init(queue, node.x() >> 4, node.z() >> 4);
|
||||
}
|
||||
int lightLevel = iChunk.getEmittedLight(node.getX() & 15, node.getY(), node.getZ() & 15);
|
||||
BlockState state = this.queue.getBlock(node.getX(), node.getY(), node.getZ());
|
||||
String id = state.getBlockType().getId().toLowerCase(Locale.ROOT);
|
||||
int lightLevel = iChunk.getEmittedLight(node.x() & 15, node.y(), node.z() & 15);
|
||||
BlockState state = this.queue.getBlock(node.x(), node.y(), node.z());
|
||||
String id = state.getBlockType().id().toLowerCase(Locale.ROOT);
|
||||
if (lightLevel <= 1) {
|
||||
continue;
|
||||
}
|
||||
if (id.contains("slab")) {
|
||||
boolean top = state.getState(slabHalf).equalsIgnoreCase("top");
|
||||
computeSlab(node.getX(), node.getY(), node.getZ(), lightLevel, lightPropagationQueue, visited, top);
|
||||
computeSlab(node.x(), node.y(), node.z(), lightLevel, lightPropagationQueue, visited, top);
|
||||
} else if (id.contains("stair")) {
|
||||
boolean top = state.getState(stairHalf).equalsIgnoreCase("top");
|
||||
Direction direction = getStairDir(state);
|
||||
String shape = getStairShape(state);
|
||||
computeStair(
|
||||
node.getX(),
|
||||
node.getY(),
|
||||
node.getZ(),
|
||||
node.x(),
|
||||
node.y(),
|
||||
node.z(),
|
||||
lightLevel,
|
||||
lightPropagationQueue,
|
||||
visited,
|
||||
@ -369,7 +369,7 @@ public class NMSRelighter implements Relighter {
|
||||
shape
|
||||
);
|
||||
} else {
|
||||
computeNormal(node.getX(), node.getY(), node.getZ(), lightLevel, lightPropagationQueue, visited);
|
||||
computeNormal(node.x(), node.y(), node.z(), lightLevel, lightPropagationQueue, visited);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -396,7 +396,7 @@ public class NMSRelighter implements Relighter {
|
||||
if (!(checkStairEast(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
||||
break east;
|
||||
}
|
||||
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
if (!state.getBlockType().id().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
this.computeSpreadBlockLight(x + 1, y, z, currentLight, queue, visited);
|
||||
break east;
|
||||
}
|
||||
@ -449,7 +449,7 @@ public class NMSRelighter implements Relighter {
|
||||
if (!(checkStairWest(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
||||
break west;
|
||||
}
|
||||
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
if (!state.getBlockType().id().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
this.computeSpreadBlockLight(x - 1, y, z, currentLight, queue, visited);
|
||||
break west;
|
||||
}
|
||||
@ -502,7 +502,7 @@ public class NMSRelighter implements Relighter {
|
||||
if (!(checkStairSouth(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
||||
break south;
|
||||
}
|
||||
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
if (!state.getBlockType().id().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
this.computeSpreadBlockLight(x, y, z + 1, currentLight, queue, visited);
|
||||
break south;
|
||||
}
|
||||
@ -555,7 +555,7 @@ public class NMSRelighter implements Relighter {
|
||||
if (!(checkStairNorth(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
||||
break north;
|
||||
}
|
||||
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
if (!state.getBlockType().id().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
this.computeSpreadBlockLight(x, y, z - 1, currentLight, queue, visited);
|
||||
break north;
|
||||
}
|
||||
@ -707,7 +707,7 @@ public class NMSRelighter implements Relighter {
|
||||
}
|
||||
|
||||
private boolean checkStairNorth(BlockState state) {
|
||||
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
if (!state.getBlockType().id().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
return true;
|
||||
}
|
||||
Direction direction = getStairDir(state);
|
||||
@ -725,7 +725,7 @@ public class NMSRelighter implements Relighter {
|
||||
}
|
||||
|
||||
private boolean checkStairSouth(BlockState state) {
|
||||
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
if (!state.getBlockType().id().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
return true;
|
||||
}
|
||||
Direction direction = getStairDir(state);
|
||||
@ -743,7 +743,7 @@ public class NMSRelighter implements Relighter {
|
||||
}
|
||||
|
||||
private boolean checkStairEast(BlockState state) {
|
||||
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
if (!state.getBlockType().id().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
return true;
|
||||
}
|
||||
Direction direction = getStairDir(state);
|
||||
@ -761,7 +761,7 @@ public class NMSRelighter implements Relighter {
|
||||
}
|
||||
|
||||
private boolean checkStairWest(BlockState state) {
|
||||
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
if (!state.getBlockType().id().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||
return true;
|
||||
}
|
||||
Direction direction = getStairDir(state);
|
||||
@ -787,11 +787,11 @@ public class NMSRelighter implements Relighter {
|
||||
}
|
||||
|
||||
private boolean isStairOrTrueTop(BlockState state, boolean top) {
|
||||
return !state.getBlockType().getId().contains("stair") || state.getState(stairHalf).equals("top") == top;
|
||||
return !state.getBlockType().id().contains("stair") || state.getState(stairHalf).equals("top") == top;
|
||||
}
|
||||
|
||||
private boolean isSlabOrTrueValue(BlockState state, String value) {
|
||||
return !state.getBlockType().getId().contains("slab") || state.getState(slabHalf).equals(value);
|
||||
return !state.getBlockType().id().contains("slab") || state.getState(slabHalf).equals(value);
|
||||
}
|
||||
|
||||
private void computeRemoveBlockLight(
|
||||
|
@ -30,9 +30,9 @@ public class OffsetTransform extends ResettableExtent {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 location, BiomeType biome) {
|
||||
int x = location.getX() + dx;
|
||||
int y = location.getX() + dy;
|
||||
int z = location.getX() + dz;
|
||||
int x = location.x() + dx;
|
||||
int y = location.x() + dy;
|
||||
int z = location.x() + dz;
|
||||
if (!getExtent().contains(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
@ -53,9 +53,9 @@ public class OffsetTransform extends ResettableExtent {
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block)
|
||||
throws WorldEditException {
|
||||
int x = location.getX() + dx;
|
||||
int y = location.getX() + dy;
|
||||
int z = location.getX() + dz;
|
||||
int x = location.x() + dx;
|
||||
int y = location.x() + dy;
|
||||
int z = location.x() + dz;
|
||||
if (!getExtent().contains(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -34,9 +34,9 @@ public class RandomOffsetTransform extends ResettableExtent {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
int x = position.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
|
||||
int y = position.getBlockY() + random.nextInt(1 + (dy << 1)) - dy;
|
||||
int z = position.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
|
||||
int x = position.x() + random.nextInt(1 + (dx << 1)) - dx;
|
||||
int y = position.y() + random.nextInt(1 + (dy << 1)) - dy;
|
||||
int z = position.z() + random.nextInt(1 + (dz << 1)) - dz;
|
||||
if (!getExtent().contains(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
@ -57,9 +57,9 @@ public class RandomOffsetTransform extends ResettableExtent {
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 pos, T block)
|
||||
throws WorldEditException {
|
||||
int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
|
||||
int y = pos.getBlockY() + random.nextInt(1 + (dy << 1)) - dy;
|
||||
int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
|
||||
int x = pos.x() + random.nextInt(1 + (dx << 1)) - dx;
|
||||
int y = pos.y() + random.nextInt(1 + (dy << 1)) - dy;
|
||||
int z = pos.z() + random.nextInt(1 + (dz << 1)) - dz;
|
||||
if (!getExtent().contains(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -55,9 +55,9 @@ public class ScaleTransform extends ResettableExtent {
|
||||
if (min == null) {
|
||||
min = pos;
|
||||
}
|
||||
mutable.mutX(min.getX() + (pos.getX() - min.getX()) * dx);
|
||||
mutable.mutY(min.getY() + (pos.getY() - min.getY()) * dy);
|
||||
mutable.mutZ(min.getZ() + (pos.getZ() - min.getZ()) * dz);
|
||||
mutable.mutX(min.x() + (pos.x() - min.x()) * dx);
|
||||
mutable.mutY(min.y() + (pos.y() - min.y()) * dy);
|
||||
mutable.mutZ(min.z() + (pos.z() - min.z()) * dz);
|
||||
return new MutableVector3(mutable);
|
||||
}
|
||||
|
||||
@ -65,9 +65,9 @@ public class ScaleTransform extends ResettableExtent {
|
||||
if (min == null) {
|
||||
min = BlockVector3.at(x, y, z);
|
||||
}
|
||||
mutable.mutX(min.getX() + (x - min.getX()) * dx);
|
||||
mutable.mutY(min.getY() + (y - min.getY()) * dy);
|
||||
mutable.mutZ(min.getZ() + (z - min.getZ()) * dz);
|
||||
mutable.mutX(min.x() + (x - min.x()) * dx);
|
||||
mutable.mutY(min.y() + (y - min.y()) * dy);
|
||||
mutable.mutZ(min.z() + (z - min.z()) * dz);
|
||||
return new MutableVector3(mutable);
|
||||
}
|
||||
|
||||
@ -77,15 +77,15 @@ public class ScaleTransform extends ResettableExtent {
|
||||
boolean result = false;
|
||||
MutableVector3 vector3 = getPos(location);
|
||||
MutableBlockVector3 pos = new MutableBlockVector3();
|
||||
double sx = vector3.getX();
|
||||
double sy = vector3.getY();
|
||||
double sz = vector3.getZ();
|
||||
double sx = vector3.x();
|
||||
double sy = vector3.y();
|
||||
double sz = vector3.z();
|
||||
double ex = sx + dx;
|
||||
double ey = Math.max(minY, Math.min(maxy, sy + dy));
|
||||
double ez = sz + dz;
|
||||
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
||||
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
||||
for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) {
|
||||
for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) {
|
||||
for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) {
|
||||
if (!getExtent().contains(pos)) {
|
||||
continue;
|
||||
}
|
||||
@ -101,15 +101,15 @@ public class ScaleTransform extends ResettableExtent {
|
||||
boolean result = false;
|
||||
MutableVector3 vector3 = getPos(position);
|
||||
MutableBlockVector3 pos = new MutableBlockVector3();
|
||||
double sx = vector3.getX();
|
||||
double sy = vector3.getY();
|
||||
double sz = vector3.getZ();
|
||||
double sx = vector3.x();
|
||||
double sy = vector3.y();
|
||||
double sz = vector3.z();
|
||||
double ex = sx + dx;
|
||||
double ey = Math.max(minY, Math.min(maxy, sy + dy));
|
||||
double ez = sz + dz;
|
||||
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
||||
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
||||
for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) {
|
||||
for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) {
|
||||
for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) {
|
||||
if (!getExtent().contains(pos)) {
|
||||
continue;
|
||||
}
|
||||
@ -126,15 +126,15 @@ public class ScaleTransform extends ResettableExtent {
|
||||
boolean result = false;
|
||||
MutableVector3 vector3 = getPos(x1, y1, z1);
|
||||
MutableBlockVector3 pos = new MutableBlockVector3();
|
||||
double sx = vector3.getX();
|
||||
double sy = vector3.getY();
|
||||
double sz = vector3.getZ();
|
||||
double ex = vector3.getX() + dx;
|
||||
double sx = vector3.x();
|
||||
double sy = vector3.y();
|
||||
double sz = vector3.z();
|
||||
double ex = vector3.x() + dx;
|
||||
double ey = Math.min(maxy, sy + dy);
|
||||
double ez = vector3.getZ() + dz;
|
||||
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
||||
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
||||
double ez = vector3.z() + dz;
|
||||
for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) {
|
||||
for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) {
|
||||
for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) {
|
||||
if (!getExtent().contains(pos)) {
|
||||
continue;
|
||||
}
|
||||
@ -150,15 +150,15 @@ public class ScaleTransform extends ResettableExtent {
|
||||
boolean result = false;
|
||||
MutableVector3 vector3 = getPos(x1, y1, z1);
|
||||
MutableBlockVector3 pos = new MutableBlockVector3();
|
||||
double sx = vector3.getX();
|
||||
double sy = vector3.getY();
|
||||
double sz = vector3.getZ();
|
||||
double sx = vector3.x();
|
||||
double sy = vector3.y();
|
||||
double sz = vector3.z();
|
||||
double ex = sx + dx;
|
||||
double ey = Math.max(minY, Math.min(maxy, sy + dy));
|
||||
double ez = sz + dz;
|
||||
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
||||
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
||||
for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) {
|
||||
for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) {
|
||||
for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) {
|
||||
if (!getExtent().contains(pos)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -27,11 +27,11 @@ public abstract class SelectTransform extends ResettableExtent {
|
||||
public abstract AbstractDelegateExtent getExtent(int x, int z);
|
||||
|
||||
public Extent getExtent(BlockVector3 pos) {
|
||||
return getExtent(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||
return getExtent(pos.x(), pos.y(), pos.z());
|
||||
}
|
||||
|
||||
public Extent getExtent(BlockVector2 pos) {
|
||||
return getExtent(pos.getBlockX(), pos.getBlockZ());
|
||||
return getExtent(pos.x(), pos.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,8 +26,8 @@ public class SurfaceRegionFunction implements FlatRegionFunction {
|
||||
|
||||
@Override
|
||||
public boolean apply(BlockVector2 position) throws WorldEditException {
|
||||
int x = position.getBlockX();
|
||||
int z = position.getBlockZ();
|
||||
int x = position.x();
|
||||
int z = position.z();
|
||||
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false);
|
||||
if (layer != -1) {
|
||||
lastY = layer;
|
||||
|
@ -21,11 +21,11 @@ public class BiomeCopy implements RegionFunction {
|
||||
|
||||
@Override
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
int x = position.getBlockX();
|
||||
int y = position.getBlockY();
|
||||
int z = position.getBlockZ();
|
||||
if (x != mutableVector.getBlockX() || z != mutableVector.getBlockZ() || y != mutableVector
|
||||
.getBlockY()) {
|
||||
int x = position.x();
|
||||
int y = position.y();
|
||||
int z = position.z();
|
||||
if (x != mutableVector.x() || z != mutableVector.z() || y != mutableVector
|
||||
.y()) {
|
||||
mutableVector.setComponents(x, y, z);
|
||||
return destination.setBiome(mutableVector, source.getBiome(mutableVector));
|
||||
}
|
||||
|
@ -72,8 +72,8 @@ public class CavesGen extends GenBase {
|
||||
int maxAngle,
|
||||
double paramDouble4
|
||||
) throws WorldEditException {
|
||||
int bx = chunkPos.getBlockX() << 4;
|
||||
int bz = chunkPos.getBlockZ() << 4;
|
||||
int bx = chunkPos.x() << 4;
|
||||
int bz = chunkPos.z() << 4;
|
||||
double real_x = bx + 7;
|
||||
double real_z = bz + 7;
|
||||
|
||||
@ -236,7 +236,7 @@ public class CavesGen extends GenBase {
|
||||
BlockState material = chunk.getBlock(bx + local_x, local_y, bz + local_z);
|
||||
BlockState materialAbove = chunk.getBlock(bx + local_x, local_y + 1, bz + local_z);
|
||||
BlockType blockType = material.getBlockType();
|
||||
switch (blockType.getId()) {
|
||||
switch (blockType.id()) {
|
||||
case "minecraft:mycelium", "minecraft:grass_block" -> grassFound = true;
|
||||
}
|
||||
if (this.isSuitableBlock(material, materialAbove)) {
|
||||
@ -277,7 +277,7 @@ public class CavesGen extends GenBase {
|
||||
}
|
||||
|
||||
protected boolean isSuitableBlock(BlockStateHolder material, BlockStateHolder materialAbove) {
|
||||
return switch (material.getBlockType().getId()) {
|
||||
return switch (material.getBlockType().id()) {
|
||||
case "minecraft:air", "minecraft:cave_air", "minecraft:void_air", "minecraft:water", "minecraft:lava", "minecraft:bedrock" -> false;
|
||||
default -> true;
|
||||
};
|
||||
|
@ -26,8 +26,8 @@ public abstract class GenBase {
|
||||
|
||||
public void generate(BlockVector2 chunkPos, Extent chunk) throws WorldEditException {
|
||||
int i = this.checkAreaSize;
|
||||
int chunkX = chunkPos.getBlockX();
|
||||
int chunkZ = chunkPos.getBlockZ();
|
||||
int chunkX = chunkPos.x();
|
||||
int chunkZ = chunkPos.z();
|
||||
for (int x = chunkX - i; x <= chunkX + i; x++) {
|
||||
for (int z = chunkZ - i; z <= chunkZ + i; z++) {
|
||||
generateChunk(x, z, chunkPos, chunk);
|
||||
|
@ -36,7 +36,7 @@ public class SchemGen implements Resource {
|
||||
int y = extent.getNearestSurfaceTerrainBlock(
|
||||
x,
|
||||
z,
|
||||
mutable.getBlockY(),
|
||||
mutable.y(),
|
||||
this.extent.getMinY(),
|
||||
this.extent.getMaxY(),
|
||||
Integer.MIN_VALUE,
|
||||
|
@ -40,7 +40,7 @@ public abstract class ABlockMask extends AbstractExtentMask {
|
||||
List<BlockState> all = type.getAllStates();
|
||||
hasAll = all.stream().map(this::test).reduce(true, (a, b) -> a && b);
|
||||
if (hasAll) {
|
||||
strings.add(type.getId());
|
||||
strings.add(type.id());
|
||||
} else {
|
||||
for (BlockState state : all) {
|
||||
if (test(state)) {
|
||||
|
@ -44,9 +44,9 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
|
||||
}
|
||||
|
||||
public BlockVector3 direction(BlockVector3 v) {
|
||||
int x = v.getBlockX();
|
||||
int y = v.getBlockY();
|
||||
int z = v.getBlockZ();
|
||||
int x = v.x();
|
||||
int y = v.y();
|
||||
int z = v.z();
|
||||
if (mask.test(mutable.setComponents(x + 1, y, z))) {
|
||||
return mutable.setComponents(1, 0, 0);
|
||||
} else if (mask.test(mutable.setComponents(x - 1, y, z))) {
|
||||
|
@ -22,9 +22,9 @@ public class AdjacentMask extends AbstractMask {
|
||||
@Override
|
||||
public boolean test(BlockVector3 bv) {
|
||||
vector.setComponents(bv);
|
||||
double x = bv.getX();
|
||||
double y = bv.getY();
|
||||
double z = bv.getZ();
|
||||
double x = bv.x();
|
||||
double y = bv.y();
|
||||
double z = bv.z();
|
||||
vector.mutX(x + 1);
|
||||
int count = 0;
|
||||
if (mask.test(vector) && ++count == min && max >= 8) {
|
||||
|
@ -127,9 +127,9 @@ public class AngleMask extends AbstractExtentMask implements ResettableMask {
|
||||
}
|
||||
|
||||
private boolean adjacentAir(Extent extent, MutableBlockVector3 mutable) {
|
||||
int x = mutable.getBlockX();
|
||||
int y = mutable.getBlockY();
|
||||
int z = mutable.getBlockZ();
|
||||
int x = mutable.x();
|
||||
int y = mutable.y();
|
||||
int z = mutable.z();
|
||||
if (!mask.test(extent, mutable.setComponents(x + 1, y, z))) {
|
||||
return true;
|
||||
}
|
||||
@ -154,23 +154,23 @@ public class AngleMask extends AbstractExtentMask implements ResettableMask {
|
||||
if (!mask.test(vector)) {
|
||||
return false;
|
||||
}
|
||||
int y = vector.getBlockY();
|
||||
int y = vector.y();
|
||||
if (overlay) {
|
||||
MutableBlockVector3 mutable = new MutableBlockVector3(vector);
|
||||
if (y < maxY && !adjacentAir(null, mutable)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int x = vector.getBlockX();
|
||||
int z = vector.getBlockZ();
|
||||
int x = vector.x();
|
||||
int z = vector.z();
|
||||
return testSlope(getExtent(), x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(final Extent extent, final BlockVector3 vector) {
|
||||
int x = vector.getBlockX();
|
||||
int y = vector.getBlockY();
|
||||
int z = vector.getBlockZ();
|
||||
int x = vector.x();
|
||||
int y = vector.y();
|
||||
int z = vector.z();
|
||||
|
||||
if ((lastX == (lastX = x) & lastZ == (lastZ = z))) {
|
||||
int height = getHeight(extent, x, y, z);
|
||||
|
@ -183,7 +183,7 @@ public class BlockMaskBuilder {
|
||||
builders = new ArrayList<>();
|
||||
Pattern pattern = Pattern.compile("(minecraft:)?" + regex);
|
||||
for (BlockType type : BlockTypesCache.values) {
|
||||
if (pattern.matcher(type.getId()).find()) {
|
||||
if (pattern.matcher(type.id()).find()) {
|
||||
blockTypeList.add(type);
|
||||
builders.add(new FuzzyStateAllowingBuilder(type));
|
||||
add(type);
|
||||
@ -284,7 +284,7 @@ public class BlockMaskBuilder {
|
||||
} else {
|
||||
boolean success = false;
|
||||
for (BlockType myType : BlockTypesCache.values) {
|
||||
if (myType.getId().matches("(minecraft:)?" + input)) {
|
||||
if (myType.id().matches("(minecraft:)?" + input)) {
|
||||
add(myType);
|
||||
success = true;
|
||||
}
|
||||
@ -571,7 +571,7 @@ public class BlockMaskBuilder {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Property %s cannot be applied to block type %s",
|
||||
property.getName(),
|
||||
type.getId()
|
||||
type.id()
|
||||
));
|
||||
}
|
||||
masked.computeIfAbsent(property, k -> new ArrayList<>()).add(index);
|
||||
|
@ -60,9 +60,9 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask {
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
int x = vector.getX();
|
||||
int y = vector.getY();
|
||||
int z = vector.getZ();
|
||||
int x = vector.x();
|
||||
int y = vector.y();
|
||||
int z = vector.z();
|
||||
try {
|
||||
boolean check = cache_checked.add(x, y, z);
|
||||
if (!check) {
|
||||
@ -88,9 +88,9 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask {
|
||||
if (!hasExtent || !(extent instanceof AbstractExtentMask)) {
|
||||
return test(vector);
|
||||
}
|
||||
int x = vector.getX();
|
||||
int y = vector.getY();
|
||||
int z = vector.getZ();
|
||||
int x = vector.x();
|
||||
int y = vector.y();
|
||||
int z = vector.z();
|
||||
AbstractExtentMask mask = (AbstractExtentMask) getMask();
|
||||
try {
|
||||
boolean check = cache_checked.add(x, y, z);
|
||||
|
@ -62,17 +62,17 @@ public class ImageBrushMask extends AbstractExtentMask {
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (solid.test(vector)) {
|
||||
int dx = vector.getBlockX() - center.getBlockX();
|
||||
int dy = vector.getBlockY() - center.getBlockY();
|
||||
int dz = vector.getBlockZ() - center.getBlockZ();
|
||||
int dx = vector.x() - center.x();
|
||||
int dy = vector.y() - center.y();
|
||||
int dz = vector.z() - center.z();
|
||||
|
||||
Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5));
|
||||
int x1 = (int) (pos1.getX() * scale + centerImageX);
|
||||
int z1 = (int) (pos1.getZ() * scale + centerImageZ);
|
||||
int x1 = (int) (pos1.x() * scale + centerImageX);
|
||||
int z1 = (int) (pos1.z() * scale + centerImageZ);
|
||||
|
||||
Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5));
|
||||
int x2 = (int) (pos2.getX() * scale + centerImageX);
|
||||
int z2 = (int) (pos2.getZ() * scale + centerImageZ);
|
||||
int x2 = (int) (pos2.x() * scale + centerImageX);
|
||||
int z2 = (int) (pos2.z() * scale + centerImageZ);
|
||||
if (x2 < x1) {
|
||||
int tmp = x1;
|
||||
x1 = x2;
|
||||
|
@ -40,20 +40,20 @@ public class LayerBrushMask extends AbstractExtentMask {
|
||||
BlockState previous2 = layers[depth - 2];
|
||||
for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
|
||||
mutable.setComponents(
|
||||
pos.getBlockX() + dir.getBlockX(),
|
||||
pos.getBlockY() + dir.getBlockY(),
|
||||
pos.getBlockZ() + dir.getBlockZ()
|
||||
pos.x() + dir.x(),
|
||||
pos.y() + dir.y(),
|
||||
pos.z() + dir.z()
|
||||
);
|
||||
if (visitor.isVisited(mutable) && editSession.getBlock(
|
||||
mutable.getBlockX(),
|
||||
mutable.getBlockY(),
|
||||
mutable.getBlockZ()
|
||||
mutable.x(),
|
||||
mutable.y(),
|
||||
mutable.z()
|
||||
) == previous) {
|
||||
mutable.setComponents(pos.getBlockX() + dir.getBlockX() * 2, pos.getBlockY() + dir.getBlockY() * 2,
|
||||
pos.getBlockZ() + dir.getBlockZ() * 2
|
||||
mutable.setComponents(pos.x() + dir.x() * 2, pos.y() + dir.y() * 2,
|
||||
pos.z() + dir.z() * 2
|
||||
);
|
||||
if (visitor.isVisited(mutable)
|
||||
&& editSession.getBlock(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) {
|
||||
&& editSession.getBlock(mutable.x(), mutable.y(), mutable.z()) == previous2) {
|
||||
found = true;
|
||||
break;
|
||||
} else {
|
||||
|
@ -15,9 +15,9 @@ public class PlaneMask extends AbstractMask implements ResettableMask {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
switch (mode) {
|
||||
case -1:
|
||||
originX = vector.getBlockX();
|
||||
originY = vector.getBlockY();
|
||||
originZ = vector.getBlockZ();
|
||||
originX = vector.x();
|
||||
originY = vector.y();
|
||||
originZ = vector.z();
|
||||
mode = 0;
|
||||
return true;
|
||||
case 0:
|
||||
@ -25,13 +25,13 @@ public class PlaneMask extends AbstractMask implements ResettableMask {
|
||||
case 2:
|
||||
case 4:
|
||||
int original = mode;
|
||||
if (originX != vector.getBlockX()) {
|
||||
if (originX != vector.x()) {
|
||||
mode &= 1;
|
||||
}
|
||||
if (originY != vector.getBlockY()) {
|
||||
if (originY != vector.y()) {
|
||||
mode &= 2;
|
||||
}
|
||||
if (originZ != vector.getBlockZ()) {
|
||||
if (originZ != vector.z()) {
|
||||
mode &= 4;
|
||||
}
|
||||
if (Integer.bitCount(mode) >= 3) {
|
||||
@ -39,13 +39,13 @@ public class PlaneMask extends AbstractMask implements ResettableMask {
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
if (originX != vector.getBlockX() && (mode & 1) == 0) {
|
||||
if (originX != vector.x() && (mode & 1) == 0) {
|
||||
return false;
|
||||
}
|
||||
if (originZ != vector.getBlockZ() && (mode & 4) == 0) {
|
||||
if (originZ != vector.z() && (mode & 4) == 0) {
|
||||
return false;
|
||||
}
|
||||
return originY == vector.getBlockY() || (mode & 2) != 0;
|
||||
return originY == vector.y() || (mode & 2) != 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -30,17 +30,17 @@ public class RadiusMask extends AbstractMask implements ResettableMask {
|
||||
if (pos == null) {
|
||||
pos = to.toImmutable();
|
||||
}
|
||||
int dx = pos.getBlockX() - to.getBlockX();
|
||||
int dx = pos.x() - to.x();
|
||||
int d = dx * dx;
|
||||
if (d > maxSqr) {
|
||||
return false;
|
||||
}
|
||||
int dz = pos.getBlockZ() - to.getBlockZ();
|
||||
int dz = pos.z() - to.z();
|
||||
d += dz * dz;
|
||||
if (d > maxSqr) {
|
||||
return false;
|
||||
}
|
||||
int dy = pos.getBlockY() - to.getBlockY();
|
||||
int dy = pos.y() - to.y();
|
||||
d += dy * dy;
|
||||
return d >= minSqr && d <= maxSqr;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class SimplexMask extends AbstractMask {
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
double value = SimplexNoise.noise(vector.getBlockX() * scale, vector.getBlockY() * scale, vector.getBlockZ() * scale);
|
||||
double value = SimplexNoise.noise(vector.x() * scale, vector.y() * scale, vector.z() * scale);
|
||||
return value >= min && value <= max;
|
||||
}
|
||||
|
||||
|
@ -64,13 +64,13 @@ public class StencilBrushMask extends AbstractExtentMask {
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (solid.test(vector)) {
|
||||
int dx = vector.getBlockX() - center.getBlockX();
|
||||
int dy = vector.getBlockY() - center.getBlockY();
|
||||
int dz = vector.getBlockZ() - center.getBlockZ();
|
||||
int dx = vector.x() - center.x();
|
||||
int dy = vector.y() - center.y();
|
||||
int dz = vector.z() - center.z();
|
||||
|
||||
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz));
|
||||
dx = MathMan.roundInt(srcPos.getX());
|
||||
dz = MathMan.roundInt(srcPos.getZ());
|
||||
dx = MathMan.roundInt(srcPos.x());
|
||||
dz = MathMan.roundInt(srcPos.z());
|
||||
|
||||
int distance = dx * dx + dz * dz;
|
||||
if (distance > size2 || Math.abs(dx) > 256 || Math.abs(dz) > 256) {
|
||||
@ -83,7 +83,7 @@ public class StencilBrushMask extends AbstractExtentMask {
|
||||
return true;
|
||||
}
|
||||
if (val >= 255 || ThreadLocalRandom.current().nextInt(maxY) < val) {
|
||||
editSession.setBlock(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), pattern);
|
||||
editSession.setBlock(vector.x(), vector.y(), vector.z(), pattern);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class SurfaceAngleMask extends AbstractExtentMask {
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (!vector.getBlock(getExtent()).isAir() && nextToAir(vector)) {
|
||||
double angle = 1 - getAverageAirDirection(vector.toVector3(), size).getY();
|
||||
double angle = 1 - getAverageAirDirection(vector.toVector3(), size).y();
|
||||
return (angle >= (min / 90.0) && angle <= (max / 90.0));
|
||||
}
|
||||
return false;
|
||||
@ -33,7 +33,7 @@ public class SurfaceAngleMask extends AbstractExtentMask {
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
if (!vector.getBlock(getExtent()).isAir() && nextToAir(vector)) {
|
||||
double angle = 1 - getAverageAirDirection(vector.toVector3(), size).getY();
|
||||
double angle = 1 - getAverageAirDirection(vector.toVector3(), size).y();
|
||||
return (angle >= (min / 90.0) && angle <= (max / 90.0));
|
||||
}
|
||||
return false;
|
||||
@ -44,7 +44,7 @@ public class SurfaceAngleMask extends AbstractExtentMask {
|
||||
for (int i = -size; i <= size; i++) {
|
||||
for (int j = -size; j <= size; j++) {
|
||||
for (int k = -size; k <= size; k++) {
|
||||
Vector3 block = Vector3.at(currentLocation.getX(), currentLocation.getY(), currentLocation.getZ()).add(
|
||||
Vector3 block = Vector3.at(currentLocation.x(), currentLocation.y(), currentLocation.z()).add(
|
||||
0.5,
|
||||
0.5,
|
||||
0.5
|
||||
@ -65,13 +65,13 @@ public class SurfaceAngleMask extends AbstractExtentMask {
|
||||
double y = 0.0;
|
||||
double z = 0.0;
|
||||
for (Vector3 vector3 : airDirections) {
|
||||
x += vector3.getX();
|
||||
y += vector3.getY();
|
||||
z += vector3.getZ();
|
||||
x += vector3.x();
|
||||
y += vector3.y();
|
||||
z += vector3.z();
|
||||
}
|
||||
|
||||
Vector3 averageAirDirection = Vector3.at(x / airDirections.size(), y / airDirections.size(), z / airDirections.size());
|
||||
return (Double.isNaN(averageAirDirection.getY()) ? Vector3.ZERO : averageAirDirection.normalize());
|
||||
return (Double.isNaN(averageAirDirection.y()) ? Vector3.ZERO : averageAirDirection.normalize());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,8 +14,8 @@ public class WallMakeMask implements Mask {
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 position) {
|
||||
int x = position.getBlockX();
|
||||
int z = position.getBlockZ();
|
||||
int x = position.x();
|
||||
int z = position.z();
|
||||
return !region.contains(x, z + 1) || !region.contains(x, z - 1) || !region.contains(x + 1, z) || !region.contains(
|
||||
x - 1,
|
||||
z
|
||||
|
@ -23,9 +23,9 @@ public class WallMask extends AbstractMask {
|
||||
public boolean test(BlockVector3 bv) {
|
||||
vector.setComponents(bv);
|
||||
int count = 0;
|
||||
double x = vector.getX();
|
||||
double y = vector.getY();
|
||||
double z = vector.getZ();
|
||||
double x = vector.x();
|
||||
double y = vector.y();
|
||||
double z = vector.z();
|
||||
vector.mutX(x + 1);
|
||||
if (mask.test(vector) && ++count == min && max >= 8) {
|
||||
vector.mutX(x);
|
||||
|
@ -16,9 +16,9 @@ public class XAxisMask extends AbstractMask implements ResettableMask {
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (layer == -1) {
|
||||
layer = vector.getBlockX();
|
||||
layer = vector.x();
|
||||
}
|
||||
return vector.getBlockX() == layer;
|
||||
return vector.x() == layer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,9 +14,9 @@ public class YAxisMask extends AbstractMask implements ResettableMask {
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (layer == -1) {
|
||||
layer = vector.getBlockY();
|
||||
layer = vector.y();
|
||||
}
|
||||
return vector.getBlockY() == layer;
|
||||
return vector.y() == layer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,9 +14,9 @@ public class ZAxisMask extends AbstractMask implements ResettableMask {
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (layer == -1) {
|
||||
layer = vector.getBlockZ();
|
||||
layer = vector.z();
|
||||
}
|
||||
return vector.getBlockZ() == layer;
|
||||
return vector.z() == layer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,9 +42,9 @@ public class AngleColorPattern extends AnglePattern {
|
||||
public <T extends BlockStateHolder<T>> int getSlope(T block, BlockVector3 vector, Extent extent) {
|
||||
int slope = super.getSlope(block, vector, extent);
|
||||
if (slope != -1) {
|
||||
int x = vector.getBlockX();
|
||||
int y = vector.getBlockY();
|
||||
int z = vector.getBlockZ();
|
||||
int x = vector.x();
|
||||
int y = vector.y();
|
||||
int z = vector.z();
|
||||
int height = extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY);
|
||||
if (height > minY) {
|
||||
BlockState below = extent.getBlock(x, height - 1, z);
|
||||
|
@ -31,9 +31,9 @@ public abstract class AnglePattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
public <T extends BlockStateHolder<T>> int getSlope(T block, BlockVector3 vector, Extent extent) {
|
||||
int x = vector.getBlockX();
|
||||
int y = vector.getBlockY();
|
||||
int z = vector.getBlockZ();
|
||||
int x = vector.x();
|
||||
int y = vector.y();
|
||||
int z = vector.z();
|
||||
if (!block.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class BufferedPattern2D extends BufferedPattern {
|
||||
|
||||
@Override
|
||||
public boolean set(BlockVector3 pos) {
|
||||
return set.add(pos.getBlockX(), 0, pos.getBlockY());
|
||||
return set.add(pos.x(), 0, pos.z());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class ExpressionPattern extends AbstractPattern {
|
||||
if (expression.getEnvironment() instanceof WorldEditExpressionEnvironment) {
|
||||
((WorldEditExpressionEnvironment) expression.getEnvironment()).setCurrentBlock(vector.toVector3());
|
||||
}
|
||||
double combined = expression.evaluate(vector.getX(), vector.getY(), vector.getZ());
|
||||
double combined = expression.evaluate(vector.x(), vector.y(), vector.z());
|
||||
return BlockState.getFromOrdinal((int) combined).toBaseBlock();
|
||||
} catch (EvaluationException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -37,7 +37,7 @@ public class Linear2DBlockPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public BaseBlock applyBlock(BlockVector3 position) {
|
||||
int index = (position.getBlockX() / this.xScale + position.getBlockZ() / this.zScale) % patternsArray.length;
|
||||
int index = (position.x() / this.xScale + position.z() / this.zScale) % patternsArray.length;
|
||||
if (index < 0) {
|
||||
index += patternsArray.length;
|
||||
}
|
||||
@ -46,8 +46,8 @@ public class Linear2DBlockPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||
int index = (floorDiv(get.getBlockX(), this.xScale)
|
||||
+ floorDiv(get.getBlockZ(), this.zScale)) % patternsArray.length;
|
||||
int index = (floorDiv(get.x(), this.xScale)
|
||||
+ floorDiv(get.z(), this.zScale)) % patternsArray.length;
|
||||
if (index < 0) {
|
||||
index += patternsArray.length;
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ public class Linear3DBlockPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public BaseBlock applyBlock(BlockVector3 position) {
|
||||
int index = (position.getBlockX() / this.xScale
|
||||
+ position.getBlockY() / this.yScale + position.getBlockZ() / this.zScale) % patternsArray.length;
|
||||
int index = (position.x() / this.xScale
|
||||
+ position.y() / this.yScale + position.z() / this.zScale) % patternsArray.length;
|
||||
if (index < 0) {
|
||||
index += patternsArray.length;
|
||||
}
|
||||
@ -50,8 +50,8 @@ public class Linear3DBlockPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||
int index = (floorDiv(get.getBlockX(), this.xScale)
|
||||
+ floorDiv(get.getBlockY(), this.yScale) + floorDiv(get.getBlockZ(), this.zScale)) % patternsArray.length;
|
||||
int index = (floorDiv(get.x(), this.xScale)
|
||||
+ floorDiv(get.y(), this.yScale) + floorDiv(get.z(), this.zScale)) % patternsArray.length;
|
||||
if (index < 0) {
|
||||
index += patternsArray.length;
|
||||
}
|
||||
|
@ -24,15 +24,15 @@ public class NoXPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public BaseBlock applyBlock(BlockVector3 pos) {
|
||||
mutable.mutY(pos.getY());
|
||||
mutable.mutZ(pos.getZ());
|
||||
mutable.mutY(pos.y());
|
||||
mutable.mutZ(pos.z());
|
||||
return pattern.applyBlock(mutable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||
mutable.mutY(get.getY());
|
||||
mutable.mutZ(get.getZ());
|
||||
mutable.mutY(get.y());
|
||||
mutable.mutZ(get.z());
|
||||
return pattern.apply(extent, mutable, set);
|
||||
}
|
||||
|
||||
|
@ -24,15 +24,15 @@ public class NoYPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public BaseBlock applyBlock(BlockVector3 pos) {
|
||||
mutable.mutX(pos.getX());
|
||||
mutable.mutZ(pos.getZ());
|
||||
mutable.mutX(pos.x());
|
||||
mutable.mutZ(pos.z());
|
||||
return pattern.applyBlock(mutable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||
mutable.mutX(get.getX());
|
||||
mutable.mutZ(get.getZ());
|
||||
mutable.mutX(get.x());
|
||||
mutable.mutZ(get.z());
|
||||
return pattern.apply(extent, mutable, set);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.fastasyncworldedit.core.function.pattern;
|
||||
|
||||
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||
import com.fastasyncworldedit.core.queue.Filter;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||
@ -25,15 +24,15 @@ public class NoZPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public BaseBlock applyBlock(BlockVector3 pos) {
|
||||
mutable.mutX(pos.getX());
|
||||
mutable.mutY(pos.getY());
|
||||
mutable.mutX(pos.x());
|
||||
mutable.mutY(pos.y());
|
||||
return pattern.applyBlock(mutable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||
mutable.mutX(get.getX());
|
||||
mutable.mutY(get.getY());
|
||||
mutable.mutX(get.x());
|
||||
mutable.mutY(get.y());
|
||||
return pattern.apply(extent, mutable, set);
|
||||
}
|
||||
|
||||
|
@ -40,10 +40,10 @@ public class OffsetPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public BaseBlock applyBlock(BlockVector3 position) {
|
||||
mutable.mutX(position.getX() + dx);
|
||||
mutable.mutY(position.getY() + dy);
|
||||
mutable.mutZ(position.getZ() + dz);
|
||||
if (mutable.getY() < minY || mutable.getY() > maxY) {
|
||||
mutable.mutX(position.x() + dx);
|
||||
mutable.mutY(position.y() + dy);
|
||||
mutable.mutZ(position.z() + dz);
|
||||
if (mutable.y() < minY || mutable.y() > maxY) {
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
return pattern.applyBlock(mutable);
|
||||
@ -51,10 +51,10 @@ public class OffsetPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||
mutable.mutX(get.getX() + dx);
|
||||
mutable.mutY(get.getY() + dy);
|
||||
mutable.mutZ(get.getZ() + dz);
|
||||
if (mutable.getY() < extent.getMinY() || mutable.getY() > extent.getMaxY()) {
|
||||
mutable.mutX(get.x() + dx);
|
||||
mutable.mutY(get.y() + dy);
|
||||
mutable.mutZ(get.z() + dz);
|
||||
if (mutable.y() < extent.getMinY() || mutable.y() > extent.getMaxY()) {
|
||||
return false;
|
||||
}
|
||||
return pattern.apply(extent, get, mutable);
|
||||
|
@ -52,10 +52,10 @@ public class RandomOffsetPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public BaseBlock applyBlock(BlockVector3 position) {
|
||||
mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
|
||||
mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
|
||||
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
|
||||
if (mutable.getY() < minY || mutable.getY() > maxY) {
|
||||
mutable.mutX((position.x() + r.nextInt(dx2) - dx));
|
||||
mutable.mutY((position.y() + r.nextInt(dy2) - dy));
|
||||
mutable.mutZ((position.z() + r.nextInt(dz2) - dz));
|
||||
if (mutable.y() < minY || mutable.y() > maxY) {
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
return pattern.applyBlock(mutable);
|
||||
@ -63,10 +63,10 @@ public class RandomOffsetPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||
mutable.mutX((set.getX() + r.nextInt(dx2) - dx));
|
||||
mutable.mutY((set.getY() + r.nextInt(dy2) - dy));
|
||||
mutable.mutZ((set.getZ() + r.nextInt(dz2) - dz));
|
||||
if (mutable.getY() < extent.getMinY() || mutable.getY() > extent.getMaxY()) {
|
||||
mutable.mutX((set.x() + r.nextInt(dx2) - dx));
|
||||
mutable.mutY((set.y() + r.nextInt(dy2) - dy));
|
||||
mutable.mutZ((set.z() + r.nextInt(dz2) - dz));
|
||||
if (mutable.y() < extent.getMinY() || mutable.y() > extent.getMaxY()) {
|
||||
return false;
|
||||
}
|
||||
return pattern.apply(extent, get, mutable);
|
||||
|
@ -35,10 +35,10 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
|
||||
if (origin == null) {
|
||||
origin = pos;
|
||||
}
|
||||
mutable.mutX(pos.getX() - origin.getX());
|
||||
mutable.mutY(pos.getY() - origin.getY());
|
||||
mutable.mutZ(pos.getZ() - origin.getZ());
|
||||
if (mutable.getY() < minY || mutable.getY() > maxY) {
|
||||
mutable.mutX(pos.x() - origin.x());
|
||||
mutable.mutY(pos.y() - origin.y());
|
||||
mutable.mutZ(pos.z() - origin.z());
|
||||
if (mutable.y() < minY || mutable.y() > maxY) {
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
return pattern.applyBlock(mutable);
|
||||
@ -49,10 +49,10 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
|
||||
if (origin == null) {
|
||||
origin = set;
|
||||
}
|
||||
mutable.mutX(set.getX() - origin.getX());
|
||||
mutable.mutY(set.getY() - origin.getY());
|
||||
mutable.mutZ(set.getZ() - origin.getZ());
|
||||
if (mutable.getY() < extent.getMinY() || mutable.getY() > extent.getMaxY()) {
|
||||
mutable.mutX(set.x() - origin.x());
|
||||
mutable.mutY(set.y() - origin.y());
|
||||
mutable.mutZ(set.z() - origin.z());
|
||||
if (mutable.y() < extent.getMinY() || mutable.y() > extent.getMaxY()) {
|
||||
return false;
|
||||
}
|
||||
return pattern.apply(extent, get, mutable);
|
||||
|
@ -63,13 +63,13 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public BaseBlock applyBlock(BlockVector3 position) {
|
||||
mutable.mutX(position.getX() + r.nextInt(dx2) - dx);
|
||||
mutable.mutY(position.getY() + r.nextInt(dy2) - dy);
|
||||
mutable.mutZ(position.getZ() + r.nextInt(dz2) - dz);
|
||||
if (mutable.getY() < minY || mutable.getY() > maxY) {
|
||||
mutable.mutX(position.x() + r.nextInt(dx2) - dx);
|
||||
mutable.mutY(position.y() + r.nextInt(dy2) - dy);
|
||||
mutable.mutZ(position.z() + r.nextInt(dz2) - dz);
|
||||
if (mutable.y() < minY || mutable.y() > maxY) {
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
if (mutable.getY() < minY || mutable.getY() > maxY) {
|
||||
if (mutable.y() < minY || mutable.y() > maxY) {
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
BaseBlock block = pattern.applyBlock(mutable);
|
||||
@ -81,10 +81,10 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||
mutable.mutX(set.getX() + r.nextInt(dx2) - dx);
|
||||
mutable.mutY(set.getY() + r.nextInt(dy2) - dy);
|
||||
mutable.mutZ(set.getZ() + r.nextInt(dz2) - dz);
|
||||
if (mutable.getY() < extent.getMinY() || mutable.getY() > extent.getMaxY()) {
|
||||
mutable.mutX(set.x() + r.nextInt(dx2) - dx);
|
||||
mutable.mutY(set.y() + r.nextInt(dy2) - dy);
|
||||
mutable.mutZ(set.z() + r.nextInt(dz2) - dz);
|
||||
if (mutable.y() < extent.getMinY() || mutable.y() > extent.getMaxY()) {
|
||||
return false;
|
||||
}
|
||||
BaseBlock block = pattern.applyBlock(mutable);
|
||||
|
@ -62,9 +62,9 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
|
||||
next = buffer[i];
|
||||
BlockVector3 dir = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i];
|
||||
next.setComponents(
|
||||
cur.getBlockX() + dir.getBlockX(),
|
||||
cur.getBlockY() + dir.getBlockY(),
|
||||
cur.getBlockZ() + dir.getBlockZ()
|
||||
cur.x() + dir.x(),
|
||||
cur.y() + dir.y(),
|
||||
cur.z() + dir.z()
|
||||
);
|
||||
if (allowed(next)) {
|
||||
allowed[index++] = next;
|
||||
@ -74,7 +74,7 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
|
||||
return cur;
|
||||
}
|
||||
next = allowed[ThreadLocalRandom.current().nextInt(index)];
|
||||
cur.setComponents(next.getBlockX(), next.getBlockY(), next.getBlockZ());
|
||||
cur.setComponents(next.x(), next.y(), next.z());
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
@ -85,9 +85,9 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
|
||||
if (!block.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
return false;
|
||||
}
|
||||
int x = v.getBlockX();
|
||||
int y = v.getBlockY();
|
||||
int z = v.getBlockZ();
|
||||
int x = v.x();
|
||||
int y = v.y();
|
||||
int z = v.z();
|
||||
v.mutY(y + 1);
|
||||
if (y < maxY && canPassthrough(v)) {
|
||||
v.mutY(y);
|
||||
|
@ -79,7 +79,7 @@ public class TypeSwapPattern extends AbstractExtentPattern {
|
||||
}
|
||||
|
||||
private BlockState getNewBlock(BlockState existing) {
|
||||
String oldId = existing.getBlockType().getId();
|
||||
String oldId = existing.getBlockType().id();
|
||||
String newId = oldId;
|
||||
if (inputPattern != null) {
|
||||
newId = inputPattern.matcher(oldId).replaceAll(outputString);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user