|
20 | 20 | import meteordevelopment.meteorclient.utils.render.color.Color; |
21 | 21 | import meteordevelopment.orbit.EventHandler; |
22 | 22 | import net.minecraft.entity.Entity; |
| 23 | +import net.minecraft.entity.LivingEntity; |
23 | 24 | import net.minecraft.entity.passive.TameableEntity; |
24 | 25 | import net.minecraft.entity.player.PlayerEntity; |
| 26 | +import net.minecraft.entity.projectile.thrown.EnderPearlEntity; |
| 27 | + |
| 28 | +import org.jetbrains.annotations.Nullable; |
25 | 29 | import org.joml.Vector3d; |
26 | 30 |
|
27 | 31 | import java.util.HashMap; |
@@ -57,17 +61,18 @@ public void onDeactivate() { |
57 | 61 | @EventHandler |
58 | 62 | private void onRender2D(Render2DEvent event) { |
59 | 63 | for (Entity entity : mc.world.getEntities()) { |
60 | | - UUID ownerUuid; |
| 64 | + UUID ownerUUID; |
61 | 65 |
|
62 | | - if (entity instanceof TameableEntity tameable) ownerUuid = tameable.getOwnerUuid(); |
| 66 | + if (entity instanceof TameableEntity tameable) ownerUUID = tameable.getOwnerUuid(); |
| 67 | + else if (entity instanceof EnderPearlEntity pearl && pearl.getOwner() != null) ownerUUID = pearl.getOwner().getUuid(); |
63 | 68 | else continue; |
64 | 69 |
|
65 | | - if (ownerUuid != null) { |
| 70 | + if (ownerUUID != null) { |
66 | 71 | Utils.set(pos, entity, event.tickDelta); |
67 | 72 | pos.add(0, entity.getEyeHeight(entity.getPose()) + 0.75, 0); |
68 | 73 |
|
69 | 74 | if (NametagUtils.to2D(pos, scale.get())) { |
70 | | - renderNametag(getOwnerName(ownerUuid)); |
| 75 | + renderNametag(getOwnerName(ownerUUID)); |
71 | 76 | } |
72 | 77 | } |
73 | 78 | } |
|
0 commit comments