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:
Ursprung
c87b1acbad
Commit
31060e1e0c
@ -30,13 +30,18 @@ import com.sk89q.worldedit.regions.Region;
|
||||
*/
|
||||
public class FlatRegionApplicator implements Operation {
|
||||
|
||||
private final Region region;
|
||||
private final FlatRegion flatRegion;
|
||||
private final FlatRegionFunction function;
|
||||
private int affected = 0;
|
||||
|
||||
public FlatRegionApplicator(Region region, FlatRegionFunction function) {
|
||||
this.region = region;
|
||||
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
|
||||
public Operation resume() throws WorldEditException {
|
||||
FlatRegion flatRegion;
|
||||
|
||||
if (region instanceof FlatRegion) {
|
||||
flatRegion = (FlatRegion) region;
|
||||
} else {
|
||||
flatRegion = CuboidRegion.makeCuboid(region);
|
||||
}
|
||||
|
||||
for (Vector2D pt : flatRegion.asFlatRegion()) {
|
||||
if (function.apply(pt)) {
|
||||
affected++;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren