Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-08 04:20:06 +01:00
Moved FlatRegion cast code to FlatRegionApplicator's constructor.
Dieser Commit ist enthalten in:
Ursprung
c87b1acbad
Commit
31060e1e0c
@ -30,13 +30,18 @@ import com.sk89q.worldedit.regions.Region;
|
|||||||
*/
|
*/
|
||||||
public class FlatRegionApplicator implements Operation {
|
public class FlatRegionApplicator implements Operation {
|
||||||
|
|
||||||
private final Region region;
|
private final FlatRegion flatRegion;
|
||||||
private final FlatRegionFunction function;
|
private final FlatRegionFunction function;
|
||||||
private int affected = 0;
|
private int affected = 0;
|
||||||
|
|
||||||
public FlatRegionApplicator(Region region, FlatRegionFunction function) {
|
public FlatRegionApplicator(Region region, FlatRegionFunction function) {
|
||||||
this.region = region;
|
|
||||||
this.function = function;
|
this.function = function;
|
||||||
|
|
||||||
|
if (region instanceof FlatRegion) {
|
||||||
|
flatRegion = (FlatRegion) region;
|
||||||
|
} else {
|
||||||
|
flatRegion = CuboidRegion.makeCuboid(region);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,14 +55,6 @@ public class FlatRegionApplicator implements Operation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Operation resume() throws WorldEditException {
|
public Operation resume() throws WorldEditException {
|
||||||
FlatRegion flatRegion;
|
|
||||||
|
|
||||||
if (region instanceof FlatRegion) {
|
|
||||||
flatRegion = (FlatRegion) region;
|
|
||||||
} else {
|
|
||||||
flatRegion = CuboidRegion.makeCuboid(region);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Vector2D pt : flatRegion.asFlatRegion()) {
|
for (Vector2D pt : flatRegion.asFlatRegion()) {
|
||||||
if (function.apply(pt)) {
|
if (function.apply(pt)) {
|
||||||
affected++;
|
affected++;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren