we do want to synchronise across the chunk when loading sections

This commit is contained in:
dordsor21 2021-01-01 17:19:14 +00:00
parent 42346b429b
commit 39b0da2b99
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -54,14 +54,13 @@ public abstract class CharBlocks implements IBlocks {
};
public final char[][] blocks;
public final Section[] sections;
private final Object[] loadLock = new Object[16];
private final Object loadLock = new Object();
public CharBlocks() {
blocks = new char[16][];
sections = new Section[16];
for (int i = 0; i < 16; i++) {
sections[i] = EMPTY;
loadLock[i] = new Object();
}
}
@ -122,7 +121,7 @@ public abstract class CharBlocks implements IBlocks {
if (section.isFull()) {
return section.get(this, layer);
}
synchronized (loadLock[layer]) {
synchronized (loadLock) {
return sections[layer].get(this, layer);
}
}