mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
A more verbose fix to #329 and similar issues.
- Re-read chunksections the first time they're "loaded" for an operation - Reset the chunksection if there are block changes when setting blocks via reflection - These are maybe gonna affect performance a bit? Idk. Seems to be alright for me - These are maybe gonna make more issues? Yeah maybe, but I couldn't find any
This commit is contained in:
@ -221,10 +221,9 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
||||
if (this.sections == null) {
|
||||
this.sections = sections.clone();
|
||||
}
|
||||
//TODO: Understand why this causes #329, what the purpose of this is, and what may or may not break after commenting this out.
|
||||
// if (this.sections[layer] != section) {
|
||||
// this.sections[layer] = section;
|
||||
// }
|
||||
if (this.sections[layer] != section) {
|
||||
this.sections[layer] = new ChunkSection[]{section}.clone()[0];
|
||||
}
|
||||
this.blocks[layer] = arr;
|
||||
}
|
||||
}
|
||||
@ -299,19 +298,17 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
||||
synchronized (this) {
|
||||
synchronized (lock) {
|
||||
lock.untilFree();
|
||||
ChunkSection getSection;
|
||||
if (this.nmsChunk != nmsChunk) {
|
||||
this.nmsChunk = nmsChunk;
|
||||
this.sections = null;
|
||||
this.reset();
|
||||
} else {
|
||||
getSection = this.getSections()[layer];
|
||||
if (getSection != existingSection) {
|
||||
this.sections[layer] = existingSection;
|
||||
this.reset();
|
||||
} else if (lock.isModified()) {
|
||||
this.reset(layer);
|
||||
}
|
||||
} else if (existingSection != getSections()[layer]) {
|
||||
this.sections[layer] = existingSection;
|
||||
this.reset();
|
||||
} else if (!Arrays.equals(update(layer, new char[4096]), load(layer))) {
|
||||
this.reset(layer);
|
||||
} else if (lock.isModified()) {
|
||||
this.reset(layer);
|
||||
}
|
||||
newSection = BukkitAdapter_1_15_2.newChunkSection(layer, this::load, setArr);
|
||||
if (!BukkitAdapter_1_15_2.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
||||
|
Reference in New Issue
Block a user