diff --git a/src/main/java/com/minelittlepony/render/transform/PonyPosture.java b/src/main/java/com/minelittlepony/render/transform/PonyPosture.java deleted file mode 100644 index 15116bb6..00000000 --- a/src/main/java/com/minelittlepony/render/transform/PonyPosture.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.minelittlepony.render.transform; - -import com.minelittlepony.model.AbstractPonyModel; -import net.minecraft.entity.EntityLivingBase; - -public interface PonyPosture { - PonyPosture ELYTRA = new PostureElytra(); - PonyPosture FLIGHT = new PostureFlight(); - PonyPosture SWIMMING = new PostureSwimming(); - PonyPosture FALLING = new PostureFalling(); - - default boolean applies(EntityLivingBase entity) { - return true; - } - - void transform(AbstractPonyModel model, T entity, double motionX, double motionY, double motionZ, float pitch, float yaw, float ticks); -} diff --git a/src/main/java/com/minelittlepony/render/transform/PonyTransformation.java b/src/main/java/com/minelittlepony/render/transform/PonyTransformation.java deleted file mode 100644 index a6f5f371..00000000 --- a/src/main/java/com/minelittlepony/render/transform/PonyTransformation.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.minelittlepony.render.transform; - -import static net.minecraft.client.renderer.GlStateManager.scale; -import static net.minecraft.client.renderer.GlStateManager.translate; - -import com.minelittlepony.model.BodyPart; -import com.minelittlepony.model.capabilities.IModel; - -public enum PonyTransformation { - - NORMAL { - @Override - public void transform(IModel model, BodyPart part) { - if (model.isSleeping()) translate(0, -0.61F, 0); - - switch (part) { - case NECK: - if (model.isCrouching()) translate(-0.03F, 0.03F, 0.1F); - default: - } - } - }, - LARGE { - @Override - public void transform(IModel model, BodyPart part) { - if (model.isSleeping()) translate(0, -0.98F, 0.2F); - - switch (part) { - case NECK: - translate(0, -0.15F, -0.07F); - if (model.isCrouching()) translate(-0.03F, 0.16F, 0.07F); - break; - case HEAD: - translate(0, -0.17F, -0.04F); - if (model.isSleeping()) translate(0, 0, -0.1F); - if (model.isCrouching()) translate(0, 0.15F, 0); - break; - case BODY: - translate(0, -0.2F, -0.04F); - scale(1.15F, 1.2F, 1.2F); - break; - case TAIL: - translate(0, -0.2F, 0.08F); - break; - case LEGS: - translate(0, -0.14F, 0); - scale(1.15F, 1.12F, 1.15F); - break; - } - } - }, - FOAL { - @Override - public void transform(IModel model, BodyPart part) { - if (model.isCrouching()) translate(0, -0.3F, 0); - if (model.isSleeping()) translate(0, -0.6F, -0.5F); - if (model.isRiding()) translate(0, -0.4F, 0); - - translate(0, 0.2F, 0); - - switch (part) { - case NECK: - scale(1.3F, 1.3F, 1.3F); - if (model.isCrouching()) translate(0, -0.01F, 0.15F); - break; - case HEAD: - scale(1.3F, 1.3F, 1.3F); - break; - case LEGS: - translate(0, 0.1F, 0); - scale(1, 0.81F, 1); - break; - default: - } - } - }, - TALL { - @Override - public void transform(IModel model, BodyPart part) { - if (model.isSleeping()) translate(0, -0.5F, 0.25F); - - switch (part) { - case NECK: - translate(0, -0.09F, -0.01F); - scale(1, 1.1F, 1); - if (model.isCrouching()) translate(-0.02F, -0.02F, 0.1F); - break; - case HEAD: - translate(0, -0.15F, 0.01F); - if (model.isCrouching()) translate(0, 0.05F, 0); - break; - case BODY: - translate(0, -0.1F, 0); - break; - case TAIL: - translate(0, -0.1F, 0); - break; - case LEGS: - translate(0, -0.25F, 0.03F); - scale(1, 1.18F, 1); - if (model.isGoingFast()) translate(0, 0.05F, 0); - break; - } - } - }; - - public abstract void transform(IModel model, BodyPart part); -} diff --git a/src/main/java/com/minelittlepony/render/transform/PostureElytra.java b/src/main/java/com/minelittlepony/render/transform/PostureElytra.java deleted file mode 100644 index e089fff5..00000000 --- a/src/main/java/com/minelittlepony/render/transform/PostureElytra.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.minelittlepony.render.transform; - -import com.minelittlepony.model.AbstractPonyModel; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.EntityLivingBase; - -public class PostureElytra implements PonyPosture { - @Override - public void transform(AbstractPonyModel model, EntityLivingBase entity, double motionX, double motionY, double motionZ, float pitch, float yaw, float ticks) { - GlStateManager.rotate(90, 1, 0, 0); - GlStateManager.translate(0, entity.isSneaking() ? 0.2F : -1, 0); - } -} diff --git a/src/main/java/com/minelittlepony/render/transform/PostureFalling.java b/src/main/java/com/minelittlepony/render/transform/PostureFalling.java deleted file mode 100644 index 1aaf1a80..00000000 --- a/src/main/java/com/minelittlepony/render/transform/PostureFalling.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.minelittlepony.render.transform; - -import com.minelittlepony.model.AbstractPonyModel; -import net.minecraft.entity.EntityLivingBase; - -public class PostureFalling implements PonyPosture { - @Override - public void transform(AbstractPonyModel model, EntityLivingBase entity, double motionX, double motionY, double motionZ, float pitch, float yaw, float ticks) { - model.motionPitch = 0; - } -} diff --git a/src/main/java/com/minelittlepony/render/transform/PostureFlight.java b/src/main/java/com/minelittlepony/render/transform/PostureFlight.java deleted file mode 100644 index 2a45390b..00000000 --- a/src/main/java/com/minelittlepony/render/transform/PostureFlight.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.minelittlepony.render.transform; - -import com.minelittlepony.model.AbstractPonyModel; -import com.minelittlepony.util.math.MathUtil; -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.math.MathHelper; - -public class PostureFlight implements PonyPosture { - @Override - public boolean applies(EntityLivingBase entity) { - return entity instanceof AbstractClientPlayer; - } - - protected double calculateRoll(AbstractClientPlayer player, double motionX, double motionY, double motionZ) { - - // since model roll should probably be calculated from model rotation rather than entity rotation... - double roll = MathUtil.sensibleAngle(player.prevRenderYawOffset - player.renderYawOffset); - double horMotion = Math.sqrt(motionX * motionX + motionZ * motionZ); - float modelYaw = MathUtil.sensibleAngle(player.renderYawOffset); - - // detecting that we're flying backwards and roll must be inverted - if (Math.abs(MathUtil.sensibleAngle((float) Math.toDegrees(Math.atan2(motionX, motionZ)) + modelYaw)) > 90) { - roll *= -1; - } - - // ayyy magic numbers (after 5 - an approximation of nice looking coefficients calculated by hand) - - // roll might be zero, in which case Math.pow produces +Infinity. Anything x Infinity = NaN. - double pow = roll != 0 ? Math.pow(Math.abs(roll), -0.191) : 0; - - roll *= horMotion * 5 * (3.6884f * pow); - - assert !Float.isNaN((float)roll); - - return MathHelper.clamp(roll, -54, 54); - } - - protected double calculateIncline(AbstractClientPlayer player, double motionX, double motionY, double motionZ) { - double dist = Math.sqrt(motionX * motionX + motionZ * motionZ); - double angle = Math.atan2(motionY, dist); - - if (!player.capabilities.isFlying) { - angle /= 2; - } - - angle = MathUtil.clampLimit(angle, Math.PI / 3); - - return Math.toDegrees(angle); - } - - @Override - public void transform(AbstractPonyModel model, AbstractClientPlayer player, double motionX, double motionY, double motionZ, float pitch, float yaw, float ticks) { - model.motionPitch = (float) calculateIncline(player, motionX, motionY, motionZ); - - GlStateManager.rotate(model.motionPitch, 1, 0, 0); - - float roll = (float)calculateRoll(player, motionX, motionY, motionZ); - - roll = model.getMetadata().getInterpolator().interpolate("pegasusRoll", roll, 10); - - GlStateManager.rotate((float)roll, 0, 0, 1); - } -} diff --git a/src/main/java/com/minelittlepony/render/transform/PostureSwimming.java b/src/main/java/com/minelittlepony/render/transform/PostureSwimming.java deleted file mode 100644 index b2e7792c..00000000 --- a/src/main/java/com/minelittlepony/render/transform/PostureSwimming.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.minelittlepony.render.transform; - -import net.minecraft.client.entity.AbstractClientPlayer; - -public class PostureSwimming extends PostureFlight { - - @Override - protected double calculateRoll(AbstractClientPlayer player, double motionX, double motionY, double motionZ) { - - motionX *= 2; - motionZ *= 2; - - return super.calculateRoll(player, motionX, motionY, motionZ); - } - - @Override - protected double calculateIncline(AbstractClientPlayer player, double motionX, double motionY, double motionZ) { - return super.calculateIncline(player, motionX, motionY, motionZ); - } -} diff --git a/src/main/java/com/minelittlepony/render/transform/package-info.java b/src/main/java/com/minelittlepony/render/transform/package-info.java deleted file mode 100644 index 21b71079..00000000 --- a/src/main/java/com/minelittlepony/render/transform/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -@MethodsReturnNonnullByDefault -@ParametersAreNonnullByDefault -package com.minelittlepony.render.transform; - -import mcp.MethodsReturnNonnullByDefault; - -import javax.annotation.ParametersAreNonnullByDefault; -