Update mson

This commit is contained in:
Sollace 2023-03-20 01:30:46 +00:00
parent 1af3ac0c69
commit 3733289ca4
34 changed files with 155 additions and 378 deletions

View file

@ -23,4 +23,4 @@ org.gradle.daemon=false
modmenu_version=6.1.0-rc.4
kirin_version=1.14.0-beta.3
hd_skins_version=6.8.0-beta.1
mson_version=1.8.0-beta.2
mson_version=1.8.0-beta.4

View file

@ -3,15 +3,13 @@ package com.minelittlepony.api.model;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import java.util.UUID;
public interface IPart extends PonyModelConstants {
/**
* Sets the model's various rotation angles.
* <p>
* See {@link AbstractPonyMode.setRotationAndAngle} for an explanation of the various parameters.
*/
default void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) {
default void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
}

View file

@ -13,7 +13,6 @@ public interface IPegasus extends IModel {
&& (MineLittlePony.getInstance().getConfig().flappyElytras.get() || !getAttributes().isGliding);
}
default boolean isBurdened() {
return isWearing(Wearable.SADDLE_BAGS_BOTH) || isWearing(Wearable.SADDLE_BAGS_LEFT) || isWearing(Wearable.SADDLE_BAGS_RIGHT);
}

View file

@ -1,8 +1,8 @@
package com.minelittlepony.api.model;
import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.api.pony.PonyPosture;
import com.minelittlepony.api.pony.*;
import com.minelittlepony.client.SkinsProxy;
import com.minelittlepony.client.pony.PonyData;
import com.minelittlepony.util.MathUtil;
import java.util.*;
@ -102,6 +102,11 @@ public class ModelAttributes {
*/
public Set<Identifier> featureSkins = new HashSet<>();
/**
* Contains the skin metadata associated with this model.
*/
public IPonyData metadata = PonyData.NULL;
/**
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
*/

View file

@ -7,6 +7,8 @@ import com.minelittlepony.client.transform.PonyTransformation;
import com.minelittlepony.client.util.render.RenderList;
import com.minelittlepony.mson.util.PartUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
import net.minecraft.client.model.ModelPart;
@ -38,6 +40,8 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
protected final RenderList mainRenderList;
private final List<IPart> parts = new ArrayList<>();
public AbstractPonyModel(ModelPart tree) {
super(tree);
@ -54,6 +58,11 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
.add(withStage(BodyPart.HEAD, helmetRenderList = RenderList.of(hat)));
}
protected <P extends IPart> P addPart(P part) {
parts.add(part);
return part;
}
protected RenderList forPart(Supplier<IPart> part) {
return (stack, vertices, overlayUv, lightUv, red, green, blue, alpha) -> {
part.get().renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes);
@ -118,7 +127,8 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
protected void setModelAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
rotateHead(headYaw, headPitch);
shakeBody(move, swing, getWobbleAmount(), ticks);
float bodySwing = getWobbleAmount();
shakeBody(move, swing, bodySwing, ticks);
rotateLegs(move, swing, ticks, entity);
if (onSetModelAngles != null) {
@ -152,6 +162,8 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
if (attributes.isSleeping) {
ponySleep();
}
parts.forEach(part -> part.setRotationAndAngles(attributes, move, swing, bodySwing, ticks));
}
public void setHeadRotation(float animationProgress, float yaw, float pitch) {
@ -590,6 +602,8 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
upperTorsoOverlay.visible = visible;
neck.visible = visible;
parts.forEach(part -> part.setVisible(visible));
}
@Override

View file

@ -14,7 +14,6 @@ import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.api.pony.IPonyData;
import com.minelittlepony.api.pony.meta.Size;
import com.minelittlepony.api.pony.meta.Sizes;
import com.minelittlepony.client.pony.PonyData;
import com.minelittlepony.mson.api.model.biped.MsonPlayer;
/**
@ -31,11 +30,6 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
*/
protected ModelAttributes attributes = new ModelAttributes();
/**
* Associated pony data.
*/
protected IPonyData metadata = PonyData.NULL;
@Nullable
protected PosingCallback<T> onSetModelAngles;
@ -73,7 +67,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
@Override
public IPonyData getMetadata() {
return metadata;
return attributes.metadata;
}
@Override
@ -83,7 +77,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
@Override
public void setMetadata(IPonyData meta) {
metadata = meta;
attributes.metadata = meta;
}
@Override
@ -120,7 +114,6 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
if (model instanceof ClientPonyModel) {
((ClientPonyModel<T>)model).attributes = attributes;
((ClientPonyModel<T>)model).metadata = metadata;
}
}

View file

@ -13,7 +13,7 @@ import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.api.pony.IPonyData;
import com.minelittlepony.api.pony.meta.Size;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.ModelView;
import com.minelittlepony.mson.api.model.BoxBuilder.RenderLayerSetter;
public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>> extends IPonyModel<T>, ModelWithArms {
@ -21,7 +21,7 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
M mixin();
@Override
default void init(ModelContext context) {
default void init(ModelView context) {
mixin().init(context);
if (mixin() instanceof RenderLayerSetter && this instanceof RenderLayerSetter) {
((RenderLayerSetter)this).setRenderLayerFactory(((RenderLayerSetter)mixin()).getRenderLayerFactory());

View file

@ -2,23 +2,24 @@ package com.minelittlepony.client.model.entity.race;
import com.minelittlepony.api.model.IPart;
import com.minelittlepony.api.model.IPegasus;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.client.model.part.PonyWings;
import com.minelittlepony.mson.api.ModelView;
import net.minecraft.client.model.ModelPart;
import net.minecraft.entity.LivingEntity;
public class AlicornModel<T extends LivingEntity> extends UnicornModel<T> implements IPegasus {
private IPart wings;
private PonyWings<AlicornModel<T>> wings;
public AlicornModel(ModelPart tree, boolean smallArms) {
super(tree, smallArms);
}
@Override
public void init(ModelContext context) {
public void init(ModelView context) {
super.init(context);
wings = context.findByName("wings");
wings = addPart(context.findByName("wings", PonyWings::new));
bodyRenderList.add(forPart(this::getWings).checked(this::canFly));
}
@ -26,19 +27,4 @@ public class AlicornModel<T extends LivingEntity> extends UnicornModel<T> implem
public IPart getWings() {
return wings;
}
@Override
public void setModelAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
super.setModelAngles(entity, move, swing, ticks, headYaw, headPitch);
if (canFly()) {
getWings().setRotationAndAngles(attributes.isGoingFast, attributes.interpolatorId, move, swing, 0, ticks);
}
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
getWings().setVisible(visible);
}
}

View file

@ -2,8 +2,8 @@ package com.minelittlepony.client.model.entity.race;
import com.minelittlepony.api.model.IPart;
import com.minelittlepony.client.model.AbstractPonyModel;
import com.minelittlepony.client.model.part.PonySnout;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.client.model.part.*;
import com.minelittlepony.mson.api.ModelView;
import net.minecraft.client.model.ModelPart;
import net.minecraft.entity.LivingEntity;
@ -14,7 +14,7 @@ public class EarthPonyModel<T extends LivingEntity> extends AbstractPonyModel<T>
protected IPart tail;
protected PonySnout snout;
protected IPart ears;
protected PonyEars ears;
public EarthPonyModel(ModelPart tree, boolean smallArms) {
super(tree);
@ -22,42 +22,26 @@ public class EarthPonyModel<T extends LivingEntity> extends AbstractPonyModel<T>
}
@Override
public void init(ModelContext context) {
public void init(ModelView context) {
super.init(context);
tail = context.findByName("tail");
snout = context.findByName("snout");
ears = context.findByName("ears");
tail = addPart(context.findByName("tail", this::createTail, IPart.class));
addPart(context.findByName("snout", PonySnout::new));
addPart(context.findByName("ears", PonyEars::new));
bodyRenderList.add(forPart(tail));
}
protected IPart createTail(ModelPart tree) {
return new PonyTail(tree);
}
@Override
public void setModelAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
super.setModelAngles(entity, move, swing, ticks, headYaw, headPitch);
snout.setGender(getMetadata().getGender());
cape.pivotY = sneaking ? 2 : riding ? -4 : 0;
}
@Override
public void setHeadRotation(float animationProgress, float yaw, float pitch) {
super.setHeadRotation(animationProgress, yaw, pitch);
snout.setGender(getMetadata().getGender());
}
@Override
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
super.shakeBody(move, swing, bodySwing, ticks);
tail.setRotationAndAngles(attributes.isSwimming || attributes.isGoingFast, attributes.interpolatorId, move, swing, bodySwing * 5, ticks);
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
snout.setVisible(visible);
tail.setVisible(visible);
}
@Override
protected float getLegOutset() {
if (smallArms) {

View file

@ -2,23 +2,24 @@ package com.minelittlepony.client.model.entity.race;
import com.minelittlepony.api.model.IPart;
import com.minelittlepony.api.model.IPegasus;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.client.model.part.PonyWings;
import com.minelittlepony.mson.api.ModelView;
import net.minecraft.client.model.ModelPart;
import net.minecraft.entity.LivingEntity;
public class PegasusModel<T extends LivingEntity> extends EarthPonyModel<T> implements IPegasus {
private IPart wings;
private PonyWings<PegasusModel<T>> wings;
public PegasusModel(ModelPart tree, boolean smallArms) {
super(tree, smallArms);
}
@Override
public void init(ModelContext context) {
public void init(ModelView context) {
super.init(context);
wings = context.findByName("wings");
wings = addPart(context.findByName("wings", PonyWings::new));
bodyRenderList.add(forPart(this::getWings));
}
@ -26,16 +27,4 @@ public class PegasusModel<T extends LivingEntity> extends EarthPonyModel<T> impl
public IPart getWings() {
return wings;
}
@Override
public void setModelAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
super.setModelAngles(entity, move, swing, ticks, headYaw, headPitch);
getWings().setRotationAndAngles(attributes.isGoingFast, entity.getUuid(), move, swing, 0, ticks);
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
getWings().setVisible(visible);
}
}

View file

@ -1,9 +1,9 @@
package com.minelittlepony.client.model.entity.race;
import com.minelittlepony.client.model.armour.PonyArmourModel;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.api.model.BodyPart;
import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.client.model.part.SeaponyTail;
import com.minelittlepony.mson.api.ModelView;
import com.minelittlepony.api.model.*;
import com.minelittlepony.api.model.armour.ArmourLayer;
import com.minelittlepony.api.model.armour.ArmourVariant;
import com.minelittlepony.api.pony.IPony;
@ -34,7 +34,12 @@ public class SeaponyModel<T extends LivingEntity> extends UnicornModel<T> {
}
@Override
public void init(ModelContext context) {
protected IPart createTail(ModelPart tree) {
return new SeaponyTail(tree);
}
@Override
public void init(ModelView context) {
super.init(context);
setVisible(true);
bodyRenderList.clear();

View file

@ -5,7 +5,7 @@ import com.minelittlepony.api.model.IUnicorn;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.part.UnicornHorn;
import com.minelittlepony.client.util.render.RenderList;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.ModelView;
import net.minecraft.client.model.ModelPart;
import net.minecraft.entity.LivingEntity;
@ -28,9 +28,9 @@ public class UnicornModel<T extends LivingEntity> extends EarthPonyModel<T> impl
}
@Override
public void init(ModelContext context) {
public void init(ModelView context) {
super.init(context);
horn = context.findByName("horn");
horn = addPart(context.findByName("horn", UnicornHorn::new));
headRenderList.add(RenderList.of().add(head::rotate).add(forPart(horn)).checked(this::hasHorn));
this.mainRenderList.add(withStage(BodyPart.HEAD, RenderList.of().add(head::rotate).add((stack, vertices, overlayUv, lightUv, red, green, blue, alpha) -> {
horn.renderMagic(stack, vertices, getMagicColor());
@ -73,10 +73,4 @@ public class UnicornModel<T extends LivingEntity> extends EarthPonyModel<T> impl
}
return super.getArm(side);
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
horn.setVisible(visible);
}
}

View file

@ -1,38 +0,0 @@
package com.minelittlepony.client.model.part;
import net.minecraft.client.model.Model;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import com.minelittlepony.api.model.IPegasus;
import com.minelittlepony.api.model.ModelAttributes;
public class BatWings<T extends Model & IPegasus> extends PegasusWings<T> {
public BatWings(ModelPart tree) {
super(tree);
}
@Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) {
stack.push();
stack.scale(1.3F, 1.3F, 1.3F);
super.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes);
stack.pop();
}
public static class Wing extends PegasusWings.Wing {
public Wing(ModelPart tree) {
super(tree);
}
@Override
public void rotateWalking(float swing) {
folded.yaw = swing * 0.05F;
}
}
}

View file

@ -7,39 +7,30 @@ import net.minecraft.util.math.MathHelper;
import com.minelittlepony.api.model.IPart;
import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.client.model.IPonyModel;
import com.minelittlepony.common.util.animation.Interpolator;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.MsonModel;
import java.util.UUID;
public class LionTail implements IPart, MsonModel {
public class LionTail implements IPart {
private ModelPart tail;
private IPonyModel<?> model;
public LionTail(ModelPart tree) {
tail = tree.getChild("tail");
}
@Override
public void init(ModelContext context) {
model = context.getModel();
}
public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
@Override
public void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) {
bodySwing *= 5;
float baseSail = 1F;
float speed = swing > 0.01F ? 6 : 90;
Interpolator interpolator = Interpolator.linear(interpolatorId);
Interpolator interpolator = Interpolator.linear(attributes.interpolatorId);
float straightness = 1.6F * (1 + (float)Math.sin(ticks / speed) / 8F);
float bend = (float)Math.sin(Math.PI/2F + 2 * ticks / speed) / 16F;
if (model.getAttributes().isCrouching) {
if (attributes.isCrouching) {
baseSail += 1;
straightness += 0.5F;
}

View file

@ -6,23 +6,21 @@ import net.minecraft.client.util.math.MatrixStack;
import com.minelittlepony.api.model.IPart;
import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.MsonModel;
import com.minelittlepony.mson.api.*;
import com.minelittlepony.mson.api.model.PartBuilder;
public class PonyEars implements IPart, MsonModel {
private ModelPart right;
private ModelPart left;
private final ModelPart right;
private final ModelPart left;
public PonyEars(ModelPart tree) {
right = tree.getChild("right");
left = tree.getChild("left");
}
@Override
public void init(ModelContext context) {
right = context.findByName("right");
left = context.findByName("left");
PartBuilder head = context.getContext();
public void init(ModelView context) {
PartBuilder head = context.getThis();
head.addChild("right_ear_" + hashCode(), right);
head.addChild("left_ear_" + hashCode(), left);
}

View file

@ -8,8 +8,7 @@ import com.minelittlepony.api.model.IPart;
import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.api.pony.meta.Gender;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.MsonModel;
import com.minelittlepony.mson.api.*;
import com.minelittlepony.mson.api.model.PartBuilder;
public class PonySnout implements IPart, MsonModel {
@ -25,8 +24,8 @@ public class PonySnout implements IPart, MsonModel {
}
@Override
public void init(ModelContext context) {
PartBuilder head = context.getContext();
public void init(ModelView context) {
PartBuilder head = context.getThis();
head.addChild("mare", mare);
head.addChild("stallion", stallion);
}
@ -36,6 +35,11 @@ public class PonySnout implements IPart, MsonModel {
stallion.setAngles(x, y, z);
}
@Override
public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
setGender(attributes.metadata.getGender());
}
@Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) {
}

View file

@ -9,13 +9,10 @@ import com.minelittlepony.api.model.IPart;
import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.api.pony.meta.TailShape;
import com.minelittlepony.client.model.AbstractPonyModel;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.MsonModel;
import com.minelittlepony.mson.api.*;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
public class PonyTail implements IPart, MsonModel {
@ -32,30 +29,24 @@ public class PonyTail implements IPart, MsonModel {
}
@Override
public void init(ModelContext context) {
public void init(ModelView context) {
model = context.getModel();
try {
int segments = context.getLocals().getLocal("segments").get().intValue();
int segments = (int)context.getLocalValue("segments", 4);
ModelContext subContext = context.resolve(this);
for (int i = 0; i < segments; i++) {
Segment segment = subContext.findByName("segment_" + i);
segment.tail = this;
segment.index = i;
this.segments.add(segment);
}
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
for (int i = 0; i < segments; i++) {
Segment segment = context.findByName("segment_" + i, Segment::new);
segment.tail = this;
segment.index = i;
this.segments.add(segment);
}
}
@Override
public void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) {
public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
boolean rainboom = attributes.isSwimming || attributes.isGoingFast;
tail.roll = rainboom ? 0 : MathHelper.cos(move * 0.8F) * 0.2f * swing;
tail.yaw = bodySwing;
tail.yaw = bodySwing * 5;
if (model.getAttributes().isCrouching && !rainboom) {
rotateSneak();

View file

@ -8,12 +8,10 @@ import net.minecraft.util.math.MathHelper;
import com.minelittlepony.api.model.*;
import com.minelittlepony.api.pony.meta.Wearable;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.ModelView;
import com.minelittlepony.mson.api.MsonModel;
import java.util.UUID;
public class PegasusWings<T extends Model & IPegasus> implements IPart, MsonModel {
public class PonyWings<T extends Model & IPegasus> implements IPart, MsonModel {
protected T pegasus;
@ -22,16 +20,21 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart, MsonMode
protected Wing legacyWing;
public PegasusWings(ModelPart tree) {
private float wingScale;
private float walkingRotationSpeed;
public PonyWings(ModelPart tree) {
}
@Override
public void init(ModelContext context) {
public void init(ModelView context) {
pegasus = context.getModel();
leftWing = context.findByName("left_wing");
rightWing = context.findByName("right_wing");
legacyWing = context.findByName("legacy_right_wing");
leftWing = context.findByName("left_wing", Wing::new);
rightWing = context.findByName("right_wing", Wing::new);
legacyWing = context.findByName("legacy_right_wing", Wing::new);
wingScale = context.getLocalValue("wing_scale", 1); // pegasi 1 / bats 1.3F
walkingRotationSpeed = context.getLocalValue("walking_rotation_speed", 0.15F); // pegasi 0.15 / bats 0.05F
}
public Wing getLeft() {
@ -43,7 +46,7 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart, MsonMode
}
@Override
public void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) {
public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
float flap = 0;
float progress = pegasus.getSwingAmount();
@ -65,7 +68,7 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart, MsonMode
if (pegasus.wingsAreOpen()) {
flapAngle = pegasus.getWingRotationFactor(ticks);
if (!pegasus.getAttributes().isCrouching && pegasus.isBurdened()) {
if (!attributes.isCrouching && pegasus.isBurdened()) {
flapAngle -= 1F;
}
} else {
@ -73,7 +76,7 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart, MsonMode
}
if (!pegasus.isFlying()) {
flapAngle = pegasus.getMetadata().getInterpolator(interpolatorId).interpolate("wingFlap", flapAngle, 10);
flapAngle = pegasus.getMetadata().getInterpolator(attributes.interpolatorId).interpolate("wingFlap", flapAngle, 10);
}
getLeft().rotateFlying(flapAngle);
@ -87,26 +90,25 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart, MsonMode
getRight().render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
}
public static class Wing implements MsonModel {
public class Wing implements MsonModel {
protected IPegasus pegasus;
protected ModelPart extended;
protected ModelPart folded;
protected final ModelPart extended;
protected final ModelPart folded;
public Wing(ModelPart tree) {
extended = tree.getChild("extended");
folded = tree.getChild("folded");
}
@Override
public void init(ModelContext context) {
public void init(ModelView context) {
pegasus = context.getModel();
extended = context.findByName("extended");
folded = context.findByName("folded");
}
public void rotateWalking(float swing) {
folded.yaw = swing * 0.15F;
folded.yaw = swing * walkingRotationSpeed;
}
public void rotateFlying(float angle) {
@ -114,6 +116,9 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart, MsonMode
}
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
stack.push();
stack.scale(wingScale, wingScale, wingScale);
if (pegasus.wingsAreOpen()) {
extended.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
} else {
@ -127,6 +132,8 @@ public class PegasusWings<T extends Model & IPegasus> implements IPart, MsonMode
stack.pop();
}
}
stack.pop();
}
}
}

View file

@ -2,43 +2,30 @@ package com.minelittlepony.client.model.part;
import com.minelittlepony.api.model.IPart;
import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.client.model.IPonyModel;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.MsonModel;
import java.util.UUID;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
public class SeaponyTail implements IPart, MsonModel {
public class SeaponyTail implements IPart {
private static final float TAIL_ROTX = PI / 2;
private ModelPart tailBase;
private final ModelPart tailBase;
private ModelPart tailTip;
private ModelPart tailFins;
private IPonyModel<?> model;
private final ModelPart tailTip;
private final ModelPart tailFins;
public SeaponyTail(ModelPart tree) {
tailBase = tree.getChild("base");
tailTip = tree.getChild("tip");
tailFins = tree.getChild("fins");
}
@Override
public void init(ModelContext context) {
model = context.getModel();
tailBase = context.findByName("base");
tailTip = context.findByName("tip");
tailFins = context.findByName("fins");
}
@Override
public void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) {
float rotation = model.getAttributes().isSleeping ? 0 : MathHelper.sin(ticks * 0.536f) / 4;
public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
float rotation = attributes.isSleeping ? 0 : MathHelper.sin(ticks * 0.536f) / 4;
tailBase.pitch = TAIL_ROTX + rotation;
tailTip.pitch = rotation;

View file

@ -11,24 +11,17 @@ import com.minelittlepony.api.model.IPart;
import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.client.render.MagicGlow;
import com.minelittlepony.common.util.Color;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.MsonModel;
public class UnicornHorn implements IPart, MsonModel {
public class UnicornHorn implements IPart {
private ModelPart horn;
private ModelPart glow;
private final ModelPart horn;
private final ModelPart glow;
protected boolean visible = true;
public UnicornHorn(ModelPart tree) {
}
@Override
public void init(ModelContext context) {
horn = context.findByName("bone");
glow = context.findByName("corona");
horn = tree.getChild("bone");
glow = tree.getChild("corona");
}
@Override

View file

@ -1,9 +1,12 @@
{
"locals": {
"wing_scale": 1.3,
"walking_rotation_speed": "0.05"
},
"data": {
"left_wing": {
"type": "mson:slot",
"name": "left_wing",
"implementation": "com.minelittlepony.client.model.part.BatWings$Wing",
"data": {
"folded": {
"texture": {"u": 56, "v": 16, "w": 64, "h": 64},
@ -57,7 +60,6 @@
"right_wing": {
"type": "mson:slot",
"name": "right_wing",
"implementation": "com.minelittlepony.client.model.part.BatWings$Wing",
"data": {
"folded": {
"texture": {"u": 56, "v": 16, "w": 64, "h": 64},

View file

@ -3,7 +3,6 @@
"left_wing": {
"type": "mson:slot",
"name": "left_wing",
"implementation": "com.minelittlepony.client.model.part.PegasusWings$Wing",
"data": {
"folded": "#extended",
"extended": {
@ -27,7 +26,6 @@
"right_wing": {
"type": "mson:slot",
"name": "right_wing",
"implementation": "com.minelittlepony.client.model.part.PegasusWings$Wing",
"data": {
"folded": "#extended",
"extended": {

View file

@ -3,7 +3,6 @@
"left_wing": {
"type": "mson:slot",
"name": "left_wing",
"implementation": "com.minelittlepony.client.model.part.PegasusWings$Wing",
"data": {
"folded": {
"texture": {"u": 56, "v": 32, "w": 64, "h": 64},
@ -33,7 +32,6 @@
"right_wing": {
"type": "mson:slot",
"name": "right_wing",
"implementation": "com.minelittlepony.client.model.part.PegasusWings$Wing",
"data": {
"folded": {
"texture": {"u": 56, "v": 16, "w": 64, "h": 64},
@ -63,7 +61,6 @@
"legacy_right_wing": {
"type": "mson:slot",
"name": "legacy_right_wing",
"implementation": "com.minelittlepony.client.model.part.PegasusWings$Wing",
"data": {
"folded": {
"texture": {"u": 56, "v": 32, "w": 64, "h": 64},

View file

@ -10,28 +10,24 @@
"segment_0": {
"type": "mson:slot",
"name": "segment_0",
"implementation": "com.minelittlepony.client.model.part.PonyTail$Segment",
"locals": { "segment_index": 0 },
"data": "minelittlepony:components/tail_segment"
},
"segment_1": {
"type": "mson:slot",
"name": "segment_1",
"implementation": "com.minelittlepony.client.model.part.PonyTail$Segment",
"locals": { "segment_index": 1 },
"data": "minelittlepony:components/tail_segment"
},
"segment_2": {
"type": "mson:slot",
"name": "segment_2",
"implementation": "com.minelittlepony.client.model.part.PonyTail$Segment",
"locals": { "segment_index": 2 },
"data": "minelittlepony:components/tail_segment"
},
"segment_3": {
"type": "mson:slot",
"name": "segment_3",
"implementation": "com.minelittlepony.client.model.part.PonyTail$Segment",
"locals": { "segment_index": 3 },
"data": "minelittlepony:components/tail_segment"
}

View file

@ -11,24 +11,9 @@
{ "from": [-4, -6, -6], "size": [ 8, 8, 8] }
],
"children": {
"snout": {
"type": "mson:slot",
"name": "snout",
"implementation": "com.minelittlepony.client.model.part.PonySnout",
"data": "minelittlepony:components/snout"
},
"ears": {
"type": "mson:slot",
"name": "ears",
"implementation": "com.minelittlepony.client.model.part.PonyEars",
"data": "minelittlepony:components/ears"
},
"horn": {
"type": "mson:slot",
"name": "horn",
"implementation": "com.minelittlepony.client.model.part.UnicornHorn",
"data": "minelittlepony:components/horn"
},
"snout": { "data": "minelittlepony:components/snout" },
"ears": { "data": "minelittlepony:components/ears" },
"horn": { "data": "minelittlepony:components/horn" },
"left_horn": {
"texture": {"u": 0, "v": 52},
"name": "left_horn",

View file

@ -1,11 +1,6 @@
{
"parent": "minelittlepony:races/steve/unicorn",
"data": {
"wings": {
"type": "mson:slot",
"name": "wings",
"implementation": "com.minelittlepony.client.model.part.PegasusWings",
"data": "minelittlepony:components/pegasus_wings"
}
"wings": { "data": "minelittlepony:components/pegasus_wings" }
}
}

View file

@ -6,25 +6,10 @@
{ "from": [-4, -6, -6], "size": [ 8, 8, 8] }
],
"children": {
"snout": {
"type": "mson:slot",
"name": "snout",
"implementation": "com.minelittlepony.client.model.part.PonySnout",
"data": "minelittlepony:components/snout"
},
"ears": {
"type": "mson:slot",
"name": "ears",
"implementation": "com.minelittlepony.client.model.part.PonyEars",
"data": "minelittlepony:components/bat_ears"
}
"snout": { "data": "minelittlepony:components/snout" },
"ears": { "data": "minelittlepony:components/bat_ears" }
}
},
"wings": {
"type": "mson:slot",
"name": "wings",
"implementation": "com.minelittlepony.client.model.part.BatWings",
"data": "minelittlepony:components/bat_wings"
}
"wings": { "data": "minelittlepony:components/bat_wings" }
}
}

View file

@ -1,11 +1,6 @@
{
"parent": "minelittlepony:races/steve/alicorn",
"data": {
"wings": {
"type": "mson:slot",
"name": "wings",
"implementation": "com.minelittlepony.client.model.part.PegasusWings",
"data": "minelittlepony:components/bug_wings"
}
"wings": { "data": "minelittlepony:components/bug_wings" }
}
}

View file

@ -7,15 +7,9 @@
],
"children": {
"snout": {
"type": "mson:slot",
"name": "snout",
"implementation": "com.minelittlepony.client.model.part.PonySnout",
"data": "minelittlepony:components/snout"
},
"data": "minelittlepony:components/snout"
},
"ears": {
"type": "mson:slot",
"name": "ears",
"implementation": "com.minelittlepony.client.model.part.PonyEars",
"locals": {
"ear_pronouncement": 0.9,
"ear_spread": 3
@ -23,9 +17,6 @@
"data": "minelittlepony:components/ears"
},
"horn": {
"type": "mson:slot",
"name": "horn",
"implementation": "com.minelittlepony.client.model.part.UnicornHorn",
"locals": {
"incline": 19,
"scale": 0.5
@ -50,8 +41,6 @@
}
},
"tail": {
"type": "mson:slot",
"name": "tail",
"implementation": "com.minelittlepony.client.model.part.LionTail",
"data": "minelittlepony:components/lion_tail"
}

View file

@ -1,11 +1,6 @@
{
"parent": "minelittlepony:steve_pony",
"data": {
"wings": {
"type": "mson:slot",
"name": "wings",
"implementation": "com.minelittlepony.client.model.part.PegasusWings",
"data": "minelittlepony:components/pegasus_wings"
}
"wings": { "data": "minelittlepony:components/pegasus_wings" }
}
}

View file

@ -6,16 +6,8 @@
{ "from": [-4, -6, -6], "size": [ 8, 8, 8] }
],
"children": {
"snout": {
"type": "mson:slot",
"name": "snout",
"implementation": "com.minelittlepony.client.model.part.PonySnout",
"data": "minelittlepony:components/snout"
},
"snout": { "data": "minelittlepony:components/snout" },
"ears": {
"type": "mson:slot",
"name": "ears",
"implementation": "com.minelittlepony.client.model.part.PonyEars",
"texture": {"w": 64, "h": 64 },
"data": {
"right": {
@ -48,12 +40,7 @@
}
}
},
"horn": {
"type": "mson:slot",
"name": "horn",
"implementation": "com.minelittlepony.client.model.part.UnicornHorn",
"data": "minelittlepony:components/horn"
},
"horn": { "data": "minelittlepony:components/horn" },
"right_antler": {
"pivot": [-2, -6, -2],
"rotate": [0, 0, 120],
@ -97,12 +84,10 @@
"wings": {
"type": "mson:slot",
"name": "wings",
"implementation": "com.minelittlepony.client.model.part.PegasusWings",
"data": {
"left_wing": {
"type": "mson:slot",
"name": "left_wing",
"implementation": "com.minelittlepony.client.model.part.PegasusWings$Wing",
"data": {
"folded": "#extended",
"extended": {
@ -126,7 +111,6 @@
"right_wing": {
"type": "mson:slot",
"name": "right_wing",
"implementation": "com.minelittlepony.client.model.part.PegasusWings$Wing",
"data": {
"folded": "#extended",
"extended": {

View file

@ -1,22 +1,5 @@
{
"parent": "minelittlepony:races/steve/alicorn",
"skeleton": {
"abdomin": {
"body": {
"neck": {
"head": {
"horn": {}
}
},
"left_arm": {},
"right_arm": {}
},
"left_fin": {},
"right_fin": {},
"center_fin": {},
"tail": { }
}
},
"data": {
"left_fin": {
"type": "mson:planar",
@ -45,8 +28,6 @@
]
},
"tail": {
"type": "mson:slot",
"name": "tail",
"implementation": "com.minelittlepony.client.model.part.SeaponyTail",
"data": "minelittlepony:components/fish_tail"
}

View file

@ -6,24 +6,9 @@
{ "from": [-4, -6, -6], "size": [ 8, 8, 8] }
],
"children": {
"snout": {
"type": "mson:slot",
"name": "snout",
"implementation": "com.minelittlepony.client.model.part.PonySnout",
"data": "minelittlepony:components/snout"
},
"ears": {
"type": "mson:slot",
"name": "ears",
"implementation": "com.minelittlepony.client.model.part.PonyEars",
"data": "minelittlepony:components/ears"
},
"horn": {
"type": "mson:slot",
"name": "horn",
"implementation": "com.minelittlepony.client.model.part.UnicornHorn",
"data": "minelittlepony:components/horn"
}
"snout": { "data": "minelittlepony:components/snout" },
"ears": { "data": "minelittlepony:components/ears" },
"horn": { "data": "minelittlepony:components/horn" }
}
},
"right_cast": {

View file

@ -11,18 +11,8 @@
{ "from": [-4, -6, -6], "size": [ 8, 8, 8] }
],
"children": {
"snout": {
"type": "mson:slot",
"name": "snout",
"implementation": "com.minelittlepony.client.model.part.PonySnout",
"data": "minelittlepony:components/snout"
},
"ears": {
"type": "mson:slot",
"name": "ears",
"implementation": "com.minelittlepony.client.model.part.PonyEars",
"data": "minelittlepony:components/ears"
},
"snout": { "data": "minelittlepony:components/snout" },
"ears": { "data": "minelittlepony:components/ears" },
"bristles": {
"texture": {"u": 56, "v": 32},
"rotate": [17, 0, 0],