From b52fc46f196df184bb0a25241feac5a167a20927 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 19 Apr 2020 13:56:02 +0100 Subject: [PATCH] Regarding #393 - Fix CharFilterBlock not being properly created (the chunk X and Z were never set) - Replace BlockVector3#divide with bitshift because you can't divide down and then bitshift back up with the correct results for negative values --- .../src/main/java/com/boydti/fawe/beta/IQueueExtent.java | 2 +- .../java/com/sk89q/worldedit/regions/AbstractRegion.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java index a3e74a806..d0a020a33 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java @@ -148,7 +148,7 @@ public interface IQueueExtent extends Flushable, Trimable, ICh if (newChunk != null) { chunk = newChunk; if (block == null) { - block = this.initFilterBlock(); + block = this.initFilterBlock().initChunk(chunkX, chunkZ); } chunk.filterBlocks(filter, block, region, full); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java index 9c63c884a..8f7423bcd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java @@ -169,8 +169,11 @@ public abstract class AbstractRegion extends AbstractSet implement public Set getChunks() { final Set chunks = new HashSet<>(); - final BlockVector3 min = getMinimumPoint().divide(16); - final BlockVector3 max = getMaximumPoint().divide(16); + final BlockVector3 minBlock = getMinimumPoint(); + final BlockVector3 maxBlock = getMaximumPoint(); + + final BlockVector2 min = BlockVector2.at(minBlock.getX() >> 4, minBlock.getZ() >> 4); + final BlockVector2 max = BlockVector2.at(maxBlock.getX() >> 4, maxBlock.getZ() >> 4); for (int X = min.getBlockX(); X <= max.getBlockX(); ++X) { for (int Z = min.getBlockZ(); Z <= max.getBlockZ(); ++Z) {