With "queueing" enabled, FAWE may start attempting to place chunks before the operation is finished.

This is unnacceptable for recursive operations, thus the queue should be disable in these cases
Fixes #842
Dieser Commit ist enthalten in:
dordsor21 2021-01-11 15:06:55 +00:00
Ursprung fa8660c7a9
Commit ddb41a9669
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
2 geänderte Dateien mit 30 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -26,11 +26,9 @@ public abstract class CharBlocks implements IBlocks {
return true; return true;
} }
}; };
protected static final Section EMPTY = new Section() { protected final Section EMPTY = new Section() {
@Override @Override
public final char[] get(CharBlocks blocks, int layer) { public final synchronized char[] get(CharBlocks blocks, int layer) {
blocks.loadLock.lock();
try {
char[] arr = blocks.blocks[layer]; char[] arr = blocks.blocks[layer];
if (arr == null) { if (arr == null) {
arr = blocks.blocks[layer] = blocks.update(layer, null); arr = blocks.blocks[layer] = blocks.update(layer, null);
@ -47,9 +45,6 @@ public abstract class CharBlocks implements IBlocks {
blocks.sections[layer] = FULL; blocks.sections[layer] = FULL;
} }
return arr; return arr;
} finally {
blocks.loadLock.unlock();
}
} }
@Override @Override
@ -59,7 +54,6 @@ public abstract class CharBlocks implements IBlocks {
}; };
public final char[][] blocks; public final char[][] blocks;
public final Section[] sections; public final Section[] sections;
private final ReentrantLock loadLock = new ReentrantLock ();
public CharBlocks() { public CharBlocks() {
blocks = new char[16][]; blocks = new char[16][];

Datei anzeigen

@ -1179,6 +1179,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
// Pick how we're going to visit blocks // Pick how we're going to visit blocks
RecursiveVisitor visitor = new DirectionalVisitor(mask, replace, origin, direction, (int) (radius * 2 + 1)); RecursiveVisitor visitor = new DirectionalVisitor(mask, replace, origin, direction, (int) (radius * 2 + 1));
// With queue enabled, FAWE may start attempting to place chunks before the operation is finished.
// This is unnacceptable for recursive operations.
disableQueue();
// Start at the origin // Start at the origin
visitor.visit(origin); visitor.visit(origin);
@ -1237,6 +1241,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
visitor = new DownwardVisitor(mask, replace, origin.getBlockY(), (int) (radius * 2 + 1)); visitor = new DownwardVisitor(mask, replace, origin.getBlockY(), (int) (radius * 2 + 1));
} }
// With queue enabled, FAWE may start attempting to place chunks before the operation is finished.
// This is unnacceptable for recursive operations.
disableQueue();
// Start at the origin // Start at the origin
visitor.visit(origin); visitor.visit(origin);
@ -1717,6 +1725,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
} }
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1)); RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1));
// With queue enabled, FAWE may start attempting to place chunks before the operation is finished.
// This is unnacceptable for recursive operations.
disableQueue();
// Around the origin in a 3x3 block // Around the origin in a 3x3 block
for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) { for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) {
if (mask.test(position)) { if (mask.test(position)) {
@ -1758,6 +1770,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
BlockReplace replace = new BlockReplace(this, fluid.getDefaultState()); BlockReplace replace = new BlockReplace(this, fluid.getDefaultState());
NonRisingVisitor visitor = new NonRisingVisitor(mask, replace); NonRisingVisitor visitor = new NonRisingVisitor(mask, replace);
// With queue enabled, FAWE may start attempting to place chunks before the operation is finished.
// This is unnacceptable for recursive operations.
disableQueue();
// Around the origin in a 3x3 block // Around the origin in a 3x3 block
for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) { for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) {
if (liquidMask.test(position)) { if (liquidMask.test(position)) {