Convert the models to mson

This commit is contained in:
Sollace 2019-11-25 16:08:57 +02:00
parent beb333db05
commit 79db99719c
10 changed files with 93 additions and 20 deletions

View file

@ -7,7 +7,11 @@ import com.minelittlepony.client.transform.PonyTransformation;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.IPart;
import com.minelittlepony.model.armour.IEquestrianArmour;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.mixin.Extends;
import com.minelittlepony.mson.api.mixin.MixedMsonModel;
import com.minelittlepony.mson.api.model.MsonPart;
import com.minelittlepony.mson.api.model.biped.MsonBiped;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.VertexConsumer;
@ -21,7 +25,9 @@ import net.minecraft.util.math.MathHelper;
/**
* Foundation class for all types of ponies.
*/
public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPonyModel<T> {
@Extends(MsonBiped.class)
public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPonyModel<T>
implements MixedMsonModel {
protected ModelPart upperTorso;
protected ModelPart upperTorsoOverlay;
@ -36,6 +42,25 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
super(0, arms);
}
@Override
public void init(ModelContext context) {
MixedMsonModel.super.init(context);
context.findByName("left_sleeve", leftSleeve);
context.findByName("right_sleeve", rightSleeve);
context.findByName("left_pant_leg", leftPantLeg);
context.findByName("right_pant_leg", rightPantLeg);
context.findByName("jacket", jacket);
upperTorso = context.findByName("upper_torso");
upperTorsoOverlay = context.findByName("saddle");
neck = context.findByName("neck");
tail = context.findByName("tail");
snout = context.findByName("snout");
ears = context.findByName("ears");
}
@Override
public IEquestrianArmour<?> createArmour() {
return new ArmourWrapper<>(ModelPonyArmour::new);

View file

@ -6,6 +6,8 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.mob.EndermanEntity;
import net.minecraft.util.math.MathHelper;
import com.minelittlepony.mson.api.ModelContext;
public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
public boolean isCarrying;
@ -22,6 +24,13 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
attributes.visualHeight = 3;
}
@Override
public void init(ModelContext context) {
super.init(context);
leftHorn = context.findByName("left_horn");
rightHorn = context.findByName("right_horn");
}
@Override
public void animateModel(EndermanEntity entity, float move, float swing, float ticks) {
rightArmPose = isCarrying ? ArmPose.BLOCK : ArmPose.EMPTY;

View file

@ -5,6 +5,7 @@ import com.minelittlepony.client.model.entity.race.ModelUnicorn;
import com.minelittlepony.client.model.armour.ArmourWrapper;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.armour.IEquestrianArmour;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.pony.IPony;
import com.mojang.blaze3d.platform.GlStateManager;
@ -31,6 +32,15 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
this(false);
}
@Override
public void init(ModelContext context) {
super.init(context);
bodyCenter = context.findByName("abdomin");
leftFin = context.findByName("left_fin");
rightFin = context.findByName("right_fin");
centerFin = context.findByName("center_fin");
}
@Override
public IEquestrianArmour<?> createArmour() {
return new ArmourWrapper<>(Armour::new);

View file

@ -65,19 +65,11 @@ public class ModelSkeletonPony<T extends HostileEntity> extends ModelAlicorn<T>
protected void rotateLegs(float move, float swing, float ticks, T entity) {
super.rotateLegs(move, swing, ticks, entity);
if (rightArmPose != ArmPose.EMPTY) {
if (canCast()) {
rotateArmHolding(unicornArmRight, -1, getSwingAmount(), ticks);
} else {
rotateArmHolding(rightArm, -1, getSwingAmount(), ticks);
}
rotateArmHolding(getArm(Arm.RIGHT), -1, getSwingAmount(), ticks);
}
if (leftArmPose != ArmPose.EMPTY) {
if (canCast()) {
rotateArmHolding(unicornArmLeft, -1, getSwingAmount(), ticks);
} else {
rotateArmHolding(leftArm, -1, getSwingAmount(), ticks);
}
rotateArmHolding(getArm(Arm.LEFT), -1, getSwingAmount(), ticks);
}
}

View file

@ -13,6 +13,7 @@ import net.minecraft.village.VillagerProfession;
import com.minelittlepony.client.model.entity.race.ModelAlicorn;
import com.minelittlepony.client.render.entity.villager.PonyTextures;
import com.minelittlepony.model.IPart;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.pony.meta.Race;
public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> extends ModelAlicorn<T> implements ModelWithHat {
@ -26,6 +27,13 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
super(false);
}
@Override
public void init(ModelContext context) {
super.init(context);
apron = context.findByName("apron");
trinket = context.findByName("trinket");
}
@Override
public IPart getWings() {
if (getMetadata().getRace() == Race.BATPONY) {

View file

@ -2,6 +2,7 @@ package com.minelittlepony.client.model.entity.race;
import com.minelittlepony.model.IPart;
import com.minelittlepony.model.IPegasus;
import com.minelittlepony.mson.api.ModelContext;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
@ -9,12 +10,18 @@ import net.minecraft.entity.LivingEntity;
public class ModelAlicorn<T extends LivingEntity> extends ModelUnicorn<T> implements IPegasus {
protected IPart wings;
private IPart wings;
public ModelAlicorn(boolean smallArms) {
super(smallArms);
}
@Override
public void init(ModelContext context) {
super.init(context);
wings = context.findByName("wings");
}
@Override
public IPart getWings() {
return wings;

View file

@ -2,6 +2,7 @@ package com.minelittlepony.client.model.entity.race;
import net.minecraft.entity.LivingEntity;
@Deprecated
public class ModelBatpony<T extends LivingEntity> extends ModelPegasus<T> {
public ModelBatpony(boolean smallArms) {
super(smallArms);

View file

@ -1,6 +1,7 @@
package com.minelittlepony.client.model.entity.race;
import com.minelittlepony.client.model.AbstractPonyModel;
import com.minelittlepony.mson.api.ModelContext;
import net.minecraft.client.model.ModelPart;
import net.minecraft.entity.LivingEntity;
@ -9,25 +10,29 @@ public class ModelEarthPony<T extends LivingEntity> extends AbstractPonyModel<T>
private final boolean smallArms;
public ModelPart bipedCape;
private ModelPart cape;
public ModelEarthPony(boolean smallArms) {
super(smallArms);
this.smallArms = smallArms;
}
@Override
public void init(ModelContext context) {
super.init(context);
cape = context.findByName("cape");
}
@Override
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
bipedCape.pivotY = isSneaking ? 2 : isRiding ? -4 : 0;
cape.pivotY = isSneaking ? 2 : isRiding ? -4 : 0;
}
@Override
protected float getLegOutset() {
if (smallArms) {
if (attributes.isSleeping) return 2.6f;
if (attributes.isCrouching) return 1;
return 4;
return Math.max(1, super.getLegOutset() - 1);
}
return super.getLegOutset();
}

View file

@ -2,6 +2,7 @@ package com.minelittlepony.client.model.entity.race;
import com.minelittlepony.model.IPart;
import com.minelittlepony.model.IPegasus;
import com.minelittlepony.mson.api.ModelContext;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
@ -15,6 +16,12 @@ public class ModelPegasus<T extends LivingEntity> extends ModelEarthPony<T> impl
super(smallArms);
}
@Override
public void init(ModelContext context) {
super.init(context);
wings = context.findByName("wings");
}
@Override
public IPart getWings() {
return wings;

View file

@ -2,6 +2,7 @@ package com.minelittlepony.client.model.entity.race;
import com.minelittlepony.client.model.part.UnicornHorn;
import com.minelittlepony.model.IUnicorn;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.model.MsonPart;
import net.minecraft.client.model.ModelPart;
@ -16,15 +17,23 @@ import net.minecraft.util.math.MathHelper;
*/
public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> implements IUnicorn<ModelPart> {
public ModelPart unicornArmRight;
public ModelPart unicornArmLeft;
protected ModelPart unicornArmRight;
protected ModelPart unicornArmLeft;
public UnicornHorn horn;
protected UnicornHorn horn;
public ModelUnicorn(boolean smallArms) {
super(smallArms);
}
@Override
public void init(ModelContext context) {
super.init(context);
horn = context.findByName("horn");
unicornArmRight = context.findByName("right_cast");
unicornArmLeft = context.findByName("left_cast");
}
@Override
public float getWobbleAmount() {
if (isCasting()) {