mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Simplify model classes/interfaces by moving all these properties to a separate class
This commit is contained in:
parent
e6ace54fb4
commit
a26e26030e
44 changed files with 452 additions and 635 deletions
|
@ -6,12 +6,12 @@ import java.util.function.Function;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.minelittlepony.client.gui.hdskins.DummyPony;
|
import com.minelittlepony.client.gui.hdskins.DummyPony;
|
||||||
import com.minelittlepony.client.gui.hdskins.RenderDummyPony;
|
import com.minelittlepony.client.gui.hdskins.RenderDummyPony;
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.model.races.PlayerModels;
|
import com.minelittlepony.client.model.races.PlayerModels;
|
||||||
import com.minelittlepony.client.render.LevitatingItemRenderer;
|
import com.minelittlepony.client.render.LevitatingItemRenderer;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.client.render.entities.MobRenderers;
|
import com.minelittlepony.client.render.entities.MobRenderers;
|
||||||
import com.minelittlepony.client.render.entities.player.RenderPonyPlayer;
|
import com.minelittlepony.client.render.entities.player.RenderPonyPlayer;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.minelittlepony.client.model.armour.ModelPonyArmour;
|
||||||
import com.minelittlepony.client.model.armour.ArmourWrapper;
|
import com.minelittlepony.client.model.armour.ArmourWrapper;
|
||||||
import com.minelittlepony.client.model.components.PonySnout;
|
import com.minelittlepony.client.model.components.PonySnout;
|
||||||
import com.minelittlepony.client.model.components.PonyTail;
|
import com.minelittlepony.client.model.components.PonyTail;
|
||||||
import com.minelittlepony.client.pony.PonyData;
|
|
||||||
import com.minelittlepony.client.transform.PonyTransformation;
|
import com.minelittlepony.client.transform.PonyTransformation;
|
||||||
import com.minelittlepony.client.util.render.AbstractRenderer;
|
import com.minelittlepony.client.util.render.AbstractRenderer;
|
||||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||||
|
@ -12,20 +11,14 @@ import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPart;
|
import com.minelittlepony.model.IPart;
|
||||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||||
import com.minelittlepony.pony.IPony;
|
|
||||||
import com.minelittlepony.pony.IPonyData;
|
|
||||||
import com.minelittlepony.pony.meta.Size;
|
|
||||||
import com.minelittlepony.util.math.MathUtil;
|
|
||||||
|
|
||||||
import net.minecraft.client.model.Cuboid;
|
import net.minecraft.client.model.Cuboid;
|
||||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.AbsoluteHand;
|
import net.minecraft.util.AbsoluteHand;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||||
|
|
||||||
|
@ -34,38 +27,11 @@ import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPonyModel<T> {
|
public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPonyModel<T> {
|
||||||
|
|
||||||
public boolean isSleeping;
|
protected PlaneRenderer upperTorso;
|
||||||
public boolean isFlying;
|
protected PlaneRenderer neck;
|
||||||
public boolean isElytraFlying;
|
|
||||||
public boolean isSwimming;
|
|
||||||
public boolean isCrouching;
|
|
||||||
public boolean isRidingInteractive;
|
|
||||||
public boolean headGear;
|
|
||||||
|
|
||||||
/**
|
protected IPart tail;
|
||||||
* Associated pony data.
|
protected PonySnout snout;
|
||||||
*/
|
|
||||||
private IPonyData metadata = new PonyData();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Vertical pitch whilst flying.
|
|
||||||
*/
|
|
||||||
public float motionPitch;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flag indicating that this model is performing a rainboom (flight).
|
|
||||||
*/
|
|
||||||
protected boolean rainboom;
|
|
||||||
|
|
||||||
protected double motionLerp;
|
|
||||||
|
|
||||||
public PlaneRenderer upperTorso;
|
|
||||||
public PlaneRenderer neck;
|
|
||||||
|
|
||||||
public IPart tail;
|
|
||||||
public PonySnout snout;
|
|
||||||
|
|
||||||
public UUID interpolatorId;
|
|
||||||
|
|
||||||
public AbstractPonyModel(boolean arms) {
|
public AbstractPonyModel(boolean arms) {
|
||||||
super(0, arms);
|
super(0, arms);
|
||||||
|
@ -76,67 +42,37 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
return new ArmourWrapper<>(new ModelPonyArmour<>(), new ModelPonyArmour<>());
|
return new ArmourWrapper<>(new ModelPonyArmour<>(), new ModelPonyArmour<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
|
|
||||||
*/
|
|
||||||
private void checkRainboom(T entity, float swing) {
|
|
||||||
Vec3d motion = entity.getVelocity();
|
|
||||||
double zMotion = Math.sqrt(motion.x * motion.x + motion.z * motion.z);
|
|
||||||
|
|
||||||
rainboom = (isFlying() && canFly()) || isElytraFlying();
|
|
||||||
rainboom &= zMotion > 0.4F;
|
|
||||||
|
|
||||||
motionLerp = MathUtil.clampLimit(zMotion * 30, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateLivingState(T entity, IPony pony) {
|
|
||||||
isChild = entity.isBaby();
|
|
||||||
isSneaking = entity.isSneaking();
|
|
||||||
isCrouching = pony.isCrouching(entity);
|
|
||||||
isSleeping = entity.isSleeping();
|
|
||||||
isFlying = pony.isFlying(entity);
|
|
||||||
isElytraFlying = entity.isFallFlying();
|
|
||||||
isSwimming = pony.isSwimming(entity);
|
|
||||||
headGear = pony.isWearingHeadgear(entity);
|
|
||||||
isRidingInteractive = pony.isRidingInteractive(entity);
|
|
||||||
interpolatorId = entity.getUuid();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the model's various rotation angles.
|
* Sets the model's various rotation angles.
|
||||||
*
|
*
|
||||||
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
* @param move Entity motion parameter
|
||||||
|
* i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
||||||
* @param swing Degree to which each 'limb' swings.
|
* @param swing Degree to which each 'limb' swings.
|
||||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
* @param ticks Total whole and partial ticks since the entity's existence.
|
||||||
|
* Used in animations together with {@code swing} and {@code move}.
|
||||||
* @param headYaw Horizontal head motion in radians.
|
* @param headYaw Horizontal head motion in radians.
|
||||||
* @param headPitch Vertical head motion in radians.
|
* @param headPitch Vertical head motion in radians.
|
||||||
* @param scale Scaling factor used to render this model. Determined by the return value of {@link RenderLivingBase.prepareScale}. Usually {@code 0.0625F}.
|
* @param scale Scaling factor used to render this model.
|
||||||
|
* Determined by the return value of {@link RenderLivingBase.prepareScale}.
|
||||||
|
* Usually {@code 0.0625F}.
|
||||||
* @param entity The entity we're being called for.
|
* @param entity The entity we're being called for.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
checkRainboom(entity, swing);
|
attributes.checkRainboom(entity, swing, canFly());
|
||||||
|
|
||||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
|
||||||
float headRotateAngleY = isSleeping() ? (Math.abs(entity.getUuid().getMostSignificantBits()) % 2.8F) - 1.9F : headYaw / 57.29578F;
|
updateHeadRotation(headYaw, headPitch);
|
||||||
float headRotateAngleX = isSleeping() ? 0.1f : headPitch / 57.29578F;
|
|
||||||
|
|
||||||
headRotateAngleX = Math.min(headRotateAngleX, (float) (0.5f - Math.toRadians(motionPitch)));
|
|
||||||
headRotateAngleX = Math.max(headRotateAngleX, (float) (-1.25f - Math.toRadians(motionPitch)));
|
|
||||||
|
|
||||||
updateHeadRotation(headRotateAngleX, headRotateAngleY);
|
|
||||||
|
|
||||||
shakeBody(move, swing, getWobbleAmount(), ticks);
|
shakeBody(move, swing, getWobbleAmount(), ticks);
|
||||||
rotateLegs(move, swing, ticks, entity);
|
rotateLegs(move, swing, ticks, entity);
|
||||||
|
|
||||||
if (!isSwimming() && !rainboom) {
|
if (!attributes.isSwimming && !attributes.isGoingFast) {
|
||||||
holdItem(swing);
|
holdItem(swing);
|
||||||
}
|
}
|
||||||
swingItem(entity);
|
swingItem(entity);
|
||||||
|
|
||||||
if (isCrouching()) {
|
if (attributes.isCrouching) {
|
||||||
ponyCrouch();
|
ponyCrouch();
|
||||||
} else if (isRiding) {
|
} else if (isRiding) {
|
||||||
ponyRide();
|
ponyRide();
|
||||||
|
@ -145,27 +81,17 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
|
|
||||||
rightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
rightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||||
leftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
leftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||||
swingArms(ticks);
|
animateBreathing(ticks);
|
||||||
setHead(0, 0, 0);
|
head.setRotationPoint(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSleeping) {
|
if (attributes.isSleeping) {
|
||||||
ponySleep();
|
ponySleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
animateWears();
|
animateWears();
|
||||||
|
|
||||||
snout.setGender(metadata.getGender());
|
snout.setGender(getMetadata().getGender());
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getWobbleAmount() {
|
|
||||||
|
|
||||||
if (getSwingAmount() <= 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return MathHelper.sin(MathHelper.sqrt(getSwingAmount()) * PI * 2) * 0.04F;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,7 +99,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
*/
|
*/
|
||||||
protected void ponyCrouch() {
|
protected void ponyCrouch() {
|
||||||
adjustBody(BODY_ROT_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
adjustBody(BODY_ROT_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
||||||
setHead(0, 6, -2);
|
head.setRotationPoint(0, 6, -2);
|
||||||
|
|
||||||
rightArm.pitch -= LEG_ROT_X_SNEAK_ADJ;
|
rightArm.pitch -= LEG_ROT_X_SNEAK_ADJ;
|
||||||
leftArm.pitch -= LEG_ROT_X_SNEAK_ADJ;
|
leftArm.pitch -= LEG_ROT_X_SNEAK_ADJ;
|
||||||
|
@ -189,23 +115,23 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
rightLeg.pitch = ROTATE_90;
|
rightLeg.pitch = ROTATE_90;
|
||||||
leftLeg.pitch = ROTATE_90;
|
leftLeg.pitch = ROTATE_90;
|
||||||
|
|
||||||
setHead(1, 2, isSneaking ? -1 : 1);
|
head.setRotationPoint(1, 2, isSneaking ? -1 : 1);
|
||||||
|
|
||||||
AbstractRenderer.shiftRotationPoint(rightArm, 0, 2, 6);
|
AbstractRenderer.shiftRotationPoint(rightArm, 0, 2, 6);
|
||||||
AbstractRenderer.shiftRotationPoint(leftArm, 0, 2, 6);
|
AbstractRenderer.shiftRotationPoint(leftArm, 0, 2, 6);
|
||||||
AbstractRenderer.shiftRotationPoint(rightLeg, 0, 2, -8);
|
AbstractRenderer.shiftRotationPoint(rightLeg, 0, 2, -8);
|
||||||
AbstractRenderer.shiftRotationPoint(leftLeg, 0, 2, -8);
|
AbstractRenderer.shiftRotationPoint(leftLeg, 0, 2, -8);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ponyRide() {
|
protected void ponyRide() {
|
||||||
if (isRidingInteractive) {
|
if (attributes.isSitting) {
|
||||||
adjustBodyComponents(BODY_ROT_X_RIDING * 2, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
|
adjustBodyComponents(BODY_ROT_X_RIDING * 2, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
|
||||||
adjustNeck(BODY_ROT_X_NOTSNEAK * 2, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK - 4);
|
adjustNeck(BODY_ROT_X_NOTSNEAK * 2, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK - 4);
|
||||||
setHead(0, -2, -5);
|
head.setRotationPoint(0, -2, -5);
|
||||||
} else {
|
} else {
|
||||||
adjustBodyComponents(BODY_ROT_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
|
adjustBodyComponents(BODY_ROT_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
|
||||||
adjustNeck(BODY_ROT_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
|
adjustNeck(BODY_ROT_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
|
||||||
setHead(0, 0, 0);
|
head.setRotationPoint(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
leftLeg.rotationPointZ = 15;
|
leftLeg.rotationPointZ = 15;
|
||||||
|
@ -221,7 +147,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
leftArm.roll = -PI * 0.06f;
|
leftArm.roll = -PI * 0.06f;
|
||||||
rightArm.roll = PI * 0.06f;
|
rightArm.roll = PI * 0.06f;
|
||||||
|
|
||||||
if (isRidingInteractive) {
|
if (attributes.isSitting) {
|
||||||
leftLeg.yaw = PI / 15;
|
leftLeg.yaw = PI / 15;
|
||||||
leftLeg.pitch = PI / 9;
|
leftLeg.pitch = PI / 9;
|
||||||
|
|
||||||
|
@ -251,7 +177,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
||||||
*/
|
*/
|
||||||
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
|
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
|
||||||
tail.setRotationAndAngles(isSwimming() || rainboom, interpolatorId, move, swing, bodySwing * 5, ticks);
|
tail.setRotationAndAngles(attributes.isSwimming || attributes.isGoingFast, attributes.interpolatorId, move, swing, bodySwing * 5, ticks);
|
||||||
|
|
||||||
upperTorso.yaw = bodySwing;
|
upperTorso.yaw = bodySwing;
|
||||||
body.yaw = bodySwing;
|
body.yaw = bodySwing;
|
||||||
|
@ -264,29 +190,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
leftLegOverlay.copyRotation(leftLeg);
|
leftLegOverlay.copyRotation(leftLeg);
|
||||||
rightLegOverlay.copyRotation(rightLeg);
|
rightLegOverlay.copyRotation(rightLeg);
|
||||||
bodyOverlay.copyRotation(body);
|
bodyOverlay.copyRotation(body);
|
||||||
}
|
headwear.copyRotation(head);
|
||||||
|
|
||||||
@Override
|
|
||||||
public Cuboid getHead() {
|
|
||||||
return head;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPitch(float pitch) {
|
|
||||||
motionPitch = pitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getPitch() {
|
|
||||||
return motionPitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the head rotation point.
|
|
||||||
*/
|
|
||||||
protected void setHead(float posX, float posY, float posZ) {
|
|
||||||
head.setRotationPoint(posX, posY, posZ);
|
|
||||||
headwear.setRotationPoint(posX, posY, posZ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -295,9 +199,15 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
* @param x New rotation X
|
* @param x New rotation X
|
||||||
* @param y New rotation Y
|
* @param y New rotation Y
|
||||||
*/
|
*/
|
||||||
protected void updateHeadRotation(float x, float y) {
|
private void updateHeadRotation(float headYaw, float headPitch) {
|
||||||
headwear.yaw = head.yaw = y;
|
|
||||||
headwear.pitch = head.pitch = x;
|
head.yaw = attributes.isSleeping ? (Math.abs(attributes.interpolatorId.getMostSignificantBits()) % 2.8F) - 1.9F : headYaw / 57.29578F;
|
||||||
|
|
||||||
|
headPitch = attributes.isSleeping ? 0.1f : headPitch / 57.29578F;
|
||||||
|
headPitch = Math.min(headPitch, (float) (0.5f - Math.toRadians(attributes.motionPitch)));
|
||||||
|
headPitch = Math.max(headPitch, (float) (-1.25f - Math.toRadians(attributes.motionPitch)));
|
||||||
|
|
||||||
|
head.pitch = headPitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -308,9 +218,9 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void rotateLegs(float move, float swing, float ticks, T entity) {
|
protected void rotateLegs(float move, float swing, float ticks, T entity) {
|
||||||
if (isSwimming()) {
|
if (attributes.isSwimming) {
|
||||||
rotateLegsSwimming(move, swing, ticks, entity);
|
rotateLegsSwimming(move, swing, ticks, entity);
|
||||||
} else if (isGoingFast()) {
|
} else if (attributes.isGoingFast) {
|
||||||
rotateLegsInFlight(move, swing, ticks, entity);
|
rotateLegsInFlight(move, swing, ticks, entity);
|
||||||
} else {
|
} else {
|
||||||
rotateLegsOnGround(move, swing, ticks, entity);
|
rotateLegsOnGround(move, swing, ticks, entity);
|
||||||
|
@ -319,14 +229,14 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
float sin = MathHelper.sin(body.yaw) * 5;
|
float sin = MathHelper.sin(body.yaw) * 5;
|
||||||
float cos = MathHelper.cos(body.yaw) * 5;
|
float cos = MathHelper.cos(body.yaw) * 5;
|
||||||
|
|
||||||
float spread = getLegSpread();
|
float spread = attributes.isGoingFast ? 2 : 1;
|
||||||
|
|
||||||
rightArm.rotationPointZ = spread + sin;
|
rightArm.rotationPointZ = spread + sin;
|
||||||
leftArm.rotationPointZ = spread - sin;
|
leftArm.rotationPointZ = spread - sin;
|
||||||
|
|
||||||
float legRPX = cos - getLegOutset() - 0.001F;
|
float legRPX = cos - getLegOutset() - 0.001F;
|
||||||
|
|
||||||
legRPX = metadata.getInterpolator(entity.getUuid()).interpolate("legOffset", legRPX, 3);
|
legRPX = getMetadata().getInterpolator(attributes.interpolatorId).interpolate("legOffset", legRPX, 3);
|
||||||
|
|
||||||
rightArm.rotationPointX = -legRPX;
|
rightArm.rotationPointX = -legRPX;
|
||||||
rightLeg.rotationPointX = -legRPX;
|
rightLeg.rotationPointX = -legRPX;
|
||||||
|
@ -342,20 +252,16 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotates legs in quopy fashion whilst swimming.
|
* Rotates legs in a quopy fashion whilst swimming.
|
||||||
*
|
|
||||||
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
|
||||||
* @param swing Degree to which each 'limb' swings.
|
|
||||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
|
||||||
* @param entity The entity we're being called for.
|
|
||||||
*
|
*
|
||||||
|
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||||
*/
|
*/
|
||||||
protected void rotateLegsSwimming(float move, float swing, float ticks, T entity) {
|
protected void rotateLegsSwimming(float move, float swing, float ticks, T entity) {
|
||||||
|
|
||||||
float legLeft = (ROTATE_90 + MathHelper.sin((move / 3) + 2 * PI/3) / 2) * (float)motionLerp;
|
float legLeft = (ROTATE_90 + MathHelper.sin((move / 3) + 2 * PI/3) / 2) * (float)attributes.motionLerp;
|
||||||
|
|
||||||
float left = (ROTATE_90 + MathHelper.sin((move / 3) + 2 * PI) / 2) * (float)motionLerp;
|
float left = (ROTATE_90 + MathHelper.sin((move / 3) + 2 * PI) / 2) * (float)attributes.motionLerp;
|
||||||
float right = (ROTATE_90 + MathHelper.sin(move / 3) / 2) * (float)motionLerp;
|
float right = (ROTATE_90 + MathHelper.sin(move / 3) / 2) * (float)attributes.motionLerp;
|
||||||
|
|
||||||
leftArm.pitch = -left;
|
leftArm.pitch = -left;
|
||||||
leftArm.yaw = -left/2;
|
leftArm.yaw = -left/2;
|
||||||
|
@ -375,15 +281,12 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
/**
|
/**
|
||||||
* Rotates legs in quopy fashion whilst flying.
|
* Rotates legs in quopy fashion whilst flying.
|
||||||
*
|
*
|
||||||
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||||
* @param swing Degree to which each 'limb' swings.
|
|
||||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
|
||||||
* @param entity The entity we're being called for.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
|
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
|
||||||
float armX = rainboom ? ROTATE_270 : MathHelper.sin(-swing / 2);
|
float armX = attributes.isGoingFast ? ROTATE_270 : MathHelper.sin(-swing / 2);
|
||||||
float legX = rainboom ? ROTATE_90 : MathHelper.sin(swing / 2);
|
float legX = attributes.isGoingFast ? ROTATE_90 : MathHelper.sin(swing / 2);
|
||||||
|
|
||||||
leftArm.pitch = armX;
|
leftArm.pitch = armX;
|
||||||
rightArm.pitch = armX;
|
rightArm.pitch = armX;
|
||||||
|
@ -404,10 +307,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
/**
|
/**
|
||||||
* Rotates legs in quopy fashion for walking.
|
* Rotates legs in quopy fashion for walking.
|
||||||
*
|
*
|
||||||
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||||
* @param swing Degree to which each 'limb' swings.
|
|
||||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
|
||||||
* @param entity The entity we're being called for.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void rotateLegsOnGround(float move, float swing, float ticks, T entity) {
|
protected void rotateLegsOnGround(float move, float swing, float ticks, T entity) {
|
||||||
|
@ -433,25 +333,19 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float getLegOutset() {
|
protected float getLegOutset() {
|
||||||
if (isSleeping()) {
|
if (attributes.isSleeping) {
|
||||||
return 3.6f;
|
return 3.6f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCrouching()) {
|
if (attributes.isCrouching) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float getLegSpread() {
|
|
||||||
return rainboom ? 2 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjusts legs as if holding an item. Delegates to the correct arm/leg/limb as neccessary.
|
* Adjusts legs as if holding an item. Delegates to the correct arm/leg/limb as necessary.
|
||||||
*
|
|
||||||
* @param swing
|
|
||||||
*/
|
*/
|
||||||
protected void holdItem(float swing) {
|
protected void holdItem(float swing) {
|
||||||
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
||||||
|
@ -490,7 +384,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
float mult = 1 - swag/2;
|
float mult = 1 - swag/2;
|
||||||
arm.pitch = arm.pitch * mult - (PI / 10) * swag;
|
arm.pitch = arm.pitch * mult - (PI / 10) * swag;
|
||||||
arm.roll = -reflect * (PI / 15);
|
arm.roll = -reflect * (PI / 15);
|
||||||
if (isCrouching()) {
|
if (attributes.isCrouching) {
|
||||||
arm.rotationPointX -= reflect * 2;
|
arm.rotationPointX -= reflect * 2;
|
||||||
}
|
}
|
||||||
case EMPTY:
|
case EMPTY:
|
||||||
|
@ -504,7 +398,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
}
|
}
|
||||||
arm.rotationPointX += reflect;
|
arm.rotationPointX += reflect;
|
||||||
arm.rotationPointZ += 3;
|
arm.rotationPointZ += 3;
|
||||||
if (isCrouching()) {
|
if (attributes.isCrouching) {
|
||||||
arm.rotationPointY += 4;
|
arm.rotationPointY += 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -539,14 +433,13 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Animates arm swinging. Delegates to the correct arm/leg/limb as neccessary.
|
* Animates arm swinging. Delegates to the correct arm/leg/limb as neccessary.
|
||||||
*
|
*
|
||||||
* @param entity The entity we are being called for.
|
* @param entity The entity we are being called for.
|
||||||
*/
|
*/
|
||||||
protected void swingItem(T entity) {
|
protected void swingItem(T entity) {
|
||||||
if (getSwingAmount() > 0 && !isSleeping()) {
|
if (getSwingAmount() > 0 && !attributes.isSleeping) {
|
||||||
AbsoluteHand mainSide = getPreferedHand(entity);
|
AbsoluteHand mainSide = getPreferedHand(entity);
|
||||||
|
|
||||||
swingArm(getArm(mainSide));
|
swingArm(getArm(mainSide));
|
||||||
|
@ -572,12 +465,13 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Animates the walking animation.
|
* Animates the arm's breathing animation when holding items.
|
||||||
*
|
*
|
||||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
* @param ticks Total whole and partial ticks since the entity's existence.
|
||||||
|
* Used in animations together with {@code swing} and {@code move}.
|
||||||
*/
|
*/
|
||||||
protected void swingArms(float ticks) {
|
protected void animateBreathing(float ticks) {
|
||||||
if (isSleeping()) {
|
if (attributes.isSleeping) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +504,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
upperTorso.rotationPointZ = rotationPointZ;
|
upperTorso.rotationPointZ = rotationPointZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) {
|
private void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) {
|
||||||
neck.setRotationPoint(NECK_ROT_X + rotateAngleX, rotationPointY, rotationPointZ);
|
neck.setRotationPoint(NECK_ROT_X + rotateAngleX, rotationPointY, rotationPointZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,7 +544,6 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
tail.init(yOffset, stretch);
|
tail.init(yOffset, stretch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the main torso and neck.
|
* Creates the main torso and neck.
|
||||||
*/
|
*/
|
||||||
|
@ -716,12 +609,12 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
preInitLegs();
|
preInitLegs();
|
||||||
preInitLegwear();
|
preInitLegwear();
|
||||||
|
|
||||||
int armLength = getArmLength();
|
int armLength = attributes.armLength;
|
||||||
int armWidth = getArmWidth();
|
int armWidth = attributes.armWidth;
|
||||||
int armDepth = getArmDepth();
|
int armDepth = attributes.armDepth;
|
||||||
|
|
||||||
float rarmX = getLegRotationX();
|
float rarmX = attributes.armRotationX;
|
||||||
float rarmY = getArmRotationY();
|
float rarmY = attributes.armRotationY;
|
||||||
|
|
||||||
float armX = THIRDP_ARM_CENTRE_X;
|
float armX = THIRDP_ARM_CENTRE_X;
|
||||||
float armY = THIRDP_ARM_CENTRE_Y;
|
float armY = THIRDP_ARM_CENTRE_Y;
|
||||||
|
@ -748,95 +641,6 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
rightLegOverlay.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
rightLegOverlay.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getArmWidth() {
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int getArmDepth() {
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int getArmLength() {
|
|
||||||
return 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected float getLegRotationX() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected float getArmRotationY() {
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArmPose getArmPoseForSide(AbsoluteHand side) {
|
|
||||||
return side == AbsoluteHand.RIGHT ? rightArmPose : leftArmPose;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IPonyData getMetadata() {
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(IPonyData meta) {
|
|
||||||
metadata = meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCrouching() {
|
|
||||||
return isCrouching;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGoingFast() {
|
|
||||||
return rainboom;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasHeadGear() {
|
|
||||||
return headGear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFlying() {
|
|
||||||
return isFlying && canFly();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isElytraFlying() {
|
|
||||||
return isElytraFlying;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSleeping() {
|
|
||||||
return isSleeping;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRiding() {
|
|
||||||
return isRiding;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSwimming() {
|
|
||||||
return isSwimming;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isChild() {
|
|
||||||
return getSize() == Size.FOAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Size getSize() {
|
|
||||||
return isChild ? Size.FOAL : getMetadata().getSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getSwingAmount() {
|
|
||||||
return handSwingProgress;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getRiderYOffset() {
|
public float getRiderYOffset() {
|
||||||
|
|
||||||
|
@ -853,11 +657,6 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getModelHeight() {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the model's various rotation angles.
|
* Sets the model's various rotation angles.
|
||||||
*
|
*
|
||||||
|
@ -871,41 +670,27 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void render(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
public void render(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
|
renderStage(BodyPart.BODY, scale, this::renderBody);
|
||||||
|
renderStage(BodyPart.NECK, scale, this::renderNeck);
|
||||||
|
renderStage(BodyPart.HEAD, scale, this::renderHead);
|
||||||
|
renderStage(BodyPart.LEGS, scale, this::renderLegs);
|
||||||
|
|
||||||
|
if (textureHeight == 64) {
|
||||||
|
renderStage(BodyPart.LEGS, scale, this::renderSleeves);
|
||||||
|
renderStage(BodyPart.BODY, scale, this::renderVest);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderStage(BodyPart.HEAD, scale, this::renderHelmet);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void renderStage(BodyPart part, float scale, Consumer<Float> action) {
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
transform(BodyPart.BODY);
|
transform(BodyPart.BODY);
|
||||||
renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
action.accept(scale);
|
||||||
popMatrix();
|
|
||||||
|
|
||||||
pushMatrix();
|
|
||||||
transform(BodyPart.NECK);
|
|
||||||
renderNeck(scale);
|
|
||||||
popMatrix();
|
|
||||||
|
|
||||||
pushMatrix();
|
|
||||||
transform(BodyPart.HEAD);
|
|
||||||
renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
|
||||||
popMatrix();
|
|
||||||
|
|
||||||
pushMatrix();
|
|
||||||
transform(BodyPart.LEGS);
|
|
||||||
renderLegs(scale);
|
|
||||||
popMatrix();
|
|
||||||
|
|
||||||
pushMatrix();
|
|
||||||
transform(BodyPart.HEAD);
|
|
||||||
renderHelmet(scale);
|
|
||||||
popMatrix();
|
popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected void renderHead(float scale) {
|
||||||
*
|
|
||||||
* Called to render the head.
|
|
||||||
*
|
|
||||||
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected void renderHead(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
|
||||||
head.render(scale);
|
head.render(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -918,23 +703,16 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
neck.render(scale);
|
neck.render(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected void renderBody(float scale) {
|
||||||
*
|
|
||||||
* Called to render the head.
|
|
||||||
*
|
|
||||||
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
|
||||||
body.render(scale);
|
body.render(scale);
|
||||||
if (textureHeight == 64) {
|
|
||||||
bodyOverlay.render(scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
upperTorso.render(scale);
|
upperTorso.render(scale);
|
||||||
body.applyTransform(scale);
|
body.applyTransform(scale);
|
||||||
tail.renderPart(scale, entity.getUuid());
|
tail.renderPart(scale, attributes.interpolatorId);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void renderVest(float scale) {
|
||||||
|
body.applyTransform(scale);
|
||||||
|
bodyOverlay.render(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderLegs(float scale) {
|
protected void renderLegs(float scale) {
|
||||||
|
@ -946,10 +724,6 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
rightArm.render(scale);
|
rightArm.render(scale);
|
||||||
leftLeg.render(scale);
|
leftLeg.render(scale);
|
||||||
rightLeg.render(scale);
|
rightLeg.render(scale);
|
||||||
|
|
||||||
if (textureHeight == 64) {
|
|
||||||
renderSleeves(scale);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderSleeves(float scale) {
|
protected void renderSleeves(float scale) {
|
||||||
|
@ -961,36 +735,15 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transform(BodyPart part) {
|
public void transform(BodyPart part) {
|
||||||
if (isSleeping()) {
|
if (attributes.isSleeping) {
|
||||||
rotatef(90, 1, 0, 0);
|
rotatef(90, 1, 0, 0);
|
||||||
rotatef(180, 0, 1, 0);
|
rotatef(180, 0, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (part == BodyPart.HEAD) {
|
if (part == BodyPart.HEAD) {
|
||||||
rotatef(motionPitch, 1, 0, 0);
|
rotatef(attributes.motionPitch, 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PonyTransformation.forSize(getSize()).transform(this, part);
|
PonyTransformation.forSize(getSize()).transform(this, part);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Copies this model's attributes from some other.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setAttributes(BipedEntityModel<T> model) {
|
|
||||||
super.setAttributes(model);
|
|
||||||
|
|
||||||
if (model instanceof AbstractPonyModel) {
|
|
||||||
AbstractPonyModel<T> pony = (AbstractPonyModel<T>) model;
|
|
||||||
isFlying = pony.isFlying;
|
|
||||||
isCrouching = pony.isCrouching;
|
|
||||||
isElytraFlying = pony.isElytraFlying;
|
|
||||||
isSwimming = pony.isSwimming;
|
|
||||||
isSleeping = pony.isSleeping;
|
|
||||||
headGear = pony.headGear;
|
|
||||||
metadata = pony.metadata;
|
|
||||||
motionPitch = pony.motionPitch;
|
|
||||||
rainboom = pony.rainboom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,96 @@
|
||||||
package com.minelittlepony.client.model;
|
package com.minelittlepony.client.model;
|
||||||
|
|
||||||
import net.minecraft.client.model.Cuboid;
|
import net.minecraft.client.model.Cuboid;
|
||||||
|
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||||
import net.minecraft.client.render.entity.model.PlayerEntityModel;
|
import net.minecraft.client.render.entity.model.PlayerEntityModel;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
|
||||||
import com.minelittlepony.model.IPonyModel;
|
import com.minelittlepony.client.pony.PonyData;
|
||||||
|
import com.minelittlepony.model.ModelAttributes;
|
||||||
|
import com.minelittlepony.pony.IPony;
|
||||||
|
import com.minelittlepony.pony.IPonyData;
|
||||||
|
import com.minelittlepony.pony.meta.Size;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The raw pony model without any implementations.
|
||||||
|
* Will act effectively the same as a normal player model without any hints
|
||||||
|
* of being cute and adorable.
|
||||||
|
*
|
||||||
|
* Modders can extend this class to make their own pony models if they wish.
|
||||||
|
*/
|
||||||
public abstract class ClientPonyModel<T extends LivingEntity> extends PlayerEntityModel<T> implements IPonyModel<T> {
|
public abstract class ClientPonyModel<T extends LivingEntity> extends PlayerEntityModel<T> implements IPonyModel<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The model attributes.
|
||||||
|
*/
|
||||||
|
protected ModelAttributes<T> attributes = new ModelAttributes<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associated pony data.
|
||||||
|
*/
|
||||||
|
protected IPonyData metadata = new PonyData();
|
||||||
|
|
||||||
public ClientPonyModel(float float_1, boolean boolean_1) {
|
public ClientPonyModel(float float_1, boolean boolean_1) {
|
||||||
super(float_1, boolean_1);
|
super(float_1, boolean_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLivingState(T entity, IPony pony) {
|
||||||
|
isChild = entity.isBaby();
|
||||||
|
isSneaking = entity.isSneaking();
|
||||||
|
attributes.updateLivingState(entity, pony);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelAttributes<?> getAttributes() {
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPonyData getMetadata() {
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Size getSize() {
|
||||||
|
return isChild ? Size.FOAL : getMetadata().getSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(IPonyData meta) {
|
||||||
|
metadata = meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Cuboid getHead() {
|
||||||
|
return head;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRiding() {
|
||||||
|
return isRiding;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSwingAmount() {
|
||||||
|
return handSwingProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies this model's attributes from some other.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setAttributes(BipedEntityModel<T> model) {
|
||||||
|
super.setAttributes(model);
|
||||||
|
|
||||||
|
if (model instanceof ClientPonyModel) {
|
||||||
|
attributes = ((ClientPonyModel<T>)model).attributes;
|
||||||
|
metadata = ((ClientPonyModel<T>)model).metadata;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Cuboid getRandomCuboid(Random rand) {
|
public Cuboid getRandomCuboid(Random rand) {
|
||||||
// grab one at random, but cycle through the list until you find one that's filled.
|
// grab one at random, but cycle through the list until you find one that's filled.
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package com.minelittlepony.model;
|
package com.minelittlepony.client.model;
|
||||||
|
|
||||||
import net.minecraft.client.model.Cuboid;
|
import net.minecraft.client.model.Cuboid;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.AbsoluteHand;
|
import net.minecraft.util.AbsoluteHand;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.BodyPart;
|
||||||
|
import com.minelittlepony.model.IUnicorn;
|
||||||
|
import com.minelittlepony.model.ModelAttributes;
|
||||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||||
import com.minelittlepony.pony.IPonyData;
|
import com.minelittlepony.pony.IPonyData;
|
||||||
import com.minelittlepony.pony.meta.Size;
|
import com.minelittlepony.pony.meta.Size;
|
||||||
|
@ -23,13 +26,13 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void setPitch(float pitch) {
|
default IPonyData getMetadata() {
|
||||||
mixin().setPitch(pitch);
|
return mixin().getMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default float getPitch() {
|
default ModelAttributes<?> getAttributes() {
|
||||||
return mixin().getPitch();
|
return mixin().getAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,56 +45,16 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
|
||||||
return mixin().createArmour();
|
return mixin().createArmour();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default IPonyData getMetadata() {
|
|
||||||
return mixin().getMetadata();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void apply(IPonyData meta) {
|
default void apply(IPonyData meta) {
|
||||||
mixin().apply(meta);
|
mixin().apply(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean isCrouching() {
|
|
||||||
return mixin().isCrouching();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean isFlying() {
|
|
||||||
return mixin().isFlying();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean isElytraFlying() {
|
|
||||||
return mixin().isElytraFlying();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean isSleeping() {
|
|
||||||
return mixin().isSleeping();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean isSwimming() {
|
|
||||||
return mixin().isSwimming();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default boolean isRiding() {
|
default boolean isRiding() {
|
||||||
return mixin().isRiding();
|
return mixin().isRiding();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean isGoingFast() {
|
|
||||||
return mixin().isGoingFast();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean isChild() {
|
|
||||||
return mixin().isChild();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default float getSwingAmount() {
|
default float getSwingAmount() {
|
||||||
return mixin().getSwingAmount();
|
return mixin().getSwingAmount();
|
||||||
|
@ -107,11 +70,6 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
|
||||||
return mixin().getRiderYOffset();
|
return mixin().getRiderYOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default float getModelHeight() {
|
|
||||||
return mixin().getModelHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void setArmAngle(float var1, AbsoluteHand var2) {
|
default void setArmAngle(float var1, AbsoluteHand var2) {
|
||||||
mixin().setArmAngle(var1, var2);
|
mixin().setArmAngle(var1, var2);
|
||||||
|
@ -122,11 +80,6 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
|
||||||
return mixin().getHead();
|
return mixin().getHead();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean hasHeadGear() {
|
|
||||||
return mixin().hasHeadGear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default Cuboid getBodyPart(BodyPart part) {
|
default Cuboid getBodyPart(BodyPart part) {
|
||||||
return mixin().getBodyPart(part);
|
return mixin().getBodyPart(part);
|
|
@ -1,12 +1,21 @@
|
||||||
package com.minelittlepony.model;
|
package com.minelittlepony.client.model;
|
||||||
|
|
||||||
import net.minecraft.client.model.Cuboid;
|
import net.minecraft.client.model.Cuboid;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.ICapitated;
|
||||||
|
import com.minelittlepony.model.ICompartmented;
|
||||||
|
import com.minelittlepony.model.IModel;
|
||||||
|
import com.minelittlepony.model.PonyModelConstants;
|
||||||
import com.minelittlepony.pony.IPony;
|
import com.minelittlepony.pony.IPony;
|
||||||
|
|
||||||
public interface IPonyModel<T extends LivingEntity> extends PonyModelConstants, IModel, ICapitated<Cuboid>, ICompartmented<Cuboid> {
|
public interface IPonyModel<T extends LivingEntity> extends PonyModelConstants, IModel, ICapitated<Cuboid>, ICompartmented<Cuboid> {
|
||||||
default void updateLivingState(T entity, IPony pony) {
|
default void updateLivingState(T entity, IPony pony) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default boolean hasHeadGear() {
|
||||||
|
return getAttributes().hasHeadGear;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -27,7 +27,7 @@ public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
protected void renderBody(float scale) {
|
||||||
chestPiece.render(scale);
|
chestPiece.render(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart, PonyMode
|
||||||
|
|
||||||
if (pegasus.wingsAreOpen()) {
|
if (pegasus.wingsAreOpen()) {
|
||||||
flapAngle = pegasus.getWingRotationFactor(ticks);
|
flapAngle = pegasus.getWingRotationFactor(ticks);
|
||||||
if (!pegasus.isCrouching() && pegasus.isWearing(Wearable.SADDLE_BAGS)) {
|
if (!pegasus.getAttributes().isCrouching && pegasus.isWearing(Wearable.SADDLE_BAGS)) {
|
||||||
flapAngle -= 1F;
|
flapAngle -= 1F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class PonyTail extends PlaneRenderer implements IPart {
|
||||||
roll = rainboom ? 0 : MathHelper.cos(move * 0.8F) * 0.2f * swing;
|
roll = rainboom ? 0 : MathHelper.cos(move * 0.8F) * 0.2f * swing;
|
||||||
yaw = bodySwing;
|
yaw = bodySwing;
|
||||||
|
|
||||||
if (theModel.isCrouching() && !rainboom) {
|
if (theModel.getAttributes().isCrouching && !rainboom) {
|
||||||
rotateSneak();
|
rotateSneak();
|
||||||
} else if (theModel.isRiding()) {
|
} else if (theModel.isRiding()) {
|
||||||
rotationPointZ = TAIL_RP_Z_RIDING;
|
rotationPointZ = TAIL_RP_Z_RIDING;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.minelittlepony.client.model.components;
|
package com.minelittlepony.client.model.components;
|
||||||
|
|
||||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||||
import com.minelittlepony.model.IPart;
|
import com.minelittlepony.model.IPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -53,7 +53,7 @@ public class SeaponyTail implements IPart {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) {
|
public void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) {
|
||||||
float rotation = model.isSleeping() ? 0 : MathHelper.sin(ticks * 0.536f) / 4;
|
float rotation = model.getAttributes().isSleeping ? 0 : MathHelper.sin(ticks * 0.536f) / 4;
|
||||||
|
|
||||||
tailBase.pitch = TAIL_ROTX + rotation;
|
tailBase.pitch = TAIL_ROTX + rotation;
|
||||||
tailTip.pitch = rotation;
|
tailTip.pitch = rotation;
|
||||||
|
|
|
@ -20,6 +20,14 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
||||||
private PonyRenderer leftHorn;
|
private PonyRenderer leftHorn;
|
||||||
private PonyRenderer rightHorn;
|
private PonyRenderer rightHorn;
|
||||||
|
|
||||||
|
public ModelEnderStallion() {
|
||||||
|
super();
|
||||||
|
attributes.armRotationX = 3;
|
||||||
|
attributes.armRotationY = 14;
|
||||||
|
attributes.armLength = 30;
|
||||||
|
attributes.visualHeight = 3;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void animateModel(EndermanEntity entity, float move, float swing, float ticks) {
|
public void animateModel(EndermanEntity entity, float move, float swing, float ticks) {
|
||||||
rightArmPose = isCarrying ? ArmPose.BLOCK : ArmPose.EMPTY;
|
rightArmPose = isCarrying ? ArmPose.BLOCK : ArmPose.EMPTY;
|
||||||
|
@ -44,12 +52,6 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
||||||
rightHorn.pitch = 0.5F;
|
rightHorn.pitch = 0.5F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setVisible(boolean visible) {
|
|
||||||
super.setVisible(visible);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAngles(EndermanEntity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
public void setAngles(EndermanEntity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
@ -130,26 +132,6 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
||||||
return isAttacking;
|
return isAttacking;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getLegRotationX() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getArmRotationY() {
|
|
||||||
return 14;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getArmLength() {
|
|
||||||
return 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getModelHeight() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWingRotationFactor(float ticks) {
|
public float getWingRotationFactor(float ticks) {
|
||||||
return MathHelper.sin(ticks) + WING_ROT_Z_SNEAK;
|
return MathHelper.sin(ticks) + WING_ROT_Z_SNEAK;
|
||||||
|
|
|
@ -4,8 +4,8 @@ import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
import net.minecraft.client.render.entity.model.GuardianEntityModel;
|
import net.minecraft.client.render.entity.model.GuardianEntityModel;
|
||||||
import net.minecraft.entity.mob.GuardianEntity;
|
import net.minecraft.entity.mob.GuardianEntity;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.model.IPonyMixinModel;
|
||||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||||
import com.minelittlepony.model.IPonyMixinModel;
|
|
||||||
|
|
||||||
public class ModelGuardianPony extends GuardianEntityModel implements IPonyMixinModel.Caster<GuardianEntity, ModelSeapony<GuardianEntity>, PonyRenderer> {
|
public class ModelGuardianPony extends GuardianEntityModel implements IPonyMixinModel.Caster<GuardianEntity, ModelSeapony<GuardianEntity>, PonyRenderer> {
|
||||||
private final ModelSeapony<GuardianEntity> mixin = new ModelSeapony<>();
|
private final ModelSeapony<GuardianEntity> mixin = new ModelSeapony<>();
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
||||||
|
|
||||||
// Seaponies can't sneak, silly
|
// Seaponies can't sneak, silly
|
||||||
isSneaking = false;
|
isSneaking = false;
|
||||||
isCrouching = false;
|
attributes.isCrouching = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -99,7 +99,7 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
||||||
|
|
||||||
float flapMotion = MathHelper.cos(ticks / 10) / 5;
|
float flapMotion = MathHelper.cos(ticks / 10) / 5;
|
||||||
|
|
||||||
if (isSleeping()) {
|
if (attributes.isSleeping) {
|
||||||
flapMotion /= 2;
|
flapMotion /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
||||||
leftFin.yaw = finAngle;
|
leftFin.yaw = finAngle;
|
||||||
rightFin.yaw = -finAngle;
|
rightFin.yaw = -finAngle;
|
||||||
|
|
||||||
if (!isSleeping()) {
|
if (!attributes.isSleeping) {
|
||||||
centerFin.roll = flapMotion;
|
centerFin.roll = flapMotion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,12 +152,12 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
protected void renderBody(float scale) {
|
||||||
body.render(scale);
|
body.render(scale);
|
||||||
bodyCenter.render(scale);
|
bodyCenter.render(scale);
|
||||||
body.applyTransform(scale);
|
body.applyTransform(scale);
|
||||||
|
|
||||||
tail.renderPart(scale, entity.getUuid());
|
tail.renderPart(scale, attributes.interpolatorId);
|
||||||
|
|
||||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
|
@ -169,7 +169,6 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
||||||
|
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
GL11.glPopAttrib();
|
GL11.glPopAttrib();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,10 +15,19 @@ public class ModelSkeletonPony<T extends HostileEntity> extends ModelMobPony<T>
|
||||||
|
|
||||||
public boolean isWithered;
|
public boolean isWithered;
|
||||||
|
|
||||||
|
public ModelSkeletonPony() {
|
||||||
|
super();
|
||||||
|
attributes.armWidth = 2;
|
||||||
|
attributes.armDepth = 2;
|
||||||
|
attributes.armRotationX = 3F;
|
||||||
|
attributes.armRotationY = 8F;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void animateModel(T entity, float move, float swing, float ticks) {
|
public void animateModel(T entity, float move, float swing, float ticks) {
|
||||||
isUnicorn = entity.getUuid().getLeastSignificantBits() % 3 != 0;
|
isUnicorn = entity.getUuid().getLeastSignificantBits() % 3 != 0;
|
||||||
isWithered = entity instanceof WitherSkeletonEntity;
|
isWithered = entity instanceof WitherSkeletonEntity;
|
||||||
|
attributes.visualHeight = isWithered ? 2.5F : 2;
|
||||||
|
|
||||||
rightArmPose = ArmPose.EMPTY;
|
rightArmPose = ArmPose.EMPTY;
|
||||||
leftArmPose = ArmPose.EMPTY;
|
leftArmPose = ArmPose.EMPTY;
|
||||||
|
@ -77,33 +86,8 @@ public class ModelSkeletonPony<T extends HostileEntity> extends ModelMobPony<T>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getLegOutset() {
|
protected float getLegOutset() {
|
||||||
if (isSleeping()) return 2.6f;
|
if (attributes.isSleeping) return 2.6f;
|
||||||
if (isCrouching()) return 0;
|
if (attributes.isCrouching) return 0;
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getArmWidth() {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getArmDepth() {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getLegRotationX() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getModelHeight() {
|
|
||||||
return isWithered ? 2.5F : 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getArmRotationY() {
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,12 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
|
||||||
profession = entity.getVillagerData().getProfession();
|
profession = entity.getVillagerData().getProfession();
|
||||||
special = entity.hasCustomName() && "Derpy".equals(entity.getCustomName().getString());
|
special = entity.hasCustomName() && "Derpy".equals(entity.getCustomName().getString());
|
||||||
special2 = special && entity.getUuid().getLeastSignificantBits() % 20 == 0;
|
special2 = special && entity.getUuid().getLeastSignificantBits() % 20 == 0;
|
||||||
|
attributes.visualHeight = special2 ? 2.3F : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
protected void renderBody(float scale) {
|
||||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.renderBody(scale);
|
||||||
|
|
||||||
if (!special && profession != VillagerProfession.NONE && profession != VillagerProfession.NITWIT) {
|
if (!special && profession != VillagerProfession.NONE && profession != VillagerProfession.NITWIT) {
|
||||||
if (profession == VillagerProfession.BUTCHER) {
|
if (profession == VillagerProfession.BUTCHER) {
|
||||||
|
@ -46,11 +47,6 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getModelHeight() {
|
|
||||||
return special2 ? 2.3F : 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWearing(Wearable wearable) {
|
public boolean isWearing(Wearable wearable) {
|
||||||
if (wearable == Wearable.SADDLE_BAGS) {
|
if (wearable == Wearable.SADDLE_BAGS) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ public class ModelWitchPony extends ModelZebra<WitchEntity> {
|
||||||
|
|
||||||
public ModelWitchPony() {
|
public ModelWitchPony() {
|
||||||
super(false);
|
super(false);
|
||||||
|
attributes.visualHeight = 2.5F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,10 +49,12 @@ public class ModelWitchPony extends ModelZebra<WitchEntity> {
|
||||||
rightArmOverlay.pitch = legDrinkingAngle;
|
rightArmOverlay.pitch = legDrinkingAngle;
|
||||||
rightArm.yaw = 0.1F;
|
rightArm.yaw = 0.1F;
|
||||||
rightArmOverlay.yaw = 0.1F;
|
rightArmOverlay.yaw = 0.1F;
|
||||||
rightArm.z = 0.1f;
|
rightArm.z = 0.1F;
|
||||||
rightArmOverlay.z = 0.1f;
|
rightArmOverlay.z = 0.1F;
|
||||||
|
|
||||||
if (rot > 0) rot = 0;
|
if (rot > 0) {
|
||||||
|
rot = 0;
|
||||||
|
}
|
||||||
|
|
||||||
head.pitch = -rot / 2;
|
head.pitch = -rot / 2;
|
||||||
headwear.pitch = -rot / 2;
|
headwear.pitch = -rot / 2;
|
||||||
|
@ -59,18 +62,6 @@ public class ModelWitchPony extends ModelZebra<WitchEntity> {
|
||||||
rightArm.z = 0;
|
rightArm.z = 0;
|
||||||
rightArmOverlay.z = 0;
|
rightArmOverlay.z = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isChild() {
|
|
||||||
return isChild;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getModelHeight() {
|
|
||||||
return 2.5F;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11;
|
||||||
import com.minelittlepony.client.util.render.Color;
|
import com.minelittlepony.client.util.render.Color;
|
||||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
import com.minelittlepony.model.IModel;
|
||||||
import com.minelittlepony.pony.meta.Wearable;
|
import com.minelittlepony.pony.meta.Wearable;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -48,12 +48,12 @@ public class ChristmasHat extends AbstractGear {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRender(IPonyModel<?> model, Entity entity) {
|
public boolean canRender(IModel model, Entity entity) {
|
||||||
return isChristmasDay() || model.isWearing(Wearable.ANTLERS);
|
return isChristmasDay() || model.isWearing(Wearable.ANTLERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLivingAnimations(IPonyModel<?> model, Entity entity) {
|
public void setLivingAnimations(IModel model, Entity entity) {
|
||||||
tint = model.getMetadata().getGlowColor();
|
tint = model.getMetadata().getGlowColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
import com.minelittlepony.model.IModel;
|
||||||
import com.minelittlepony.model.gear.IStackable;
|
import com.minelittlepony.model.gear.IStackable;
|
||||||
import com.minelittlepony.pony.meta.Wearable;
|
import com.minelittlepony.pony.meta.Wearable;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class Muffin extends AbstractGear implements IStackable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRender(IPonyModel<?> model, Entity entity) {
|
public boolean canRender(IModel model, Entity entity) {
|
||||||
return model.isWearing(Wearable.MUFFIN);
|
return model.isWearing(Wearable.MUFFIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ package com.minelittlepony.client.model.gear;
|
||||||
|
|
||||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
|
import com.minelittlepony.model.IModel;
|
||||||
import com.minelittlepony.model.IPegasus;
|
import com.minelittlepony.model.IPegasus;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.minelittlepony.pony.meta.Wearable;
|
import com.minelittlepony.pony.meta.Wearable;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class SaddleBags extends AbstractGear {
|
||||||
float dropAmount = 0;
|
float dropAmount = 0;
|
||||||
|
|
||||||
|
|
||||||
private IPonyModel<?> model;
|
private IModel model;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(float yOffset, float stretch) {
|
public void init(float yOffset, float stretch) {
|
||||||
|
@ -73,7 +73,7 @@ public class SaddleBags extends AbstractGear {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLivingAnimations(IPonyModel<?> model, Entity entity) {
|
public void setLivingAnimations(IModel model, Entity entity) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
|
||||||
hangLow = false;
|
hangLow = false;
|
||||||
|
@ -126,7 +126,7 @@ public class SaddleBags extends AbstractGear {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRender(IPonyModel<?> model, Entity entity) {
|
public boolean canRender(IModel model, Entity entity) {
|
||||||
return model.isWearing(Wearable.SADDLE_BAGS);
|
return model.isWearing(Wearable.SADDLE_BAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.util.Identifier;
|
||||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
import com.minelittlepony.model.IModel;
|
||||||
import com.minelittlepony.model.gear.IStackable;
|
import com.minelittlepony.model.gear.IStackable;
|
||||||
import com.minelittlepony.pony.meta.Wearable;
|
import com.minelittlepony.pony.meta.Wearable;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class Stetson extends AbstractGear implements IStackable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRender(IPonyModel<?> model, Entity entity) {
|
public boolean canRender(IModel model, Entity entity) {
|
||||||
return model.isWearing(Wearable.STETSON);
|
return model.isWearing(Wearable.STETSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
import com.minelittlepony.model.IModel;
|
||||||
import com.minelittlepony.model.gear.IStackable;
|
import com.minelittlepony.model.gear.IStackable;
|
||||||
import com.minelittlepony.pony.meta.Wearable;
|
import com.minelittlepony.pony.meta.Wearable;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class WitchHat extends AbstractGear implements IStackable {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRender(IPonyModel<?> model, Entity entity) {
|
public boolean canRender(IModel model, Entity entity) {
|
||||||
return model.isWearing(Wearable.HAT);
|
return model.isWearing(Wearable.HAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,16 +28,16 @@ public class ModelAlicorn<T extends LivingEntity> extends ModelUnicorn<T> implem
|
||||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
|
||||||
if (canFly()) {
|
if (canFly()) {
|
||||||
wings.setRotationAndAngles(rainboom, entity.getUuid(), move, swing, 0, ticks);
|
wings.setRotationAndAngles(attributes.isGoingFast, attributes.interpolatorId, move, swing, 0, ticks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
protected void renderBody(float scale) {
|
||||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.renderBody(scale);
|
||||||
|
|
||||||
if (canFly()) {
|
if (canFly()) {
|
||||||
wings.renderPart(scale, entity.getUuid());
|
wings.renderPart(scale, attributes.interpolatorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class ModelChangeling<T extends LivingEntity> extends ModelAlicorn<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wingsAreOpen() {
|
public boolean wingsAreOpen() {
|
||||||
return (isFlying() || isCrouching()) && !isElytraFlying();
|
return (isFlying() || attributes.isCrouching) && !getAttributes().isGliding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,6 +14,12 @@ public class ModelEarthPony<T extends LivingEntity> extends AbstractPonyModel<T>
|
||||||
public ModelEarthPony(boolean smallArms) {
|
public ModelEarthPony(boolean smallArms) {
|
||||||
super(smallArms);
|
super(smallArms);
|
||||||
this.smallArms = smallArms;
|
this.smallArms = smallArms;
|
||||||
|
|
||||||
|
if (smallArms) {
|
||||||
|
attributes.armWidth = 3;
|
||||||
|
attributes.armRotationX = 2F;
|
||||||
|
attributes.armRotationY = 8.5F;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,28 +34,13 @@ public class ModelEarthPony<T extends LivingEntity> extends AbstractPonyModel<T>
|
||||||
@Override
|
@Override
|
||||||
protected float getLegOutset() {
|
protected float getLegOutset() {
|
||||||
if (smallArms) {
|
if (smallArms) {
|
||||||
if (isSleeping()) return 2.6f;
|
if (attributes.isSleeping) return 2.6f;
|
||||||
if (isCrouching()) return 1;
|
if (attributes.isCrouching) return 1;
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
return super.getLegOutset();
|
return super.getLegOutset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getArmWidth() {
|
|
||||||
return smallArms ? 3 : super.getArmWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getLegRotationX() {
|
|
||||||
return smallArms ? 2 : super.getLegRotationX();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getArmRotationY() {
|
|
||||||
return smallArms ? 8.5f : super.getArmRotationY();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initHead(float yOffset, float stretch) {
|
protected void initHead(float yOffset, float stretch) {
|
||||||
super.initHead(yOffset, stretch);
|
super.initHead(yOffset, stretch);
|
||||||
|
|
|
@ -26,12 +26,12 @@ public class ModelPegasus<T extends LivingEntity> extends ModelEarthPony<T> impl
|
||||||
@Override
|
@Override
|
||||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
wings.setRotationAndAngles(rainboom, entity.getUuid(), move, swing, 0, ticks);
|
wings.setRotationAndAngles(attributes.isGoingFast, entity.getUuid(), move, swing, 0, ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBody(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
protected void renderBody(float scale) {
|
||||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.renderBody(scale);
|
||||||
wings.renderPart(scale, entity.getUuid());
|
wings.renderPart(scale, attributes.interpolatorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
|
||||||
AbsoluteHand mainSide = getPreferedHand(entity);
|
AbsoluteHand mainSide = getPreferedHand(entity);
|
||||||
|
|
||||||
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) {
|
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) {
|
||||||
if (getSwingAmount() > -9990 && !isSleeping()) {
|
if (getSwingAmount() > -9990 && !attributes.isSleeping) {
|
||||||
swingArm(getUnicornArmForSide(mainSide));
|
swingArm(getUnicornArmForSide(mainSide));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -83,9 +83,15 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArmPose getArmPoseForSide(AbsoluteHand side) {
|
||||||
|
return side == AbsoluteHand.RIGHT ? rightArmPose : leftArmPose;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void swingArms(float ticks) {
|
protected void animateBreathing(float ticks) {
|
||||||
if (isSleeping()) return;
|
if (attributes.isSleeping) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (canCast()) {
|
if (canCast()) {
|
||||||
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||||
|
@ -101,7 +107,7 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
|
||||||
unicornArmLeft.pitch += sin;
|
unicornArmLeft.pitch += sin;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
super.swingArms(ticks);
|
super.animateBreathing(ticks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,12 +129,12 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderHead(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
protected void renderHead(float scale) {
|
||||||
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.renderHead(scale);
|
||||||
|
|
||||||
if (canCast()) {
|
if (canCast()) {
|
||||||
head.applyTransform(scale);
|
head.applyTransform(scale);
|
||||||
horn.renderPart(scale, entity.getUuid());
|
horn.renderPart(scale, attributes.interpolatorId);
|
||||||
if (isCasting()) {
|
if (isCasting()) {
|
||||||
horn.renderMagic(getMagicColor(), scale);
|
horn.renderMagic(getMagicColor(), scale);
|
||||||
}
|
}
|
||||||
|
@ -141,12 +147,12 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
|
||||||
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
|
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
|
||||||
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
|
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
|
||||||
|
|
||||||
int armLength = getArmLength();
|
int armLength = attributes.armLength;
|
||||||
int armWidth = getArmWidth();
|
int armWidth = attributes.armWidth;
|
||||||
int armDepth = getArmDepth();
|
int armDepth = attributes.armDepth;
|
||||||
|
|
||||||
float rarmX = getLegRotationX();
|
float rarmX = attributes.armRotationX;
|
||||||
float rarmY = getArmRotationY();
|
float rarmY = attributes.armRotationY;
|
||||||
|
|
||||||
float armX = THIRDP_ARM_CENTRE_X;
|
float armX = THIRDP_ARM_CENTRE_X;
|
||||||
float armY = THIRDP_ARM_CENTRE_Y;
|
float armY = THIRDP_ARM_CENTRE_Y;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.minelittlepony.client.render;
|
package com.minelittlepony.client.render;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.model.ModelWrapper;
|
import com.minelittlepony.client.model.ModelWrapper;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.minelittlepony.model.PonyModelConstants;
|
import com.minelittlepony.model.PonyModelConstants;
|
||||||
import com.minelittlepony.pony.IPony;
|
import com.minelittlepony.pony.IPony;
|
||||||
import com.minelittlepony.util.math.MathUtil;
|
import com.minelittlepony.util.math.MathUtil;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.minelittlepony.client.render;
|
package com.minelittlepony.client.render;
|
||||||
|
|
||||||
import com.minelittlepony.client.PonyRenderManager;
|
import com.minelittlepony.client.PonyRenderManager;
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.model.ModelWrapper;
|
import com.minelittlepony.client.model.ModelWrapper;
|
||||||
import com.minelittlepony.client.transform.PonyPosture;
|
import com.minelittlepony.client.transform.PonyPosture;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.minelittlepony.pony.IPony;
|
import com.minelittlepony.pony.IPony;
|
||||||
import com.minelittlepony.settings.PonySettings;
|
import com.minelittlepony.settings.PonySettings;
|
||||||
import com.minelittlepony.util.math.MathUtil;
|
import com.minelittlepony.util.math.MathUtil;
|
||||||
|
@ -20,8 +20,6 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
|
||||||
|
|
||||||
public ModelWrapper<T, M> playerModel;
|
public ModelWrapper<T, M> playerModel;
|
||||||
|
|
||||||
private M ponyModel;
|
|
||||||
|
|
||||||
private IPony pony;
|
private IPony pony;
|
||||||
|
|
||||||
private final IPonyRender<T, M> renderer;
|
private final IPonyRender<T, M> renderer;
|
||||||
|
@ -52,7 +50,7 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
|
||||||
public void preRenderCallback(T entity, float ticks) {
|
public void preRenderCallback(T entity, float ticks) {
|
||||||
updateModel(entity);
|
updateModel(entity);
|
||||||
|
|
||||||
ponyModel.updateLivingState(entity, pony);
|
getModel().updateLivingState(entity, pony);
|
||||||
|
|
||||||
float s = getScaleFactor();
|
float s = getScaleFactor();
|
||||||
GlStateManager.scalef(s, s, s);
|
GlStateManager.scalef(s, s, s);
|
||||||
|
@ -94,12 +92,12 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void applyPostureTransform(T player, float yaw, float ticks) {
|
public void applyPostureTransform(T player, float yaw, float ticks) {
|
||||||
((PonyPosture<T>)getPosture(player)).apply(player, ponyModel, yaw, ticks, 1);
|
((PonyPosture<T>)getPosture(player)).apply(player, getModel(), yaw, ticks, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void applyPostureRiding(T player, float yaw, float ticks) {
|
public void applyPostureRiding(T player, float yaw, float ticks) {
|
||||||
((PonyPosture<T>)getPosture(player)).apply(player, ponyModel, yaw, ticks, -1);
|
((PonyPosture<T>)getPosture(player)).apply(player, getModel(), yaw, ticks, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -112,11 +110,11 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
|
||||||
return PonyPosture.DEFAULT;
|
return PonyPosture.DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getModel().isSwimming()) {
|
if (getModel().getAttributes().isSwimming) {
|
||||||
return PonyPosture.SWIMMING;
|
return PonyPosture.SWIMMING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getModel().isGoingFast()) {
|
if (getModel().getAttributes().isGoingFast) {
|
||||||
return PonyPosture.FLIGHT;
|
return PonyPosture.FLIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,9 +127,8 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
|
||||||
|
|
||||||
public M setPonyModel(ModelWrapper<T, M> model) {
|
public M setPonyModel(ModelWrapper<T, M> model) {
|
||||||
playerModel = model;
|
playerModel = model;
|
||||||
ponyModel = playerModel.getBody();
|
|
||||||
|
|
||||||
return ponyModel;
|
return getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateModel(T entity) {
|
public void updateModel(T entity) {
|
||||||
|
@ -154,11 +151,11 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
|
||||||
|
|
||||||
public double getNamePlateYOffset(T entity, double initial) {
|
public double getNamePlateYOffset(T entity, double initial) {
|
||||||
|
|
||||||
// We start by negating the height calculation done by mohjong.
|
// We start by negating the height calculation done by mahjong.
|
||||||
float y = -(entity.getHeight() + 0.5F - (entity.isSneaking() ? 0.25F : 0));
|
float y = -(entity.getHeight() + 0.5F - (entity.isSneaking() ? 0.25F : 0));
|
||||||
|
|
||||||
// Then we add our own offsets.
|
// Then we add our own offsets.
|
||||||
y += ponyModel.getModelHeight() * getScaleFactor() + 0.25F;
|
y += getModel().getAttributes().visualHeight * getScaleFactor() + 0.25F;
|
||||||
|
|
||||||
if (entity.isSneaking()) {
|
if (entity.isSneaking()) {
|
||||||
y -= 0.25F;
|
y -= 0.25F;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.client.render.entities;
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.client.model.ClientPonyModel;
|
import com.minelittlepony.client.model.ClientPonyModel;
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.model.ModelWrapper;
|
import com.minelittlepony.client.model.ModelWrapper;
|
||||||
import com.minelittlepony.client.render.DebugBoundingBoxRenderer;
|
import com.minelittlepony.client.render.DebugBoundingBoxRenderer;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
|
@ -14,7 +15,6 @@ import com.minelittlepony.client.render.layer.LayerPonyCustomHead;
|
||||||
import com.minelittlepony.client.render.layer.LayerPonyElytra;
|
import com.minelittlepony.client.render.layer.LayerPonyElytra;
|
||||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||||
import com.minelittlepony.hdskins.HDSkins;
|
import com.minelittlepony.hdskins.HDSkins;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.minelittlepony.model.IUnicorn;
|
import com.minelittlepony.model.IUnicorn;
|
||||||
import com.minelittlepony.pony.IPony;
|
import com.minelittlepony.pony.IPony;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.minelittlepony.client.render.layer;
|
package com.minelittlepony.client.render.layer;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
|
|
||||||
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
||||||
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
|
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
|
||||||
|
|
|
@ -3,10 +3,10 @@ package com.minelittlepony.client.render.layer;
|
||||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||||
import net.minecraft.client.render.entity.model.EntityModel;
|
import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.model.components.ModelDeadMau5Ears;
|
import com.minelittlepony.client.model.components.ModelDeadMau5Ears;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
||||||
public class LayerDJPon3Head<T extends AbstractClientPlayerEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyLayer<T, M> {
|
public class LayerDJPon3Head<T extends AbstractClientPlayerEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyLayer<T, M> {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.mojang.blaze3d.platform.GLX;
|
import com.mojang.blaze3d.platform.GLX;
|
||||||
|
|
||||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.util.Identifier;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.model.gear.ChristmasHat;
|
import com.minelittlepony.client.model.gear.ChristmasHat;
|
||||||
import com.minelittlepony.client.model.gear.Muffin;
|
import com.minelittlepony.client.model.gear.Muffin;
|
||||||
import com.minelittlepony.client.model.gear.SaddleBags;
|
import com.minelittlepony.client.model.gear.SaddleBags;
|
||||||
|
@ -14,7 +15,6 @@ import com.minelittlepony.client.model.gear.Stetson;
|
||||||
import com.minelittlepony.client.model.gear.WitchHat;
|
import com.minelittlepony.client.model.gear.WitchHat;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.minelittlepony.model.gear.IGear;
|
import com.minelittlepony.model.gear.IGear;
|
||||||
import com.minelittlepony.model.gear.IStackable;
|
import com.minelittlepony.model.gear.IStackable;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
@ -83,7 +83,7 @@ public class LayerGear<T extends LivingEntity, M extends EntityModel<T> & IPonyM
|
||||||
getContext().bindTexture(texture);
|
getContext().bindTexture(texture);
|
||||||
|
|
||||||
gear.setLivingAnimations(model, entity);
|
gear.setLivingAnimations(model, entity);
|
||||||
gear.setRotationAndAngles(model.isGoingFast(), entity.getUuid(), move, swing, model.getWobbleAmount(), ticks);
|
gear.setRotationAndAngles(model.getAttributes().isGoingFast, entity.getUuid(), move, swing, model.getWobbleAmount(), ticks);
|
||||||
gear.renderPart(scale, entity.getUuid());
|
gear.renderPart(scale, entity.getUuid());
|
||||||
|
|
||||||
GL11.glPopAttrib();
|
GL11.glPopAttrib();
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.minelittlepony.client.render.layer;
|
package com.minelittlepony.client.render.layer;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.entity.model.EntityModel;
|
import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.minelittlepony.client.render.layer;
|
package com.minelittlepony.client.render.layer;
|
||||||
|
|
||||||
import com.minelittlepony.client.PonyRenderManager;
|
import com.minelittlepony.client.PonyRenderManager;
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.minelittlepony.model.IUnicorn;
|
import com.minelittlepony.model.IUnicorn;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package com.minelittlepony.client.render.layer;
|
package com.minelittlepony.client.render.layer;
|
||||||
|
|
||||||
import com.minelittlepony.client.ForgeProxy;
|
import com.minelittlepony.client.ForgeProxy;
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.model.ModelWrapper;
|
import com.minelittlepony.client.model.ModelWrapper;
|
||||||
import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
|
import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.client.util.render.Color;
|
import com.minelittlepony.client.util.render.Color;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.minelittlepony.model.armour.ArmourLayer;
|
import com.minelittlepony.model.armour.ArmourLayer;
|
||||||
import com.minelittlepony.model.armour.IArmour;
|
import com.minelittlepony.model.armour.IArmour;
|
||||||
import com.minelittlepony.model.armour.IArmourTextureResolver;
|
import com.minelittlepony.model.armour.IArmourTextureResolver;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.minelittlepony.client.render.layer;
|
package com.minelittlepony.client.render.layer;
|
||||||
|
|
||||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import net.minecraft.block.AbstractSkullBlock;
|
import net.minecraft.block.AbstractSkullBlock;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.minelittlepony.client.render.layer;
|
package com.minelittlepony.client.render.layer;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.model.IPonyModel;
|
||||||
import com.minelittlepony.client.model.components.PonyElytra;
|
import com.minelittlepony.client.model.components.PonyElytra;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
||||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||||
|
|
|
@ -15,16 +15,16 @@ public enum PonyTransformation {
|
||||||
NORMAL(Size.NORMAL, 0, 3F, 0.75F) {
|
NORMAL(Size.NORMAL, 0, 3F, 0.75F) {
|
||||||
@Override
|
@Override
|
||||||
public void transform(IModel model, BodyPart part) {
|
public void transform(IModel model, BodyPart part) {
|
||||||
if (model.isCrouching()) translate(0, -0.2F, 0);
|
if (model.getAttributes().isCrouching) translate(0, -0.2F, 0);
|
||||||
if (model.isSleeping()) translate(0, -0.61F, 0.1F);
|
if (model.getAttributes().isSleeping) translate(0, -0.61F, 0.1F);
|
||||||
if (model.isRiding()) translate(0, -0.2F, -0.2F);
|
if (model.isRiding()) translate(0, -0.2F, -0.2F);
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case NECK:
|
case NECK:
|
||||||
if (model.isCrouching()) translate(-0.03F, 0.03F, 0.1F);
|
if (model.getAttributes().isCrouching) translate(-0.03F, 0.03F, 0.1F);
|
||||||
break;
|
break;
|
||||||
case HEAD:
|
case HEAD:
|
||||||
if (model.isCrouching()) translate(0, 0.1F, 0);
|
if (model.getAttributes().isCrouching) translate(0, 0.1F, 0);
|
||||||
break;
|
break;
|
||||||
case BACK:
|
case BACK:
|
||||||
translateVec(riderOffset);
|
translateVec(riderOffset);
|
||||||
|
@ -36,19 +36,19 @@ public enum PonyTransformation {
|
||||||
LANKY(Size.LANKY, 0, 2.6F, 0.75F) {
|
LANKY(Size.LANKY, 0, 2.6F, 0.75F) {
|
||||||
@Override
|
@Override
|
||||||
public void transform(IModel model, BodyPart part) {
|
public void transform(IModel model, BodyPart part) {
|
||||||
if (model.isCrouching()) translate(0, -0.15F, 0);
|
if (model.getAttributes().isCrouching) translate(0, -0.15F, 0);
|
||||||
if (model.isSleeping()) translate(0, -0.6F, 0.15F);
|
if (model.getAttributes().isSleeping) translate(0, -0.6F, 0.15F);
|
||||||
if (model.isRiding()) translate(0, 0, -0.2F);
|
if (model.isRiding()) translate(0, 0, -0.2F);
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case NECK:
|
case NECK:
|
||||||
translate(0, -0.15F, -0.07F);
|
translate(0, -0.15F, -0.07F);
|
||||||
if (model.isCrouching()) translate(-0.03F, 0.16F, 0.07F);
|
if (model.getAttributes().isCrouching) translate(-0.03F, 0.16F, 0.07F);
|
||||||
break;
|
break;
|
||||||
case HEAD:
|
case HEAD:
|
||||||
translate(0, -0.17F, -0.04F);
|
translate(0, -0.17F, -0.04F);
|
||||||
if (model.isSleeping()) translate(0, 0, -0.1F);
|
if (model.getAttributes().isSleeping) translate(0, 0, -0.1F);
|
||||||
if (model.isCrouching()) translate(0, 0.15F, 0);
|
if (model.getAttributes().isCrouching) translate(0, 0.15F, 0);
|
||||||
break;
|
break;
|
||||||
case BODY:
|
case BODY:
|
||||||
translate(0, -0.2F, -0.04F);
|
translate(0, -0.2F, -0.04F);
|
||||||
|
@ -70,19 +70,19 @@ public enum PonyTransformation {
|
||||||
BULKY(Size.BULKY, 0, 2.3F, 0.75F) {
|
BULKY(Size.BULKY, 0, 2.3F, 0.75F) {
|
||||||
@Override
|
@Override
|
||||||
public void transform(IModel model, BodyPart part) {
|
public void transform(IModel model, BodyPart part) {
|
||||||
if (model.isCrouching()) translate(0, -0.15F, 0);
|
if (model.getAttributes().isCrouching) translate(0, -0.15F, 0);
|
||||||
if (model.isSleeping()) translate(0, -0.6F, 0.25F);
|
if (model.getAttributes().isSleeping) translate(0, -0.6F, 0.25F);
|
||||||
if (model.isRiding()) translate(0, 0, -0.2F);
|
if (model.isRiding()) translate(0, 0, -0.2F);
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case NECK:
|
case NECK:
|
||||||
translate(0, -0.15F, -0.07F);
|
translate(0, -0.15F, -0.07F);
|
||||||
if (model.isCrouching()) translate(-0.03F, 0.16F, 0.07F);
|
if (model.getAttributes().isCrouching) translate(-0.03F, 0.16F, 0.07F);
|
||||||
break;
|
break;
|
||||||
case HEAD:
|
case HEAD:
|
||||||
translate(0, -0.17F, -0.04F);
|
translate(0, -0.17F, -0.04F);
|
||||||
if (model.isSleeping()) translate(0, 0, -0.1F);
|
if (model.getAttributes().isSleeping) translate(0, 0, -0.1F);
|
||||||
if (model.isCrouching()) translate(0, 0.15F, 0);
|
if (model.getAttributes().isCrouching) translate(0, 0.15F, 0);
|
||||||
break;
|
break;
|
||||||
case BODY:
|
case BODY:
|
||||||
translate(0, -0.2F, -0.04F);
|
translate(0, -0.2F, -0.04F);
|
||||||
|
@ -104,8 +104,8 @@ public enum PonyTransformation {
|
||||||
FOAL(Size.FOAL, 0, 3.8F, 0.75F) {
|
FOAL(Size.FOAL, 0, 3.8F, 0.75F) {
|
||||||
@Override
|
@Override
|
||||||
public void transform(IModel model, BodyPart part) {
|
public void transform(IModel model, BodyPart part) {
|
||||||
if (model.isCrouching()) translate(0, -0.3F, 0);
|
if (model.getAttributes().isCrouching) translate(0, -0.3F, 0);
|
||||||
if (model.isSleeping()) translate(0, -0.65F, -0.3F);
|
if (model.getAttributes().isSleeping) translate(0, -0.65F, -0.3F);
|
||||||
if (model.isRiding()) translate(0, -0.6F, -0.2F);
|
if (model.isRiding()) translate(0, -0.6F, -0.2F);
|
||||||
|
|
||||||
translate(0, 0.2F, 0);
|
translate(0, 0.2F, 0);
|
||||||
|
@ -114,7 +114,7 @@ public enum PonyTransformation {
|
||||||
case NECK:
|
case NECK:
|
||||||
translate(0, 0, 0.04F);
|
translate(0, 0, 0.04F);
|
||||||
scale(1.3F, 1.3F, 1.3F);
|
scale(1.3F, 1.3F, 1.3F);
|
||||||
if (model.isCrouching()) translate(0, -0.01F, 0.15F);
|
if (model.getAttributes().isCrouching) translate(0, -0.01F, 0.15F);
|
||||||
break;
|
break;
|
||||||
case HEAD:
|
case HEAD:
|
||||||
scale(1.3F, 1.3F, 1.3F);
|
scale(1.3F, 1.3F, 1.3F);
|
||||||
|
@ -133,19 +133,19 @@ public enum PonyTransformation {
|
||||||
TALL(Size.TALL, 0, 2.2F, 0.75F) {
|
TALL(Size.TALL, 0, 2.2F, 0.75F) {
|
||||||
@Override
|
@Override
|
||||||
public void transform(IModel model, BodyPart part) {
|
public void transform(IModel model, BodyPart part) {
|
||||||
if (model.isCrouching()) translate(0, -0.15F, 0);
|
if (model.getAttributes().isCrouching) translate(0, -0.15F, 0);
|
||||||
if (model.isSleeping()) translate(0, -0.5F, 0.35F);
|
if (model.getAttributes().isSleeping) translate(0, -0.5F, 0.35F);
|
||||||
if (model.isRiding()) translate(0, 0.1F, -0.2F);
|
if (model.isRiding()) translate(0, 0.1F, -0.2F);
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case NECK:
|
case NECK:
|
||||||
translate(0, -0.09F, 0);
|
translate(0, -0.09F, 0);
|
||||||
scale(1, 1.1F, 1);
|
scale(1, 1.1F, 1);
|
||||||
if (model.isCrouching()) translate(-0.02F, -0.02F, 0.1F);
|
if (model.getAttributes().isCrouching) translate(-0.02F, -0.02F, 0.1F);
|
||||||
break;
|
break;
|
||||||
case HEAD:
|
case HEAD:
|
||||||
translate(0.01F, -0.15F, 0);
|
translate(0.01F, -0.15F, 0);
|
||||||
if (model.isCrouching()) translate(0, 0.04F, 0);
|
if (model.getAttributes().isCrouching) translate(0, 0.04F, 0);
|
||||||
break;
|
break;
|
||||||
case BODY:
|
case BODY:
|
||||||
case TAIL:
|
case TAIL:
|
||||||
|
@ -154,7 +154,7 @@ public enum PonyTransformation {
|
||||||
case LEGS:
|
case LEGS:
|
||||||
translate(0, -0.27F, 0.03F);
|
translate(0, -0.27F, 0.03F);
|
||||||
scale(1, 1.18F, 1);
|
scale(1, 1.18F, 1);
|
||||||
if (model.isGoingFast()) translate(0, 0.05F, 0);
|
if (model.getAttributes().isGoingFast) translate(0, 0.05F, 0);
|
||||||
break;
|
break;
|
||||||
case BACK:
|
case BACK:
|
||||||
riderOffset = new Vec3d(0, 2.2F, 0.75F);
|
riderOffset = new Vec3d(0, 2.2F, 0.75F);
|
||||||
|
@ -166,19 +166,19 @@ public enum PonyTransformation {
|
||||||
YEARLING(Size.YEARLING, 0, 3.8F, 0.75F) {
|
YEARLING(Size.YEARLING, 0, 3.8F, 0.75F) {
|
||||||
@Override
|
@Override
|
||||||
public void transform(IModel model, BodyPart part) {
|
public void transform(IModel model, BodyPart part) {
|
||||||
if (model.isCrouching()) translate(0, -0.15F, 0);
|
if (model.getAttributes().isCrouching) translate(0, -0.15F, 0);
|
||||||
if (model.isSleeping()) translate(0, -0.4F, -0.3F);
|
if (model.getAttributes().isSleeping) translate(0, -0.4F, -0.3F);
|
||||||
if (model.isRiding()) translate(0, -0.4F, -0.2F);
|
if (model.isRiding()) translate(0, -0.4F, -0.2F);
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case NECK:
|
case NECK:
|
||||||
translate(0, -0.09F, -0.01F);
|
translate(0, -0.09F, -0.01F);
|
||||||
scale(1, 1.1F, 1);
|
scale(1, 1.1F, 1);
|
||||||
if (model.isCrouching()) translate(-0.02F, -0.02F, 0.1F);
|
if (model.getAttributes().isCrouching) translate(-0.02F, -0.02F, 0.1F);
|
||||||
break;
|
break;
|
||||||
case HEAD:
|
case HEAD:
|
||||||
translate(0, -0.15F, 0.01F);
|
translate(0, -0.15F, 0.01F);
|
||||||
if (model.isCrouching()) translate(0, 0.04F, 0);
|
if (model.getAttributes().isCrouching) translate(0, 0.04F, 0);
|
||||||
scale(1.15F, 1.15F, 1.15F);
|
scale(1.15F, 1.15F, 1.15F);
|
||||||
break;
|
break;
|
||||||
case BODY:
|
case BODY:
|
||||||
|
@ -188,7 +188,7 @@ public enum PonyTransformation {
|
||||||
case LEGS:
|
case LEGS:
|
||||||
translate(0, -0.265F, 0.03F);
|
translate(0, -0.265F, 0.03F);
|
||||||
scale(1, 1.18F, 1);
|
scale(1, 1.18F, 1);
|
||||||
if (model.isGoingFast()) translate(0, 0.05F, 0);
|
if (model.getAttributes().isGoingFast) translate(0, 0.05F, 0);
|
||||||
break;
|
break;
|
||||||
case BACK:
|
case BACK:
|
||||||
translateVec(riderOffset);
|
translateVec(riderOffset);
|
||||||
|
|
|
@ -7,6 +7,6 @@ import com.minelittlepony.model.IModel;
|
||||||
public class PostureFalling implements PonyPosture<LivingEntity> {
|
public class PostureFalling implements PonyPosture<LivingEntity> {
|
||||||
@Override
|
@Override
|
||||||
public void transform(IModel model, LivingEntity entity, double motionX, double motionY, double motionZ, float yaw, float ticks) {
|
public void transform(IModel model, LivingEntity entity, double motionX, double motionY, double motionZ, float yaw, float ticks) {
|
||||||
model.setPitch(0);
|
model.getAttributes().motionPitch = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@ public class PostureFlight extends MotionCompositor implements PonyPosture<Playe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transform(IModel model, PlayerEntity player, double motionX, double motionY, double motionZ, float yaw, float ticks) {
|
public void transform(IModel model, PlayerEntity player, double motionX, double motionY, double motionZ, float yaw, float ticks) {
|
||||||
model.setPitch((float) calculateIncline(player, motionX, motionY, motionZ));
|
model.getAttributes().motionPitch = (float) calculateIncline(player, motionX, motionY, motionZ);
|
||||||
|
|
||||||
GlStateManager.rotatef(model.getPitch(), 1, 0, 0);
|
GlStateManager.rotatef(model.getAttributes().motionPitch, 1, 0, 0);
|
||||||
|
|
||||||
float roll = (float)calculateRoll(player, motionX, motionY, motionZ);
|
float roll = (float)calculateRoll(player, motionX, motionY, motionZ);
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.minelittlepony.model;
|
package com.minelittlepony.model;
|
||||||
|
|
||||||
import net.minecraft.client.render.entity.model.ModelWithArms;
|
import net.minecraft.client.render.entity.model.ModelWithArms;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import com.minelittlepony.model.BodyPart;
|
|
||||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||||
import com.minelittlepony.pony.IPonyData;
|
import com.minelittlepony.pony.IPonyData;
|
||||||
import com.minelittlepony.pony.meta.Size;
|
import com.minelittlepony.pony.meta.Size;
|
||||||
|
@ -22,10 +22,6 @@ public interface IModel extends ModelWithArms {
|
||||||
*/
|
*/
|
||||||
void transform(BodyPart part);
|
void transform(BodyPart part);
|
||||||
|
|
||||||
void setPitch(float pitch);
|
|
||||||
|
|
||||||
float getPitch();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the active scaling profile used to lay out this model's parts.
|
* Gets the active scaling profile used to lay out this model's parts.
|
||||||
*/
|
*/
|
||||||
|
@ -36,6 +32,11 @@ public interface IModel extends ModelWithArms {
|
||||||
*/
|
*/
|
||||||
IEquestrianArmour<?> createArmour();
|
IEquestrianArmour<?> createArmour();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the transitive properties of this model.
|
||||||
|
*/
|
||||||
|
ModelAttributes<?> getAttributes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the skin metadata associated with this model.
|
* Gets the skin metadata associated with this model.
|
||||||
*/
|
*/
|
||||||
|
@ -46,42 +47,18 @@ public interface IModel extends ModelWithArms {
|
||||||
*/
|
*/
|
||||||
void apply(IPonyData meta);
|
void apply(IPonyData meta);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this model is on the ground and crouching.
|
|
||||||
*/
|
|
||||||
boolean isCrouching();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the model is flying.
|
* Returns true if the model is flying.
|
||||||
*/
|
*/
|
||||||
boolean isFlying();
|
default boolean isFlying() {
|
||||||
|
return getAttributes().isFlying && canFly();
|
||||||
/**
|
}
|
||||||
* Returns true if the model is elytra flying. Elytra flying is different
|
|
||||||
* from regular flying in that there are actual "wings" involved.
|
|
||||||
*/
|
|
||||||
boolean isElytraFlying();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this model is lying on a bed or bed-like object.
|
|
||||||
*/
|
|
||||||
boolean isSleeping();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this model is wimming underwater.
|
|
||||||
*/
|
|
||||||
boolean isSwimming();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this model is riding a boat, horse, or other animals.
|
* Returns true if this model is riding a boat, horse, or other animals.
|
||||||
*/
|
*/
|
||||||
boolean isRiding();
|
boolean isRiding();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if we're flying really fast.
|
|
||||||
*/
|
|
||||||
boolean isGoingFast();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this model is being applied to a race that has wings.
|
* Returns true if this model is being applied to a race that has wings.
|
||||||
*/
|
*/
|
||||||
|
@ -92,7 +69,9 @@ public interface IModel extends ModelWithArms {
|
||||||
/**
|
/**
|
||||||
* Returns true if the current model is a child or a child-like foal.
|
* Returns true if the current model is a child or a child-like foal.
|
||||||
*/
|
*/
|
||||||
boolean isChild();
|
default boolean isChild() {
|
||||||
|
return getSize() == Size.FOAL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current leg swing amount.
|
* Gets the current leg swing amount.
|
||||||
|
@ -100,20 +79,22 @@ public interface IModel extends ModelWithArms {
|
||||||
float getSwingAmount();
|
float getSwingAmount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the step woddle used for various hair bits and animations.
|
* Gets the step wobble used for various hair bits and animations.
|
||||||
*/
|
*/
|
||||||
float getWobbleAmount();
|
default float getWobbleAmount() {
|
||||||
|
|
||||||
|
if (getSwingAmount() <= 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MathHelper.sin(MathHelper.sqrt(getSwingAmount()) * PonyModelConstants.PI * 2) * 0.04F;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the y-offset applied to entities riding this one.
|
* Gets the y-offset applied to entities riding this one.
|
||||||
*/
|
*/
|
||||||
float getRiderYOffset();
|
float getRiderYOffset();
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the actual, visible height of this model when rendered.
|
|
||||||
*/
|
|
||||||
float getModelHeight();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests if this model is wearing the given piece of gear.
|
* Tests if this model is wearing the given piece of gear.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,7 +11,7 @@ public interface IPegasus extends IModel {
|
||||||
* Returns true if the wings are spread.
|
* Returns true if the wings are spread.
|
||||||
*/
|
*/
|
||||||
default boolean wingsAreOpen() {
|
default boolean wingsAreOpen() {
|
||||||
return (isSwimming() || isFlying() || isCrouching()) && !isElytraFlying();
|
return (getAttributes().isSwimming || isFlying() || getAttributes().isCrouching) && !getAttributes().isGliding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,7 @@ public interface IPegasus extends IModel {
|
||||||
* @param ticks Partial render ticks
|
* @param ticks Partial render ticks
|
||||||
*/
|
*/
|
||||||
default float getWingRotationFactor(float ticks) {
|
default float getWingRotationFactor(float ticks) {
|
||||||
if (isSwimming()) {
|
if (getAttributes().isSwimming) {
|
||||||
return (MathHelper.sin(ticks * 0.136f) / 2) + ROTATE_270;
|
return (MathHelper.sin(ticks * 0.136f) / 2) + ROTATE_270;
|
||||||
}
|
}
|
||||||
if (isFlying()) {
|
if (isFlying()) {
|
||||||
|
|
98
src/main/java/com/minelittlepony/model/ModelAttributes.java
Normal file
98
src/main/java/com/minelittlepony/model/ModelAttributes.java
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
package com.minelittlepony.model;
|
||||||
|
|
||||||
|
import com.minelittlepony.pony.IPony;
|
||||||
|
import com.minelittlepony.util.math.MathUtil;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class ModelAttributes<T extends LivingEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if the model is sleeping in a bed.
|
||||||
|
*/
|
||||||
|
public boolean isSleeping;
|
||||||
|
/**
|
||||||
|
* True if the model is flying like a pegasus.
|
||||||
|
*/
|
||||||
|
public boolean isFlying;
|
||||||
|
/**
|
||||||
|
* True if the model is elytra flying. Elytra flying is different
|
||||||
|
* from regular flying in that there are actual "wings" involved.
|
||||||
|
*/
|
||||||
|
public boolean isGliding;
|
||||||
|
/**
|
||||||
|
* True if the model is swimming under water.
|
||||||
|
*/
|
||||||
|
public boolean isSwimming;
|
||||||
|
/**
|
||||||
|
* True if the pony is crouching.
|
||||||
|
*/
|
||||||
|
public boolean isCrouching;
|
||||||
|
/**
|
||||||
|
* True if the model is sitting as in boats.
|
||||||
|
*/
|
||||||
|
public boolean isSitting;
|
||||||
|
/**
|
||||||
|
* Flag indicating that this model is performing a rainboom (flight).
|
||||||
|
*/
|
||||||
|
public boolean isGoingFast;
|
||||||
|
/**
|
||||||
|
* True if the model is wearing any unconventional headgear (ie. a Pumpkin)
|
||||||
|
*/
|
||||||
|
public boolean hasHeadGear;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vertical pitch whilst flying.
|
||||||
|
*/
|
||||||
|
public float motionPitch;
|
||||||
|
/**
|
||||||
|
* Lerp amount controlling leg swing whilst performing a rainboom.
|
||||||
|
*/
|
||||||
|
public double motionLerp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unique id of the interpolator used for this model.
|
||||||
|
* Usually the UUID of the entity being rendered.
|
||||||
|
*/
|
||||||
|
public UUID interpolatorId;
|
||||||
|
|
||||||
|
public int armWidth = 4;
|
||||||
|
public int armDepth = 4;
|
||||||
|
|
||||||
|
public int armLength = 12;
|
||||||
|
|
||||||
|
public float armRotationX = 3F;
|
||||||
|
public float armRotationY = 8F;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actual, visible height of this model when rendered.
|
||||||
|
* Used when drawing nameplates.
|
||||||
|
*/
|
||||||
|
public float visualHeight = 2F;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
|
||||||
|
*/
|
||||||
|
public void checkRainboom(T entity, float swing, boolean hasWings) {
|
||||||
|
Vec3d motion = entity.getVelocity();
|
||||||
|
double zMotion = Math.sqrt(motion.x * motion.x + motion.z * motion.z);
|
||||||
|
|
||||||
|
isGoingFast = (isFlying && hasWings) || isGliding;
|
||||||
|
isGoingFast &= zMotion > 0.4F;
|
||||||
|
|
||||||
|
motionLerp = MathUtil.clampLimit(zMotion * 30, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateLivingState(T entity, IPony pony) {
|
||||||
|
isCrouching = pony.isCrouching(entity);
|
||||||
|
isSleeping = entity.isSleeping();
|
||||||
|
isFlying = pony.isFlying(entity);
|
||||||
|
isGliding = entity.isFallFlying();
|
||||||
|
isSwimming = pony.isSwimming(entity);
|
||||||
|
hasHeadGear = pony.isWearingHeadgear(entity);
|
||||||
|
isSitting = pony.isRidingInteractive(entity);
|
||||||
|
interpolatorId = entity.getUuid();
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,8 +4,8 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
|
import com.minelittlepony.model.IModel;
|
||||||
import com.minelittlepony.model.IPart;
|
import com.minelittlepony.model.IPart;
|
||||||
import com.minelittlepony.model.IPonyModel;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public interface IGear extends IPart {
|
||||||
*
|
*
|
||||||
* @return True to render this wearable
|
* @return True to render this wearable
|
||||||
*/
|
*/
|
||||||
boolean canRender(IPonyModel<?> model, Entity entity);
|
boolean canRender(IModel model, Entity entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the body location that this wearable appears on.
|
* Gets the body location that this wearable appears on.
|
||||||
|
@ -36,7 +36,7 @@ public interface IGear extends IPart {
|
||||||
/**
|
/**
|
||||||
* Orients this wearable.
|
* Orients this wearable.
|
||||||
*/
|
*/
|
||||||
default void setLivingAnimations(IPonyModel<?> model, Entity entity) {
|
default void setLivingAnimations(IModel model, Entity entity) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue