mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Update some parameter names
This commit is contained in:
parent
aa933861c4
commit
b2fe56334f
7 changed files with 30 additions and 41 deletions
|
@ -6,17 +6,15 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
public interface IPart {
|
||||
/**
|
||||
* Sets the model's various rotation angles.
|
||||
* <p>
|
||||
* See {@link AbstractPonyMode.setRotationAndAngle} for an explanation of the various parameters.
|
||||
*/
|
||||
default void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
|
||||
default void setPartAngles(ModelAttributes attributes, float limbAngle, float limbSpeed, float bodySwing, float animationProgress) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders this model component.
|
||||
*/
|
||||
void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes);
|
||||
void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, float red, float green, float blue, float alpha, ModelAttributes attributes);
|
||||
|
||||
/**
|
||||
* Sets whether this part should be rendered.
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.minelittlepony.client.hdskins;
|
|||
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.SkinsProxy;
|
||||
|
|
|
@ -165,7 +165,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
ponySleep();
|
||||
}
|
||||
|
||||
parts.forEach(part -> part.setRotationAndAngles(attributes, limbAngle, limbSpeed, wobbleAmount, animationProgress));
|
||||
parts.forEach(part -> part.setPartAngles(attributes, limbAngle, limbSpeed, wobbleAmount, animationProgress));
|
||||
}
|
||||
|
||||
public void setHeadRotation(float animationProgress, float yaw, float pitch) {
|
||||
|
|
|
@ -18,17 +18,17 @@ public class LionTail implements IPart {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
|
||||
public void setPartAngles(ModelAttributes attributes, float limbAngle, float limbSpeed, float bodySwing, float animationProgress) {
|
||||
|
||||
bodySwing *= 5;
|
||||
|
||||
float baseSail = 1F;
|
||||
|
||||
float speed = swing > 0.01F ? 6 : 90;
|
||||
float speed = limbSpeed > 0.01F ? 6 : 90;
|
||||
Interpolator interpolator = attributes.getMainInterpolator();
|
||||
|
||||
float straightness = 1.6F * (1 + (float)Math.sin(ticks / speed) / 8F);
|
||||
float twist = (float)Math.sin(Math.PI/2F + 2 * ticks / speed) / 16F;
|
||||
float straightness = 1.6F * (1 + (float)Math.sin(animationProgress / speed) / 8F);
|
||||
float twist = (float)Math.sin(Math.PI/2F + 2 * animationProgress / speed) / 16F;
|
||||
float bend = attributes.motionRoll / 80F;
|
||||
|
||||
if (attributes.isCrouching) {
|
||||
|
@ -45,11 +45,11 @@ public class LionTail implements IPart {
|
|||
bend = interpolator.interpolate("kirin_tail_bendiness", bend, 10);
|
||||
|
||||
tail.pitch = baseSail;
|
||||
tail.pitch += swing / 2;
|
||||
tail.pitch += limbSpeed / 2;
|
||||
tail.yaw = twist;
|
||||
tail.roll = bodySwing * 2;
|
||||
|
||||
float sinTickFactor = MathHelper.sin(ticks * 0.067f) * 0.05f;
|
||||
float sinTickFactor = MathHelper.sin(animationProgress * 0.067f) * 0.05f;
|
||||
tail.pitch += sinTickFactor;
|
||||
tail.yaw += sinTickFactor;
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ import com.minelittlepony.client.model.AbstractPonyModel;
|
|||
import com.minelittlepony.mson.api.*;
|
||||
import com.minelittlepony.util.MathUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class PonyTail implements IPart, MsonModel {
|
||||
private static final float TAIL_Z = 14;
|
||||
|
@ -27,7 +27,7 @@ public class PonyTail implements IPart, MsonModel {
|
|||
private int tailStop = 0;
|
||||
private TailShape shape = TailShape.STRAIGHT;
|
||||
|
||||
private final List<Segment> segments = new ArrayList<>();
|
||||
private List<Segment> segments = List.of();
|
||||
|
||||
public PonyTail(ModelPart tree) {
|
||||
tail = tree.getChild("tail");
|
||||
|
@ -36,38 +36,32 @@ public class PonyTail implements IPart, MsonModel {
|
|||
@Override
|
||||
public void init(ModelView context) {
|
||||
model = context.getModel();
|
||||
|
||||
int segments = (int)context.getLocalValue("segments", 4);
|
||||
|
||||
for (int i = 0; i < segments; i++) {
|
||||
Segment segment = context.findByName("segment_" + i);
|
||||
segment.tail = this;
|
||||
segment.index = i;
|
||||
this.segments.add(segment);
|
||||
}
|
||||
segments = IntStream.range(0, (int)context.getLocalValue("segments", 4))
|
||||
.mapToObj(i -> context.<Segment>findByName("segment_" + i))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
|
||||
public void setPartAngles(ModelAttributes attributes, float limbAngle, float limbSpeed, float bodySwing, float animationProgress) {
|
||||
boolean rainboom = attributes.isSwimming || attributes.isGoingFast;
|
||||
tail.roll = rainboom ? 0 : MathHelper.cos(move * 0.8F) * 0.2f * swing;
|
||||
tail.roll = rainboom ? 0 : MathHelper.cos(limbAngle * 0.8F) * 0.2f * limbSpeed;
|
||||
tail.yaw = bodySwing * 5;
|
||||
|
||||
if (model.getAttributes().isCrouching && !rainboom) {
|
||||
if (attributes.isCrouching && !rainboom) {
|
||||
tail.setPivot(0, 0, TAIL_SNEAKING_Z);
|
||||
tail.pitch = -model.body.pitch + 0.1F;
|
||||
} else if (model.getAttributes().isSitting) {
|
||||
} else if (attributes.isSitting) {
|
||||
tail.pivotZ = TAIL_RIDING_Z;
|
||||
tail.pivotY = TAIL_RIDING_Y;
|
||||
tail.pitch = MathHelper.PI / 5;
|
||||
} else {
|
||||
tail.setPivot(0, 0, TAIL_Z);
|
||||
if (rainboom) {
|
||||
tail.pitch = MathUtil.Angles._90_DEG + MathHelper.sin(move) / 10;
|
||||
tail.pitch = MathUtil.Angles._90_DEG + MathHelper.sin(limbAngle) / 10;
|
||||
} else {
|
||||
tail.pitch = swing / 2;
|
||||
tail.pitch = limbSpeed / 2;
|
||||
|
||||
swingX(ticks);
|
||||
swingX(animationProgress);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,8 +80,8 @@ public class PonyTail implements IPart, MsonModel {
|
|||
@Override
|
||||
public void setVisible(boolean visible, ModelAttributes attributes) {
|
||||
tail.visible = visible;
|
||||
tailStop = model.getMetadata().getTailLength().ordinal();
|
||||
shape = model.getMetadata().getTailShape();
|
||||
tailStop = attributes.metadata.getTailLength().ordinal();
|
||||
shape = attributes.metadata.getTailShape();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,23 +89,21 @@ public class PonyTail implements IPart, MsonModel {
|
|||
stack.push();
|
||||
tail.rotate(stack);
|
||||
|
||||
segments.forEach(segment -> segment.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha));
|
||||
for (int i = 0; i < segments.size(); i++) {
|
||||
segments.get(i).render(this, stack, vertices, i, overlayUv, lightUv, red, green, blue, alpha);
|
||||
}
|
||||
|
||||
stack.pop();
|
||||
}
|
||||
|
||||
public static class Segment {
|
||||
public PonyTail tail;
|
||||
|
||||
public int index;
|
||||
|
||||
private final ModelPart tree;
|
||||
|
||||
public Segment(ModelPart tree) {
|
||||
this.tree = tree;
|
||||
}
|
||||
|
||||
public void render(MatrixStack stack, VertexConsumer renderContext, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
||||
public void render(PonyTail tail, MatrixStack stack, VertexConsumer renderContext, int index, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
||||
if (index >= tail.tailStop) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class PonyWings<T extends Model & IPegasus> implements IPart, MsonModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
|
||||
public void setPartAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
|
||||
float flap = 0;
|
||||
float progress = pegasus.getSwingAmount();
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ public class SeaponyTail implements IPart, MsonModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
|
||||
float rotation = attributes.isSleeping ? 0 : MathHelper.sin(ticks * 0.536f) / 4;
|
||||
public void setPartAngles(ModelAttributes attributes, float limbAngle, float limbSpeed, float bodySwing, float animationProgress) {
|
||||
float rotation = attributes.isSleeping ? 0 : MathHelper.sin(animationProgress * 0.536f) / 4;
|
||||
|
||||
tailBase.pitch = MathHelper.HALF_PI + rotation;
|
||||
tailTip.pitch = rotation;
|
||||
|
|
Loading…
Reference in a new issue