From a8e1c66e0f93ea07684fc1fa519f43ae96e734f9 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 13 Oct 2022 19:39:53 +0200 Subject: [PATCH] Fix error when updating pony model for a disguise player entity --- .../minelittlepony/unicopia/client/minelittlepony/Main.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java index 7a02815f..ee14a709 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java +++ b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java @@ -37,13 +37,12 @@ public class Main extends MineLPDelegate implements ClientModInitializer { IGear.register(GlassesGear::new); } - @SuppressWarnings("unchecked") private void onPonyModelPrepared(Entity entity, IModel model, ModelAttributes.Mode mode) { if (hookErroring) return; try { if (entity instanceof PlayerEntity) { - if (entity instanceof Owned) { - entity = ((Owned)entity).getMaster(); + if (entity instanceof Owned o && o.getMaster() instanceof PlayerEntity master) { + entity = master; } Pony pony = Pony.of((PlayerEntity)entity);