mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Convert the models to mson
This commit is contained in:
parent
beb333db05
commit
79db99719c
10 changed files with 93 additions and 20 deletions
|
@ -7,7 +7,11 @@ import com.minelittlepony.client.transform.PonyTransformation;
|
||||||
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.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.MsonPart;
|
||||||
|
import com.minelittlepony.mson.api.model.biped.MsonBiped;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
|
@ -21,7 +25,9 @@ import net.minecraft.util.math.MathHelper;
|
||||||
/**
|
/**
|
||||||
* Foundation class for all types of ponies.
|
* 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 upperTorso;
|
||||||
protected ModelPart upperTorsoOverlay;
|
protected ModelPart upperTorsoOverlay;
|
||||||
|
@ -36,6 +42,25 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
super(0, arms);
|
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
|
@Override
|
||||||
public IEquestrianArmour<?> createArmour() {
|
public IEquestrianArmour<?> createArmour() {
|
||||||
return new ArmourWrapper<>(ModelPonyArmour::new);
|
return new ArmourWrapper<>(ModelPonyArmour::new);
|
||||||
|
|
|
@ -6,6 +6,8 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.mob.EndermanEntity;
|
import net.minecraft.entity.mob.EndermanEntity;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import com.minelittlepony.mson.api.ModelContext;
|
||||||
|
|
||||||
public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
||||||
|
|
||||||
public boolean isCarrying;
|
public boolean isCarrying;
|
||||||
|
@ -22,6 +24,13 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
||||||
attributes.visualHeight = 3;
|
attributes.visualHeight = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ModelContext context) {
|
||||||
|
super.init(context);
|
||||||
|
leftHorn = context.findByName("left_horn");
|
||||||
|
rightHorn = context.findByName("right_horn");
|
||||||
|
}
|
||||||
|
|
||||||
@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;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.minelittlepony.client.model.entity.race.ModelUnicorn;
|
||||||
import com.minelittlepony.client.model.armour.ArmourWrapper;
|
import com.minelittlepony.client.model.armour.ArmourWrapper;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||||
|
import com.minelittlepony.mson.api.ModelContext;
|
||||||
import com.minelittlepony.pony.IPony;
|
import com.minelittlepony.pony.IPony;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
||||||
|
@ -31,6 +32,15 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
|
||||||
this(false);
|
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
|
@Override
|
||||||
public IEquestrianArmour<?> createArmour() {
|
public IEquestrianArmour<?> createArmour() {
|
||||||
return new ArmourWrapper<>(Armour::new);
|
return new ArmourWrapper<>(Armour::new);
|
||||||
|
|
|
@ -65,19 +65,11 @@ public class ModelSkeletonPony<T extends HostileEntity> extends ModelAlicorn<T>
|
||||||
protected void rotateLegs(float move, float swing, float ticks, T entity) {
|
protected void rotateLegs(float move, float swing, float ticks, T entity) {
|
||||||
super.rotateLegs(move, swing, ticks, entity);
|
super.rotateLegs(move, swing, ticks, entity);
|
||||||
if (rightArmPose != ArmPose.EMPTY) {
|
if (rightArmPose != ArmPose.EMPTY) {
|
||||||
if (canCast()) {
|
rotateArmHolding(getArm(Arm.RIGHT), -1, getSwingAmount(), ticks);
|
||||||
rotateArmHolding(unicornArmRight, -1, getSwingAmount(), ticks);
|
|
||||||
} else {
|
|
||||||
rotateArmHolding(rightArm, -1, getSwingAmount(), ticks);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leftArmPose != ArmPose.EMPTY) {
|
if (leftArmPose != ArmPose.EMPTY) {
|
||||||
if (canCast()) {
|
rotateArmHolding(getArm(Arm.LEFT), -1, getSwingAmount(), ticks);
|
||||||
rotateArmHolding(unicornArmLeft, -1, getSwingAmount(), ticks);
|
|
||||||
} else {
|
|
||||||
rotateArmHolding(leftArm, -1, getSwingAmount(), ticks);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.village.VillagerProfession;
|
||||||
import com.minelittlepony.client.model.entity.race.ModelAlicorn;
|
import com.minelittlepony.client.model.entity.race.ModelAlicorn;
|
||||||
import com.minelittlepony.client.render.entity.villager.PonyTextures;
|
import com.minelittlepony.client.render.entity.villager.PonyTextures;
|
||||||
import com.minelittlepony.model.IPart;
|
import com.minelittlepony.model.IPart;
|
||||||
|
import com.minelittlepony.mson.api.ModelContext;
|
||||||
import com.minelittlepony.pony.meta.Race;
|
import com.minelittlepony.pony.meta.Race;
|
||||||
|
|
||||||
public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> extends ModelAlicorn<T> implements ModelWithHat {
|
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);
|
super(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ModelContext context) {
|
||||||
|
super.init(context);
|
||||||
|
apron = context.findByName("apron");
|
||||||
|
trinket = context.findByName("trinket");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPart getWings() {
|
public IPart getWings() {
|
||||||
if (getMetadata().getRace() == Race.BATPONY) {
|
if (getMetadata().getRace() == Race.BATPONY) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.client.model.entity.race;
|
||||||
|
|
||||||
import com.minelittlepony.model.IPart;
|
import com.minelittlepony.model.IPart;
|
||||||
import com.minelittlepony.model.IPegasus;
|
import com.minelittlepony.model.IPegasus;
|
||||||
|
import com.minelittlepony.mson.api.ModelContext;
|
||||||
|
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
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 {
|
public class ModelAlicorn<T extends LivingEntity> extends ModelUnicorn<T> implements IPegasus {
|
||||||
|
|
||||||
protected IPart wings;
|
private IPart wings;
|
||||||
|
|
||||||
public ModelAlicorn(boolean smallArms) {
|
public ModelAlicorn(boolean smallArms) {
|
||||||
super(smallArms);
|
super(smallArms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ModelContext context) {
|
||||||
|
super.init(context);
|
||||||
|
wings = context.findByName("wings");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPart getWings() {
|
public IPart getWings() {
|
||||||
return wings;
|
return wings;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.client.model.entity.race;
|
||||||
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class ModelBatpony<T extends LivingEntity> extends ModelPegasus<T> {
|
public class ModelBatpony<T extends LivingEntity> extends ModelPegasus<T> {
|
||||||
public ModelBatpony(boolean smallArms) {
|
public ModelBatpony(boolean smallArms) {
|
||||||
super(smallArms);
|
super(smallArms);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.minelittlepony.client.model.entity.race;
|
package com.minelittlepony.client.model.entity.race;
|
||||||
|
|
||||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||||
|
import com.minelittlepony.mson.api.ModelContext;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
@ -9,25 +10,29 @@ public class ModelEarthPony<T extends LivingEntity> extends AbstractPonyModel<T>
|
||||||
|
|
||||||
private final boolean smallArms;
|
private final boolean smallArms;
|
||||||
|
|
||||||
public ModelPart bipedCape;
|
private ModelPart cape;
|
||||||
|
|
||||||
public ModelEarthPony(boolean smallArms) {
|
public ModelEarthPony(boolean smallArms) {
|
||||||
super(smallArms);
|
super(smallArms);
|
||||||
this.smallArms = smallArms;
|
this.smallArms = smallArms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ModelContext context) {
|
||||||
|
super.init(context);
|
||||||
|
cape = context.findByName("cape");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
|
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
|
||||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
|
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
|
||||||
bipedCape.pivotY = isSneaking ? 2 : isRiding ? -4 : 0;
|
cape.pivotY = isSneaking ? 2 : isRiding ? -4 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getLegOutset() {
|
protected float getLegOutset() {
|
||||||
if (smallArms) {
|
if (smallArms) {
|
||||||
if (attributes.isSleeping) return 2.6f;
|
return Math.max(1, super.getLegOutset() - 1);
|
||||||
if (attributes.isCrouching) return 1;
|
|
||||||
return 4;
|
|
||||||
}
|
}
|
||||||
return super.getLegOutset();
|
return super.getLegOutset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.client.model.entity.race;
|
||||||
|
|
||||||
import com.minelittlepony.model.IPart;
|
import com.minelittlepony.model.IPart;
|
||||||
import com.minelittlepony.model.IPegasus;
|
import com.minelittlepony.model.IPegasus;
|
||||||
|
import com.minelittlepony.mson.api.ModelContext;
|
||||||
|
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
@ -15,6 +16,12 @@ public class ModelPegasus<T extends LivingEntity> extends ModelEarthPony<T> impl
|
||||||
super(smallArms);
|
super(smallArms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ModelContext context) {
|
||||||
|
super.init(context);
|
||||||
|
wings = context.findByName("wings");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPart getWings() {
|
public IPart getWings() {
|
||||||
return wings;
|
return wings;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.client.model.entity.race;
|
||||||
|
|
||||||
import com.minelittlepony.client.model.part.UnicornHorn;
|
import com.minelittlepony.client.model.part.UnicornHorn;
|
||||||
import com.minelittlepony.model.IUnicorn;
|
import com.minelittlepony.model.IUnicorn;
|
||||||
|
import com.minelittlepony.mson.api.ModelContext;
|
||||||
import com.minelittlepony.mson.api.model.MsonPart;
|
import com.minelittlepony.mson.api.model.MsonPart;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
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 class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> implements IUnicorn<ModelPart> {
|
||||||
|
|
||||||
public ModelPart unicornArmRight;
|
protected ModelPart unicornArmRight;
|
||||||
public ModelPart unicornArmLeft;
|
protected ModelPart unicornArmLeft;
|
||||||
|
|
||||||
public UnicornHorn horn;
|
protected UnicornHorn horn;
|
||||||
|
|
||||||
public ModelUnicorn(boolean smallArms) {
|
public ModelUnicorn(boolean smallArms) {
|
||||||
super(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
|
@Override
|
||||||
public float getWobbleAmount() {
|
public float getWobbleAmount() {
|
||||||
if (isCasting()) {
|
if (isCasting()) {
|
||||||
|
|
Loading…
Reference in a new issue