mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-12-01 07:03:52 +01:00
Fix deform
This commit is contained in:
parent
3f9e202f3a
commit
04e281e72d
@ -10,7 +10,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.boydti.fawe'
|
group = 'com.boydti.fawe'
|
||||||
version = '3.3.12'
|
version = '3.3.13'
|
||||||
description = """FastAsyncWorldEdit"""
|
description = """FastAsyncWorldEdit"""
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: FastAsyncWorldEdit
|
name: FastAsyncWorldEdit
|
||||||
main: com.boydti.fawe.bukkit.FaweBukkit
|
main: com.boydti.fawe.bukkit.FaweBukkit
|
||||||
version: 3.3.12
|
version: 3.3.13
|
||||||
description: Fast Async WorldEdit plugin
|
description: Fast Async WorldEdit plugin
|
||||||
authors: [Empire92]
|
authors: [Empire92]
|
||||||
loadbefore: [WorldEdit]
|
loadbefore: [WorldEdit]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: FastAsyncWorldEdit
|
name: FastAsyncWorldEdit
|
||||||
main: com.boydti.fawe.bukkit.FaweBukkit
|
main: com.boydti.fawe.bukkit.FaweBukkit
|
||||||
version: 3.3.12
|
version: 3.3.13
|
||||||
description: Fast Async WorldEdit plugin
|
description: Fast Async WorldEdit plugin
|
||||||
authors: [Empire92]
|
authors: [Empire92]
|
||||||
loadbefore: [WorldEdit]
|
loadbefore: [WorldEdit]
|
||||||
|
@ -113,7 +113,6 @@ import com.sk89q.worldedit.regions.shape.RegionShape;
|
|||||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||||
import com.sk89q.worldedit.util.Countable;
|
import com.sk89q.worldedit.util.Countable;
|
||||||
import com.sk89q.worldedit.util.TreeGenerator;
|
import com.sk89q.worldedit.util.TreeGenerator;
|
||||||
import com.sk89q.worldedit.util.collection.DoubleArrayList;
|
|
||||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||||
import com.sk89q.worldedit.world.AbstractWorld;
|
import com.sk89q.worldedit.world.AbstractWorld;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
@ -2255,43 +2254,25 @@ public class EditSession implements Extent {
|
|||||||
public int deformRegion(final Region region, final Vector zero, final Vector unit, final String expressionString) throws ExpressionException, MaxChangedBlocksException {
|
public int deformRegion(final Region region, final Vector zero, final Vector unit, final String expressionString) throws ExpressionException, MaxChangedBlocksException {
|
||||||
final Expression expression = Expression.compile(expressionString, "x", "y", "z");
|
final Expression expression = Expression.compile(expressionString, "x", "y", "z");
|
||||||
expression.optimize();
|
expression.optimize();
|
||||||
|
|
||||||
final RValue x = expression.getVariable("x", false);
|
final RValue x = expression.getVariable("x", false);
|
||||||
final RValue y = expression.getVariable("y", false);
|
final RValue y = expression.getVariable("y", false);
|
||||||
final RValue z = expression.getVariable("z", false);
|
final RValue z = expression.getVariable("z", false);
|
||||||
|
|
||||||
final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(this, unit, zero);
|
final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(this, unit, zero);
|
||||||
expression.setEnvironment(environment);
|
expression.setEnvironment(environment);
|
||||||
|
int affected = 0;
|
||||||
final DoubleArrayList<BlockVector, BaseBlock> queue = new DoubleArrayList<BlockVector, BaseBlock>(false);
|
for (BlockVector position : region) {
|
||||||
|
|
||||||
for (final BlockVector position : region) {
|
|
||||||
// offset, scale
|
// offset, scale
|
||||||
final Vector scaled = position.subtract(zero).divide(unit);
|
final Vector scaled = position.subtract(zero).divide(unit);
|
||||||
|
|
||||||
// transform
|
// transform
|
||||||
expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ());
|
expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ());
|
||||||
|
|
||||||
final BlockVector sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue());
|
final BlockVector sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue());
|
||||||
|
|
||||||
// read block from world
|
// read block from world
|
||||||
final BaseBlock material = new BaseBlock(this.world.getBlockType(sourcePosition), this.world.getBlockData(sourcePosition));
|
BaseBlock material = FaweCache.CACHE_BLOCK[this.queue.getCombinedId4Data(sourcePosition.getBlockX(), sourcePosition.getBlockY(), sourcePosition.getBlockZ())];
|
||||||
|
|
||||||
// queue operation
|
// queue operation
|
||||||
queue.put(position, material);
|
|
||||||
}
|
|
||||||
|
|
||||||
int affected = 0;
|
|
||||||
for (final Map.Entry<BlockVector, BaseBlock> entry : queue) {
|
|
||||||
final BlockVector position = entry.getKey();
|
|
||||||
final BaseBlock material = entry.getValue();
|
|
||||||
|
|
||||||
// set at new position
|
|
||||||
if (this.setBlock(position, material)) {
|
if (this.setBlock(position, material)) {
|
||||||
++affected;
|
++affected;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return affected;
|
return affected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public final class Operations {
|
|||||||
/**
|
/**
|
||||||
* Complete a given operation synchronously until it completes.
|
* Complete a given operation synchronously until it completes.
|
||||||
*
|
*
|
||||||
* @param op operation to execute
|
* @param operation operation to execute
|
||||||
* @throws WorldEditException WorldEdit exception
|
* @throws WorldEditException WorldEdit exception
|
||||||
*/
|
*/
|
||||||
public static void complete(Operation operation) throws WorldEditException {
|
public static void complete(Operation operation) throws WorldEditException {
|
||||||
@ -47,7 +47,7 @@ public final class Operations {
|
|||||||
* Complete a given operation synchronously until it completes. Catch all
|
* Complete a given operation synchronously until it completes. Catch all
|
||||||
* errors that is not {@link MaxChangedBlocksException} for legacy reasons.
|
* errors that is not {@link MaxChangedBlocksException} for legacy reasons.
|
||||||
*
|
*
|
||||||
* @param op operation to execute
|
* @param operation operation to execute
|
||||||
* @throws MaxChangedBlocksException thrown when too many blocks have been changed
|
* @throws MaxChangedBlocksException thrown when too many blocks have been changed
|
||||||
*/
|
*/
|
||||||
public static void completeLegacy(Operation operation) throws MaxChangedBlocksException {
|
public static void completeLegacy(Operation operation) throws MaxChangedBlocksException {
|
||||||
@ -65,7 +65,7 @@ public final class Operations {
|
|||||||
* {@link com.sk89q.worldedit.WorldEditException} exceptions as
|
* {@link com.sk89q.worldedit.WorldEditException} exceptions as
|
||||||
* {@link java.lang.RuntimeException}s.
|
* {@link java.lang.RuntimeException}s.
|
||||||
*
|
*
|
||||||
* @param op operation to execute
|
* @param operation operation to execute
|
||||||
*/
|
*/
|
||||||
public static void completeBlindly(Operation operation) {
|
public static void completeBlindly(Operation operation) {
|
||||||
try {
|
try {
|
||||||
|
@ -416,6 +416,45 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Iterator<BlockVector> iterator_old() {
|
||||||
|
final BlockVector v = new BlockVector(0,0,0);
|
||||||
|
return new Iterator<BlockVector>() {
|
||||||
|
private Vector min = getMinimumPoint();
|
||||||
|
private Vector max = getMaximumPoint();
|
||||||
|
private int nextX = min.getBlockX();
|
||||||
|
private int nextY = min.getBlockY();
|
||||||
|
private int nextZ = min.getBlockZ();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return (nextX != Integer.MIN_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector next() {
|
||||||
|
v.x = nextX;
|
||||||
|
v.y = nextY;
|
||||||
|
v.z = nextZ;
|
||||||
|
if (++nextX > max.getBlockX()) {
|
||||||
|
nextX = min.getBlockX();
|
||||||
|
if (++nextY > max.getBlockY()) {
|
||||||
|
nextY = min.getBlockY();
|
||||||
|
if (++nextZ > max.getBlockZ()) {
|
||||||
|
nextX = Integer.MIN_VALUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Vector2D> asFlatRegion() {
|
public Iterable<Vector2D> asFlatRegion() {
|
||||||
return new Iterable<Vector2D>() {
|
return new Iterable<Vector2D>() {
|
||||||
|
@ -13,7 +13,7 @@ import org.spongepowered.api.plugin.Plugin;
|
|||||||
import org.spongepowered.api.plugin.PluginContainer;
|
import org.spongepowered.api.plugin.PluginContainer;
|
||||||
import org.spongepowered.api.profile.GameProfileManager;
|
import org.spongepowered.api.profile.GameProfileManager;
|
||||||
|
|
||||||
@Plugin(id = "com.boydti.fawe", name = "FastAsyncWorldEdit", description = "Lagless WorldEdit, Area restrictions, Memory mangement, Block logging", url = "https://github.com/boy0001/FastAsyncWorldedit", version = "3.3.12")
|
@Plugin(id = "com.boydti.fawe", name = "FastAsyncWorldEdit", description = "Lagless WorldEdit, Area restrictions, Memory mangement, Block logging", url = "https://github.com/boy0001/FastAsyncWorldedit", version = "3.3.13")
|
||||||
public class SpongeMain {
|
public class SpongeMain {
|
||||||
public PluginContainer plugin;
|
public PluginContainer plugin;
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>FastAsyncWorldEdit</artifactId>
|
<artifactId>FastAsyncWorldEdit</artifactId>
|
||||||
<version>3.3.12</version>
|
<version>3.3.13</version>
|
||||||
<name>FastAsyncWorldEdit</name>
|
<name>FastAsyncWorldEdit</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
Loading…
Reference in New Issue
Block a user