Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 11:00:05 +01:00
//sel poly now keeps the previous selection, converting its outline into a polygon if necessary.
This loses some blocks, if anyone cares
Dieser Commit ist enthalten in:
Ursprung
76fd63d64b
Commit
7d503fdc5c
@ -616,7 +616,7 @@ public class SelectionCommands {
|
|||||||
selector = new ExtendingCuboidRegionSelector(oldSelector);
|
selector = new ExtendingCuboidRegionSelector(oldSelector);
|
||||||
player.print("Cuboid: left click for a starting point, right click to extend");
|
player.print("Cuboid: left click for a starting point, right click to extend");
|
||||||
} else if (typeName.equalsIgnoreCase("poly")) {
|
} else if (typeName.equalsIgnoreCase("poly")) {
|
||||||
selector = new Polygonal2DRegionSelector(world);
|
selector = new Polygonal2DRegionSelector(oldSelector);
|
||||||
player.print("2D polygon selector: Left/right click to add a point.");
|
player.print("2D polygon selector: Left/right click to add a point.");
|
||||||
} else {
|
} else {
|
||||||
player.printError("Only 'cuboid', 'extend' and 'poly' are accepted.");
|
player.printError("Only 'cuboid', 'extend' and 'poly' are accepted.");
|
||||||
|
@ -45,11 +45,11 @@ public class CuboidRegionSelector implements RegionSelector, CUIPointBasedRegion
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CuboidRegionSelector() {
|
public CuboidRegionSelector() {
|
||||||
this((LocalWorld)null);
|
this((LocalWorld) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CuboidRegionSelector(RegionSelector oldSelector) {
|
public CuboidRegionSelector(RegionSelector oldSelector) {
|
||||||
region = new CuboidRegion(oldSelector.getIncompleteRegion().getWorld(), new Vector(), new Vector());
|
this(oldSelector.getIncompleteRegion().getWorld());
|
||||||
if (oldSelector instanceof CuboidRegionSelector) {
|
if (oldSelector instanceof CuboidRegionSelector) {
|
||||||
final CuboidRegionSelector cuboidRegionSelector = (CuboidRegionSelector) oldSelector;
|
final CuboidRegionSelector cuboidRegionSelector = (CuboidRegionSelector) oldSelector;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class Polygonal2DRegion implements Region {
|
|||||||
* Construct the region
|
* Construct the region
|
||||||
*/
|
*/
|
||||||
public Polygonal2DRegion() {
|
public Polygonal2DRegion() {
|
||||||
this(null);
|
this((LocalWorld) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,6 +84,11 @@ public class Polygonal2DRegion implements Region {
|
|||||||
recalculate();
|
recalculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Polygonal2DRegion(Polygonal2DRegion region) {
|
||||||
|
this(region.world, region.points, region.minY, region.maxY);
|
||||||
|
hasY = region.hasY;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of points.
|
* Get the list of points.
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.regions;
|
package com.sk89q.worldedit.regions;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
@ -46,6 +47,39 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIPointBasedR
|
|||||||
region = new Polygonal2DRegion(world);
|
region = new Polygonal2DRegion(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Polygonal2DRegionSelector(RegionSelector oldSelector) {
|
||||||
|
this(oldSelector.getIncompleteRegion().getWorld());
|
||||||
|
if (oldSelector instanceof Polygonal2DRegionSelector) {
|
||||||
|
final Polygonal2DRegionSelector polygonal2DRegionSelector = (Polygonal2DRegionSelector) oldSelector;
|
||||||
|
|
||||||
|
pos1 = polygonal2DRegionSelector.pos1;
|
||||||
|
region = new Polygonal2DRegion(polygonal2DRegionSelector.region);
|
||||||
|
} else {
|
||||||
|
final Region oldRegion;
|
||||||
|
try {
|
||||||
|
oldRegion = oldSelector.getRegion();
|
||||||
|
} catch (IncompleteRegionException e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockVector min = oldRegion.getMinimumPoint().toBlockVector();
|
||||||
|
BlockVector max = oldRegion.getMaximumPoint().toBlockVector();
|
||||||
|
|
||||||
|
int minY = min.getBlockY();
|
||||||
|
int maxY = max.getBlockY();
|
||||||
|
|
||||||
|
List<BlockVector2D> points = new ArrayList<BlockVector2D>(4);
|
||||||
|
|
||||||
|
points.add(new BlockVector2D(min.getX(), min.getZ()));
|
||||||
|
points.add(new BlockVector2D(min.getX(), max.getZ()));
|
||||||
|
points.add(new BlockVector2D(max.getX(), max.getZ()));
|
||||||
|
points.add(new BlockVector2D(max.getX(), min.getZ()));
|
||||||
|
|
||||||
|
pos1 = min;
|
||||||
|
region = new Polygonal2DRegion(oldRegion.getWorld(), points, minY, maxY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean selectPrimary(Vector pos) {
|
public boolean selectPrimary(Vector pos) {
|
||||||
if (pos.equals(pos1)) {
|
if (pos.equals(pos1)) {
|
||||||
return false;
|
return false;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren