mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-25 03:55:35 +01:00
Tweak some stuff
This commit is contained in:
parent
55f95e5022
commit
a7b29ab82f
@ -88,7 +88,7 @@ public class BukkitQueue_1_11 extends BukkitQueue_0<Chunk, ChunkSection[], Chunk
|
||||
protected static MutableGenLayer genLayer;
|
||||
protected static ChunkSection emptySection;
|
||||
|
||||
public static final IBlockData[] IBD_CACHE = new IBlockData[Character.MAX_VALUE];
|
||||
public static final IBlockData[] IBD_CACHE = new IBlockData[Character.MAX_VALUE + 1];
|
||||
|
||||
static {
|
||||
try {
|
||||
@ -130,7 +130,7 @@ public class BukkitQueue_1_11 extends BukkitQueue_0<Chunk, ChunkSection[], Chunk
|
||||
setupAdapter(new com.boydti.fawe.bukkit.v1_11.FaweAdapter_1_11());
|
||||
Fawe.debug("Using adapter: " + adapter);
|
||||
Fawe.debug("=========================================");
|
||||
for (int i = 0; i < Character.MAX_VALUE; i++) {
|
||||
for (int i = 0; i < IBD_CACHE.length; i++) {
|
||||
try {
|
||||
IBD_CACHE[i] = Block.getById(i >> 4).fromLegacyData(i & 0xF);
|
||||
} catch (Throwable ignore) {}
|
||||
|
@ -13,10 +13,6 @@ import org.primesoft.blockshub.api.IWorld;
|
||||
|
||||
public class LoggingChangeSet extends AbstractDelegateChangeSet {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
private static boolean initialized = false;
|
||||
|
||||
public static FaweChangeSet wrap(FawePlayer<Player> player, FaweChangeSet parent) {
|
||||
|
@ -22,6 +22,21 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChangeTask(FaweQueue queue) {
|
||||
super.addChangeTask(queue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean flushAsync() {
|
||||
return super.flushAsync();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean flush() {
|
||||
return super.flush() && parent.flush();
|
||||
}
|
||||
|
||||
public final FaweChangeSet getParent() {
|
||||
return parent;
|
||||
}
|
||||
@ -36,16 +51,6 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
|
||||
return parent.getWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean flushAsync() {
|
||||
return parent.flushAsync();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean flush() {
|
||||
return parent.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int x, int y, int z, int combinedFrom, int combinedTo) {
|
||||
parent.add(x, y, z, combinedFrom, combinedTo);
|
||||
@ -145,9 +150,4 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
|
||||
public void add(int x, int y, int z, int combinedFrom, BaseBlock to) {
|
||||
parent.add(x, y, z, combinedFrom, to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChangeTask(FaweQueue queue) {
|
||||
parent.addChangeTask(queue);
|
||||
}
|
||||
}
|
||||
|
@ -35,10 +35,8 @@ public abstract class FaweChangeSet implements ChangeSet {
|
||||
private final String worldName;
|
||||
private final boolean mainThread;
|
||||
private final int layers;
|
||||
protected final AtomicInteger waitingCombined = new AtomicInteger(0);
|
||||
private final AtomicInteger waitingAsync = new AtomicInteger(0);
|
||||
// private Object lockCombined = new Object();
|
||||
// private Object lockAsync = new Object();
|
||||
protected AtomicInteger waitingCombined = new AtomicInteger(0);
|
||||
protected AtomicInteger waitingAsync = new AtomicInteger(0);
|
||||
|
||||
public static FaweChangeSet getDefaultChangeSet(World world, UUID uuid) {
|
||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||
@ -220,7 +218,7 @@ public abstract class FaweChangeSet implements ChangeSet {
|
||||
queue.setChangeTask(new RunnableVal2<FaweChunk, FaweChunk>() {
|
||||
@Override
|
||||
public void run(final FaweChunk previous, final FaweChunk next) {
|
||||
waitingCombined.incrementAndGet();
|
||||
FaweChangeSet.this.waitingCombined.incrementAndGet();
|
||||
Runnable run = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -263,7 +261,7 @@ public abstract class FaweChangeSet implements ChangeSet {
|
||||
default:
|
||||
char combinedIdPrevious = previousLayer != null ? previousLayer[index] : 0;
|
||||
if (combinedIdCurrent != combinedIdPrevious) {
|
||||
synchronized (this) {
|
||||
synchronized (FaweChangeSet.this) {
|
||||
add(xx, yy, zz, combinedIdPrevious, combinedIdCurrent);
|
||||
}
|
||||
}
|
||||
@ -277,14 +275,14 @@ public abstract class FaweChangeSet implements ChangeSet {
|
||||
// Tiles created
|
||||
Map<Short, CompoundTag> tiles = next.getTiles();
|
||||
for (Map.Entry<Short, CompoundTag> entry : tiles.entrySet()) {
|
||||
synchronized (this) {
|
||||
synchronized (FaweChangeSet.this) {
|
||||
addTileCreate(entry.getValue());
|
||||
}
|
||||
}
|
||||
// Tiles removed
|
||||
tiles = previous.getTiles();
|
||||
for (Map.Entry<Short, CompoundTag> entry : tiles.entrySet()) {
|
||||
synchronized (this) {
|
||||
synchronized (FaweChangeSet.this) {
|
||||
addTileRemove(entry.getValue());
|
||||
}
|
||||
}
|
||||
@ -294,14 +292,14 @@ public abstract class FaweChangeSet implements ChangeSet {
|
||||
// Entities created
|
||||
Set<CompoundTag> entities = next.getEntities();
|
||||
for (CompoundTag entityTag : entities) {
|
||||
synchronized (this) {
|
||||
synchronized (FaweChangeSet.this) {
|
||||
addEntityCreate(entityTag);
|
||||
}
|
||||
}
|
||||
// Entities removed
|
||||
entities = previous.getEntities();
|
||||
for (CompoundTag entityTag : entities) {
|
||||
synchronized (this) {
|
||||
synchronized (FaweChangeSet.this) {
|
||||
addEntityRemove(entityTag);
|
||||
}
|
||||
}
|
||||
@ -309,12 +307,12 @@ public abstract class FaweChangeSet implements ChangeSet {
|
||||
} catch (Throwable e) {
|
||||
MainUtil.handleError(e);
|
||||
} finally {
|
||||
if (waitingCombined.decrementAndGet() <= 0) {
|
||||
synchronized (waitingAsync) {
|
||||
waitingAsync.notifyAll();
|
||||
if (FaweChangeSet.this.waitingCombined.decrementAndGet() <= 0) {
|
||||
synchronized (FaweChangeSet.this.waitingAsync) {
|
||||
FaweChangeSet.this.waitingAsync.notifyAll();
|
||||
}
|
||||
synchronized (waitingCombined) {
|
||||
waitingCombined.notifyAll();
|
||||
synchronized (FaweChangeSet.this.waitingCombined) {
|
||||
FaweChangeSet.this.waitingCombined.notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user