Fixed rendering of legacy pony armour

This commit is contained in:
Sollace 2023-02-15 16:27:11 +00:00
parent d843896177
commit c68d484d42
6 changed files with 19 additions and 16 deletions

View file

@ -6,6 +6,7 @@ import net.minecraft.util.Identifier;
import com.mojang.serialization.Lifecycle;
@Deprecated
public final class ArmourRegistry {
private ArmourRegistry() {}
static final Registry<IArmour<?>> REGISTRY = new SimpleRegistry<>(RegistryKey.ofRegistry(new Identifier("minelittlepony", "armour")), Lifecycle.stable());

View file

@ -14,6 +14,7 @@ import com.minelittlepony.api.pony.IPonyData;
*
* @param <V> The type of the contained armour model.
*/
@Deprecated
public interface IArmour<V extends IArmourModel> extends IModelWrapper {
/**
* Registers a custom armour for the supplied item.

View file

@ -7,12 +7,15 @@ import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
/**
* A resolver for looking up the texture for a piece of armour.
* <p>
* This is for modders who want to override the default implementation found in {@link DefaultArmourTextureResolver}.
*/
public interface IArmourTextureResolver {
IArmourTextureResolver DEFAULT = new DefaultArmourTextureResolver();
/**
* Gets the armour texture to be used for the given entity, armour piece, slot, and render layer.

View file

@ -90,8 +90,6 @@ public class PonyArmourModel<T extends LivingEntity> extends AbstractPonyModel<T
@Override
public void showChestplate() {
chestPiece.visible = true;
neck.visible = true;
body.visible = variant == ArmourVariant.LEGACY;
upperTorso.visible = variant == ArmourVariant.LEGACY;
chestPiece.visible = variant == ArmourVariant.NORMAL;
@ -99,12 +97,9 @@ public class PonyArmourModel<T extends LivingEntity> extends AbstractPonyModel<T
@Override
public void showSaddle() {
chestPiece.visible = true;
neck.visible = true;
if (variant == ArmourVariant.LEGACY) {
upperTorso.visible = true;
}
body.visible = variant == ArmourVariant.LEGACY;
upperTorso.visible = variant == ArmourVariant.LEGACY;
chestPiece.visible = variant == ArmourVariant.NORMAL;
}
@Override

View file

@ -7,7 +7,6 @@ import com.minelittlepony.api.model.armour.IArmourModel;
import com.minelittlepony.api.model.armour.IArmourTextureResolver;
import com.minelittlepony.client.model.IPonyModel;
import com.minelittlepony.client.model.ModelWrapper;
import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
import com.minelittlepony.client.render.IPonyRenderContext;
import com.minelittlepony.common.util.Color;
@ -28,8 +27,6 @@ import net.minecraft.util.Identifier;
public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> {
private static final IArmourTextureResolver DEFAULT = new DefaultArmourTextureResolver();
public ArmourFeature(IPonyRenderContext<T, M> renderer) {
super(renderer);
}
@ -84,7 +81,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
blue = Color.b(color);
}
IArmourTextureResolver resolver = armour.getTextureResolver(DEFAULT);
IArmourTextureResolver resolver = armour.getTextureResolver(IArmourTextureResolver.DEFAULT);
boolean glint = itemstack.hasGlint();

View file

@ -3,6 +3,12 @@
"texture": {"w": 64, "h": 32},
"dilate": 0.27,
"data": {
"body": {
"texture": { "u": 16, "v": 18 },
"cubes": [
{ "from": [-4, 4, -2], "size": [ 8, 8, 4] }
]
},
"chestpiece": {
"texture": {"u": 16, "v": 8},
"cubes": [
@ -19,10 +25,10 @@
"upper_torso": {
"type": "mson:planar",
"texture": {"u": 24, "v": 0},
"east": [4, 4, 2, 8, 8, 32, 32],
"west": [-4, 4, 2, 8, 8, 23, 32],
"south": [-4, 4,10, 8, 8, 32, 23],
"up": [-4, 4, -2, 8, 12, 32, 23],
"east": [ 4, 4, 2, 8, 8, 32, 23],
"west": [ -4, 4, 2, 8, 8, 32, 23],
"south": [-4, 4, 10, 8, 8, 32, 23],
"up": [ -4, 4, 1, 8, 12, 32, 23],
"__comment": "it's a little short, so the butt tends to show. :/"
},
"right_arm": {