Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-20 09:50:06 +01:00
Fix out of bounds error for erode and pull brushes (#2554)
- Fixes #2380
Dieser Commit ist enthalten in:
Ursprung
b919633a87
Commit
763a497cdc
@ -67,11 +67,11 @@ public class ErodeBrush implements Brush {
|
|||||||
final int by = target.getBlockY();
|
final int by = target.getBlockY();
|
||||||
final int bz = target.getBlockZ();
|
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;
|
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;
|
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;
|
int z0 = z + bz;
|
||||||
BlockState state = es.getBlock(x0, y0, z0);
|
BlockState state = es.getBlock(x0, y0, z0);
|
||||||
buffer1.setBlock(relx, rely, relz, state);
|
buffer1.setBlock(relx, rely, relz, state);
|
||||||
@ -115,11 +115,11 @@ public class ErodeBrush implements Brush {
|
|||||||
Clipboard current, Clipboard target
|
Clipboard current, Clipboard target
|
||||||
) {
|
) {
|
||||||
int[] frequency = null;
|
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;
|
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;
|
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;
|
int cube = x2y2 + y * y;
|
||||||
target.setBlock(relx, rely, relz, current.getBlock(relx, rely, relz));
|
target.setBlock(relx, rely, relz, current.getBlock(relx, rely, relz));
|
||||||
if (cube >= brushSizeSquared) {
|
if (cube >= brushSizeSquared) {
|
||||||
@ -166,11 +166,11 @@ public class ErodeBrush implements Brush {
|
|||||||
Clipboard current, Clipboard target
|
Clipboard current, Clipboard target
|
||||||
) {
|
) {
|
||||||
int[] frequency = null;
|
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;
|
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;
|
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;
|
int cube = x2y2 + y * y;
|
||||||
target.setBlock(relx, rely, relz, current.getBlock(relx, rely, relz));
|
target.setBlock(relx, rely, relz, current.getBlock(relx, rely, relz));
|
||||||
if (cube >= brushSizeSquared) {
|
if (cube >= brushSizeSquared) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren