diff --git a/src/main/java/com/minelittlepony/client/render/EquineRenderManager.java b/src/main/java/com/minelittlepony/client/render/EquineRenderManager.java index 4827db26..6849a246 100644 --- a/src/main/java/com/minelittlepony/client/render/EquineRenderManager.java +++ b/src/main/java/com/minelittlepony/client/render/EquineRenderManager.java @@ -103,17 +103,14 @@ public class EquineRenderManager) PonyPosture.getPosture(getModel().getAttributes(), player)).apply(player, getModel(), stack, yaw, ticks, 1); + public void setupTransforms(T entity, MatrixStack stack, float yaw, float tickDelta) { + PonyPosture.of(getModel().getAttributes()).apply(entity, getModel(), stack, yaw, tickDelta, 1); } - @SuppressWarnings("unchecked") - public void applyPostureRiding(T player, MatrixStack stack, float yaw, float ticks) { - ((PonyPosture) PonyPosture.getPosture(getModel().getAttributes(), player)).apply(player, getModel(), stack, yaw, ticks, -1); + public void applyPostureRiding(T entity, MatrixStack stack, float yaw, float tickDelta) { + PonyPosture.of(getModel().getAttributes()).apply(entity, getModel(), stack, yaw, tickDelta, -1); } - public M getModel() { return playerModel.body(); } diff --git a/src/main/java/com/minelittlepony/client/render/entity/AbstractPonyRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/AbstractPonyRenderer.java index 3c83ce4a..31ada979 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/AbstractPonyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/AbstractPonyRenderer.java @@ -81,8 +81,7 @@ public abstract class AbstractPonyRenderer { - PonyPosture STANDING = (IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float tickDelta) -> { +public interface PonyPosture { + PonyPosture STANDING = (IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float tickDelta) -> { model.getAttributes().motionPitch /= 10; model.getAttributes().motionLerp /= 10; model.getAttributes().motionRoll /= 10; }; - PonyPosture ELYTRA = (IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float tickDelta) -> { + PonyPosture ELYTRA = (IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float tickDelta) -> { stack.translate(0, entity.isInSneakingPose() ? -0.825F : -1, 0); }; - PonyPosture FLYING = new PostureFlight(1, 0); - PonyPosture SWIMMING = new PostureFlight(2, -0.9F); - PonyPosture FALLING = STANDING; + PonyPosture FLYING = new PostureFlight(1, 0); + PonyPosture SWIMMING = new PostureFlight(2, -0.9F); + PonyPosture FALLING = STANDING; @NotNull - static PonyPosture getPosture(ModelAttributes attributes, LivingEntity entity) { + static PonyPosture of(ModelAttributes attributes) { if (attributes.isGliding) { return ELYTRA; } @@ -44,7 +44,7 @@ public interface PonyPosture { return FALLING; } - default void apply(T player, IModel model, MatrixStack stack, float yaw, float tickDelta, int invert) { + default void apply(LivingEntity player, IModel model, MatrixStack stack, float yaw, float tickDelta, int invert) { if (RenderPass.getCurrent() == RenderPass.GUI || RenderPass.getCurrent() == RenderPass.WORLD) { // this reverts the rotations done in PlayerEntityRenderer#setupTransforms @@ -91,5 +91,5 @@ public interface PonyPosture { transform(model, player, stack, motionX, invert * motionY, motionZ, yaw, tickDelta); } - void transform(IModel model, T entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float tickDelta); + void transform(IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float tickDelta); } diff --git a/src/main/java/com/minelittlepony/client/transform/PostureFlight.java b/src/main/java/com/minelittlepony/client/transform/PostureFlight.java index a621d064..b019b215 100644 --- a/src/main/java/com/minelittlepony/client/transform/PostureFlight.java +++ b/src/main/java/com/minelittlepony/client/transform/PostureFlight.java @@ -7,7 +7,7 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.RotationAxis; import net.minecraft.entity.LivingEntity; -public class PostureFlight extends MotionCompositor implements PonyPosture { +public class PostureFlight extends MotionCompositor implements PonyPosture { private final float xScale; private final float yOffset;