mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Clean up models a little and fix strider/spike models
This commit is contained in:
parent
a3f71175cc
commit
5ff19ea93d
20 changed files with 144 additions and 146 deletions
|
@ -2,14 +2,10 @@ package com.minelittlepony.api.model;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.render.entity.model.ModelWithArms;
|
import net.minecraft.client.render.entity.model.ModelWithArms;
|
||||||
import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
|
|
||||||
import net.minecraft.client.render.entity.model.BipedEntityModel.ArmPose;
|
|
||||||
import net.minecraft.util.Arm;
|
import net.minecraft.util.Arm;
|
||||||
|
|
||||||
public interface ModelWithHooves extends ModelWithArms {
|
public interface ModelWithHooves extends ModelWithArms {
|
||||||
ModelPart getForeLeg(Arm side);
|
ModelPart getForeLeg(Arm side);
|
||||||
|
|
||||||
ModelPart getHindLeg(Arm side);
|
ModelPart getHindLeg(Arm side);
|
||||||
|
|
||||||
<S extends PlayerEntityRenderState> ArmPose getArmPoseForSide(S state, Arm side);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||||
import com.minelittlepony.api.pony.meta.Race;
|
import com.minelittlepony.api.pony.meta.Race;
|
||||||
import com.minelittlepony.mson.api.MsonModel;
|
import com.minelittlepony.mson.api.MsonModel;
|
||||||
|
|
||||||
public interface PonyModel<T extends EntityRenderState & PonyModel.AttributedHolder> extends MsonModel, ModelWithHooves, ModelWithHat, ModelWithHead {
|
public interface PonyModel<T extends EntityRenderState & PonyModel.AttributedHolder> extends MsonModel, ModelWithHooves, ModelWithHead {
|
||||||
|
|
||||||
ModelPart getBodyPart(BodyPart part);
|
ModelPart getBodyPart(BodyPart part);
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,25 @@ import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.render.entity.state.EntityRenderState;
|
import net.minecraft.client.render.entity.state.EntityRenderState;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
|
||||||
public interface SubModel<T extends EntityRenderState> {
|
import com.minelittlepony.mson.util.RenderList;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public interface SubModel<T extends EntityRenderState> extends RenderList {
|
||||||
|
static <T extends EntityRenderState> RenderList toRenderList(Supplier<SubModel<? super T>> part) {
|
||||||
|
return (stack, vertices, overlay, light, color) -> part.get().renderPart(stack, vertices, overlay, light, color);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders this model component.
|
* Renders this model component.
|
||||||
*/
|
*/
|
||||||
void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color);
|
void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void accept(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color) {
|
||||||
|
renderPart(stack, vertices, overlay, light, color);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the model's various rotation angles.
|
* Sets the model's various rotation angles.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,7 +10,6 @@ import com.minelittlepony.util.MathUtil.Angles;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
|
@ -22,8 +21,6 @@ import net.minecraft.item.consume.UseAction;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.math.*;
|
import net.minecraft.util.math.*;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Foundation class for all types of ponies.
|
* Foundation class for all types of ponies.
|
||||||
*/
|
*/
|
||||||
|
@ -53,10 +50,6 @@ public abstract class AbstractPonyModel<T extends PonyRenderState> extends Clien
|
||||||
|
|
||||||
private final List<SubModel<? super T>> parts = new ArrayList<>();
|
private final List<SubModel<? super T>> parts = new ArrayList<>();
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Nullable
|
|
||||||
protected T currentState;
|
|
||||||
|
|
||||||
public AbstractPonyModel(ModelPart tree, boolean smallArms) {
|
public AbstractPonyModel(ModelPart tree, boolean smallArms) {
|
||||||
super(tree, smallArms);
|
super(tree, smallArms);
|
||||||
|
|
||||||
|
@ -73,14 +66,7 @@ public abstract class AbstractPonyModel<T extends PonyRenderState> extends Clien
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RenderList forPart(Supplier<SubModel<? super T>> part) {
|
@SuppressWarnings({"deprecation"})
|
||||||
return (stack, vertices, overlay, light, color) -> part.get().renderPart(stack, vertices, overlay, light, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected RenderList forPart(SubModel<T> part) {
|
|
||||||
return (stack, vertices, overlay, light, color) -> part.renderPart(stack, vertices, overlay, light, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected RenderList withStage(BodyPart part, RenderList action) {
|
protected RenderList withStage(BodyPart part, RenderList action) {
|
||||||
return (stack, vertices, overlay, light, color) -> {
|
return (stack, vertices, overlay, light, color) -> {
|
||||||
stack.push();
|
stack.push();
|
||||||
|
@ -97,22 +83,8 @@ public abstract class AbstractPonyModel<T extends PonyRenderState> extends Clien
|
||||||
mainRenderList.accept(stack, vertices, overlay, light, color);
|
mainRenderList.accept(stack, vertices, overlay, light, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the model's various rotation angles.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public final void setAngles(PlayerEntityRenderState entity) {
|
|
||||||
currentState = (T)entity;
|
|
||||||
super.setAngles((PlayerEntityRenderState)entity);
|
|
||||||
|
|
||||||
resetPivot(head, neck, leftArm, rightArm, leftLeg, rightLeg);
|
|
||||||
|
|
||||||
setModelVisibilities((T)entity);
|
|
||||||
setModelAngles((T)entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setModelVisibilities(T state) {
|
protected void setModelVisibilities(T state) {
|
||||||
|
resetPivot(head, neck, leftArm, rightArm, leftLeg, rightLeg);
|
||||||
hat.visible = head.visible && !state.attributes.isHorsey;
|
hat.visible = head.visible && !state.attributes.isHorsey;
|
||||||
if (state.attributes.isHorsey) {
|
if (state.attributes.isHorsey) {
|
||||||
neck.visible = head.visible;
|
neck.visible = head.visible;
|
||||||
|
@ -122,7 +94,7 @@ public abstract class AbstractPonyModel<T extends PonyRenderState> extends Clien
|
||||||
parts.forEach(part -> part.setVisible(body.visible, state));
|
parts.forEach(part -> part.setVisible(body.visible, state));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "deprecation"})
|
||||||
public void copyTransforms(BipedEntityModel<PlayerEntityRenderState> model) {
|
public void copyTransforms(BipedEntityModel<PlayerEntityRenderState> model) {
|
||||||
super.copyTransforms(model);
|
super.copyTransforms(model);
|
||||||
if (model instanceof AbstractPonyModel m) {
|
if (model instanceof AbstractPonyModel m) {
|
||||||
|
@ -147,10 +119,6 @@ public abstract class AbstractPonyModel<T extends PonyRenderState> extends Clien
|
||||||
ArmPose left = getArmPose(entity, Arm.LEFT);
|
ArmPose left = getArmPose(entity, Arm.LEFT);
|
||||||
ArmPose right = getArmPose(entity, Arm.RIGHT);
|
ArmPose right = getArmPose(entity, Arm.RIGHT);
|
||||||
|
|
||||||
if (onSetModelAngles != null) {
|
|
||||||
onSetModelAngles.poseModel(this, entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!entity.attributes.isSwimming && !entity.attributes.isGoingFast) {
|
if (!entity.attributes.isSwimming && !entity.attributes.isGoingFast) {
|
||||||
alignArmForAction(entity, getArm(Arm.LEFT), left, right, 1);
|
alignArmForAction(entity, getArm(Arm.LEFT), left, right, 1);
|
||||||
alignArmForAction(entity, getArm(Arm.RIGHT), right, left, -1);
|
alignArmForAction(entity, getArm(Arm.RIGHT), right, left, -1);
|
||||||
|
|
|
@ -20,6 +20,10 @@ public abstract class ClientPonyModel<T extends PonyRenderState> extends PlayerE
|
||||||
@Nullable
|
@Nullable
|
||||||
protected PosingCallback<T> onSetModelAngles;
|
protected PosingCallback<T> onSetModelAngles;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Nullable
|
||||||
|
protected T currentState;
|
||||||
|
|
||||||
public ClientPonyModel(ModelPart tree, boolean smallArms) {
|
public ClientPonyModel(ModelPart tree, boolean smallArms) {
|
||||||
super(tree, smallArms);
|
super(tree, smallArms);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +32,29 @@ public abstract class ClientPonyModel<T extends PonyRenderState> extends PlayerE
|
||||||
onSetModelAngles = callback;
|
onSetModelAngles = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the model's various rotation angles.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public final void setAngles(PlayerEntityRenderState entity) {
|
||||||
|
currentState = (T)entity;
|
||||||
|
super.setAngles((PlayerEntityRenderState)entity);
|
||||||
|
|
||||||
|
setModelVisibilities((T)entity);
|
||||||
|
setModelAngles((T)entity);
|
||||||
|
|
||||||
|
if (onSetModelAngles != null) {
|
||||||
|
onSetModelAngles.poseModel(this, (T)entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setModelVisibilities(T state) {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setModelAngles(T entity) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModelPart getForeLeg(Arm side) {
|
public ModelPart getForeLeg(Arm side) {
|
||||||
return getArm(side);
|
return getArm(side);
|
||||||
|
@ -39,13 +66,8 @@ public abstract class ClientPonyModel<T extends PonyRenderState> extends PlayerE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final <S extends PlayerEntityRenderState> ArmPose getArmPoseForSide(S state, Arm side) {
|
public ArmPose getArmPose(PlayerEntityRenderState state, Arm side) {
|
||||||
return getArmPose(state, side);
|
return super.getArmPose(state, side);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHatVisible(boolean visible) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resetPivot(ModelPart part) {
|
static void resetPivot(ModelPart part) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class PiglinPonyModel extends ZomponyModel<PonyPiglinRenderer.State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ArmPose getArmPose(PlayerEntityRenderState p, Arm arm) {
|
public ArmPose getArmPose(PlayerEntityRenderState p, Arm arm) {
|
||||||
if (p instanceof PonyPiglinRenderer.State state) {
|
if (p instanceof PonyPiglinRenderer.State state) {
|
||||||
return switch (arm) {
|
return switch (arm) {
|
||||||
case LEFT -> switch (state.activity) {
|
case LEFT -> switch (state.activity) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class PillagerPonyModel extends ChangelingModel<IllagerPonyRenderer.State
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BipedEntityModel.ArmPose getArmPose(PlayerEntityRenderState state, Arm arm) {
|
public BipedEntityModel.ArmPose getArmPose(PlayerEntityRenderState state, Arm arm) {
|
||||||
ArmPose holdingPose = getHoldingPose(((IllagerPonyRenderer.State)state).state);
|
ArmPose holdingPose = getHoldingPose(((IllagerPonyRenderer.State)state).state);
|
||||||
|
|
||||||
if (holdingPose != ArmPose.EMPTY) {
|
if (holdingPose != ArmPose.EMPTY) {
|
||||||
|
|
|
@ -17,10 +17,8 @@ public class SkeleponyModel<T extends SkeleponyRenderer.State> extends AlicornMo
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected BipedEntityModel.ArmPose getArmPose(PlayerEntityRenderState state, Arm arm) {
|
public BipedEntityModel.ArmPose getArmPose(PlayerEntityRenderState state, Arm arm) {
|
||||||
boolean isMain = arm == state.mainArm;
|
if (arm == state.mainArm) {
|
||||||
|
|
||||||
if (isMain) {
|
|
||||||
ItemStack mainHand = state.getMainHandStack();
|
ItemStack mainHand = state.getMainHandStack();
|
||||||
if (!mainHand.isEmpty()) {
|
if (!mainHand.isEmpty()) {
|
||||||
return mainHand.getItem() == Items.BOW && ((T)state).isAttacking ? ArmPose.BOW_AND_ARROW : ArmPose.ITEM;
|
return mainHand.getItem() == Items.BOW && ((T)state).isAttacking ? ArmPose.BOW_AND_ARROW : ArmPose.ITEM;
|
||||||
|
|
|
@ -20,18 +20,8 @@ public class SpikeModel extends BipedEntityModel<StriderRenderer.State> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAngles(StriderRenderer.State entity) {
|
public void setAngles(StriderRenderer.State entity) {
|
||||||
entity.limbFrequency *= 2;
|
|
||||||
entity.limbAmplitudeMultiplier *= 1.5F;
|
|
||||||
entity.baby = false;
|
|
||||||
|
|
||||||
head.pivotX = 0;
|
|
||||||
head.pivotZ = 0;
|
|
||||||
head.pivotY = 0;
|
|
||||||
|
|
||||||
super.setAngles(entity);
|
super.setAngles(entity);
|
||||||
|
|
||||||
leftArm.pivotY++;
|
|
||||||
rightArm.pivotY++;
|
|
||||||
body.pitch += 0.15F;
|
body.pitch += 0.15F;
|
||||||
|
|
||||||
if (entity.saddled) {
|
if (entity.saddled) {
|
||||||
|
@ -78,8 +68,6 @@ public class SpikeModel extends BipedEntityModel<StriderRenderer.State> {
|
||||||
tail.yaw = (float)Math.sin(entity.age / 20F) / 40 + (float)Math.sin(entity.limbFrequency / 20F) / 4;
|
tail.yaw = (float)Math.sin(entity.age / 20F) / 40 + (float)Math.sin(entity.limbFrequency / 20F) / 4;
|
||||||
tail2.yaw = tail.yaw / 2;
|
tail2.yaw = tail.yaw / 2;
|
||||||
tail3.yaw = tail2.yaw / 2;
|
tail3.yaw = tail2.yaw / 2;
|
||||||
|
|
||||||
getRootPart().pivotY += 7;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,13 +14,13 @@ public class AlicornModel<T extends PonyRenderState> extends UnicornModel<T> imp
|
||||||
|
|
||||||
public AlicornModel(ModelPart tree, boolean smallArms) {
|
public AlicornModel(ModelPart tree, boolean smallArms) {
|
||||||
super(tree, smallArms);
|
super(tree, smallArms);
|
||||||
|
bodyRenderList.add(SubModel.toRenderList(this::getWings));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(ModelView context) {
|
public void init(ModelView context) {
|
||||||
super.init(context);
|
super.init(context);
|
||||||
wings = addPart(context.findByName("wings"));
|
wings = addPart(context.findByName("wings"));
|
||||||
bodyRenderList.add(forPart(this::getWings));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,7 +9,6 @@ import com.minelittlepony.mson.api.ModelView;
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
|
|
||||||
public class EarthPonyModel<T extends PonyRenderState> extends AbstractPonyModel<T> {
|
public class EarthPonyModel<T extends PonyRenderState> extends AbstractPonyModel<T> {
|
||||||
|
|
||||||
protected SubModel<T> tail;
|
protected SubModel<T> tail;
|
||||||
protected PonySnout snout;
|
protected PonySnout snout;
|
||||||
protected PonyEars ears;
|
protected PonyEars ears;
|
||||||
|
@ -33,7 +32,7 @@ public class EarthPonyModel<T extends PonyRenderState> extends AbstractPonyModel
|
||||||
snout = addPart(context.findByName("snout"));
|
snout = addPart(context.findByName("snout"));
|
||||||
ears = addPart(context.findByName("ears"));
|
ears = addPart(context.findByName("ears"));
|
||||||
|
|
||||||
bodyRenderList.add(forPart(tail));
|
bodyRenderList.add(tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setModelVisibilities(T state) {
|
protected void setModelVisibilities(T state) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class PegasusModel<T extends PonyRenderState> extends EarthPonyModel<T> i
|
||||||
public void init(ModelView context) {
|
public void init(ModelView context) {
|
||||||
super.init(context);
|
super.init(context);
|
||||||
wings = addPart(context.findByName("wings"));
|
wings = addPart(context.findByName("wings"));
|
||||||
bodyRenderList.add(forPart(this::getWings));
|
bodyRenderList.add(SubModel.toRenderList(this::getWings));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SeaponyModel<T extends PonyRenderState> extends UnicornModel<T> {
|
||||||
super.init(context);
|
super.init(context);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
bodyRenderList.clear();
|
bodyRenderList.clear();
|
||||||
bodyRenderList.add(body).add(body::rotate).add(forPart(tail)).add(leftFin, centerFin, rightFin);
|
bodyRenderList.add(body).add(body::rotate).add(tail).add(leftFin, centerFin, rightFin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,10 +25,23 @@ public class UnicornModel<T extends PonyRenderState> extends EarthPonyModel<T> {
|
||||||
|
|
||||||
protected UnicornHorn<T> horn;
|
protected UnicornHorn<T> horn;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public UnicornModel(ModelPart tree, boolean smallArms) {
|
public UnicornModel(ModelPart tree, boolean smallArms) {
|
||||||
super(tree, smallArms);
|
super(tree, smallArms);
|
||||||
unicornArmRight = tree.getChild("right_cast");
|
unicornArmRight = tree.getChild("right_cast");
|
||||||
unicornArmLeft = tree.getChild("left_cast");
|
unicornArmLeft = tree.getChild("left_cast");
|
||||||
|
headRenderList.add(RenderList.of().add(head::rotate).add(SubModel.toRenderList(() -> horn)));
|
||||||
|
mainRenderList.add(withStage(BodyPart.HEAD, RenderList.of().add(head::rotate).add((stack, vertices, overlay, light, color) -> {
|
||||||
|
if (isCasting(currentState)) {
|
||||||
|
horn.renderMagic(stack, vertices, currentState == null ? 0 : currentState.attributes.metadata.glowColor());
|
||||||
|
}
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ModelView context) {
|
||||||
|
super.init(context);
|
||||||
|
horn = addPart(context.findByName("horn"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCasting(T state) {
|
public boolean isCasting(T state) {
|
||||||
|
@ -41,16 +54,6 @@ public class UnicornModel<T extends PonyRenderState> extends EarthPonyModel<T> {
|
||||||
return isCasting(state) ? 0 : 1;
|
return isCasting(state) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(ModelView context) {
|
|
||||||
super.init(context);
|
|
||||||
horn = addPart(context.findByName("horn"));
|
|
||||||
headRenderList.add(RenderList.of().add(head::rotate).add(forPart(horn)));
|
|
||||||
mainRenderList.add(withStage(BodyPart.HEAD, RenderList.of().add(head::rotate).add((stack, vertices, overlay, light, color) -> {
|
|
||||||
horn.renderMagic(stack, vertices, currentState == null ? 0 : currentState.attributes.metadata.glowColor());
|
|
||||||
})).checked(() -> isCasting(currentState)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void rotateLegs(T state) {
|
protected void rotateLegs(T state) {
|
||||||
super.rotateLegs(state);
|
super.rotateLegs(state);
|
||||||
|
@ -69,9 +72,10 @@ public class UnicornModel<T extends PonyRenderState> extends EarthPonyModel<T> {
|
||||||
unicornArmLeft.pitch -= LEG_SNEAKING_PITCH_ADJUSTMENT;
|
unicornArmLeft.pitch -= LEG_SNEAKING_PITCH_ADJUSTMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public ModelPart getArm(Arm side) {
|
public ModelPart getArm(Arm side) {
|
||||||
if (currentState != null && currentState.hasMagicGlow() && getArmPoseForSide(currentState, side) != ArmPose.EMPTY && PonyConfig.getInstance().tpsmagic.get()) {
|
if (currentState != null && currentState.hasMagicGlow() && getArmPose(currentState, side) != ArmPose.EMPTY && PonyConfig.getInstance().tpsmagic.get()) {
|
||||||
return side == Arm.LEFT ? unicornArmLeft : unicornArmRight;
|
return side == Arm.LEFT ? unicornArmLeft : unicornArmRight;
|
||||||
}
|
}
|
||||||
return super.getArm(side);
|
return super.getArm(side);
|
||||||
|
|
|
@ -168,6 +168,7 @@ public abstract class AbstractPonyRenderer<
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public static <
|
public static <
|
||||||
T extends MobEntity,
|
T extends MobEntity,
|
||||||
|
|
|
@ -41,6 +41,9 @@ public class StriderRenderer extends MobEntityRenderer<StriderEntity, StriderRen
|
||||||
state.cold = entity.isCold();
|
state.cold = entity.isCold();
|
||||||
state.saddled = entity.isSaddled();
|
state.saddled = entity.isSaddled();
|
||||||
state.flailAmount = 1 + (float)MathHelper.clamp(entity.getVelocity().y * 10, 0, 7);
|
state.flailAmount = 1 + (float)MathHelper.clamp(entity.getVelocity().y * 10, 0, 7);
|
||||||
|
state.limbFrequency *= 2;
|
||||||
|
state.limbAmplitudeMultiplier *= 1.5F;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,9 +43,7 @@ abstract class AbstractNpcRenderer<
|
||||||
return super.shouldRender(model, entity, wearable, gear);
|
return super.shouldRender(model, entity, wearable, gear);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeModel(ClientPonyModel<S> model) {
|
protected abstract void initializeModel(ClientPonyModel<S> model);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier getDefaultTexture(S villager, Wearable wearable) {
|
public Identifier getDefaultTexture(S villager, Wearable wearable) {
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
package com.minelittlepony.client.render.entity.npc;
|
package com.minelittlepony.client.render.entity.npc;
|
||||||
|
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.entity.LivingEntity;
|
|
||||||
import net.minecraft.entity.passive.VillagerEntity;
|
import net.minecraft.entity.passive.VillagerEntity;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import com.minelittlepony.api.model.ModelAttributes;
|
|
||||||
import com.minelittlepony.api.model.PonyModel;
|
|
||||||
import com.minelittlepony.api.pony.Pony;
|
|
||||||
import com.minelittlepony.client.VariatedTextureSupplier;
|
import com.minelittlepony.client.VariatedTextureSupplier;
|
||||||
|
import com.minelittlepony.client.model.ClientPonyModel;
|
||||||
import com.minelittlepony.client.render.entity.npc.textures.*;
|
import com.minelittlepony.client.render.entity.npc.textures.*;
|
||||||
|
|
||||||
public class VillagerPonyRenderer extends AbstractNpcRenderer<VillagerEntity, VillagerPonyRenderer.State> {
|
public class VillagerPonyRenderer extends AbstractNpcRenderer<VillagerEntity, VillagerPonyRenderer.State> {
|
||||||
|
@ -22,18 +19,31 @@ public class VillagerPonyRenderer extends AbstractNpcRenderer<VillagerEntity, Vi
|
||||||
super(context, "villager", TEXTURES, FORMATTER);
|
super(context, "villager", TEXTURES, FORMATTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initializeModel(ClientPonyModel<State> model) {
|
||||||
|
model.onSetModelAngles((m, state) -> {
|
||||||
|
if (state.headRolling) {
|
||||||
|
m.head.roll = 0.3F * MathHelper.sin(0.45F * state.age);
|
||||||
|
m.head.pitch = 0.4F;
|
||||||
|
} else {
|
||||||
|
m.head.roll = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public State createRenderState() {
|
public State createRenderState() {
|
||||||
return new State();
|
return new State();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRenderState(VillagerEntity entity, State state, float tickDelta) {
|
||||||
|
super.updateRenderState(entity, state, tickDelta);
|
||||||
|
state.headRolling = entity.getHeadRollingTimeLeft() > 0;
|
||||||
|
state.yawDegrees = 0.3F * MathHelper.sin(0.45F * state.age);
|
||||||
|
}
|
||||||
|
|
||||||
public static class State extends SillyPonyTextureSupplier.State {
|
public static class State extends SillyPonyTextureSupplier.State {
|
||||||
public int headRollingTime;
|
public boolean headRolling;
|
||||||
public void updateState(LivingEntity entity, PonyModel<?> model, Pony pony, ModelAttributes.Mode mode) {
|
|
||||||
super.updateState(entity, model, pony, mode);
|
|
||||||
if (((VillagerEntity)entity).getHeadRollingTimeLeft() > 0) {
|
|
||||||
this.yawDegrees = 0.3F * MathHelper.sin(0.45F * age);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,14 @@ package com.minelittlepony.client.render.entity.npc;
|
||||||
|
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.render.entity.model.BipedEntityModel.ArmPose;
|
import net.minecraft.client.render.entity.model.BipedEntityModel.ArmPose;
|
||||||
import net.minecraft.entity.LivingEntity;
|
|
||||||
import net.minecraft.entity.mob.ZombieVillagerEntity;
|
import net.minecraft.entity.mob.ZombieVillagerEntity;
|
||||||
|
|
||||||
import com.minelittlepony.api.model.*;
|
import com.minelittlepony.api.model.*;
|
||||||
import com.minelittlepony.api.pony.Pony;
|
|
||||||
import com.minelittlepony.client.VariatedTextureSupplier;
|
import com.minelittlepony.client.VariatedTextureSupplier;
|
||||||
import com.minelittlepony.client.model.ClientPonyModel;
|
import com.minelittlepony.client.model.ClientPonyModel;
|
||||||
import com.minelittlepony.client.render.entity.npc.textures.*;
|
import com.minelittlepony.client.render.entity.npc.textures.*;
|
||||||
|
|
||||||
public class ZomponyVillagerRenderer extends AbstractNpcRenderer<ZombieVillagerEntity, ZomponyVillagerRenderer.State> {
|
public class ZomponyVillagerRenderer extends AbstractNpcRenderer<ZombieVillagerEntity, SillyPonyTextureSupplier.State> {
|
||||||
private static final TextureSupplier<String> FORMATTER = TextureSupplier.formatted("minelittlepony", "textures/entity/zombie_villager/zombie_%s.png");
|
private static final TextureSupplier<String> FORMATTER = TextureSupplier.formatted("minelittlepony", "textures/entity/zombie_villager/zombie_%s.png");
|
||||||
private static final TextureSupplier<ZombieVillagerEntity> TEXTURES = TextureSupplier.ofPool(
|
private static final TextureSupplier<ZombieVillagerEntity> TEXTURES = TextureSupplier.ofPool(
|
||||||
VariatedTextureSupplier.BACKGROUND_ZOMPONIES_POOL,
|
VariatedTextureSupplier.BACKGROUND_ZOMPONIES_POOL,
|
||||||
|
@ -26,26 +24,24 @@ public class ZomponyVillagerRenderer extends AbstractNpcRenderer<ZombieVillagerE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public State createRenderState() {
|
public SillyPonyTextureSupplier.State createRenderState() {
|
||||||
return new State();
|
return new SillyPonyTextureSupplier.State();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializeModel(ClientPonyModel<State> model) {
|
public void updateRenderState(ZombieVillagerEntity entity, SillyPonyTextureSupplier.State state, float tickDelta) {
|
||||||
|
super.updateRenderState(entity, state, tickDelta);
|
||||||
|
if (entity.isConverting()) {
|
||||||
|
state.bodyYaw += (float) (Math.cos(entity.age * 3.25D) * (Math.PI / 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initializeModel(ClientPonyModel<SillyPonyTextureSupplier.State> model) {
|
||||||
model.onSetModelAngles((m, state) -> {
|
model.onSetModelAngles((m, state) -> {
|
||||||
if (m.getArmPoseForSide(state, state.mainArm) == ArmPose.EMPTY) {
|
if (m.getArmPose(state, state.mainArm) == ArmPose.EMPTY) {
|
||||||
MobPosingHelper.rotateUndeadArms(state, m, state.limbFrequency, state.age);
|
MobPosingHelper.rotateUndeadArms(state, m, state.limbFrequency, state.age);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class State extends SillyPonyTextureSupplier.State {
|
|
||||||
@Override
|
|
||||||
public void updateState(LivingEntity entity, PonyModel<?> model, Pony pony, ModelAttributes.Mode mode) {
|
|
||||||
super.updateState(entity, model, pony, mode);
|
|
||||||
if (((ZombieVillagerEntity)entity).isConverting()) {
|
|
||||||
bodyYaw += (float) (Math.cos(entity.age * 3.25D) * (Math.PI / 4));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"head": {
|
"head": {
|
||||||
|
"pivot": [0, 7, 0],
|
||||||
"cubes": [
|
"cubes": [
|
||||||
{ "from": [-3, -7, -3], "size": [ 6, 6, 6] },
|
{ "from": [-3, -7, -3], "size": [ 6, 6, 6] },
|
||||||
{ "from": [-2, -3, -4.5], "size": [ 4, 2, 2], "texture": { "v": 12 } }
|
{ "from": [-2, -3, -4.5], "size": [ 4, 2, 2], "texture": { "v": 12 } }
|
||||||
|
@ -65,6 +66,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"body": {
|
"body": {
|
||||||
|
"pivot": [0, 7, 0],
|
||||||
"cubes": [
|
"cubes": [
|
||||||
{ "from": [-2, -1, -2], "size": [ 4, 2, 3], "texture": { "v": 21 } },
|
{ "from": [-2, -1, -2], "size": [ 4, 2, 3], "texture": { "v": 21 } },
|
||||||
{ "from": [-3, 1, -2.5], "size": [ 6, 4, 5], "texture": { "v": 26 } },
|
{ "from": [-3, 1, -2.5], "size": [ 6, 4, 5], "texture": { "v": 26 } },
|
||||||
|
@ -133,7 +135,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right_arm": {
|
"right_arm": {
|
||||||
"pivot": [-5, 3, 0],
|
"pivot": [-5, 11, 0],
|
||||||
"texture": { "u": 24 },
|
"texture": { "u": 24 },
|
||||||
"cubes": [
|
"cubes": [
|
||||||
{ "from": [-1, -2, -2], "size": [ 3, 3, 3], "texture": { "v": 12 }, "dilate": -0.25 },
|
{ "from": [-1, -2, -2], "size": [ 3, 3, 3], "texture": { "v": 12 }, "dilate": -0.25 },
|
||||||
|
@ -146,7 +148,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"left_arm": {
|
"left_arm": {
|
||||||
"pivot": [5, 3, 0],
|
"pivot": [5, 11, 0],
|
||||||
"mirror": [true, false, false],
|
"mirror": [true, false, false],
|
||||||
"texture": { "u": 36 },
|
"texture": { "u": 36 },
|
||||||
"cubes": [
|
"cubes": [
|
||||||
|
@ -160,7 +162,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right_leg": {
|
"right_leg": {
|
||||||
"pivot": [-1.9, 3, 0],
|
"pivot": [-1.9, 19, 2],
|
||||||
"texture": { "u": 24 },
|
"texture": { "u": 24 },
|
||||||
"cubes": [
|
"cubes": [
|
||||||
{ "from": [-2, 0, -2], "size": [ 3, 4, 3], "texture": { "v": 28 } },
|
{ "from": [-2, 0, -2], "size": [ 3, 4, 3], "texture": { "v": 28 } },
|
||||||
|
@ -173,7 +175,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"left_leg": {
|
"left_leg": {
|
||||||
"pivot": [1.9, 3, 0],
|
"pivot": [1.9, 19, 2],
|
||||||
"texture": { "u": 38 },
|
"texture": { "u": 38 },
|
||||||
"mirror": [true, false, false],
|
"mirror": [true, false, false],
|
||||||
"cubes": [
|
"cubes": [
|
||||||
|
|
Loading…
Reference in a new issue