From 0f5abbf6bba1dda3cbeb554eae73f6bcff8f50ad Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 14 Oct 2023 20:26:18 +0100 Subject: [PATCH 1/2] fix: avoid tripping async catcher when getting entity from chunk --- .../adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java index d21510ff60..2f0d22b7ae 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java @@ -295,7 +295,14 @@ public int[] getHeightMap(HeightMapType type) { @Override public CompoundTag getEntity(UUID uuid) { - Entity entity = serverLevel.getEntity(uuid); + ensureLoaded(serverLevel, chunkX, chunkZ); + List entities = PaperweightPlatformAdapter.getEntities(getChunk()); + Entity entity = null; + for (Entity e : entities) { + if (e.getUUID() == uuid) { + entity = e; + } + } if (entity != null) { org.bukkit.entity.Entity bukkitEnt = entity.getBukkitEntity(); return BukkitAdapter.adapt(bukkitEnt).getState().getNbtData(); From 185d55ccee3128873c5439614cc0d0e1e2966254 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 14 Oct 2023 20:41:32 +0100 Subject: [PATCH 2/2] address comments --- .../adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java index 2f0d22b7ae..cbfd90ae26 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java @@ -299,8 +299,9 @@ public CompoundTag getEntity(UUID uuid) { List entities = PaperweightPlatformAdapter.getEntities(getChunk()); Entity entity = null; for (Entity e : entities) { - if (e.getUUID() == uuid) { + if (e.getUUID().equals(uuid)) { entity = e; + break; } } if (entity != null) {