Don't attempt to set field on null ChunkSection

This commit is contained in:
dordsor21 2020-05-09 17:42:40 +01:00
parent cb20cef0e6
commit 0dee452e1a
3 changed files with 12 additions and 12 deletions

View File

@ -262,10 +262,6 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
char[] setArr = set.load(layer);
ChunkSection newSection;
ChunkSection existingSection = sections[layer];
//ensure that the server doesn't try to tick the chunksection while we're editing it.
BukkitAdapter_1_14.fieldTickingBlockCount.set(existingSection, (short) 0);
if (existingSection == null) {
newSection = BukkitAdapter_1_14.newChunkSection(layer, setArr);
if (BukkitAdapter_1_14.setSectionAtomic(sections, null, newSection, layer)) {
@ -279,6 +275,10 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
}
}
}
//ensure that the server doesn't try to tick the chunksection while we're editing it.
BukkitAdapter_1_14.fieldTickingBlockCount.set(existingSection, (short) 0);
DelegateLock lock = BukkitAdapter_1_14.applyLock(existingSection);
synchronized (this) {
synchronized (lock) {

View File

@ -270,10 +270,6 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
char[] setArr = set.load(layer);
ChunkSection newSection;
ChunkSection existingSection = sections[layer];
//ensure that the server doesn't try to tick the chunksection while we're editing it.
BukkitAdapter_1_15.fieldTickingBlockCount.set(existingSection, (short) 0);
if (existingSection == null) {
newSection = BukkitAdapter_1_15.newChunkSection(layer, setArr);
if (BukkitAdapter_1_15.setSectionAtomic(sections, null, newSection, layer)) {
@ -287,6 +283,10 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
}
}
}
//ensure that the server doesn't try to tick the chunksection while we're editing it.
BukkitAdapter_1_15.fieldTickingBlockCount.set(existingSection, (short) 0);
DelegateLock lock = BukkitAdapter_1_15.applyLock(existingSection);
synchronized (this) {
synchronized (lock) {

View File

@ -282,10 +282,6 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
char[] setArr = set.load(layer);
ChunkSection newSection;
ChunkSection existingSection = sections[layer];
//ensure that the server doesn't try to tick the chunksection while we're editing it.
BukkitAdapter_1_15_2.fieldTickingBlockCount.set(existingSection, (short) 0);
if (existingSection == null) {
newSection = BukkitAdapter_1_15_2.newChunkSection(layer, setArr);
if (BukkitAdapter_1_15_2.setSectionAtomic(sections, null, newSection, layer)) {
@ -299,7 +295,11 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
}
}
}
BukkitAdapter_1_15_2.fieldTickingBlockCount.set(existingSection, (short) 0);
//ensure that the server doesn't try to tick the chunksection while we're editing it.
DelegateLock lock = BukkitAdapter_1_15_2.applyLock(existingSection);
synchronized (this) {
synchronized (lock) {
lock.untilFree();