Skip to content

Commit

Permalink
Make #clipboard in height brush work again (#3098)
Browse files Browse the repository at this point in the history
  • Loading branch information
SirYwell authored Feb 14, 2025
1 parent dac62f1 commit 7bcc9aa
Showing 1 changed file with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public void stencilBrush(
int maxY = player.getWorld().getMaxY();
try {
brush = new StencilBrush(stream, rotation, yscale, onlyWhite,
"#clipboard".equalsIgnoreCase(image)
isClipboard(image)
? session.getClipboard().getClipboard() : null, minY, maxY
);
} catch (EmptyClipboardException ignored) {
Expand Down Expand Up @@ -903,32 +903,28 @@ private void terrainBrush(
int minY = player.getWorld().getMinY();
int maxY = player.getWorld().getMaxY();
if (flat) {
try {
brush = new FlattenBrush(stream, rotation, yscale, layers, smooth,
"#clipboard".equalsIgnoreCase(image)
? session.getClipboard().getClipboard() : null, shape, minY, maxY
);
} catch (EmptyClipboardException ignored) {
brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, null, shape, minY, maxY);
}
brush = new FlattenBrush(stream, rotation, yscale, layers, smooth,
isClipboard(image)
? session.getClipboard().getClipboard() : null, shape, minY, maxY
);
} else {
try {
brush = new HeightBrush(stream, rotation, yscale, layers, smooth,
"#clipboard".equalsIgnoreCase(image)
? session.getClipboard().getClipboard() : null, minY, maxY
);
} catch (EmptyClipboardException ignored) {
brush = new HeightBrush(stream, rotation, yscale, layers, smooth, null, minY, maxY);
}
brush = new HeightBrush(stream, rotation, yscale, layers, smooth,
isClipboard(image)
? session.getClipboard().getClipboard() : null, minY, maxY
);
}
if (randomRotate) {
brush.setRandomRotate(true);
}
set(context, brush, "worldedit.brush.height").setSize(radius);
}

private static boolean isClipboard(String image) {
return "#clipboard".equalsIgnoreCase(image);
}

private InputStream getHeightmapStream(String filename) throws FileNotFoundException {
if (filename == null || "none".equalsIgnoreCase(filename)) {
if (filename == null || "none".equalsIgnoreCase(filename) || isClipboard(filename)) {
return null;
}
String filenamePng = filename.endsWith(".png") ? filename : filename + ".png";
Expand Down

0 comments on commit 7bcc9aa

Please sign in to comment.