geforkt von Mirrors/FastAsyncWorldEdit
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
Dieser Commit ist enthalten in:
Ursprung
600a1a5daa
Commit
fda7d00747
@ -221,10 +221,9 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
if (this.sections == null) {
|
if (this.sections == null) {
|
||||||
this.sections = sections.clone();
|
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) {
|
||||||
// if (this.sections[layer] != section) {
|
this.sections[layer] = new ChunkSection[]{section}.clone()[0];
|
||||||
// this.sections[layer] = section;
|
}
|
||||||
// }
|
|
||||||
this.blocks[layer] = arr;
|
this.blocks[layer] = arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,20 +298,18 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
lock.untilFree();
|
lock.untilFree();
|
||||||
ChunkSection getSection;
|
|
||||||
if (this.nmsChunk != nmsChunk) {
|
if (this.nmsChunk != nmsChunk) {
|
||||||
this.nmsChunk = nmsChunk;
|
this.nmsChunk = nmsChunk;
|
||||||
this.sections = null;
|
this.sections = null;
|
||||||
this.reset();
|
this.reset();
|
||||||
} else {
|
} else if (existingSection != getSections()[layer]) {
|
||||||
getSection = this.getSections()[layer];
|
|
||||||
if (getSection != existingSection) {
|
|
||||||
this.sections[layer] = existingSection;
|
this.sections[layer] = existingSection;
|
||||||
this.reset();
|
this.reset();
|
||||||
|
} else if (!Arrays.equals(update(layer, new char[4096]), load(layer))) {
|
||||||
|
this.reset(layer);
|
||||||
} else if (lock.isModified()) {
|
} else if (lock.isModified()) {
|
||||||
this.reset(layer);
|
this.reset(layer);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
newSection = BukkitAdapter_1_15_2.newChunkSection(layer, this::load, setArr);
|
newSection = BukkitAdapter_1_15_2.newChunkSection(layer, this::load, setArr);
|
||||||
if (!BukkitAdapter_1_15_2.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
if (!BukkitAdapter_1_15_2.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
||||||
System.out.println("Failed to set chunk section:" + X + "," + Z + " layer: " + layer);
|
System.out.println("Failed to set chunk section:" + X + "," + Z + " layer: " + layer);
|
||||||
|
@ -243,6 +243,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
public IChunkGet get(ChunkHolder chunk) {
|
public IChunkGet get(ChunkHolder chunk) {
|
||||||
chunk.getOrCreateGet();
|
chunk.getOrCreateGet();
|
||||||
chunk.delegate = BOTH;
|
chunk.delegate = BOTH;
|
||||||
|
chunk.chunkExisting.trim(false);
|
||||||
return chunk.chunkExisting;
|
return chunk.chunkExisting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,6 +272,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
public BiomeType getBiome(ChunkHolder chunk, int x, int y, int z) {
|
public BiomeType getBiome(ChunkHolder chunk, int x, int y, int z) {
|
||||||
chunk.getOrCreateGet();
|
chunk.getOrCreateGet();
|
||||||
chunk.delegate = GET;
|
chunk.delegate = GET;
|
||||||
|
chunk.chunkExisting.trim(false);
|
||||||
return chunk.getBiomeType(x, y, z);
|
return chunk.getBiomeType(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,6 +280,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
public BlockState getBlock(ChunkHolder chunk, int x, int y, int z) {
|
public BlockState getBlock(ChunkHolder chunk, int x, int y, int z) {
|
||||||
chunk.getOrCreateGet();
|
chunk.getOrCreateGet();
|
||||||
chunk.delegate = GET;
|
chunk.delegate = GET;
|
||||||
|
chunk.chunkExisting.trim(false);
|
||||||
return chunk.getBlock(x, y, z);
|
return chunk.getBlock(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,6 +289,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
int z) {
|
int z) {
|
||||||
chunk.getOrCreateGet();
|
chunk.getOrCreateGet();
|
||||||
chunk.delegate = GET;
|
chunk.delegate = GET;
|
||||||
|
chunk.chunkExisting.trim(false);
|
||||||
return chunk.getFullBlock(x, y, z);
|
return chunk.getFullBlock(x, y, z);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren