geforkt von Mirrors/FastAsyncWorldEdit
Changed //center to use visitors.
Dieser Commit ist enthalten in:
Ursprung
570b4ebd93
Commit
e022804c27
@ -978,25 +978,26 @@ public class EditSession {
|
|||||||
return visitor.getAffected();
|
return visitor.getAffected();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int center(Region region, Pattern pattern)
|
/**
|
||||||
throws MaxChangedBlocksException {
|
* Sets the blocks at the center of the given region to the given pattern.
|
||||||
|
* If the center sits between two blocks on a certain axis, then two blocks
|
||||||
|
* will be placed to mark the center.
|
||||||
|
*
|
||||||
|
* @param region the region to find the center of
|
||||||
|
* @param pattern the replacement pattern
|
||||||
|
* @return the number of blocks placed
|
||||||
|
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||||
|
*/
|
||||||
|
public int center(Region region, Pattern pattern) throws MaxChangedBlocksException {
|
||||||
|
checkNotNull(region, "region must not be null");
|
||||||
|
checkNotNull(pattern, "pattern must not be null");
|
||||||
|
|
||||||
Vector center = region.getCenter();
|
Vector center = region.getCenter();
|
||||||
int x2 = center.getBlockX();
|
Region centerRegion = new CuboidRegion(
|
||||||
int y2 = center.getBlockY();
|
getWorld(), // Causes clamping of Y range
|
||||||
int z2 = center.getBlockZ();
|
new Vector((int) center.getX(), (int) center.getY(), (int) center.getZ()),
|
||||||
|
center.toBlockVector());
|
||||||
int affected = 0;
|
return setBlocks(centerRegion, pattern);
|
||||||
for (int x = (int) center.getX(); x <= x2; x++) {
|
|
||||||
for (int y = (int) center.getY(); y <= y2; y++) {
|
|
||||||
for (int z = (int) center.getZ(); z <= z2; z++) {
|
|
||||||
if (setBlock(new Vector(x, y, z), pattern)) {
|
|
||||||
affected++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return affected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren