Skip to content

Commit

Permalink
fix: avoid tripping async catcher when getting entity from chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
dordsor21 committed Oct 14, 2023
1 parent 186d24b commit 0f5abbf
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Entity> 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();
Expand Down

0 comments on commit 0f5abbf

Please sign in to comment.