Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-20 09:50:06 +01:00
Merge branch 'main' into feat/improved-entity-operations
Dieser Commit ist enthalten in:
Commit
7b241ef01a
@ -34,7 +34,7 @@ logger.lifecycle("""
|
|||||||
*******************************************
|
*******************************************
|
||||||
""")
|
""")
|
||||||
|
|
||||||
var rootVersion by extra("2.9.2")
|
var rootVersion by extra("2.9.3")
|
||||||
var snapshot by extra("SNAPSHOT")
|
var snapshot by extra("SNAPSHOT")
|
||||||
var revision: String by extra("")
|
var revision: String by extra("")
|
||||||
var buildNumber by extra("")
|
var buildNumber by extra("")
|
||||||
|
@ -24,7 +24,7 @@ dependencies {
|
|||||||
implementation(gradleApi())
|
implementation(gradleApi())
|
||||||
implementation("org.ajoberstar.grgit:grgit-gradle:5.2.2")
|
implementation("org.ajoberstar.grgit:grgit-gradle:5.2.2")
|
||||||
implementation("com.github.johnrengelman:shadow:8.1.1")
|
implementation("com.github.johnrengelman:shadow:8.1.1")
|
||||||
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.11")
|
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.13")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
@ -14,8 +14,8 @@ mapmanager = "1.8.0-SNAPSHOT"
|
|||||||
griefprevention = "17.0.0"
|
griefprevention = "17.0.0"
|
||||||
griefdefender = "2.1.0-SNAPSHOT"
|
griefdefender = "2.1.0-SNAPSHOT"
|
||||||
residence = "4.5._13.1"
|
residence = "4.5._13.1"
|
||||||
towny = "0.100.1.23"
|
towny = "0.100.2.0"
|
||||||
plotsquared = "7.3.6"
|
plotsquared = "7.3.7"
|
||||||
|
|
||||||
# Third party
|
# Third party
|
||||||
bstats = "3.0.2"
|
bstats = "3.0.2"
|
||||||
@ -43,7 +43,7 @@ serverlib = "2.3.4"
|
|||||||
## Internal
|
## Internal
|
||||||
text-adapter = "3.0.6"
|
text-adapter = "3.0.6"
|
||||||
text = "3.0.4"
|
text = "3.0.4"
|
||||||
piston = "0.5.8"
|
piston = "0.5.10"
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
mockito = "5.11.0"
|
mockito = "5.11.0"
|
||||||
|
@ -12,6 +12,6 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.20.4-R0.1-SNAPSHOT
|
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.20.4-R0.1-SNAPSHOT
|
||||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.4-R0.1-20240325.123556-143")
|
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.4-R0.1-20240405.071722-146")
|
||||||
compileOnly(libs.paperlib)
|
compileOnly(libs.paperlib)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* The following classes are FAWE additions:
|
* The following classes are FAWE additions:
|
||||||
*
|
*
|
||||||
* @see com.sk89q.worldedit.cli.AccessPoint
|
* {@link com.sk89q.worldedit.cli.AccessPoint}
|
||||||
*/
|
*/
|
||||||
package com.sk89q.worldedit.cli;
|
package com.sk89q.worldedit.cli;
|
||||||
|
@ -5,6 +5,7 @@ import com.fastasyncworldedit.core.function.mask.RadiusMask;
|
|||||||
import com.fastasyncworldedit.core.function.mask.SurfaceMask;
|
import com.fastasyncworldedit.core.function.mask.SurfaceMask;
|
||||||
import com.fastasyncworldedit.core.math.BlockVectorSet;
|
import com.fastasyncworldedit.core.math.BlockVectorSet;
|
||||||
import com.fastasyncworldedit.core.math.LocalBlockVectorSet;
|
import com.fastasyncworldedit.core.math.LocalBlockVectorSet;
|
||||||
|
import com.fastasyncworldedit.core.util.collection.BlockVector3Set;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||||
@ -64,8 +65,9 @@ public class ScatterBrush implements Brush {
|
|||||||
length = 1;
|
length = 1;
|
||||||
visited.add(position);
|
visited.add(position);
|
||||||
}
|
}
|
||||||
LocalBlockVectorSet placed = new LocalBlockVectorSet();
|
BlockVector3 patternSize = pattern.size();
|
||||||
placed.setOffset(position.getX(), position.getZ());
|
BlockVector3Set placed = BlockVector3Set.getAppropriateVectorSet(patternSize.add(distance, distance, distance));
|
||||||
|
placed.setOffset(position.getX(), position.getY(), position.getZ());
|
||||||
int maxFails = 1000;
|
int maxFails = 1000;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
int index = ThreadLocalRandom.current().nextInt(length);
|
int index = ThreadLocalRandom.current().nextInt(length);
|
||||||
@ -88,7 +90,20 @@ public class ScatterBrush implements Brush {
|
|||||||
finish(editSession, placed, position, pattern, size);
|
finish(editSession, placed, position, pattern, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link ScatterBrush#finish(EditSession, BlockVector3Set, BlockVector3, Pattern, double)}
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "2.9.2")
|
||||||
public void finish(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pos, Pattern pattern, double size) {
|
public void finish(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pos, Pattern pattern, double size) {
|
||||||
|
finish(editSession, (BlockVector3Set) placed, pos, pattern, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Complete the scatter brush process.
|
||||||
|
*
|
||||||
|
* @since 2.9.2
|
||||||
|
*/
|
||||||
|
public void finish(EditSession editSession, BlockVector3Set placed, BlockVector3 pos, Pattern pattern, double size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canApply(BlockVector3 pos) {
|
public boolean canApply(BlockVector3 pos) {
|
||||||
@ -99,8 +114,23 @@ public class ScatterBrush implements Brush {
|
|||||||
return surface.direction(pt);
|
return surface.direction(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link ScatterBrush#apply(EditSession, BlockVector3Set, BlockVector3, Pattern, double)}
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "2.9.2")
|
||||||
public void apply(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pt, Pattern p, double size) throws
|
public void apply(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pt, Pattern p, double size) throws
|
||||||
MaxChangedBlocksException {
|
MaxChangedBlocksException {
|
||||||
|
apply(editSession, (BlockVector3Set) placed, pt, p, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the scatter brush to a given position
|
||||||
|
*
|
||||||
|
* @since 2.9.2
|
||||||
|
*/
|
||||||
|
public void apply(EditSession editSession, BlockVector3Set placed, BlockVector3 pt, Pattern p, double size) throws
|
||||||
|
MaxChangedBlocksException {
|
||||||
editSession.setBlock(pt, p);
|
editSession.setBlock(pt, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package com.fastasyncworldedit.core.command.tool.brush;
|
|||||||
import com.fastasyncworldedit.core.function.mask.SurfaceMask;
|
import com.fastasyncworldedit.core.function.mask.SurfaceMask;
|
||||||
import com.fastasyncworldedit.core.math.LocalBlockVectorSet;
|
import com.fastasyncworldedit.core.math.LocalBlockVectorSet;
|
||||||
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
|
import com.fastasyncworldedit.core.util.collection.BlockVector3Set;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
@ -24,7 +25,7 @@ public class ShatterBrush extends ScatterBrush {
|
|||||||
@Override
|
@Override
|
||||||
public void apply(
|
public void apply(
|
||||||
final EditSession editSession,
|
final EditSession editSession,
|
||||||
final LocalBlockVectorSet placed,
|
final BlockVector3Set placed,
|
||||||
final BlockVector3 position,
|
final BlockVector3 position,
|
||||||
Pattern p,
|
Pattern p,
|
||||||
double size
|
double size
|
||||||
@ -34,7 +35,7 @@ public class ShatterBrush extends ScatterBrush {
|
|||||||
@Override
|
@Override
|
||||||
public void finish(
|
public void finish(
|
||||||
EditSession editSession,
|
EditSession editSession,
|
||||||
LocalBlockVectorSet placed,
|
BlockVector3Set placed,
|
||||||
final BlockVector3 position,
|
final BlockVector3 position,
|
||||||
Pattern pattern,
|
Pattern pattern,
|
||||||
double size
|
double size
|
||||||
|
@ -15,7 +15,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
/**
|
/**
|
||||||
* @deprecated Unused internal, will be removed in v3
|
* @deprecated Unused internal, will be removed in v3
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "TODO")
|
@Deprecated(forRemoval = true, since = "2.9.2")
|
||||||
public class TransformExtent extends BlockTransformExtent {
|
public class TransformExtent extends BlockTransformExtent {
|
||||||
|
|
||||||
private final MutableVector3 mutable1 = new MutableVector3();
|
private final MutableVector3 mutable1 = new MutableVector3();
|
||||||
|
@ -15,7 +15,7 @@ import static java.lang.Math.floorDiv;
|
|||||||
* @deprecated replaced by {@link com.sk89q.worldedit.function.pattern.RandomPattern}
|
* @deprecated replaced by {@link com.sk89q.worldedit.function.pattern.RandomPattern}
|
||||||
* combined with {@link com.fastasyncworldedit.core.math.random.Linear2DRandom}.
|
* combined with {@link com.fastasyncworldedit.core.math.random.Linear2DRandom}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "TODO")
|
@Deprecated(forRemoval = true, since = "2.9.2")
|
||||||
public class Linear2DBlockPattern extends AbstractPattern {
|
public class Linear2DBlockPattern extends AbstractPattern {
|
||||||
|
|
||||||
private final Pattern[] patternsArray;
|
private final Pattern[] patternsArray;
|
||||||
|
@ -15,7 +15,7 @@ import static java.lang.Math.floorDiv;
|
|||||||
* @deprecated replaced by {@link com.sk89q.worldedit.function.pattern.RandomPattern}
|
* @deprecated replaced by {@link com.sk89q.worldedit.function.pattern.RandomPattern}
|
||||||
* combined with {@link com.fastasyncworldedit.core.math.random.Linear3DRandom}.
|
* combined with {@link com.fastasyncworldedit.core.math.random.Linear3DRandom}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "TODO")
|
@Deprecated(forRemoval = true, since = "2.9.2")
|
||||||
public class Linear3DBlockPattern extends AbstractPattern {
|
public class Linear3DBlockPattern extends AbstractPattern {
|
||||||
|
|
||||||
private final Pattern[] patternsArray;
|
private final Pattern[] patternsArray;
|
||||||
|
@ -60,6 +60,13 @@ public class OffsetPattern extends AbstractPattern {
|
|||||||
return pattern.apply(extent, get, mutable);
|
return pattern.apply(extent, get, mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 size() {
|
||||||
|
// Not exactly the "size" but offset should be taken into consideration in most
|
||||||
|
// places where the "size" matters
|
||||||
|
return BlockVector3.at(dx, dy, dz);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pattern fork() {
|
public Pattern fork() {
|
||||||
return new OffsetPattern(this.pattern.fork(), this.dx, this.dy, this.dz, this.minY, this.maxY);
|
return new OffsetPattern(this.pattern.fork(), this.dx, this.dy, this.dz, this.minY, this.maxY);
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.fastasyncworldedit.core.function.pattern;
|
package com.fastasyncworldedit.core.function.pattern;
|
||||||
|
|
||||||
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
@ -9,6 +11,8 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
|
|
||||||
@ -23,6 +27,7 @@ public class RandomFullClipboardPattern extends AbstractPattern {
|
|||||||
private final boolean randomRotate;
|
private final boolean randomRotate;
|
||||||
private final boolean randomFlip;
|
private final boolean randomFlip;
|
||||||
private final Vector3 flipVector = Vector3.at(1, 0, 0).multiply(-2).add(1, 1, 1);
|
private final Vector3 flipVector = Vector3.at(1, 0, 0).multiply(-2).add(1, 1, 1);
|
||||||
|
private final BlockVector3 size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link Pattern} instance
|
* Create a new {@link Pattern} instance
|
||||||
@ -34,6 +39,12 @@ public class RandomFullClipboardPattern extends AbstractPattern {
|
|||||||
public RandomFullClipboardPattern(List<ClipboardHolder> clipboards, boolean randomRotate, boolean randomFlip) {
|
public RandomFullClipboardPattern(List<ClipboardHolder> clipboards, boolean randomRotate, boolean randomFlip) {
|
||||||
checkNotNull(clipboards);
|
checkNotNull(clipboards);
|
||||||
this.clipboards = clipboards;
|
this.clipboards = clipboards;
|
||||||
|
MutableBlockVector3 mut = new MutableBlockVector3();
|
||||||
|
clipboards.stream().flatMap(c -> c.getClipboards().stream()).map(c -> {
|
||||||
|
Region region = c.getRegion();
|
||||||
|
return region.getMaximumPoint().subtract(c.getOrigin().getMinimum(region.getMinimumPoint()));
|
||||||
|
}).forEach(mut::getMaximum);
|
||||||
|
this.size = mut.toImmutable();
|
||||||
this.randomRotate = randomRotate;
|
this.randomRotate = randomRotate;
|
||||||
this.randomFlip = randomFlip;
|
this.randomFlip = randomFlip;
|
||||||
}
|
}
|
||||||
@ -66,4 +77,9 @@ public class RandomFullClipboardPattern extends AbstractPattern {
|
|||||||
throw new IllegalStateException("Incorrect use. This pattern can only be applied to an extent!");
|
throw new IllegalStateException("Incorrect use. This pattern can only be applied to an extent!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 size() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,11 @@ public class RandomOffsetPattern extends AbstractPattern {
|
|||||||
return pattern.apply(extent, get, mutable);
|
return pattern.apply(extent, get, mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 size() {
|
||||||
|
return BlockVector3.at(dx2, dy2, dz2);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pattern fork() {
|
public Pattern fork() {
|
||||||
return new RandomOffsetPattern(this.pattern.fork(), this.dx, this.dy, this.dz, this.minY, this.maxY);
|
return new RandomOffsetPattern(this.pattern.fork(), this.dx, this.dy, this.dz, this.minY, this.maxY);
|
||||||
|
@ -129,6 +129,11 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
|
|||||||
return !block.getBlockType().getMaterial().isMovementBlocker();
|
return !block.getBlockType().getMaterial().isMovementBlocker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 size() {
|
||||||
|
return BlockVector3.at(moves, moves, moves);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pattern fork() {
|
public Pattern fork() {
|
||||||
return new SurfaceRandomOffsetPattern(this.pattern.fork(), this.moves, this.minY, this.maxY);
|
return new SurfaceRandomOffsetPattern(this.pattern.fork(), this.moves, this.minY, this.maxY);
|
||||||
|
@ -78,6 +78,49 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
|
|||||||
return localMap != null && localMap.contains(x & 2047, ((y + 128) & 511) - 128, z & 2047);
|
return localMap != null && localMap.contains(x & 2047, ((y + 128) & 511) - 128, z & 2047);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOffset(final int x, final int z) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOffset(final int x, final int y, final int z) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean containsRadius(final int x, final int y, final int z, final int radius) {
|
||||||
|
if (radius <= 0) {
|
||||||
|
return contains(x, y, z);
|
||||||
|
}
|
||||||
|
// Quick corners check
|
||||||
|
if (!contains(x - radius, y, z - radius)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!contains(x + radius, y, z + radius)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!contains(x - radius, y, z + radius)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!contains(x + radius, y, z - radius)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Slow but if someone wants to think of an elegant way then feel free to add it
|
||||||
|
for (int xx = -radius; xx <= radius; xx++) {
|
||||||
|
int rx = x + xx;
|
||||||
|
for (int yy = -radius; yy <= radius; yy++) {
|
||||||
|
int ry = y + yy;
|
||||||
|
for (int zz = -radius; zz <= radius; zz++) {
|
||||||
|
if (contains(rx, ry, z + zz)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(Object o) {
|
public boolean contains(Object o) {
|
||||||
if (o instanceof BlockVector3 v) {
|
if (o instanceof BlockVector3 v) {
|
||||||
|
@ -100,14 +100,7 @@ public class LocalBlockVectorSet implements BlockVector3Set {
|
|||||||
return new LocalBlockVectorSet(offsetX, offsetY, offsetZ, set.clone());
|
return new LocalBlockVectorSet(offsetX, offsetY, offsetZ, set.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* If a radius is contained by the set
|
|
||||||
*
|
|
||||||
* @param x x radius center
|
|
||||||
* @param y y radius center
|
|
||||||
* @param z z radius center
|
|
||||||
* @return if radius is contained by the set
|
|
||||||
*/
|
|
||||||
public boolean containsRadius(int x, int y, int z, int radius) {
|
public boolean containsRadius(int x, int y, int z, int radius) {
|
||||||
if (radius <= 0) {
|
if (radius <= 0) {
|
||||||
return contains(x, y, z);
|
return contains(x, y, z);
|
||||||
@ -130,9 +123,11 @@ public class LocalBlockVectorSet implements BlockVector3Set {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int xx = -radius; xx <= radius; xx++) {
|
for (int xx = -radius; xx <= radius; xx++) {
|
||||||
|
int rx = x + xx;
|
||||||
for (int yy = -radius; yy <= radius; yy++) {
|
for (int yy = -radius; yy <= radius; yy++) {
|
||||||
|
int ry = y + yy;
|
||||||
for (int zz = -radius; zz <= radius; zz++) {
|
for (int zz = -radius; zz <= radius; zz++) {
|
||||||
if (contains(x + xx, y + yy, z + zz)) {
|
if (contains(rx, ry, z + zz)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,27 +136,13 @@ public class LocalBlockVectorSet implements BlockVector3Set {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Set the offset applied to values when storing and reading to keep the values within -1024 to 1023. Uses default y offset
|
|
||||||
* of 128 to allow -64 -> 320 world height use.
|
|
||||||
*
|
|
||||||
* @param x x offset
|
|
||||||
* @param z z offset
|
|
||||||
*/
|
|
||||||
public void setOffset(int x, int z) {
|
public void setOffset(int x, int z) {
|
||||||
this.offsetX = x;
|
this.offsetX = x;
|
||||||
this.offsetZ = z;
|
this.offsetZ = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Set the offset applied to values when storing and reading to keep the x and z values within -1024 to 1023. Y values
|
|
||||||
* require keeping withing -256 and 255.
|
|
||||||
*
|
|
||||||
* @param x x offset
|
|
||||||
* @param y y offset
|
|
||||||
* @param z z offset
|
|
||||||
* @since 2.2.0
|
|
||||||
*/
|
|
||||||
public void setOffset(int x, int y, int z) {
|
public void setOffset(int x, int y, int z) {
|
||||||
this.offsetX = x;
|
this.offsetX = x;
|
||||||
this.offsetY = y;
|
this.offsetY = y;
|
||||||
|
@ -61,6 +61,22 @@ public class MutableBlockVector3 extends BlockVector3 {
|
|||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 getMinimum(BlockVector3 v2) {
|
||||||
|
this.x = Math.min(v2.getX(), x);
|
||||||
|
this.y = Math.min(v2.getY(), y);
|
||||||
|
this.z = Math.min(v2.getZ(), z);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 getMaximum(BlockVector3 v2) {
|
||||||
|
this.x = Math.max(v2.getX(), x);
|
||||||
|
this.y = Math.max(v2.getY(), y);
|
||||||
|
this.z = Math.max(v2.getZ(), z);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MutableBlockVector3 mutX(double x) {
|
public MutableBlockVector3 mutX(double x) {
|
||||||
this.x = (int) x;
|
this.x = (int) x;
|
||||||
|
@ -6,7 +6,7 @@ import static java.lang.Math.floorDiv;
|
|||||||
/**
|
/**
|
||||||
* A {@link SimpleRandom} that deterministically maps coordinates
|
* A {@link SimpleRandom} that deterministically maps coordinates
|
||||||
* to values.
|
* to values.
|
||||||
* @since TODO
|
* @since 2.9.2
|
||||||
*/
|
*/
|
||||||
public class Linear2DRandom implements SimpleRandom {
|
public class Linear2DRandom implements SimpleRandom {
|
||||||
private final int xScale;
|
private final int xScale;
|
||||||
|
@ -5,7 +5,7 @@ import static java.lang.Math.floorDiv;
|
|||||||
/**
|
/**
|
||||||
* A {@link SimpleRandom} that deterministically maps coordinates
|
* A {@link SimpleRandom} that deterministically maps coordinates
|
||||||
* to values.
|
* to values.
|
||||||
* @since TODO
|
* @since 2.9.2
|
||||||
*/
|
*/
|
||||||
public class Linear3DRandom implements SimpleRandom {
|
public class Linear3DRandom implements SimpleRandom {
|
||||||
|
|
||||||
|
@ -9,13 +9,17 @@ import java.util.Set;
|
|||||||
|
|
||||||
public interface BlockVector3Set extends Set<BlockVector3> {
|
public interface BlockVector3Set extends Set<BlockVector3> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the appropriate {@link BlockVector3Set} implementation for the given region. Either {@link LocalBlockVectorSet} or
|
||||||
|
* {@link BlockVectorSet}. Sets the offset if using {@link LocalBlockVectorSet}.
|
||||||
|
*
|
||||||
|
* @param region Region to get for
|
||||||
|
* @return Appropriate {@link BlockVector3Set} implementation
|
||||||
|
*/
|
||||||
static BlockVector3Set getAppropriateVectorSet(Region region) {
|
static BlockVector3Set getAppropriateVectorSet(Region region) {
|
||||||
BlockVector3 max = region.getMaximumPoint();
|
BlockVector3 max = region.getMaximumPoint();
|
||||||
BlockVector3 min = region.getMinimumPoint();
|
BlockVector3 min = region.getMinimumPoint();
|
||||||
BlockVector3 size = region.getDimensions();
|
BlockVector3Set set = getAppropriateVectorSet(region.getDimensions());
|
||||||
if (size.getBlockX() > 2048 || size.getBlockZ() > 2048 || size.getBlockY() > 512) {
|
|
||||||
return new BlockVectorSet();
|
|
||||||
} else {
|
|
||||||
// Set default offset as many operations utilising a region are likely to start in a corner, this initialising the
|
// Set default offset as many operations utilising a region are likely to start in a corner, this initialising the
|
||||||
// LocalBlockVectorSet poorly
|
// LocalBlockVectorSet poorly
|
||||||
// This needs to be ceiling as LocalBlockVector extends 1 block further "negative"
|
// This needs to be ceiling as LocalBlockVector extends 1 block further "negative"
|
||||||
@ -27,11 +31,58 @@ public interface BlockVector3Set extends Set<BlockVector3> {
|
|||||||
} else {
|
} else {
|
||||||
offsetY = 128;
|
offsetY = 128;
|
||||||
}
|
}
|
||||||
return new LocalBlockVectorSet(offsetX, offsetY, offsetZ);
|
set.setOffset(offsetX, offsetY, offsetZ);
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the appropriate {@link BlockVector3Set} implementation for the given dimensions. Either {@link LocalBlockVectorSet} or
|
||||||
|
* {@link BlockVectorSet}. The offset should be manually set.
|
||||||
|
*
|
||||||
|
* @param size Dimensions to get for
|
||||||
|
* @return Appropriate {@link BlockVector3Set} implementation
|
||||||
|
*/
|
||||||
|
static BlockVector3Set getAppropriateVectorSet(BlockVector3 size) {
|
||||||
|
if (size.getBlockX() > 2048 || size.getBlockZ() > 2048 || size.getBlockY() > 512) {
|
||||||
|
return new BlockVectorSet();
|
||||||
|
} else {
|
||||||
|
return new LocalBlockVectorSet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean add(int x, int y, int z);
|
boolean add(int x, int y, int z);
|
||||||
|
|
||||||
boolean contains(int x, int y, int z);
|
boolean contains(int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the offset applied to values when storing and reading to keep the values within -1024 to 1023. Uses default y offset
|
||||||
|
* of 128 to allow -64 -> 320 world height use.
|
||||||
|
*
|
||||||
|
* @param x x offset
|
||||||
|
* @param z z offset
|
||||||
|
* @since 2.9.2
|
||||||
|
*/
|
||||||
|
void setOffset(int x, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the offset applied to values when storing and reading to keep the x and z values within -1024 to 1023. Y values
|
||||||
|
* require keeping withing -256 and 255.
|
||||||
|
*
|
||||||
|
* @param x x offset
|
||||||
|
* @param y y offset
|
||||||
|
* @param z z offset
|
||||||
|
* @since 2.9.2
|
||||||
|
*/
|
||||||
|
void setOffset(int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If a radius is contained by the set
|
||||||
|
*
|
||||||
|
* @param x x radius center
|
||||||
|
* @param y y radius center
|
||||||
|
* @param z z radius center
|
||||||
|
* @return if radius is contained by the set
|
||||||
|
* @since 2.9.2
|
||||||
|
*/
|
||||||
|
boolean containsRadius(int x, int y, int z, int radius);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
/**
|
/**
|
||||||
* The following classes are FAWE additions:
|
* The following classes are FAWE additions:
|
||||||
*
|
*
|
||||||
* @see com.sk89q.worldedit.command.argument.ExpressionConverter
|
* {@link com.sk89q.worldedit.command.argument.ExpressionConverter},
|
||||||
* @see com.sk89q.worldedit.command.argument.LocationConverter
|
* {@link com.sk89q.worldedit.command.argument.LocationConverter}
|
||||||
*/
|
*/
|
||||||
@org.enginehub.piston.util.NonnullByDefault
|
@org.enginehub.piston.util.NonnullByDefault
|
||||||
package com.sk89q.worldedit.command.argument;
|
package com.sk89q.worldedit.command.argument;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* The following classes are FAWE additions:
|
* The following classes are FAWE additions:
|
||||||
*
|
*
|
||||||
* @see com.sk89q.worldedit.command.HistorySubCommands
|
* {@link com.sk89q.worldedit.command.HistorySubCommands}
|
||||||
*/
|
*/
|
||||||
package com.sk89q.worldedit.command;
|
package com.sk89q.worldedit.command;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
* The following classes are FAWE additions:
|
* The following classes are FAWE additions:
|
||||||
*
|
*
|
||||||
* @see com.sk89q.worldedit.command.util.annotation.AllowedRegion
|
* {@link com.sk89q.worldedit.command.util.annotation.AllowedRegion},
|
||||||
* @see com.sk89q.worldedit.command.util.annotation.Confirm
|
* {@link com.sk89q.worldedit.command.util.annotation.Confirm},
|
||||||
* @see com.sk89q.worldedit.command.util.annotation.ConfirmHandler
|
* {@link com.sk89q.worldedit.command.util.annotation.ConfirmHandler},
|
||||||
* @see com.sk89q.worldedit.command.util.annotation.Link
|
* {@link com.sk89q.worldedit.command.util.annotation.Link},
|
||||||
* @see com.sk89q.worldedit.command.util.annotation.PatternList
|
* {@link com.sk89q.worldedit.command.util.annotation.PatternList},
|
||||||
* @see com.sk89q.worldedit.command.util.annotation.Preload
|
* {@link com.sk89q.worldedit.command.util.annotation.Preload},
|
||||||
* @see com.sk89q.worldedit.command.util.annotation.PreloadHandler
|
* {@link com.sk89q.worldedit.command.util.annotation.PreloadHandler},
|
||||||
* @see com.sk89q.worldedit.command.util.annotation.Step
|
* {@link com.sk89q.worldedit.command.util.annotation.Step},
|
||||||
* @see com.sk89q.worldedit.command.util.annotation.Time
|
* {@link com.sk89q.worldedit.command.util.annotation.Time}
|
||||||
*/
|
*/
|
||||||
package com.sk89q.worldedit.command.util.annotation;
|
package com.sk89q.worldedit.command.util.annotation;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* The following classes are FAWE additions:
|
* The following classes are FAWE additions:
|
||||||
*
|
*
|
||||||
* @see com.sk89q.worldedit.function.operation.BackwardsExtentBlockCopy
|
* {@link com.sk89q.worldedit.function.operation.BackwardsExtentBlockCopy}
|
||||||
*/
|
*/
|
||||||
package com.sk89q.worldedit.function.operation;
|
package com.sk89q.worldedit.function.operation;
|
||||||
|
@ -25,6 +25,7 @@ import com.sk89q.worldedit.WorldEditException;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
|
import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,4 +75,14 @@ public interface Pattern extends Filter {
|
|||||||
*/
|
*/
|
||||||
BaseBlock applyBlock(BlockVector3 position);
|
BaseBlock applyBlock(BlockVector3 position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the likely maximum size of the volume this pattern will affect
|
||||||
|
*
|
||||||
|
* @return Pattern size
|
||||||
|
* @since 2.9.2
|
||||||
|
*/
|
||||||
|
default BlockVector3 size() {
|
||||||
|
return BlockVector3.ONE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public enum RegionSelectorType {
|
|||||||
* Get a {@link RegionSelectorType} for the given {@link RegionSelector}
|
* Get a {@link RegionSelectorType} for the given {@link RegionSelector}
|
||||||
*
|
*
|
||||||
* @param selector Region selector to get type enum for
|
* @param selector Region selector to get type enum for
|
||||||
* @since TODO
|
* @since 2.9.2
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public static RegionSelectorType getForSelector(RegionSelector selector) {
|
public static RegionSelectorType getForSelector(RegionSelector selector) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* The following classes are FAWE additions:
|
* The following classes are FAWE additions:
|
||||||
*
|
*
|
||||||
* @see com.sk89q.worldedit.world.block.BlockTypesCache
|
* {@link com.sk89q.worldedit.world.block.BlockTypesCache}
|
||||||
*/
|
*/
|
||||||
package com.sk89q.worldedit.world.block;
|
package com.sk89q.worldedit.world.block;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* The following classes are FAWE additions:
|
* The following classes are FAWE additions:
|
||||||
*
|
*
|
||||||
* @see com.sk89q.worldedit.world.chunk.AnvilChunk15
|
* {@link com.sk89q.worldedit.world.chunk.AnvilChunk15},
|
||||||
* @see com.sk89q.worldedit.world.chunk.AnvilChunk17
|
* {@link com.sk89q.worldedit.world.chunk.AnvilChunk17}
|
||||||
*/
|
*/
|
||||||
package com.sk89q.worldedit.world.chunk;
|
package com.sk89q.worldedit.world.chunk;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren