geforkt von Mirrors/FastAsyncWorldEdit
- Added a -p flag to //flip that makes it flip around the player instead of the center of the clipboard.
- Code cleanup
Dieser Commit ist enthalten in:
Ursprung
84ed4bf4c3
Commit
2281684f20
@ -167,7 +167,7 @@ public class CuboidClipboard {
|
|||||||
Math.abs(sizeRotated.getBlockY()),
|
Math.abs(sizeRotated.getBlockY()),
|
||||||
Math.abs(sizeRotated.getBlockZ()));
|
Math.abs(sizeRotated.getBlockZ()));
|
||||||
offset = offset.transform2D(angle, 0, 0, 0, 0)
|
offset = offset.transform2D(angle, 0, 0, 0, 0)
|
||||||
.subtract(shiftX, 0, shiftZ);;
|
.subtract(shiftX, 0, shiftZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -175,14 +175,15 @@ public class CuboidClipboard {
|
|||||||
*
|
*
|
||||||
* @param dir
|
* @param dir
|
||||||
*/
|
*/
|
||||||
public void flip(FlipDirection dir) {
|
public void flip(FlipDirection dir, boolean aroundPlayer) {
|
||||||
int width = getWidth();
|
int width = getWidth();
|
||||||
int length = getLength();
|
int length = getLength();
|
||||||
int height = getHeight();
|
int height = getHeight();
|
||||||
|
|
||||||
if (dir == FlipDirection.NORTH_SOUTH) {
|
switch (dir) {
|
||||||
int len = (int)Math.floor(width / 2);
|
case NORTH_SOUTH:
|
||||||
for (int xs = 0; xs < len; ++xs) {
|
int wid = (int)Math.floor(width / 2);
|
||||||
|
for (int xs = 0; xs < wid; ++xs) {
|
||||||
for (int z = 0; z < length; ++z) {
|
for (int z = 0; z < length; ++z) {
|
||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
BaseBlock old = data[xs][y][z];
|
BaseBlock old = data[xs][y][z];
|
||||||
@ -192,7 +193,13 @@ public class CuboidClipboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (dir == FlipDirection.WEST_EAST) {
|
|
||||||
|
if (aroundPlayer)
|
||||||
|
offset = offset.setX(1 - offset.getX() - width);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WEST_EAST:
|
||||||
int len = (int)Math.floor(length / 2);
|
int len = (int)Math.floor(length / 2);
|
||||||
for (int zs = 0; zs < len; ++zs) {
|
for (int zs = 0; zs < len; ++zs) {
|
||||||
for (int x = 0; x < width; ++x) {
|
for (int x = 0; x < width; ++x) {
|
||||||
@ -204,9 +211,15 @@ public class CuboidClipboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (dir == FlipDirection.UP_DOWN) {
|
|
||||||
int len = (int)Math.floor(height / 2);
|
if (aroundPlayer)
|
||||||
for (int ys = 0; ys < len; ++ys) {
|
offset = offset.setZ(1 - offset.getZ() - length);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UP_DOWN:
|
||||||
|
int hei = (int)Math.floor(height / 2);
|
||||||
|
for (int ys = 0; ys < hei; ++ys) {
|
||||||
for (int x = 0; x < width; ++x) {
|
for (int x = 0; x < width; ++x) {
|
||||||
for (int z = 0; z < length; ++z) {
|
for (int z = 0; z < length; ++z) {
|
||||||
BaseBlock old = data[x][ys][z];
|
BaseBlock old = data[x][ys][z];
|
||||||
@ -215,6 +228,11 @@ public class CuboidClipboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aroundPlayer)
|
||||||
|
offset = offset.setY(1 - offset.getY() - height);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,8 @@ public class ClipboardCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
aliases = {"/flip"},
|
aliases = {"/flip"},
|
||||||
usage = "[dir]",
|
usage = "[dir]",
|
||||||
desc = "Flip the contents of the clipboard",
|
flags = "p",
|
||||||
|
desc = "Flip the contents of the clipboard. To flip it around yourself, use the -p flag.",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 1
|
max = 1
|
||||||
)
|
)
|
||||||
@ -166,7 +167,7 @@ public class ClipboardCommands {
|
|||||||
args.argsLength() > 0 ? args.getString(0).toLowerCase() : "me");
|
args.argsLength() > 0 ? args.getString(0).toLowerCase() : "me");
|
||||||
|
|
||||||
CuboidClipboard clipboard = session.getClipboard();
|
CuboidClipboard clipboard = session.getClipboard();
|
||||||
clipboard.flip(dir);
|
clipboard.flip(dir, args.hasFlag('p'));
|
||||||
player.print("Clipboard flipped.");
|
player.print("Clipboard flipped.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren