Fixed saddlebags using the wrong texture for changelings

This commit is contained in:
Sollace 2023-03-29 00:37:03 +01:00
parent d6d4fc8acc
commit aa933861c4
4 changed files with 19 additions and 13 deletions

View file

@ -36,7 +36,6 @@ public enum Race implements TriggerPixelType<Race> {
/**
* Returns true if this pony has a horn (and by extension can cast magic).
* @return
*/
public boolean hasHorn() {
return horn;
@ -50,12 +49,26 @@ public enum Race implements TriggerPixelType<Race> {
}
/**
* Returns true if this is a human.
* Returns true if this a changeling or reformed changeling.
*/
public boolean hasBugWings() {
return this == CHANGELING || this == CHANGEDLING;
}
/**
* Returns true if this is not a pony.
*/
public boolean isHuman() {
return this == HUMAN;
}
/**
* Returns true if the model allows embedding saddlebags in the main body texture.
*/
public boolean supportsLegacySaddlebags() {
return !(this == BATPONY || hasBugWings());
}
@Override
public int getColorCode() {
return triggerPixel;

View file

@ -106,7 +106,7 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer {
IPonyData metadata = IPony.getManager().getPony(main.getId()).metadata();
if (wearable != Wearable.NONE && metadata.isWearing(wearable)) {
if (wearable.isSaddlebags() && metadata.getRace() != Race.BATPONY) {
if (wearable.isSaddlebags() && metadata.getRace().supportsLegacySaddlebags()) {
return Optional.of(main.getId());
}

View file

@ -7,7 +7,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import com.minelittlepony.api.model.*;
import com.minelittlepony.api.pony.meta.Race;
import com.minelittlepony.api.pony.meta.Wearable;
import com.minelittlepony.mson.api.ModelView;
import com.minelittlepony.mson.api.MsonModel;
@ -120,16 +119,14 @@ public class PonyWings<T extends Model & IPegasus> implements IPart, MsonModel {
public void rotateWalking(float swing) {
folded.yaw = swing * walkingRotationSpeed;
Race race = pegasus.getMetadata().getRace();
if (race == Race.CHANGELING || race == Race.CHANGEDLING) {
if (pegasus.getMetadata().getRace().hasBugWings()) {
extended.yaw = folded.yaw;
}
}
public void rotateFlying(float roll) {
extended.roll = roll;
Race race = pegasus.getMetadata().getRace();
if (race == Race.CHANGELING || race == Race.CHANGEDLING) {
if (pegasus.getMetadata().getRace().hasBugWings()) {
folded.roll = roll;
}
}

View file

@ -2,7 +2,6 @@ package com.minelittlepony.client.render.entity;
import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.api.pony.meta.Race;
import com.minelittlepony.api.pony.meta.Wearable;
import com.minelittlepony.client.SkinsProxy;
import com.minelittlepony.client.model.*;
@ -183,10 +182,7 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
@Override
public Identifier getDefaultTexture(AbstractClientPlayerEntity entity, Wearable wearable) {
return SkinsProxy.instance.getSkin(wearable.getId(), entity).orElseGet(() -> {
if (wearable.isSaddlebags()) {
if (getInternalRenderer().getModel().getMetadata().getRace() == Race.BATPONY) {
return wearable.getDefaultTexture();
}
if (wearable.isSaddlebags() && getInternalRenderer().getModel().getMetadata().getRace().supportsLegacySaddlebags()) {
return manager.getTexture(entity);
}