From 9207263426fc4c23662f9dbb7fcfe3953ef4fedf Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 16 Apr 2019 01:16:00 +1000 Subject: [PATCH] Remove chunk notify task --- .../fawe/bukkit/v1_13/BukkitChunk_1_13.java | 4 --- .../boydti/fawe/example/MappedFaweQueue.java | 6 ----- .../jnbt/anvil/HeightMapMCAGenerator.java | 5 ---- .../com/boydti/fawe/object/FaweChunk.java | 26 +------------------ .../com/boydti/fawe/object/FaweQueue.java | 2 -- .../visualization/ImmutableVirtualWorld.java | 5 ---- .../fawe/object/queue/IDelegateFaweQueue.java | 5 ---- .../fawe/object/queue/LazyFaweChunk.java | 15 ----------- .../fawe/object/queue/NullFaweQueue.java | 5 ---- 9 files changed, 1 insertion(+), 72 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java index 5207021eb..30ab4e66b 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java @@ -434,11 +434,9 @@ public class BukkitChunk_1_13 extends IntFaweChunk { } 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 { } 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; } } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/example/MappedFaweQueue.java b/worldedit-core/src/main/java/com/boydti/fawe/example/MappedFaweQueue.java index 4b403e132..2c88f5900 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/example/MappedFaweQueue.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/example/MappedFaweQueue.java @@ -144,12 +144,6 @@ public abstract class MappedFaweQueue 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; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/HeightMapMCAGenerator.java b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/HeightMapMCAGenerator.java index bf05415a3..5cce020b4 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/HeightMapMCAGenerator.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/HeightMapMCAGenerator.java @@ -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; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/FaweChunk.java b/worldedit-core/src/main/java/com/boydti/fawe/object/FaweChunk.java index 6361ea4f2..d138263d3 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/FaweChunk.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/FaweChunk.java @@ -16,12 +16,10 @@ import java.util.concurrent.Callable; import javax.annotation.Nullable; public abstract class FaweChunk implements Callable { + public static int HEIGHT = 256; private FaweQueue parent; private int x, z; - public static int HEIGHT = 256; - - private final ArrayDeque 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 implements Callable { } } - /** - * 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 * diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/FaweQueue.java b/worldedit-core/src/main/java/com/boydti/fawe/object/FaweQueue.java index f8c079625..4e56a4977 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/FaweQueue.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/FaweQueue.java @@ -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; } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/ImmutableVirtualWorld.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/ImmutableVirtualWorld.java index adec43732..2cc85ad8d 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/ImmutableVirtualWorld.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/ImmutableVirtualWorld.java @@ -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; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/queue/IDelegateFaweQueue.java b/worldedit-core/src/main/java/com/boydti/fawe/object/queue/IDelegateFaweQueue.java index 748043afa..c88cca70b 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/queue/IDelegateFaweQueue.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/queue/IDelegateFaweQueue.java @@ -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); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/queue/LazyFaweChunk.java b/worldedit-core/src/main/java/com/boydti/fawe/object/queue/LazyFaweChunk.java index 02343d2dc..ac609b5ee 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/queue/LazyFaweChunk.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/queue/LazyFaweChunk.java @@ -115,21 +115,6 @@ public abstract class LazyFaweChunk 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); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/queue/NullFaweQueue.java b/worldedit-core/src/main/java/com/boydti/fawe/object/queue/NullFaweQueue.java index 23f6ac293..5b8c75e38 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/queue/NullFaweQueue.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/queue/NullFaweQueue.java @@ -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;