mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-16 17:16:11 +00:00
chore: minor improvements to processing-related code (#2271)
This commit is contained in:
parent
bdb170a5ca
commit
5504811f11
@ -445,10 +445,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
|
|
||||||
bitMask |= 1 << layer;
|
bitMask |= 1 << layer;
|
||||||
|
|
||||||
// Changes may still be written to chunk SET
|
char[] setArr = set.load(layerNo);
|
||||||
char[] tmp = set.load(layerNo);
|
|
||||||
char[] setArr = new char[4096];
|
|
||||||
System.arraycopy(tmp, 0, setArr, 0, 4096);
|
|
||||||
|
|
||||||
// synchronise on internal section to avoid circular locking with a continuing edit if the chunk was
|
// synchronise on internal section to avoid circular locking with a continuing edit if the chunk was
|
||||||
// submitted to keep loaded internal chunks to queue target size.
|
// submitted to keep loaded internal chunks to queue target size.
|
||||||
|
@ -491,9 +491,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
|
|
||||||
bitMask |= 1 << getSectionIndex;
|
bitMask |= 1 << getSectionIndex;
|
||||||
|
|
||||||
char[] tmp = set.load(layerNo);
|
char[] setArr = set.load(layerNo);
|
||||||
char[] setArr = new char[4096];
|
|
||||||
System.arraycopy(tmp, 0, setArr, 0, 4096);
|
|
||||||
|
|
||||||
// synchronise on internal section to avoid circular locking with a continuing edit if the chunk was
|
// synchronise on internal section to avoid circular locking with a continuing edit if the chunk was
|
||||||
// submitted to keep loaded internal chunks to queue target size.
|
// submitted to keep loaded internal chunks to queue target size.
|
||||||
|
@ -488,9 +488,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
|
|
||||||
bitMask |= 1 << getSectionIndex;
|
bitMask |= 1 << getSectionIndex;
|
||||||
|
|
||||||
char[] tmp = set.load(layerNo);
|
char[] setArr = set.load(layerNo);
|
||||||
char[] setArr = new char[4096];
|
|
||||||
System.arraycopy(tmp, 0, setArr, 0, 4096);
|
|
||||||
|
|
||||||
// synchronise on internal section to avoid circular locking with a continuing edit if the chunk was
|
// synchronise on internal section to avoid circular locking with a continuing edit if the chunk was
|
||||||
// submitted to keep loaded internal chunks to queue target size.
|
// submitted to keep loaded internal chunks to queue target size.
|
||||||
|
@ -490,9 +490,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
|
|
||||||
bitMask |= 1 << getSectionIndex;
|
bitMask |= 1 << getSectionIndex;
|
||||||
|
|
||||||
char[] tmp = set.load(layerNo);
|
char[] setArr = set.load(layerNo);
|
||||||
char[] setArr = new char[4096];
|
|
||||||
System.arraycopy(tmp, 0, setArr, 0, 4096);
|
|
||||||
|
|
||||||
// synchronise on internal section to avoid circular locking with a continuing edit if the chunk was
|
// synchronise on internal section to avoid circular locking with a continuing edit if the chunk was
|
||||||
// submitted to keep loaded internal chunks to queue target size.
|
// submitted to keep loaded internal chunks to queue target size.
|
||||||
|
@ -490,9 +490,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
|
|
||||||
bitMask |= 1 << getSectionIndex;
|
bitMask |= 1 << getSectionIndex;
|
||||||
|
|
||||||
char[] tmp = set.load(layerNo);
|
char[] setArr = set.load(layerNo);
|
||||||
char[] setArr = new char[4096];
|
|
||||||
System.arraycopy(tmp, 0, setArr, 0, 4096);
|
|
||||||
|
|
||||||
// synchronise on internal section to avoid circular locking with a continuing edit if the chunk was
|
// synchronise on internal section to avoid circular locking with a continuing edit if the chunk was
|
||||||
// submitted to keep loaded internal chunks to queue target size.
|
// submitted to keep loaded internal chunks to queue target size.
|
||||||
|
@ -824,14 +824,15 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
boolean trimX = lowerX != 0 || upperX != 15;
|
boolean trimX = lowerX != 0 || upperX != 15;
|
||||||
boolean trimZ = lowerZ != 0 || upperZ != 15;
|
boolean trimZ = lowerZ != 0 || upperZ != 15;
|
||||||
|
|
||||||
|
if (!(trimX || trimZ)) {
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
for (int layer = get.getMinSectionPosition(); layer < get.getMaxSectionPosition(); layer++) {
|
for (int layer = get.getMinSectionPosition(); layer < get.getMaxSectionPosition(); layer++) {
|
||||||
if (!set.hasSection(layer)) {
|
if (!set.hasSection(layer)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
char[] arr = Objects.requireNonNull(set.loadIfPresent(layer)); // This shouldn't be null if above is true
|
char[] arr = Objects.requireNonNull(set.loadIfPresent(layer)); // This shouldn't be null if above is true
|
||||||
if (!(trimX || trimZ)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int indexY = 0;
|
int indexY = 0;
|
||||||
for (int y = 0; y < 16; y++, indexY += 256) { // For each y layer within a chunk section
|
for (int y = 0; y < 16; y++, indexY += 256) { // For each y layer within a chunk section
|
||||||
int index;
|
int index;
|
||||||
|
@ -401,11 +401,17 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
|
|||||||
// contains some
|
// contains some
|
||||||
boolean processExtra = false;
|
boolean processExtra = false;
|
||||||
for (int layer = getMinimumY() >> 4; layer <= getMaximumY() >> 4; layer++) {
|
for (int layer = getMinimumY() >> 4; layer <= getMaximumY() >> 4; layer++) {
|
||||||
|
if (!set.hasSection(layer)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int by = layer << 4;
|
int by = layer << 4;
|
||||||
int ty = by + 15;
|
int ty = by + 15;
|
||||||
if (!containsEntireCuboid(bx, tx, by, ty, bz, tz)) {
|
if (!containsEntireCuboid(bx, tx, by, ty, bz, tz)) {
|
||||||
processExtra = true;
|
processExtra = true;
|
||||||
char[] arr = set.load(layer);
|
char[] arr = set.loadIfPresent(layer);
|
||||||
|
if (arr == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for (int y = 0, index = 0; y < 16; y++) {
|
for (int y = 0, index = 0; y < 16; y++) {
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
for (int x = 0; x < 16; x++, index++) {
|
for (int x = 0; x < 16; x++, index++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user