Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-20 21:40:06 +01:00
SPIGOT-1390: Fixed issues with Array.fill upper bound in setRegion
Dieser Commit ist enthalten in:
Ursprung
d3e0b6fead
Commit
07c300164a
@ -97,7 +97,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
|
|||||||
if (xMin >= xMax || yMin >= yMax || zMin >= zMax) {
|
if (xMin >= xMax || yMin >= yMax || zMin >= zMax) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char typeChar = (char) (blockId << 4 | data);
|
char typeChar = (char) ((blockId << 4) | data);
|
||||||
if (xMin == 0 && xMax == 0x10) {
|
if (xMin == 0 && xMax == 0x10) {
|
||||||
if (zMin == 0 && zMax == 0x10) {
|
if (zMin == 0 && zMax == 0x10) {
|
||||||
for (int y = yMin & 0xf0; y < yMax; y += 0x10) {
|
for (int y = yMin & 0xf0; y < yMax; y += 0x10) {
|
||||||
@ -110,7 +110,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
|
|||||||
// First chunk section
|
// First chunk section
|
||||||
Arrays.fill(section, (yMin & 0xf) << 8, 0x1000, typeChar);
|
Arrays.fill(section, (yMin & 0xf) << 8, 0x1000, typeChar);
|
||||||
}
|
}
|
||||||
} else if (y + 0x10 >= yMax) {
|
} else if (y + 0x10 > yMax) {
|
||||||
// Last chunk section
|
// Last chunk section
|
||||||
Arrays.fill(section, 0, (yMax & 0xf) << 8, typeChar);
|
Arrays.fill(section, 0, (yMax & 0xf) << 8, typeChar);
|
||||||
} else {
|
} else {
|
||||||
@ -123,7 +123,8 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
|
|||||||
char[] section = getChunkSection(y, true);
|
char[] section = getChunkSection(y, true);
|
||||||
int offsetBase = (y & 0xf) << 8;
|
int offsetBase = (y & 0xf) << 8;
|
||||||
int min = offsetBase | (zMin << 4);
|
int min = offsetBase | (zMin << 4);
|
||||||
int max = offsetBase | (zMax << 4);
|
// Need to add zMax as it can be 16, which overlaps the y coordinate bits
|
||||||
|
int max = offsetBase + (zMax << 4);
|
||||||
Arrays.fill(section, min, max, typeChar);
|
Arrays.fill(section, min, max, typeChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,8 +133,9 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
|
|||||||
char[] section = getChunkSection(y, true);
|
char[] section = getChunkSection(y, true);
|
||||||
int offsetBase = (y & 0xf) << 8;
|
int offsetBase = (y & 0xf) << 8;
|
||||||
for (int z = zMin; z < zMax; z++) {
|
for (int z = zMin; z < zMax; z++) {
|
||||||
int offset = offsetBase | z << 4;
|
int offset = offsetBase | (z << 4);
|
||||||
Arrays.fill(section, offset | xMin, offset | xMax, typeChar);
|
// Need to add xMax as it can be 16, which overlaps the z coordinate bits
|
||||||
|
Arrays.fill(section, offset | xMin, offset + xMax, typeChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren