Fix error when updating pony model for a disguise player entity

This commit is contained in:
Sollace 2022-10-13 19:39:53 +02:00
parent 67a894958c
commit a8e1c66e0f

View file

@ -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<PlayerEntity>)entity).getMaster();
if (entity instanceof Owned<?> o && o.getMaster() instanceof PlayerEntity master) {
entity = master;
}
Pony pony = Pony.of((PlayerEntity)entity);