diff --git a/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java b/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java index 180426fb..a62f000f 100644 --- a/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java @@ -37,32 +37,36 @@ public class LevitatingItemRenderer { */ public void renderItem(ItemRenderer itemRenderer, @Nullable LivingEntity entity, ItemStack stack, ModelTransformationMode mode, boolean left, MatrixStack matrix, VertexConsumerProvider renderContext, @Nullable World world, int lightUv, int posLong) { - if (entity instanceof PlayerEntity && (mode.isFirstPerson() || mode == ModelTransformationMode.THIRD_PERSON_LEFT_HAND || mode == ModelTransformationMode.THIRD_PERSON_RIGHT_HAND)) { + if (mode.isFirstPerson() + || mode == ModelTransformationMode.THIRD_PERSON_LEFT_HAND + || mode == ModelTransformationMode.THIRD_PERSON_RIGHT_HAND + ) { + Pony.getManager().getPony(entity).ifPresentOrElse(pony -> { + matrix.push(); - Pony pony = Pony.getManager().getPony((PlayerEntity)entity); + boolean doMagic = PonyConfig.getInstance().fpsmagic.get() && pony.hasMagic(); - matrix.push(); + if (doMagic && mode.isFirstPerson()) { + setupPerspective(itemRenderer, entity, stack, left, matrix); + } - boolean doMagic = PonyConfig.getInstance().fpsmagic.get() && pony.hasMagic(); + itemRenderer.renderItem(entity, stack, mode, left, matrix, renderContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong); - if (doMagic && mode.isFirstPerson()) { - setupPerspective(itemRenderer, entity, stack, left, matrix); - } + if (doMagic) { + VertexConsumerProvider interceptedContext = getProvider(pony, renderContext); - itemRenderer.renderItem(entity, stack, mode, left, matrix, renderContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong); + matrix.scale(1.1F, 1.1F, 1.1F); + matrix.translate(0.015F, 0.01F, 0.01F); - if (doMagic) { - VertexConsumerProvider interceptedContext = getProvider(pony, renderContext); + itemRenderer.renderItem(entity, stack, mode, left, matrix, interceptedContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong); + matrix.translate(-0.03F, -0.02F, -0.02F); + itemRenderer.renderItem(entity, stack, mode, left, matrix, interceptedContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong); + } - matrix.scale(1.1F, 1.1F, 1.1F); - matrix.translate(0.015F, 0.01F, 0.01F); - - itemRenderer.renderItem(entity, stack, mode, left, matrix, interceptedContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong); - matrix.translate(-0.03F, -0.02F, -0.02F); - itemRenderer.renderItem(entity, stack, mode, left, matrix, interceptedContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong); - } - - matrix.pop(); + matrix.pop(); + }, () -> { + itemRenderer.renderItem(entity, stack, mode, left, matrix, renderContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong); + }); } else { itemRenderer.renderItem(entity, stack, mode, left, matrix, renderContext, world, lightUv, OverlayTexture.DEFAULT_UV, posLong); } diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/HeldItemFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/HeldItemFeature.java index 44b6d94a..4a5c8179 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/HeldItemFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/HeldItemFeature.java @@ -37,6 +37,7 @@ public class HeldItemFeature & return main ? entity.getMainHandStack() : entity.getOffHandStack(); } + @Override public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) {