Skip to content

Commit

Permalink
fix: avoid tripping async catcher when getting entity from chunk (#2464)
Browse files Browse the repository at this point in the history
  • Loading branch information
dordsor21 authored Oct 18, 2023
1 parent 470c75d commit c6a9673
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,15 @@ 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().equals(uuid)) {
entity = e;
break;
}
}
if (entity != null) {
org.bukkit.entity.Entity bukkitEnt = entity.getBukkitEntity();
return BukkitAdapter.adapt(bukkitEnt).getState().getNbtData();
Expand Down

0 comments on commit c6a9673

Please sign in to comment.