Skip to content

Commit

Permalink
attempt to fix #56
Browse files Browse the repository at this point in the history
  • Loading branch information
amsam0 committed Jul 6, 2024
1 parent 3dfc123 commit 8194338
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ public ServerPlayer commandContextToPlayer(CommandContext<?> context) {
// the cast is safe because getBukkitEntity and getBukkitSender return the same thing
try {
net.minecraft.server.level.ServerLevel nmsLevel = (net.minecraft.server.level.ServerLevel) getCraftWorld().getMethod("getHandle").invoke(world);
net.minecraft.world.entity.Entity nmsEntity = nmsLevel.getEntity(uuid);
net.minecraft.world.entity.Entity nmsEntity;
try {
nmsEntity = nmsLevel.moonrise$getEntityLookup().get(uuid);
} catch (NoSuchMethodError ignored) {
nmsEntity = nmsLevel.getEntity(uuid);
}
if (nmsEntity == null) return null;
@SuppressWarnings("DataFlowIssue") Entity entity = (Entity) nmsEntity.getBukkitSender(null);
return api.createPosition(
Expand Down

0 comments on commit 8194338

Please sign in to comment.