Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-27 03:12:37 +01:00
Removed EditSession from RecursiveVisitor.
Dieser Commit ist enthalten in:
Ursprung
f0d97c5231
Commit
25021b4a30
@ -828,7 +828,9 @@ public class EditSession implements Extent {
|
||||
|
||||
MaskIntersection mask = new MaskIntersection(
|
||||
new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))),
|
||||
new BoundedHeightMask(origin.getBlockY() - depth + 1, origin.getBlockY()),
|
||||
new BoundedHeightMask(
|
||||
Math.max(origin.getBlockY() - depth + 1, 0),
|
||||
Math.min(getWorld().getMaxY(), origin.getBlockY())),
|
||||
Masks.negate(new ExistingBlockMask(this)));
|
||||
|
||||
// Want to replace blocks
|
||||
@ -837,9 +839,9 @@ public class EditSession implements Extent {
|
||||
// Pick how we're going to visit blocks
|
||||
RecursiveVisitor visitor;
|
||||
if (recursive) {
|
||||
visitor = new RecursiveVisitor(this, mask, replace);
|
||||
visitor = new RecursiveVisitor(mask, replace);
|
||||
} else {
|
||||
visitor = new DownwardVisitor(this, mask, replace, origin.getBlockY());
|
||||
visitor = new DownwardVisitor(mask, replace, origin.getBlockY());
|
||||
}
|
||||
|
||||
// Start at the origin
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -40,13 +39,12 @@ public class DownwardVisitor extends RecursiveVisitor {
|
||||
/**
|
||||
* Create a new visitor.
|
||||
*
|
||||
* @param editSession the edit session
|
||||
* @param mask the mask
|
||||
* @param function the function
|
||||
* @param baseY the base Y
|
||||
*/
|
||||
public DownwardVisitor(EditSession editSession, Mask mask, RegionFunction function, int baseY) {
|
||||
super(editSession, mask, function);
|
||||
public DownwardVisitor(Mask mask, RegionFunction function, int baseY) {
|
||||
super(mask, function);
|
||||
|
||||
this.baseY = baseY;
|
||||
|
||||
|
@ -42,7 +42,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class LayerVisitor implements Operation {
|
||||
|
||||
private final EditSession editSession;
|
||||
private final FlatRegion flatRegion;
|
||||
private final LayerFunction function;
|
||||
private Mask2D mask = Masks.alwaysTrue2D();
|
||||
@ -57,13 +56,11 @@ public class LayerVisitor implements Operation {
|
||||
* @param maxY the maximum Y to begin the search at
|
||||
* @param function the layer function to apply t blocks
|
||||
*/
|
||||
public LayerVisitor(EditSession editSession, FlatRegion flatRegion, int minY, int maxY, LayerFunction function) {
|
||||
checkNotNull(editSession);
|
||||
public LayerVisitor(FlatRegion flatRegion, int minY, int maxY, LayerFunction function) {
|
||||
checkNotNull(flatRegion);
|
||||
checkArgument(minY <= maxY, "minY <= maxY required");
|
||||
checkNotNull(function);
|
||||
|
||||
this.editSession = editSession;
|
||||
this.flatRegion = flatRegion;
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
|
@ -19,10 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
|
||||
/**
|
||||
* An implementation of an {@link BreadthFirstSearch} that uses a mask to
|
||||
@ -30,21 +29,15 @@ import com.sk89q.worldedit.function.RegionFunction;
|
||||
*/
|
||||
public class RecursiveVisitor extends BreadthFirstSearch {
|
||||
|
||||
private final EditSession editSession;
|
||||
private final Mask mask;
|
||||
|
||||
public RecursiveVisitor(EditSession editSession, Mask mask, RegionFunction function) {
|
||||
public RecursiveVisitor(Mask mask, RegionFunction function) {
|
||||
super(function);
|
||||
this.editSession = editSession;
|
||||
this.mask = mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isVisitable(Vector from, Vector to) {
|
||||
int y = to.getBlockY();
|
||||
if (y < 0 || y > editSession.getWorld().getMaxY()) {
|
||||
return false;
|
||||
}
|
||||
return mask.test(to);
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren