Remove chunk notify task

This commit is contained in:
Jesse Boyd 2019-04-16 01:16:00 +10:00
parent a4de4e1a65
commit 9207263426
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
9 changed files with 1 additions and 72 deletions

View File

@ -434,11 +434,9 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
}
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
section = sections[j] = this.sectionPalettes[j];
// getParent().setCount(0, count - this.getAir(j), section);
continue;
} else {
section = sections[j] = getParent().newChunkSection(j, flag, array);
// getParent().setCount(0, count - this.getAir(j), section);
continue;
}
} else if (count >= 4096) {
@ -448,11 +446,9 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
}
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
section = sections[j] = this.sectionPalettes[j];
// getParent().setCount(0, count - this.getAir(j), section);
continue;
} else {
section = sections[j] = getParent().newChunkSection(j, flag, array);
// getParent().setCount(0, count - this.getAir(j), section);
continue;
}
}

View File

@ -144,12 +144,6 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, CHUNKSECTIONS, SECTION> impl
return regenerateChunk(getWorld(), x, z, biome, seed);
}
@Override
public void addNotifyTask(int x, int z, Runnable runnable) {
FaweChunk chunk = map.getFaweChunk(x, z);
chunk.addNotifyTask(runnable);
}
@Override
public boolean setBlock(int x, int y, int z, int id) {
int cx = x >> 4;

View File

@ -925,11 +925,6 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
chunkOffset = null;
}
@Override
public void addNotifyTask(int x, int z, Runnable runnable) {
if (runnable != null) runnable.run();
}
@Override
public BiomeType getBiomeType(int x, int z) throws FaweException.FaweChunkLoadException {
int index = z * getWidth() + x;

View File

@ -16,12 +16,10 @@ import java.util.concurrent.Callable;
import javax.annotation.Nullable;
public abstract class FaweChunk<T> implements Callable<FaweChunk> {
public static int HEIGHT = 256;
private FaweQueue parent;
private int x, z;
public static int HEIGHT = 256;
private final ArrayDeque<Runnable> tasks = new ArrayDeque<>(0);
/**
* A FaweSections object represents a chunk and the blocks that you wish to change in it.
@ -217,28 +215,6 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
}
}
/**
* Add a task to run when this chunk is dispatched
*
* @param run
*/
public void addNotifyTask(Runnable run) {
if (run != null) {
tasks.add(run);
}
}
public boolean hasNotifyTasks() {
return tasks.size() > 0;
}
public void executeNotifyTasks() {
for (Runnable task : tasks) {
task.run();
}
tasks.clear();
}
/**
* Get the underlying chunk object
*

View File

@ -394,8 +394,6 @@ public interface FaweQueue extends HasFaweQueue, Extent {
*/
void clear();
void addNotifyTask(int x, int z, Runnable runnable);
default boolean hasBlock(int x, int y, int z) throws FaweException.FaweChunkLoadException {
return getCombinedId4Data(x, y, z) != 0;
}

View File

@ -56,11 +56,6 @@ public abstract class ImmutableVirtualWorld implements VirtualWorld {
return null;
}
@Override
public void addNotifyTask(int x, int z, Runnable runnable) {
if (runnable != null) runnable.run();
}
@Override
public BiomeType getBiome(BlockVector2 position) {
return BiomeTypes.FOREST;

View File

@ -332,11 +332,6 @@ public interface IDelegateFaweQueue extends FaweQueue {
getQueue().clear();
}
@Override
default void addNotifyTask(int x, int z, Runnable runnable) {
getQueue().addNotifyTask(x, z, runnable);
}
@Override
default boolean hasBlock(int x, int y, int z) throws FaweException.FaweChunkLoadException {
return getQueue().hasBlock(x, y, z);

View File

@ -115,21 +115,6 @@ public abstract class LazyFaweChunk<T extends FaweChunk> extends FaweChunk {
internalGetOrCacheChunk().fillCuboid(x1, x2, y1, y2, z1, z2, combinedId);
}
@Override
public void addNotifyTask(Runnable run) {
internalGetOrCacheChunk().addNotifyTask(run);
}
@Override
public boolean hasNotifyTasks() {
return internalGetOrCacheChunk().hasNotifyTasks();
}
@Override
public void executeNotifyTasks() {
internalGetOrCacheChunk().executeNotifyTasks();
}
@Override
public void setTile(int x, int y, int z, CompoundTag tile) {
internalGetOrCacheChunk().setTile(x, y, z, tile);

View File

@ -177,11 +177,6 @@ public class NullFaweQueue implements FaweQueue {
}
@Override
public void addNotifyTask(int x, int z, Runnable runnable) {
runnable.run();
}
@Override
public BiomeType getBiomeType(int x, int z) throws FaweException.FaweChunkLoadException {
return null;