Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Use more MutableBlockVector3s
Dieser Commit ist enthalten in:
Ursprung
6f5430a940
Commit
3ba42df321
@ -24,12 +24,20 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
||||||
|
<<<<<<< Updated upstream
|
||||||
return getExtent().setBlock(location.getX(), location.getY(), location.getZ(), block);
|
return getExtent().setBlock(location.getX(), location.getY(), location.getZ(), block);
|
||||||
|
=======
|
||||||
|
return getExtent().setBlock(location.getX() + dx, location.getY() + dy, location.getZ() + dz, block);
|
||||||
|
>>>>>>> Stashed changes
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
||||||
|
<<<<<<< Updated upstream
|
||||||
return getExtent().setBlock(x, y, z, block);
|
return getExtent().setBlock(x, y, z, block);
|
||||||
|
=======
|
||||||
|
return getExtent().setBlock(x + dx, y + dy, z + dz, block);
|
||||||
|
>>>>>>> Stashed changes
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.fastasyncworldedit.core.extent;
|
package com.fastasyncworldedit.core.extent;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet;
|
import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet;
|
||||||
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
@ -25,6 +26,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class HistoryExtent extends AbstractDelegateExtent {
|
public class HistoryExtent extends AbstractDelegateExtent {
|
||||||
|
|
||||||
|
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
private AbstractChangeSet changeSet;
|
private AbstractChangeSet changeSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,7 +99,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
|||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector3 position, BiomeType newBiome) {
|
public boolean setBiome(BlockVector3 position, BiomeType newBiome) {
|
||||||
BiomeType oldBiome = this.getBiome(position);
|
BiomeType oldBiome = this.getBiome(position);
|
||||||
if (oldBiome.getId() != newBiome.getId()) {
|
if (!oldBiome.getId().equals(newBiome.getId())) {
|
||||||
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockY(), position.getBlockZ(), oldBiome, newBiome);
|
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockY(), position.getBlockZ(), oldBiome, newBiome);
|
||||||
return getExtent().setBiome(position, newBiome);
|
return getExtent().setBiome(position, newBiome);
|
||||||
} else {
|
} else {
|
||||||
@ -107,8 +109,8 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(int x, int y, int z, BiomeType newBiome) {
|
public boolean setBiome(int x, int y, int z, BiomeType newBiome) {
|
||||||
BiomeType oldBiome = this.getBiome(BlockVector3.at(x, y, z));
|
BiomeType oldBiome = this.getBiome(mutable.setComponents(x, y, z));
|
||||||
if (oldBiome.getId() != newBiome.getId()) {
|
if (!oldBiome.getId().equals(newBiome.getId())) {
|
||||||
this.changeSet.addBiomeChange(x, y, z, oldBiome, newBiome);
|
this.changeSet.addBiomeChange(x, y, z, oldBiome, newBiome);
|
||||||
return getExtent().setBiome(x, y, z, newBiome);
|
return getExtent().setBiome(x, y, z, newBiome);
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,9 +45,20 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
return min.add(tmp.roundHalfUp().toBlockPoint());
|
return min.add(tmp.roundHalfUp().toBlockPoint());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BlockVector3 getPos(int x, int y, int z) {
|
||||||
|
if (min == null) {
|
||||||
|
min = BlockVector3.at(x, y, z);
|
||||||
|
}
|
||||||
|
mutable.mutX(x - min.getX());
|
||||||
|
mutable.mutY(y - min.getY());
|
||||||
|
mutable.mutZ(z - min.getZ());
|
||||||
|
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
|
||||||
|
return min.add(tmp.roundHalfUp().toBlockPoint());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(int x, int y, int z) {
|
public BlockState getBlock(int x, int y, int z) {
|
||||||
return super.getBlock(getPos(BlockVector3.at(x, y, z)));
|
return super.getBlock(getPos(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -65,12 +76,12 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
mutable.mutX(position.getBlockX());
|
mutable.mutX(position.getBlockX());
|
||||||
mutable.mutZ(position.getBlockZ());
|
mutable.mutZ(position.getBlockZ());
|
||||||
mutable.mutY(position.getBlockY());
|
mutable.mutY(position.getBlockY());
|
||||||
return super.getBiome(getPos(mutable));
|
return super.getBiome(getPos(mutable.getX(), mutable.getY(), mutable.getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException {
|
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException {
|
||||||
return this.setBlock(getPos(BlockVector3.at(x, y, z)), block);
|
return this.setBlock(getPos(x, y, z), block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,7 +95,7 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
mutable.mutX(position.getBlockX());
|
mutable.mutX(position.getBlockX());
|
||||||
mutable.mutZ(position.getBlockZ());
|
mutable.mutZ(position.getBlockZ());
|
||||||
mutable.mutY(position.getBlockY());
|
mutable.mutY(position.getBlockY());
|
||||||
return super.setBiome(getPos(mutable), biome);
|
return super.setBiome(getPos(mutable.getX(), mutable.getY(), mutable.getZ()), biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTransform(Transform transform) {
|
public void setTransform(Transform transform) {
|
||||||
|
@ -4,6 +4,7 @@ import com.fastasyncworldedit.core.Fawe;
|
|||||||
import com.fastasyncworldedit.core.function.visitor.Order;
|
import com.fastasyncworldedit.core.function.visitor.Order;
|
||||||
import com.fastasyncworldedit.core.internal.io.FaweOutputStream;
|
import com.fastasyncworldedit.core.internal.io.FaweOutputStream;
|
||||||
import com.fastasyncworldedit.core.jnbt.streamer.IntValueReader;
|
import com.fastasyncworldedit.core.jnbt.streamer.IntValueReader;
|
||||||
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
import com.fastasyncworldedit.core.util.IOUtil;
|
import com.fastasyncworldedit.core.util.IOUtil;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.IntArrayTag;
|
import com.sk89q.jnbt.IntArrayTag;
|
||||||
@ -278,12 +279,12 @@ public class FastSchematicWriter implements ClipboardWriter {
|
|||||||
BlockVector3 min = clipboard.getMinimumPoint();
|
BlockVector3 min = clipboard.getMinimumPoint();
|
||||||
int width = clipboard.getRegion().getWidth();
|
int width = clipboard.getRegion().getWidth();
|
||||||
int length = clipboard.getRegion().getLength();
|
int length = clipboard.getRegion().getLength();
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
for (int z = 0, i = 0; z < length; z++) {
|
for (int z = 0, i = 0; z < length; z++) {
|
||||||
int z0 = min.getBlockZ() + z;
|
int z0 = min.getBlockZ() + z;
|
||||||
for (int x = 0; x < width; x++, i++) {
|
for (int x = 0; x < width; x++, i++) {
|
||||||
int x0 = min.getBlockX() + x;
|
int x0 = min.getBlockX() + x;
|
||||||
BlockVector3 pt = BlockVector3.at(x0, min.getBlockY(), z0);
|
BiomeType biome = clipboard.getBiome(mutable.setComponents(x0, min.getY(), z0));
|
||||||
BiomeType biome = clipboard.getBiome(pt);
|
|
||||||
task.applyInt(i, biome.getInternalId());
|
task.applyInt(i, biome.getInternalId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.fastasyncworldedit.core.extent.transform;
|
package com.fastasyncworldedit.core.extent.transform;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.extent.ResettableExtent;
|
import com.fastasyncworldedit.core.extent.ResettableExtent;
|
||||||
|
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.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
@ -10,6 +11,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
public class PatternTransform extends ResettableExtent {
|
public class PatternTransform extends ResettableExtent {
|
||||||
|
|
||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
|
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public PatternTransform(Extent parent, Pattern pattern) {
|
public PatternTransform(Extent parent, Pattern pattern) {
|
||||||
super(parent);
|
super(parent);
|
||||||
@ -22,4 +24,14 @@ public class PatternTransform extends ResettableExtent {
|
|||||||
return pattern.apply(getExtent(), location, location);
|
return pattern.apply(getExtent(), location, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< Updated upstream
|
||||||
|
=======
|
||||||
|
@Override
|
||||||
|
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block)
|
||||||
|
throws WorldEditException {
|
||||||
|
mutable.setComponents(x, y, z);
|
||||||
|
return pattern.apply(extent, mutable, mutable);
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> Stashed changes
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.fastasyncworldedit.core.function.visitor;
|
|||||||
|
|
||||||
import com.fastasyncworldedit.core.configuration.Caption;
|
import com.fastasyncworldedit.core.configuration.Caption;
|
||||||
import com.fastasyncworldedit.core.math.IntTriple;
|
import com.fastasyncworldedit.core.math.IntTriple;
|
||||||
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.function.RegionFunction;
|
import com.sk89q.worldedit.function.RegionFunction;
|
||||||
@ -40,12 +41,12 @@ public abstract class DFSVisitor implements Operation {
|
|||||||
this.hashQueue = new LinkedHashSet<>();
|
this.hashQueue = new LinkedHashSet<>();
|
||||||
this.visited = new LinkedHashMap<>();
|
this.visited = new LinkedHashMap<>();
|
||||||
this.function = function;
|
this.function = function;
|
||||||
this.directions.add(BlockVector3.at(0, -1, 0));
|
this.directions.add(BlockVector3.UNIT_MINUS_Y);
|
||||||
this.directions.add(BlockVector3.at(0, 1, 0));
|
this.directions.add(BlockVector3.UNIT_Y);
|
||||||
this.directions.add(BlockVector3.at(-1, 0, 0));
|
this.directions.add(BlockVector3.UNIT_MINUS_X);
|
||||||
this.directions.add(BlockVector3.at(1, 0, 0));
|
this.directions.add(BlockVector3.UNIT_X);
|
||||||
this.directions.add(BlockVector3.at(0, 0, -1));
|
this.directions.add(BlockVector3.UNIT_MINUS_Z);
|
||||||
this.directions.add(BlockVector3.at(0, 0, 1));
|
this.directions.add(BlockVector3.UNIT_Z);
|
||||||
this.maxDepth = maxDepth;
|
this.maxDepth = maxDepth;
|
||||||
this.maxBranch = maxBranching;
|
this.maxBranch = maxBranching;
|
||||||
}
|
}
|
||||||
@ -76,8 +77,8 @@ public abstract class DFSVisitor implements Operation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Operation resume(RunContext run) throws WorldEditException {
|
public Operation resume(RunContext run) throws WorldEditException {
|
||||||
// MutableBlockVector3 mutable = new MutableBlockVector3();
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
// MutableBlockVector3 mutable2 = new MutableBlockVector3();
|
MutableBlockVector3 mutable2 = new MutableBlockVector3();
|
||||||
IntTriple[] dirs = getIntDirections();
|
IntTriple[] dirs = getIntDirections();
|
||||||
|
|
||||||
while (!queue.isEmpty()) {
|
while (!queue.isEmpty()) {
|
||||||
@ -87,23 +88,18 @@ public abstract class DFSVisitor implements Operation {
|
|||||||
if (visited.containsKey(from)) {
|
if (visited.containsKey(from)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// mutable.mutX(from.getX());
|
mutable.mutX(from.getX());
|
||||||
// mutable.mutY(from.getY());
|
mutable.mutY(from.getY());
|
||||||
// mutable.mutZ(from.getZ());
|
mutable.mutZ(from.getZ());
|
||||||
BlockVector3 bv = BlockVector3.at(from.getX(), from.getY(), from.getZ());
|
function.apply(mutable);
|
||||||
function.apply(bv);
|
|
||||||
int countAdd = 0;
|
int countAdd = 0;
|
||||||
int countAttempt = 0;
|
int countAttempt = 0;
|
||||||
for (IntTriple direction : dirs) {
|
for (IntTriple direction : dirs) {
|
||||||
// mutable2.mutX(from.getX() + direction.x);
|
mutable2.mutX(from.getX() + direction.getX());
|
||||||
// mutable2.mutY(from.getY() + direction.y);
|
mutable2.mutY(from.getY() + direction.getY());
|
||||||
// mutable2.mutZ(from.getZ() + direction.z);
|
mutable2.mutZ(from.getZ() + direction.getZ());
|
||||||
BlockVector3 bv2 = BlockVector3
|
if (isVisitable(mutable, mutable2)) {
|
||||||
.at(from.getX() + direction.getX(), from.getY() + direction.getY(),
|
Node adjacent = new Node(mutable2.getBlockX(), mutable2.getBlockY(), mutable2.getBlockZ());
|
||||||
from.getZ() + direction.getZ()
|
|
||||||
);
|
|
||||||
if (isVisitable(bv, bv2)) {
|
|
||||||
Node adjacent = new Node(bv2.getBlockX(), bv2.getBlockY(), bv2.getBlockZ());
|
|
||||||
if (!adjacent.equals(current.from)) {
|
if (!adjacent.equals(current.from)) {
|
||||||
AtomicInteger adjacentCount = visited.get(adjacent);
|
AtomicInteger adjacentCount = visited.get(adjacent);
|
||||||
if (adjacentCount == null) {
|
if (adjacentCount == null) {
|
||||||
|
@ -29,13 +29,14 @@ public class DirectionalVisitor extends RecursiveVisitor {
|
|||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
this.dirVec = direction;
|
this.dirVec = direction;
|
||||||
|
|
||||||
|
|
||||||
setDirections(
|
setDirections(
|
||||||
BlockVector3.at(1, 0, 0),
|
BlockVector3.UNIT_MINUS_X,
|
||||||
BlockVector3.at(-1, 0, 0),
|
BlockVector3.UNIT_X,
|
||||||
BlockVector3.at(0, 0, 1),
|
BlockVector3.UNIT_MINUS_Y,
|
||||||
BlockVector3.at(0, 0, -1),
|
BlockVector3.UNIT_Y,
|
||||||
BlockVector3.at(0, -1, 0),
|
BlockVector3.UNIT_MINUS_Z,
|
||||||
BlockVector3.at(0, 1, 0)
|
BlockVector3.UNIT_Z
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.fastasyncworldedit.core.wrappers;
|
package com.fastasyncworldedit.core.wrappers;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.Fawe;
|
import com.fastasyncworldedit.core.Fawe;
|
||||||
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
import com.fastasyncworldedit.core.util.EditSessionBuilder;
|
import com.fastasyncworldedit.core.util.EditSessionBuilder;
|
||||||
import com.fastasyncworldedit.core.util.TaskManager;
|
import com.fastasyncworldedit.core.util.TaskManager;
|
||||||
import com.fastasyncworldedit.core.util.task.RunnableVal;
|
import com.fastasyncworldedit.core.util.task.RunnableVal;
|
||||||
@ -89,14 +90,16 @@ public class AsyncPlayer extends PlayerProxy {
|
|||||||
int z = pos.getBlockZ();
|
int z = pos.getBlockZ();
|
||||||
Extent world = getLocation().getExtent();
|
Extent world = getLocation().getExtent();
|
||||||
|
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
// No free space above
|
// No free space above
|
||||||
if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isAir()) {
|
if (!world.getBlock(mutable.setComponents(x, y, z)).getBlockType().getMaterial().isAir()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (y <= world.getMaximumPoint().getY()) {
|
while (y <= world.getMaximumPoint().getY()) {
|
||||||
// Found a ceiling!
|
// Found a ceiling!
|
||||||
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial()
|
if (world.getBlock(mutable.mutY(y)).getBlockType().getMaterial()
|
||||||
.isMovementBlocker()) {
|
.isMovementBlocker()) {
|
||||||
int platformY = Math.max(initialY, y - 3 - clearance);
|
int platformY = Math.max(initialY, y - 3 - clearance);
|
||||||
floatAt(x, platformY + 1, z, alwaysGlass);
|
floatAt(x, platformY + 1, z, alwaysGlass);
|
||||||
@ -124,8 +127,10 @@ public class AsyncPlayer extends PlayerProxy {
|
|||||||
final int maxY = Math.min(getWorld().getMaxY() + 1, initialY + distance);
|
final int maxY = Math.min(getWorld().getMaxY() + 1, initialY + distance);
|
||||||
final Extent world = getLocation().getExtent();
|
final Extent world = getLocation().getExtent();
|
||||||
|
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3(x, y, z);
|
||||||
|
|
||||||
while (y <= world.getMaximumPoint().getY() + 2) {
|
while (y <= world.getMaximumPoint().getY() + 2) {
|
||||||
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial()
|
if (world.getBlock(mutable.mutY(y)).getBlockType().getMaterial()
|
||||||
.isMovementBlocker()) {
|
.isMovementBlocker()) {
|
||||||
break; // Hit something
|
break; // Hit something
|
||||||
} else if (y > maxY + 1) {
|
} else if (y > maxY + 1) {
|
||||||
@ -211,9 +216,11 @@ public class AsyncPlayer extends PlayerProxy {
|
|||||||
int freeToFind = 2;
|
int freeToFind = 2;
|
||||||
boolean inFree = false;
|
boolean inFree = false;
|
||||||
|
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
while ((block = hitBlox.getNextBlock()) != null) {
|
while ((block = hitBlox.getNextBlock()) != null) {
|
||||||
boolean free = !world.getBlock(
|
boolean free = !world.getBlock(
|
||||||
BlockVector3.at(block.getBlockX(), block.getBlockY(), block.getBlockZ()))
|
mutable.setComponents(block.getBlockX(), block.getBlockY(), block.getBlockZ()))
|
||||||
.getBlockType().getMaterial().isMovementBlocker();
|
.getBlockType().getMaterial().isMovementBlocker();
|
||||||
|
|
||||||
if (firstBlock) {
|
if (firstBlock) {
|
||||||
|
@ -1333,7 +1333,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
checkNotNull(pattern);
|
checkNotNull(pattern);
|
||||||
checkArgument(radius >= 0, "radius >= 0");
|
checkArgument(radius >= 0, "radius >= 0");
|
||||||
checkArgument(depth >= 1, "depth >= 1");
|
checkArgument(depth >= 1, "depth >= 1");
|
||||||
if (direction.equals(BlockVector3.at(0, -1, 0))) {
|
if (direction.equals(BlockVector3.UNIT_MINUS_Y)) {
|
||||||
return fillXZ(origin, pattern, radius, depth, false);
|
return fillXZ(origin, pattern, radius, depth, false);
|
||||||
}
|
}
|
||||||
Mask mask = new MaskIntersection(
|
Mask mask = new MaskIntersection(
|
||||||
@ -2493,29 +2493,36 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
int minY = Math.max(getWorld().getMinY(), centerY - height);
|
int minY = Math.max(getWorld().getMinY(), centerY - height);
|
||||||
int maxY = Math.min(getWorld().getMaxY(), centerY + height);
|
int maxY = Math.min(getWorld().getMaxY(), centerY + height);
|
||||||
|
|
||||||
|
//FAWE start - mutable
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
MutableBlockVector3 mutable2 = new MutableBlockVector3();
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
int ceilRadius = (int) Math.ceil(radius);
|
int ceilRadius = (int) Math.ceil(radius);
|
||||||
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
|
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
|
||||||
for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
|
for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
|
||||||
if ((BlockVector3.at(x, oy, z)).distanceSq(position) > radiusSq) {
|
//FAWE start - mutable
|
||||||
|
if ((mutable.setComponents(x, oy, z)).distanceSq(position) > radiusSq) {
|
||||||
|
//FAWE end
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = maxY; y > minY; --y) {
|
for (int y = maxY; y > minY; --y) {
|
||||||
BlockVector3 pt = BlockVector3.at(x, y, z);
|
//FAWE start - mutable
|
||||||
BlockVector3 below = BlockVector3.at(x, y - 1, z);
|
mutable.setComponents(x, y, z);
|
||||||
BlockType id = getBlock(pt).getBlockType();
|
mutable2.setComponents(x, y - 1, z);
|
||||||
|
BlockType id = getBlock(mutable).getBlockType();
|
||||||
|
|
||||||
if (id == BlockTypes.ICE) {
|
if (id == BlockTypes.ICE) {
|
||||||
if (setBlock(pt, water)) {
|
if (setBlock(mutable, water)) {
|
||||||
++affected;
|
++affected;
|
||||||
}
|
}
|
||||||
} else if (id == BlockTypes.SNOW) {
|
} else if (id == BlockTypes.SNOW) {
|
||||||
//FAWE start
|
if (setBlock(mutable, air)) {
|
||||||
if (setBlock(pt, air)) {
|
|
||||||
if (y > 0) {
|
if (y > 0) {
|
||||||
BlockState block = getBlock(below);
|
BlockState block = getBlock(mutable2);
|
||||||
if (block.getStates().containsKey(snowy)) {
|
if (block.getStates().containsKey(snowy)) {
|
||||||
if (setBlock(below, block.with(snowy, false))) {
|
if (setBlock(mutable2, block.with(snowy, false))) {
|
||||||
affected++;
|
affected++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2627,20 +2634,29 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
final int minY = Math.max(getWorld().getMinY(), centerY - height);
|
final int minY = Math.max(getWorld().getMinY(), centerY - height);
|
||||||
final int maxY = Math.min(getWorld().getMaxY(), centerY + height);
|
final int maxY = Math.min(getWorld().getMaxY(), centerY + height);
|
||||||
|
|
||||||
|
//FAWE start - mutable
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
final int ceilRadius = (int) Math.ceil(radius);
|
final int ceilRadius = (int) Math.ceil(radius);
|
||||||
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
|
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
|
||||||
for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
|
for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
|
||||||
if ((BlockVector3.at(x, oy, z)).distanceSq(position) > radiusSq) {
|
//FAWE start - mutable
|
||||||
|
if (mutable.setComponents(x, oy, z).distanceSq(position) > radiusSq) {
|
||||||
|
//FAWE end
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = maxY; y > minY; --y) {
|
for (int y = maxY; y > minY; --y) {
|
||||||
final BlockVector3 pt = BlockVector3.at(x, y, z);
|
//FAWE start - mutable
|
||||||
final BlockState block = getBlock(pt);
|
final BlockState block = getBlock(mutable.mutY(y));
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
if (block.getBlockType() == BlockTypes.DIRT
|
if (block.getBlockType() == BlockTypes.DIRT
|
||||||
|| (!onlyNormalDirt && block.getBlockType() == BlockTypes.COARSE_DIRT)) {
|
|| (!onlyNormalDirt && block.getBlockType() == BlockTypes.COARSE_DIRT)) {
|
||||||
if (setBlock(pt, grass)) {
|
//FAWE start - mutable
|
||||||
|
if (setBlock(mutable.mutY(y), grass)) {
|
||||||
|
//FAWE end
|
||||||
++affected;
|
++affected;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2958,24 +2974,34 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
final int maxY = max.getBlockY();
|
final int maxY = max.getBlockY();
|
||||||
final int maxZ = max.getBlockZ();
|
final int maxZ = max.getBlockZ();
|
||||||
|
|
||||||
|
//FAWE start - mutable
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
for (int x = minX; x <= maxX; ++x) {
|
for (int x = minX; x <= maxX; ++x) {
|
||||||
for (int y = minY; y <= maxY; ++y) {
|
for (int y = minY; y <= maxY; ++y) {
|
||||||
recurseHollow(region, BlockVector3.at(x, y, minZ), outside, mask);
|
//FAWE start - mutable
|
||||||
recurseHollow(region, BlockVector3.at(x, y, maxZ), outside, mask);
|
recurseHollow(region, mutable.setComponents(x, y, minZ), outside, mask);
|
||||||
|
recurseHollow(region, mutable.setComponents(x, y, maxZ), outside, mask);
|
||||||
|
//FAWE end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = minY; y <= maxY; ++y) {
|
for (int y = minY; y <= maxY; ++y) {
|
||||||
for (int z = minZ; z <= maxZ; ++z) {
|
for (int z = minZ; z <= maxZ; ++z) {
|
||||||
recurseHollow(region, BlockVector3.at(minX, y, z), outside, mask);
|
//FAWE start - mutable
|
||||||
recurseHollow(region, BlockVector3.at(maxX, y, z), outside, mask);
|
recurseHollow(region, mutable.setComponents(minX, y, z), outside, mask);
|
||||||
|
recurseHollow(region, mutable.setComponents(maxX, y, z), outside, mask);
|
||||||
|
//FAWE end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int z = minZ; z <= maxZ; ++z) {
|
for (int z = minZ; z <= maxZ; ++z) {
|
||||||
for (int x = minX; x <= maxX; ++x) {
|
for (int x = minX; x <= maxX; ++x) {
|
||||||
recurseHollow(region, BlockVector3.at(x, minY, z), outside, mask);
|
//FAWE start - mutable
|
||||||
recurseHollow(region, BlockVector3.at(x, maxY, z), outside, mask);
|
recurseHollow(region, mutable.setComponents(x, minY, z), outside, mask);
|
||||||
|
recurseHollow(region, mutable.setComponents(x, maxY, z), outside, mask);
|
||||||
|
//FAWE end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3035,8 +3061,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
public int drawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled, boolean flat)
|
public int drawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled, boolean flat)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
|
|
||||||
|
//FAWE start - LocalBlockVectorSet
|
||||||
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
||||||
//FAWE start
|
|
||||||
boolean notdrawn = true;
|
boolean notdrawn = true;
|
||||||
//FAWE end
|
//FAWE end
|
||||||
|
|
||||||
@ -3054,8 +3080,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
int dz = Math.abs(z2 - z1);
|
int dz = Math.abs(z2 - z1);
|
||||||
|
|
||||||
if (dx + dy + dz == 0) {
|
if (dx + dy + dz == 0) {
|
||||||
vset.add(BlockVector3.at(tipx, tipy, tipz));
|
//FAWE start - LocalBlockVectorSet
|
||||||
//FAWE start
|
vset.add(tipx, tipy, tipz);
|
||||||
notdrawn = false;
|
notdrawn = false;
|
||||||
//FAWE end
|
//FAWE end
|
||||||
}
|
}
|
||||||
@ -3069,7 +3095,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
tipy = (int) Math.round(y1 + domstep * (double) dy / (double) dx * (y2 - y1 > 0 ? 1 : -1));
|
tipy = (int) Math.round(y1 + domstep * (double) dy / (double) dx * (y2 - y1 > 0 ? 1 : -1));
|
||||||
tipz = (int) Math.round(z1 + domstep * (double) dz / (double) dx * (z2 - z1 > 0 ? 1 : -1));
|
tipz = (int) Math.round(z1 + domstep * (double) dz / (double) dx * (z2 - z1 > 0 ? 1 : -1));
|
||||||
|
|
||||||
vset.add(BlockVector3.at(tipx, tipy, tipz));
|
//FAWE start - LocalBlockVectorSet
|
||||||
|
vset.add(tipx, tipy, tipz);
|
||||||
|
//FAWE end
|
||||||
}
|
}
|
||||||
//FAWE start - notdrawn
|
//FAWE start - notdrawn
|
||||||
} else if (dMax == dy && notdrawn) {
|
} else if (dMax == dy && notdrawn) {
|
||||||
@ -3079,7 +3107,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
tipx = (int) Math.round(x1 + domstep * (double) dx / (double) dy * (x2 - x1 > 0 ? 1 : -1));
|
tipx = (int) Math.round(x1 + domstep * (double) dx / (double) dy * (x2 - x1 > 0 ? 1 : -1));
|
||||||
tipz = (int) Math.round(z1 + domstep * (double) dz / (double) dy * (z2 - z1 > 0 ? 1 : -1));
|
tipz = (int) Math.round(z1 + domstep * (double) dz / (double) dy * (z2 - z1 > 0 ? 1 : -1));
|
||||||
|
|
||||||
vset.add(BlockVector3.at(tipx, tipy, tipz));
|
//FAWE start - LocalBlockVectorSet
|
||||||
|
vset.add(tipx, tipy, tipz);
|
||||||
|
//FAWE end
|
||||||
}
|
}
|
||||||
//FAWE start - notdrawn
|
//FAWE start - notdrawn
|
||||||
} else if (dMax == dz && notdrawn) {
|
} else if (dMax == dz && notdrawn) {
|
||||||
@ -3089,7 +3119,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
tipy = (int) Math.round(y1 + domstep * (double) dy / (double) dz * (y2 - y1 > 0 ? 1 : -1));
|
tipy = (int) Math.round(y1 + domstep * (double) dy / (double) dz * (y2 - y1 > 0 ? 1 : -1));
|
||||||
tipx = (int) Math.round(x1 + domstep * (double) dx / (double) dz * (x2 - x1 > 0 ? 1 : -1));
|
tipx = (int) Math.round(x1 + domstep * (double) dx / (double) dz * (x2 - x1 > 0 ? 1 : -1));
|
||||||
|
|
||||||
vset.add(BlockVector3.at(tipx, tipy, tipz));
|
//FAWE start - LocalBlockVectorSet
|
||||||
|
vset.add(tipx, tipy, tipz);
|
||||||
|
//FAWE end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//FAWE start - set BV3
|
//FAWE start - set BV3
|
||||||
@ -3457,6 +3489,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
final Set<BlockVector2> chunks = region.getChunks();
|
final Set<BlockVector2> chunks = region.getChunks();
|
||||||
MutableBlockVector3 mutable = new MutableBlockVector3();
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
MutableBlockVector3 mutable2 = new MutableBlockVector3();
|
||||||
MutableBlockVector2 mutable2D = new MutableBlockVector2();
|
MutableBlockVector2 mutable2D = new MutableBlockVector2();
|
||||||
for (BlockVector2 chunk : chunks) {
|
for (BlockVector2 chunk : chunks) {
|
||||||
final int cx = chunk.getBlockX();
|
final int cx = chunk.getBlockX();
|
||||||
@ -3493,13 +3526,13 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!conNextX) {
|
if (!conNextX) {
|
||||||
setExistingBlocks(BlockVector3.at(bx + 16, 0, bz), BlockVector3.at(bx + 31, maxY, bz + 15));
|
setExistingBlocks(mutable.setComponents(bx + 16, 0, bz), mutable2.setComponents(bx + 31, maxY, bz + 15));
|
||||||
}
|
}
|
||||||
if (!conNextZ) {
|
if (!conNextZ) {
|
||||||
setExistingBlocks(BlockVector3.at(bx, 0, bz + 16), BlockVector3.at(bx + 15, maxY, bz + 31));
|
setExistingBlocks(mutable.setComponents(bx, 0, bz + 16), mutable2.setComponents(bx + 15, maxY, bz + 31));
|
||||||
}
|
}
|
||||||
if (!chunks.contains(mutable2D.setComponents(cx + 1, cz + 1)) && !conNextX && !conNextZ) {
|
if (!chunks.contains(mutable2D.setComponents(cx + 1, cz + 1)) && !conNextX && !conNextZ) {
|
||||||
setExistingBlocks(BlockVector3.at(bx + 16, 0, bz + 16), BlockVector3.at(bx + 31, maxY, bz + 31));
|
setExistingBlocks(mutable.setComponents(bx + 16, 0, bz + 16), mutable2.setComponents(bx + 31, maxY, bz + 31));
|
||||||
}
|
}
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
int xx = x + bx;
|
int xx = x + bx;
|
||||||
|
@ -86,9 +86,9 @@ public class ClipboardPatternParser extends InputParser<Pattern> {
|
|||||||
throw new InputParseException(Caption.of("worldedit.error.parser.clipboard.missing-coordinates"));
|
throw new InputParseException(Caption.of("worldedit.error.parser.clipboard.missing-coordinates"));
|
||||||
}
|
}
|
||||||
offset = BlockVector3.at(
|
offset = BlockVector3.at(
|
||||||
Integer.valueOf(offsetSplit[0]),
|
Integer.parseInt(offsetSplit[0]),
|
||||||
Integer.valueOf(offsetSplit[1]),
|
Integer.parseInt(offsetSplit[1]),
|
||||||
Integer.valueOf(offsetSplit[2])
|
Integer.parseInt(offsetSplit[2])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
|
|
||||||
byte free = 0;
|
byte free = 0;
|
||||||
|
|
||||||
BlockVector3 mutablePos = MutableBlockVector3.ZERO;
|
BlockVector3 mutablePos = new MutableBlockVector3();
|
||||||
while (y <= maxY) {
|
while (y <= maxY) {
|
||||||
if (!world.getBlock(mutablePos.setComponents(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
|
if (!world.getBlock(mutablePos.setComponents(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
|
||||||
++free;
|
++free;
|
||||||
@ -209,9 +209,14 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
int yLessSearchHeight = y - WorldEdit.getInstance().getConfiguration().defaultVerticalHeight;
|
int yLessSearchHeight = y - WorldEdit.getInstance().getConfiguration().defaultVerticalHeight;
|
||||||
int minY = Math.min(worldMinY, yLessSearchHeight) + 2;
|
int minY = Math.min(worldMinY, yLessSearchHeight) + 2;
|
||||||
|
|
||||||
|
//FAWE start - mutable
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3(x, y, z);
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
while (y >= minY) {
|
while (y >= minY) {
|
||||||
final BlockVector3 pos = BlockVector3.at(x, y, z);
|
//FAWE start - mutable
|
||||||
final BlockState id = world.getBlock(pos);
|
final BlockState id = world.getBlock(mutable.mutY(y));
|
||||||
|
//FAWE end
|
||||||
if (id.getBlockType().getMaterial().isMovementBlocker()
|
if (id.getBlockType().getMaterial().isMovementBlocker()
|
||||||
&& trySetPosition(Vector3.at(x + 0.5, y + 1, z + 0.5))) {
|
&& trySetPosition(Vector3.at(x + 0.5, y + 1, z + 0.5))) {
|
||||||
return;
|
return;
|
||||||
@ -263,8 +268,14 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
int yPlusSearchHeight = y + WorldEdit.getInstance().getConfiguration().defaultVerticalHeight;
|
int yPlusSearchHeight = y + WorldEdit.getInstance().getConfiguration().defaultVerticalHeight;
|
||||||
int maxY = Math.min(world.getMaxY(), yPlusSearchHeight) + 2;
|
int maxY = Math.min(world.getMaxY(), yPlusSearchHeight) + 2;
|
||||||
|
|
||||||
|
//FAWE start - mutable
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3(x, y, z);
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
while (y <= maxY) {
|
while (y <= maxY) {
|
||||||
if (isLocationGoodForStanding(BlockVector3.at(x, y, z))
|
//FAWE start - mutable
|
||||||
|
if (isLocationGoodForStanding(mutable.mutY(y))
|
||||||
|
//FAWE end
|
||||||
&& trySetPosition(Vector3.at(x + 0.5, y, z + 0.5))) {
|
&& trySetPosition(Vector3.at(x + 0.5, y, z + 0.5))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -285,8 +296,14 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
int yLessSearchHeight = y - WorldEdit.getInstance().getConfiguration().defaultVerticalHeight;
|
int yLessSearchHeight = y - WorldEdit.getInstance().getConfiguration().defaultVerticalHeight;
|
||||||
int minY = Math.min(world.getMinY() + 1, yLessSearchHeight);
|
int minY = Math.min(world.getMinY() + 1, yLessSearchHeight);
|
||||||
|
|
||||||
|
//FAWE start - mutable
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3(x, y, z);
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
while (y >= minY) {
|
while (y >= minY) {
|
||||||
if (isLocationGoodForStanding(BlockVector3.at(x, y, z))
|
//FAWE start - mutable
|
||||||
|
if (isLocationGoodForStanding(mutable.mutY(y))
|
||||||
|
//FAWE end
|
||||||
&& trySetPosition(Vector3.at(x + 0.5, y, z + 0.5))) {
|
&& trySetPosition(Vector3.at(x + 0.5, y, z + 0.5))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -311,8 +328,12 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
int y = Math.max(world.getMinY(), pos.getBlockY() + 2);
|
int y = Math.max(world.getMinY(), pos.getBlockY() + 2);
|
||||||
int z = pos.getBlockZ();
|
int z = pos.getBlockZ();
|
||||||
|
|
||||||
|
//FAWE start - mutable
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3(x, y, z);
|
||||||
|
|
||||||
// No free space above
|
// No free space above
|
||||||
if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isAir()) {
|
if (!world.getBlock(mutable).getBlockType().getMaterial().isAir()) {
|
||||||
|
//FAWE end
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +342,9 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
|
|
||||||
while (y <= maxY) {
|
while (y <= maxY) {
|
||||||
// Found a ceiling!
|
// Found a ceiling!
|
||||||
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
|
//FAWE start - mutable
|
||||||
|
if (world.getBlock(mutable.mutY(y)).getBlockType().getMaterial().isMovementBlocker()) {
|
||||||
|
//FAWE end
|
||||||
int platformY = Math.max(initialY, y - 3 - clearance);
|
int platformY = Math.max(initialY, y - 3 - clearance);
|
||||||
if (platformY < initialY) { // if ==, they already have the given clearance, if <, clearance is too large
|
if (platformY < initialY) { // if ==, they already have the given clearance, if <, clearance is too large
|
||||||
return false;
|
return false;
|
||||||
@ -353,8 +376,14 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
final int z = pos.getBlockZ();
|
final int z = pos.getBlockZ();
|
||||||
final int maxY = Math.min(world.getMaxY() + 1, initialY + distance);
|
final int maxY = Math.min(world.getMaxY() + 1, initialY + distance);
|
||||||
|
|
||||||
|
//FAWE start - mutable
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3(x, y, z);
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
while (y <= world.getMaxY() + 2) {
|
while (y <= world.getMaxY() + 2) {
|
||||||
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
|
//FAWE start - mutable
|
||||||
|
if (world.getBlock(mutable.mutY(y)).getBlockType().getMaterial().isMovementBlocker()) {
|
||||||
|
//FAWE end
|
||||||
break; // Hit something
|
break; // Hit something
|
||||||
} else if (y > maxY + 1) {
|
} else if (y > maxY + 1) {
|
||||||
break;
|
break;
|
||||||
|
@ -213,11 +213,13 @@ public interface Extent extends InputExtent, OutputExtent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default int getHighestTerrainBlock(final int x, final int z, int minY, int maxY, Mask filter) {
|
default int getHighestTerrainBlock(final int x, final int z, int minY, int maxY, Mask filter) {
|
||||||
maxY = Math.min(maxY, getMaxY());
|
maxY = Math.min(maxY, Math.max(0, maxY));
|
||||||
minY = Math.max(getMinY(), minY);
|
minY = Math.max(0, minY);
|
||||||
BlockVector3 pos = MutableBlockVector3.at(x, minY, z);
|
|
||||||
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
for (int y = maxY; y >= minY; --y) {
|
for (int y = maxY; y >= minY; --y) {
|
||||||
if (filter.test(pos.mutY(y))) {
|
if (filter.test(mutable.setComponents(x, y, z))) {
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,8 +157,9 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat
|
|||||||
max = max.getMaximum(BlockVector3.at(x, y, z));
|
max = max.getMaximum(BlockVector3.at(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask.test(BlockVector3.at(x, y, z))) {
|
BlockVector3 pos = BlockVector3.at(x, y, z);
|
||||||
biomeBuffer.put(BlockVector3.at(x, y, z), biome);
|
if (mask.test(pos)) {
|
||||||
|
biomeBuffer.put(pos, biome);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return getExtent().setBiome(x, y, z, biome);
|
return getExtent().setBiome(x, y, z, biome);
|
||||||
|
@ -342,7 +342,7 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
|||||||
int yy = pos.getY() + rely;
|
int yy = pos.getY() + rely;
|
||||||
int zz = pos.getZ() + relz;
|
int zz = pos.getZ() + relz;
|
||||||
if (pasteBiomes) {
|
if (pasteBiomes) {
|
||||||
extent.setBiome(xx, yy, zz, Clipboard.this.getBiome(BlockVector3.at(pos.getX(), pos.getY(), pos.getZ())));
|
extent.setBiome(xx, yy, zz, Clipboard.this.getBiome(pos));
|
||||||
}
|
}
|
||||||
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
|
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -59,12 +59,12 @@ public abstract class BreadthFirstSearch implements Operation {
|
|||||||
public static final BlockVector3[] DIAGONAL_DIRECTIONS;
|
public static final BlockVector3[] DIAGONAL_DIRECTIONS;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
DEFAULT_DIRECTIONS[0] = (BlockVector3.at(0, -1, 0));
|
DEFAULT_DIRECTIONS[0] = (BlockVector3.UNIT_MINUS_Y);
|
||||||
DEFAULT_DIRECTIONS[1] = (BlockVector3.at(0, 1, 0));
|
DEFAULT_DIRECTIONS[1] = (BlockVector3.UNIT_Y);
|
||||||
DEFAULT_DIRECTIONS[2] = (BlockVector3.at(-1, 0, 0));
|
DEFAULT_DIRECTIONS[2] = (BlockVector3.UNIT_MINUS_X);
|
||||||
DEFAULT_DIRECTIONS[3] = (BlockVector3.at(1, 0, 0));
|
DEFAULT_DIRECTIONS[3] = (BlockVector3.UNIT_X);
|
||||||
DEFAULT_DIRECTIONS[4] = (BlockVector3.at(0, 0, -1));
|
DEFAULT_DIRECTIONS[4] = (BlockVector3.UNIT_MINUS_Z);
|
||||||
DEFAULT_DIRECTIONS[5] = (BlockVector3.at(0, 0, 1));
|
DEFAULT_DIRECTIONS[5] = (BlockVector3.UNIT_Z);
|
||||||
List<BlockVector3> list = new ArrayList<>();
|
List<BlockVector3> list = new ArrayList<>();
|
||||||
for (int x = -1; x <= 1; x++) {
|
for (int x = -1; x <= 1; x++) {
|
||||||
for (int y = -1; y <= 1; y++) {
|
for (int y = -1; y <= 1; y++) {
|
||||||
|
@ -122,7 +122,9 @@ public class RequestExtent implements Extent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||||
return getExtent().setBiome(BlockVector3.at(x, y, z), biome);
|
//FAWE start - no BV3
|
||||||
|
return getExtent().setBiome(x, y, z, biome);
|
||||||
|
//FAWE end
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.util.collection;
|
package com.sk89q.worldedit.util.collection;
|
||||||
|
|
||||||
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
import com.google.common.collect.AbstractIterator;
|
import com.google.common.collect.AbstractIterator;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||||
@ -64,18 +65,19 @@ class VectorPositionList implements PositionList {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<BlockVector3> iterator() {
|
public Iterator<BlockVector3> iterator() {
|
||||||
return new AbstractIterator<BlockVector3>() {
|
return new AbstractIterator<>() {
|
||||||
|
|
||||||
private final IntIterator iteratorX = delegateX.iterator();
|
private final IntIterator iteratorX = delegateX.iterator();
|
||||||
private final IntIterator iteratorY = delegateY.iterator();
|
private final IntIterator iteratorY = delegateY.iterator();
|
||||||
private final IntIterator iteratorZ = delegateZ.iterator();
|
private final IntIterator iteratorZ = delegateZ.iterator();
|
||||||
|
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockVector3 computeNext() {
|
protected BlockVector3 computeNext() {
|
||||||
if (!iteratorX.hasNext()) {
|
if (!iteratorX.hasNext()) {
|
||||||
return endOfData();
|
return endOfData();
|
||||||
}
|
}
|
||||||
return BlockVector3.at(
|
return mutable.setComponents(
|
||||||
iteratorX.nextInt(),
|
iteratorX.nextInt(),
|
||||||
iteratorY.nextInt(),
|
iteratorY.nextInt(),
|
||||||
iteratorZ.nextInt()
|
iteratorZ.nextInt()
|
||||||
@ -91,13 +93,14 @@ class VectorPositionList implements PositionList {
|
|||||||
private final IntListIterator iteratorX = delegateX.listIterator(delegateX.size());
|
private final IntListIterator iteratorX = delegateX.listIterator(delegateX.size());
|
||||||
private final IntListIterator iteratorY = delegateY.listIterator(delegateY.size());
|
private final IntListIterator iteratorY = delegateY.listIterator(delegateY.size());
|
||||||
private final IntListIterator iteratorZ = delegateZ.listIterator(delegateZ.size());
|
private final IntListIterator iteratorZ = delegateZ.listIterator(delegateZ.size());
|
||||||
|
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockVector3 computeNext() {
|
protected BlockVector3 computeNext() {
|
||||||
if (!iteratorX.hasPrevious()) {
|
if (!iteratorX.hasPrevious()) {
|
||||||
return endOfData();
|
return endOfData();
|
||||||
}
|
}
|
||||||
return BlockVector3.at(
|
return mutable.setComponents(
|
||||||
iteratorX.previousInt(),
|
iteratorX.previousInt(),
|
||||||
iteratorY.previousInt(),
|
iteratorY.previousInt(),
|
||||||
iteratorZ.previousInt()
|
iteratorZ.previousInt()
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren