Didn't mean to commit that

This commit is contained in:
Matthew Messinger 2018-07-30 01:35:56 -04:00
parent 668d7ff6e0
commit 6337b055c9
7 changed files with 0 additions and 242 deletions

View file

@ -1,17 +0,0 @@
package com.minelittlepony.render.transform;
import com.minelittlepony.model.AbstractPonyModel;
import net.minecraft.entity.EntityLivingBase;
public interface PonyPosture<T extends EntityLivingBase> {
PonyPosture<EntityLivingBase> ELYTRA = new PostureElytra();
PonyPosture<? extends EntityLivingBase> FLIGHT = new PostureFlight();
PonyPosture<? extends EntityLivingBase> SWIMMING = new PostureSwimming();
PonyPosture<EntityLivingBase> 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);
}

View file

@ -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);
}

View file

@ -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<EntityLivingBase> {
@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);
}
}

View file

@ -1,11 +0,0 @@
package com.minelittlepony.render.transform;
import com.minelittlepony.model.AbstractPonyModel;
import net.minecraft.entity.EntityLivingBase;
public class PostureFalling implements PonyPosture<EntityLivingBase> {
@Override
public void transform(AbstractPonyModel model, EntityLivingBase entity, double motionX, double motionY, double motionZ, float pitch, float yaw, float ticks) {
model.motionPitch = 0;
}
}

View file

@ -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<AbstractClientPlayer> {
@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);
}
}

View file

@ -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);
}
}

View file

@ -1,8 +0,0 @@
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
package com.minelittlepony.render.transform;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;