mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 04:46:40 +00:00
minor tweak for mutable vectors
This commit is contained in:
@ -20,17 +20,14 @@
|
||||
package com.sk89q.worldedit.regions;
|
||||
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||
|
||||
@ -320,7 +317,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
@Override
|
||||
public Iterator<BlockVector2> iterator() {
|
||||
return new Iterator<BlockVector2>() {
|
||||
private MutableBlockVector2D pos = new MutableBlockVector2D().setComponents(maxX + 1, maxZ);
|
||||
private MutableBlockVector2 pos = new MutableBlockVector2().setComponents(maxX + 1, maxZ);
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
@ -329,7 +326,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
|
||||
@Override
|
||||
public BlockVector2 next() {
|
||||
MutableBlockVector2D result = pos;
|
||||
MutableBlockVector2 result = pos;
|
||||
// calc next
|
||||
pos.setComponents(pos.getX() - 1, pos.getZ());
|
||||
if (pos.getX() <= minX) {
|
||||
@ -339,7 +336,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
pos.setComponents(maxX, pos.getZ() - 1);
|
||||
}
|
||||
}
|
||||
return result.toBlockVector2();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -437,7 +434,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
return iterator_old();
|
||||
}
|
||||
return new Iterator<BlockVector3>() {
|
||||
final MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
final MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||
private BlockVector3 min = getMinimumPoint();
|
||||
private BlockVector3 max = getMaximumPoint();
|
||||
|
||||
@ -492,7 +489,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
x = tx;
|
||||
y = ty;
|
||||
hasNext = false;
|
||||
return mutable.toBlockVector3();
|
||||
return mutable;
|
||||
}
|
||||
} else {
|
||||
z = cbz;
|
||||
@ -521,13 +518,13 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
x = cbx;
|
||||
}
|
||||
}
|
||||
return mutable.toBlockVector3();
|
||||
return mutable;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Iterator<BlockVector3> iterator_old() {
|
||||
final MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
final MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||
return new Iterator<BlockVector3>() {
|
||||
private BlockVector3 min = getMinimumPoint();
|
||||
private BlockVector3 max = getMaximumPoint();
|
||||
@ -573,7 +570,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
}
|
||||
}
|
||||
}
|
||||
return mutable.toBlockVector3();
|
||||
return mutable;
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -583,7 +580,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
return new Iterable<BlockVector2>() {
|
||||
@Override
|
||||
public Iterator<BlockVector2> iterator() {
|
||||
MutableBlockVector2D mutable = new MutableBlockVector2D();
|
||||
MutableBlockVector2 mutable = new MutableBlockVector2();
|
||||
return new Iterator<BlockVector2>() {
|
||||
private BlockVector3 min = getMinimumPoint();
|
||||
private BlockVector3 max = getMaximumPoint();
|
||||
|
@ -306,7 +306,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
|
||||
double dz = Math.abs(pz - center.getBlockZ()) * radiusInverse.getZ();
|
||||
|
||||
return dx * dx + dz * dz <= 1;
|
||||
// return position.toBlockVector2().subtract(center).toVector2().divide(radius).lengthSq() <= 1;
|
||||
// return position.subtract(center).toVector2().divide(radius).lengthSq() <= 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
package com.sk89q.worldedit.regions;
|
||||
|
||||
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
|
@ -23,12 +23,13 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
|
||||
public class WorldEditExpressionEnvironment implements ExpressionEnvironment {
|
||||
private final Vector3 unit;
|
||||
private final Vector3 zero2;
|
||||
private Vector3 current = Vector3.ZERO;
|
||||
private Vector3 current = new MutableVector3(Vector3.ZERO);
|
||||
private EditSession editSession;
|
||||
private Extent extent;
|
||||
|
||||
@ -81,6 +82,10 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment {
|
||||
return extent.getBlock(toWorld(x, y, z)).getBlockType().getLegacyCombinedId() & 0xF;
|
||||
}
|
||||
|
||||
public void setCurrentBlock(int x, int y, int z) {
|
||||
current.setComponents(x, y, z);
|
||||
}
|
||||
|
||||
public void setCurrentBlock(Vector3 current) {
|
||||
this.current = current;
|
||||
}
|
||||
|
Reference in New Issue
Block a user