3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-27 11:20:04 +01:00

Moved FlatRegion cast code to FlatRegionApplicator's constructor.

Dieser Commit ist enthalten in:
sk89q 2014-03-01 13:54:44 -08:00
Ursprung c87b1acbad
Commit 31060e1e0c

Datei anzeigen

@ -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++;