3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-20 01:40:06 +01:00

Fix out of bounds error for erode and pull brushes (#2554)

- Fixes #2380
Dieser Commit ist enthalten in:
Zeranny 2024-01-28 12:10:48 +00:00 committet von GitHub
Ursprung b919633a87
Commit 763a497cdc
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -67,11 +67,11 @@ public class ErodeBrush implements Brush {
final int by = target.getBlockY();
final int bz = target.getBlockZ();
for (int x = -brushSize, relx = 0; x <= brushSize; x++, relx++) {
for (int x = -brushSize, relx = 0; x <= brushSize && relx < buffer1.getWidth(); x++, relx++) {
int x0 = x + bx;
for (int y = -brushSize, rely = 0; y <= brushSize; y++, rely++) {
for (int y = -brushSize, rely = 0; y <= brushSize && rely < buffer1.getHeight(); y++, rely++) {
int y0 = y + by;
for (int z = -brushSize, relz = 0; z <= brushSize; z++, relz++) {
for (int z = -brushSize, relz = 0; z <= brushSize && relz < buffer1.getLength(); z++, relz++) {
int z0 = z + bz;
BlockState state = es.getBlock(x0, y0, z0);
buffer1.setBlock(relx, rely, relz, state);
@ -115,11 +115,11 @@ public class ErodeBrush implements Brush {
Clipboard current, Clipboard target
) {
int[] frequency = null;
for (int x = -brushSize, relx = 0; x <= brushSize; x++, relx++) {
for (int x = -brushSize, relx = 0; x <= brushSize && relx < target.getWidth(); x++, relx++) {
int x2 = x * x;
for (int z = -brushSize, relz = 0; z <= brushSize; z++, relz++) {
for (int z = -brushSize, relz = 0; z <= brushSize && relz < target.getLength(); z++, relz++) {
int x2y2 = x2 + z * z;
for (int y = -brushSize, rely = 0; y <= brushSize; y++, rely++) {
for (int y = -brushSize, rely = 0; y <= brushSize && rely < target.getHeight(); y++, rely++) {
int cube = x2y2 + y * y;
target.setBlock(relx, rely, relz, current.getBlock(relx, rely, relz));
if (cube >= brushSizeSquared) {
@ -166,11 +166,11 @@ public class ErodeBrush implements Brush {
Clipboard current, Clipboard target
) {
int[] frequency = null;
for (int x = -brushSize, relx = 0; x <= brushSize; x++, relx++) {
for (int x = -brushSize, relx = 0; x <= brushSize && relx < target.getWidth(); x++, relx++) {
int x2 = x * x;
for (int z = -brushSize, relz = 0; z <= brushSize; z++, relz++) {
for (int z = -brushSize, relz = 0; z <= brushSize && relz < target.getLength(); z++, relz++) {
int x2y2 = x2 + z * z;
for (int y = -brushSize, rely = 0; y <= brushSize; y++, rely++) {
for (int y = -brushSize, rely = 0; y <= brushSize && rely < target.getHeight(); y++, rely++) {
int cube = x2y2 + y * y;
target.setBlock(relx, rely, relz, current.getBlock(relx, rely, relz));
if (cube >= brushSizeSquared) {