From 2b46e1901c3c56ba7958202fedee9215d496282d Mon Sep 17 00:00:00 2001 From: Phillipp Glanz Date: Mon, 3 Apr 2023 13:13:33 +0200 Subject: [PATCH] Implement dirty workaround for get data from right ticking region --- .../fawe/v1_19_R3/PaperweightGetBlocks.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/worldedit-bukkit/folia-adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/folia/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java b/worldedit-bukkit/folia-adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/folia/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java index 2ca6537b1..c898dfdae 100644 --- a/worldedit-bukkit/folia-adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/folia/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java +++ b/worldedit-bukkit/folia-adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/folia/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java @@ -61,7 +61,6 @@ import net.minecraft.world.level.chunk.PalettedContainerRO; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.lighting.LevelLightEngine; import org.apache.logging.log4j.Logger; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_19_R3.CraftWorld; import org.bukkit.craftbukkit.v1_19_R3.block.CraftBlock; @@ -253,8 +252,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc if (entity == null) { return null; } - return new PaperweightLazyCompoundTag(Suppliers.memoize(TaskManager.taskManager().syncAt(entity, - new Location(new BukkitWorld(getChunk().bukkitChunk.getWorld()), Vector3.at(x,y,z)) + return new PaperweightLazyCompoundTag(Suppliers.memoize(TaskManager.taskManager().syncAt( + entity, + new Location(new BukkitWorld(getChunk().bukkitChunk.getWorld()), Vector3.at(x, y, z)) )::saveWithId)); // return new PaperweightLazyCompoundTag(Suppliers.memoize(blockEntity::saveWithId)); } @@ -773,10 +773,17 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc final BlockPos pos = new BlockPos(x, y, z); synchronized (nmsWorld) { - BlockEntity tileEntity = nmsWorld.getBlockEntity(pos); + + BlockEntity tileEntity = TaskManager.taskManager().syncAt( + () -> nmsWorld.getBlockEntity(pos), + new Location(new BukkitWorld(getChunk().bukkitChunk.getWorld()), Vector3.at(x, y, z)) + ); if (tileEntity == null || tileEntity.isRemoved()) { nmsWorld.removeBlockEntity(pos); - tileEntity = nmsWorld.getBlockEntity(pos); + tileEntity = TaskManager.taskManager().syncAt( + () -> nmsWorld.getBlockEntity(pos), + new Location(new BukkitWorld(getChunk().bukkitChunk.getWorld()), Vector3.at(x, y, z)) + ); } if (tileEntity != null) { final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(