diff --git a/src/main/java/com/minelittlepony/api/model/Models.java b/src/main/java/com/minelittlepony/api/model/Models.java index f4c9ed99..f5c2dde8 100644 --- a/src/main/java/com/minelittlepony/api/model/Models.java +++ b/src/main/java/com/minelittlepony/api/model/Models.java @@ -1,10 +1,12 @@ package com.minelittlepony.api.model; import net.minecraft.item.ItemStack; +import net.minecraft.item.equipment.EquipmentModel; import net.minecraft.util.Util; import org.jetbrains.annotations.Nullable; +import com.minelittlepony.client.model.AbstractPonyModel; import com.minelittlepony.client.model.PlayerModelKey; import com.minelittlepony.client.model.armour.*; import com.minelittlepony.mson.api.ModelKey; @@ -17,7 +19,7 @@ import java.util.function.Function; * Container class for the various models and their associated piece of armour. */ public record Models> ( - Function>, PonyArmourModel> armor, + Function>, AbstractPonyModel> armor, M body ) { @@ -32,9 +34,9 @@ public record Models> ( this(Util.memoize(k -> k.createModel()), key.createModel()); } - public Optional> getArmourModel(ItemStack stack, ArmourLayer layer, ArmourVariant variant) { - return ArmorModelRegistry.getModelKey(stack.getItem(), layer) - .or(() -> variant.getDefaultModel(layer)) + public Optional> getArmourModel(ItemStack stack, EquipmentModel.LayerType layerType, ArmourVariant variant) { + return ArmorModelRegistry.getModelKey(stack.getItem(), layerType) + .or(() -> variant.getDefaultModel(layerType)) .map(armor); } } diff --git a/src/main/java/com/minelittlepony/client/model/ModelType.java b/src/main/java/com/minelittlepony/client/model/ModelType.java index 10cc34c7..fe94eec6 100644 --- a/src/main/java/com/minelittlepony/client/model/ModelType.java +++ b/src/main/java/com/minelittlepony/client/model/ModelType.java @@ -48,10 +48,10 @@ public final class ModelType { public static final ModelKey> ELYTRA = register("elytra", PonyElytra::new); public static final ModelKey ARMOUR_STAND = register("armour_stand", PonyArmourStandModel::new); - public static final ModelKey> INNER_VANILLA_ARMOR = register("armor/inner_vanilla_armor", PonyArmourModel::new); - public static final ModelKey> OUTER_VANILLA_ARMOR = register("armor/outer_vanilla_armor", PonyArmourModel::new); - public static final ModelKey> INNER_PONY_ARMOR = register("armor/inner_pony_armor", PonyArmourModel::new); - public static final ModelKey> OUTER_PONY_ARMOR = register("armor/outer_pony_armor", PonyArmourModel::new); + public static final ModelKey> INNER_VANILLA_ARMOR = register("armor/inner_vanilla_armor", PonyArmourModel::new); + public static final ModelKey> OUTER_VANILLA_ARMOR = register("armor/outer_vanilla_armor", PonyArmourModel::new); + public static final ModelKey> INNER_PONY_ARMOR = register("armor/inner_pony_armor", PonyArmourModel::new); + public static final ModelKey> OUTER_PONY_ARMOR = register("armor/outer_pony_armor", PonyArmourModel::new); public static final GearModelKey STETSON = registerGear("stetson", Wearable.STETSON, t -> new WearableGear(t, Wearable.STETSON, BodyPart.HEAD, 0.15F)); public static final GearModelKey SADDLEBAGS_BOTH = registerGear("saddlebags", Wearable.SADDLE_BAGS_BOTH, t -> new SaddleBags(t, Wearable.SADDLE_BAGS_BOTH)); @@ -83,7 +83,7 @@ public final class ModelType { @SuppressWarnings("unchecked") static > PlayerModelKey registerPlayer(String name, Race race, BiFunction constructor, - MsonModel.Factory> armorFactory) { + MsonModel.Factory> armorFactory) { return (PlayerModelKey)PLAYER_MODELS.computeIfAbsent(race, r -> new PlayerModelKey(name, constructor, armorFactory)); } diff --git a/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java b/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java index d0de3d97..65d42f9f 100644 --- a/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java +++ b/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java @@ -8,7 +8,6 @@ import org.jetbrains.annotations.Nullable; import com.minelittlepony.api.model.Models; import com.minelittlepony.api.model.PonyModel; import com.minelittlepony.client.MineLittlePony; -import com.minelittlepony.client.model.armour.PonyArmourModel; import com.minelittlepony.mson.api.*; import java.util.function.*; @@ -16,11 +15,11 @@ import java.util.function.*; public record PlayerModelKey> ( ModelKey steveKey, ModelKey alexKey, - MsonModel.Factory> armorFactory + MsonModel.Factory> armorFactory ) { PlayerModelKey(String name, BiFunction modelFactory, - MsonModel.Factory> armorFactory + MsonModel.Factory> armorFactory ) { this( new ModelKeyImpl<>(MineLittlePony.id("races/steve/" + name), tree -> modelFactory.apply(tree, false)), diff --git a/src/main/java/com/minelittlepony/client/model/armour/ArmorModelRegistry.java b/src/main/java/com/minelittlepony/client/model/armour/ArmorModelRegistry.java index 8eaeb1ec..0dd87485 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/ArmorModelRegistry.java +++ b/src/main/java/com/minelittlepony/client/model/armour/ArmorModelRegistry.java @@ -1,23 +1,25 @@ package com.minelittlepony.client.model.armour; import net.minecraft.item.Item; +import net.minecraft.item.equipment.EquipmentModel; import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; +import com.minelittlepony.client.model.AbstractPonyModel; import com.minelittlepony.mson.api.ModelKey; import com.minelittlepony.mson.api.Mson; import java.util.*; public interface ArmorModelRegistry { - static final Map>>> REGISTRY = new HashMap<>(); + static final Map>>> REGISTRY = new HashMap<>(); - public static Optional>> getModelKey(Item item, ArmourLayer layer) { + public static Optional>> getModelKey(Item item, EquipmentModel.LayerType layerType) { Identifier id = Registries.ITEM.getId(item); if (id.getNamespace().equals("minecraft")) { return Optional.empty(); } - return REGISTRY.computeIfAbsent(id.withPath(p -> "armor/" + layer.name().toLowerCase(Locale.ROOT) + "_" + p + ".json"), i -> { + return REGISTRY.computeIfAbsent(id.withPath(p -> "armor/" + layerType.name().toLowerCase(Locale.ROOT) + "_" + p + ".json"), i -> { return Optional.of(Mson.getInstance().registerModel(i, PonyArmourModel::new)); }).filter(key -> key.getModelData().isPresent()); } diff --git a/src/main/java/com/minelittlepony/client/model/armour/ArmourLayer.java b/src/main/java/com/minelittlepony/client/model/armour/ArmourLayer.java deleted file mode 100644 index 0710a0bb..00000000 --- a/src/main/java/com/minelittlepony/client/model/armour/ArmourLayer.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.minelittlepony.client.model.armour; - -/** - * The layer used to render a given armour piece. - */ -public enum ArmourLayer { - /** - * Hanging loose and sagging free - */ - OUTER, - /** - * Fits snugly to the player's model. - */ - INNER; - - public int getLegacyId() { - return ordinal() + 1; - } - - public boolean isInner() { - return this == INNER; - } -} \ No newline at end of file diff --git a/src/main/java/com/minelittlepony/client/model/armour/ArmourRendererPlugin.java b/src/main/java/com/minelittlepony/client/model/armour/ArmourRendererPlugin.java index a1994275..8085a149 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/ArmourRendererPlugin.java +++ b/src/main/java/com/minelittlepony/client/model/armour/ArmourRendererPlugin.java @@ -34,11 +34,11 @@ public interface ArmourRendererPlugin { return ArmourTextureResolver.INSTANCE; } - default void onArmourRendered(LivingEntityRenderState state, MatrixStack matrices, VertexConsumerProvider provider, EquipmentSlot armorSlot, ArmourLayer layer, ArmourType type) { + default void onArmourRendered(LivingEntityRenderState state, MatrixStack matrices, VertexConsumerProvider provider, EquipmentSlot armorSlot, EquipmentModel.LayerType layerType, ArmourType type) { } - default ItemStack[] getArmorStacks(BipedEntityRenderState state, EquipmentSlot armorSlot, ArmourLayer layer, ArmourType type) { + default ItemStack[] getArmorStacks(BipedEntityRenderState state, EquipmentSlot armorSlot, EquipmentModel.LayerType layerType, ArmourType type) { return new ItemStack[] { switch (armorSlot) { case HEAD -> state.equippedHeadStack; case CHEST -> state.equippedChestStack; diff --git a/src/main/java/com/minelittlepony/client/model/armour/ArmourVariant.java b/src/main/java/com/minelittlepony/client/model/armour/ArmourVariant.java index a04100ef..dda97bd9 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/ArmourVariant.java +++ b/src/main/java/com/minelittlepony/client/model/armour/ArmourVariant.java @@ -1,5 +1,8 @@ package com.minelittlepony.client.model.armour; +import net.minecraft.item.equipment.EquipmentModel; + +import com.minelittlepony.client.model.AbstractPonyModel; import com.minelittlepony.client.model.ModelType; import com.minelittlepony.mson.api.ModelKey; @@ -10,15 +13,15 @@ public enum ArmourVariant { LEGACY(ModelType.INNER_VANILLA_ARMOR, ModelType.OUTER_VANILLA_ARMOR), TRIM(ModelType.INNER_VANILLA_ARMOR, ModelType.OUTER_VANILLA_ARMOR); - private final Optional>> innerModel; - private final Optional>> outerModel; + private final Optional>> innerModel; + private final Optional>> outerModel; - ArmourVariant(ModelKey> inner, ModelKey> outer) { + ArmourVariant(ModelKey> inner, ModelKey> outer) { this.innerModel = Optional.of(inner); this.outerModel = Optional.of(outer); } - public Optional>> getDefaultModel(ArmourLayer layer) { - return layer.isInner() ? innerModel : outerModel; + public Optional>> getDefaultModel(EquipmentModel.LayerType layerType) { + return layerType == EquipmentModel.LayerType.HUMANOID_LEGGINGS ? innerModel : outerModel; } } diff --git a/src/main/java/com/minelittlepony/client/model/armour/PonifiedEquipmentRenderer.java b/src/main/java/com/minelittlepony/client/model/armour/PonifiedEquipmentRenderer.java index b989b04d..45fcec0d 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/PonifiedEquipmentRenderer.java +++ b/src/main/java/com/minelittlepony/client/model/armour/PonifiedEquipmentRenderer.java @@ -11,7 +11,6 @@ import net.minecraft.component.type.DyedColorComponent; import net.minecraft.entity.EquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.item.equipment.EquipmentModel; -import net.minecraft.item.equipment.EquipmentModel.LayerType; import net.minecraft.item.equipment.trim.ArmorTrim; import net.minecraft.registry.tag.ItemTags; import net.minecraft.util.Colors; @@ -21,7 +20,8 @@ import net.minecraft.util.math.ColorHelper; import org.jetbrains.annotations.Nullable; import com.minelittlepony.api.model.Models; -import com.minelittlepony.api.model.PonyModel; +import com.minelittlepony.client.model.AbstractPonyModel; +import com.minelittlepony.client.model.ClientPonyModel; import com.minelittlepony.client.render.entity.state.PonyRenderState; import java.util.*; @@ -31,76 +31,87 @@ public class PonifiedEquipmentRenderer extends EquipmentRenderer { private final EquipmentModelLoader modelLoader; + private @Nullable Set> drawnModels; + public PonifiedEquipmentRenderer(EquipmentModelLoader modelLoader) { super(modelLoader, MinecraftClient.getInstance().getBakedModelManager().getAtlas(TexturedRenderLayers.ARMOR_TRIMS_ATLAS_TEXTURE)); this.modelLoader = modelLoader; } - public > void render( + public > void render( EquipmentSlot equipmentSlot, EquipmentModel.LayerType layerType, Identifier modelId, S entity, - Models> models, + Models models, ItemStack stack, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light ) { - this.render(equipmentSlot, layerType, modelId, entity, models, stack, matrices, vertexConsumers, light, null); + render(equipmentSlot, layerType, modelId, entity, models, stack, matrices, vertexConsumers, light, null); } - public > void render( + public > void render( EquipmentSlot equipmentSlot, EquipmentModel.LayerType layerType, Identifier modelId, S entity, - Models> models, + Models models, ItemStack stack, MatrixStack matrices, - VertexConsumerProvider vertexConsumers, + VertexConsumerProvider vertices, int light, @Nullable Identifier texture ) { - List layers = modelLoader.get(modelId).getLayers(layerType); if (!layers.isEmpty()) { ArmourRendererPlugin plugin = ArmourRendererPlugin.INSTANCE.get(); int defaultColor = stack.isIn(ItemTags.DYEABLE) ? DyedColorComponent.getColor(stack, 0) : 0; float armorAlpha = plugin.getArmourAlpha(equipmentSlot, layerType); - boolean hasGlint = plugin.getGlintAlpha(equipmentSlot, stack) > 0 && stack.hasGlint(); - - Set> drawnModels = new HashSet<>(); + boolean hasGlint = plugin.getGlintAlpha(equipmentSlot, stack) > 0; if (armorAlpha > 0) { for (EquipmentModel.Layer layer : layers) { int dyeColor = getDyeColor(layer, defaultColor); if (dyeColor != TRANSPARENT) { - ArmourLayer armourLayer = layerType == LayerType.HUMANOID_LEGGINGS ? ArmourLayer.INNER : ArmourLayer.OUTER; ArmourTexture armorTexture = plugin.getTextureLookup().getTexture(stack, layerType, layer); Identifier layerTexture = layer.usePlayerTexture() && texture != null ? texture : armorTexture.texture(); - VertexConsumer armorConsumer = getArmorVertexConsumer(plugin, equipmentSlot, vertexConsumers, layerTexture, layerType, hasGlint); + @Nullable + VertexConsumer armorConsumer = getArmorVertexConsumer(plugin, equipmentSlot, vertices, layerTexture, layerType, hasGlint); if (armorConsumer != null) { - ArmourVariant variant = layer.usePlayerTexture() ? ArmourVariant.NORMAL : armorTexture.variant(); - models.getArmourModel(stack, armourLayer, variant).ifPresent(model -> { - if (model.setAngles(entity, equipmentSlot, armourLayer, models.body())) { + ArmourVariant variant = layer.usePlayerTexture() ? ArmourVariant.LEGACY : armorTexture.variant(); + AbstractPonyModel model = models.getArmourModel(stack, layerType, variant).orElse(null); + if (model != null) { + model.setAngles(entity); + models.body().copyTransforms(model); + if (setVisibilities(model, equipmentSlot, layerType)) { model.render(matrices, armorConsumer, light, OverlayTexture.DEFAULT_UV, dyeColor); + if (drawnModels == null) { + drawnModels = new HashSet<>(); + } drawnModels.add(model); } - }); + } } } } } - ArmorTrim armorTrim = stack.get(DataComponentTypes.TRIM); - if (armorTrim != null && plugin.getTrimAlpha(equipmentSlot, armorTrim, layerType) > 0) { - VertexConsumer trimConsumer = plugin.getTrimConsumer(equipmentSlot, vertexConsumers, armorTrim, layerType, modelId); + if (drawnModels != null) { + @Nullable + ArmorTrim armorTrim = stack.get(DataComponentTypes.TRIM); + @Nullable + VertexConsumer trimConsumer = armorTrim != null && plugin.getTrimAlpha(equipmentSlot, armorTrim, layerType) > 0 ? plugin.getTrimConsumer(equipmentSlot, vertices, armorTrim, layerType, modelId) : null; if (trimConsumer != null) { - drawnModels.forEach(model -> model.render(matrices, trimConsumer, light, OverlayTexture.DEFAULT_UV)); + for (EntityModel model : drawnModels) { + model.render(matrices, trimConsumer, light, OverlayTexture.DEFAULT_UV); + } } } + + drawnModels = null; } } @@ -125,4 +136,19 @@ public class PonifiedEquipmentRenderer extends EquipmentRenderer { return Colors.WHITE; } + public static boolean setVisibilities(AbstractPonyModel model, EquipmentSlot slot, EquipmentModel.LayerType layer) { + model.setVisible(false); + model.body.visible = slot == EquipmentSlot.CHEST; + model.head.visible = layer == EquipmentModel.LayerType.HUMANOID && slot == EquipmentSlot.HEAD; + + if (slot == (layer == EquipmentModel.LayerType.HUMANOID ? EquipmentSlot.FEET : EquipmentSlot.LEGS)) { + model.rightArm.visible = true; + model.leftArm.visible = true; + model.rightLeg.visible = true; + model.leftLeg.visible = true; + return true; + } + + return model.head.visible || model.body.visible; + } } diff --git a/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java b/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java index bb318356..d1a710e3 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java +++ b/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java @@ -1,44 +1,13 @@ package com.minelittlepony.client.model.armour; import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.entity.state.PlayerEntityRenderState; -import net.minecraft.entity.EquipmentSlot; -import com.minelittlepony.api.model.PonyModel; import com.minelittlepony.client.model.AbstractPonyModel; -import com.minelittlepony.client.model.ClientPonyModel; import com.minelittlepony.client.render.entity.state.PonyRenderState; -public class PonyArmourModel extends AbstractPonyModel { - +public class PonyArmourModel extends AbstractPonyModel { public PonyArmourModel(ModelPart tree) { super(tree, false); } - public boolean setAngles(PlayerEntityRenderState state, EquipmentSlot slot, ArmourLayer layer, PonyModel mainModel) { - setAngles(state); - if (!setVisibilities(slot, layer)) { - return false; - } - if (mainModel instanceof ClientPonyModel abs) { - abs.copyTransforms(this); - } - return true; - } - - public boolean setVisibilities(EquipmentSlot slot, ArmourLayer layer) { - setVisible(false); - body.visible = slot == EquipmentSlot.CHEST; - head.visible = layer == ArmourLayer.OUTER && slot == EquipmentSlot.HEAD; - - if (slot == (layer == ArmourLayer.OUTER ? EquipmentSlot.FEET : EquipmentSlot.LEGS)) { - rightArm.visible = true; - leftArm.visible = true; - rightLeg.visible = true; - leftLeg.visible = true; - return true; - } - - return head.visible || body.visible; - } } diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java index dc8d1cf3..aef9a312 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java @@ -1,7 +1,6 @@ package com.minelittlepony.client.render.entity.feature; import com.minelittlepony.api.model.Models; -import com.minelittlepony.api.model.PonyModel; import com.minelittlepony.client.model.ClientPonyModel; import com.minelittlepony.client.model.armour.*; import com.minelittlepony.client.render.PonyRenderContext; @@ -16,7 +15,6 @@ import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; import net.minecraft.item.*; import net.minecraft.item.equipment.EquipmentModel; -import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -38,40 +36,36 @@ public class ArmourFeature< renderArmor(getModelWrapper(), matrices, provider, light, entity, limbDistance, limbAngle, equipmentRenderer); } - public static > void renderArmor( - Models> pony, MatrixStack matrices, - VertexConsumerProvider provider, int light, S entity, - float limbDistance, float limbAngle, PonifiedEquipmentRenderer equipmentRenderer) { + public static > void renderArmor( + Models pony, MatrixStack matrices, + VertexConsumerProvider provider, int light, S entity, + float limbDistance, float limbAngle, PonifiedEquipmentRenderer equipmentRenderer) { for (EquipmentSlot i : EquipmentSlot.values()) { if (i.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) { - renderArmor(pony, matrices, provider, light, entity, limbDistance, limbAngle, i, ArmourLayer.INNER, equipmentRenderer); - renderArmor(pony, matrices, provider, light, entity, limbDistance, limbAngle, i, ArmourLayer.OUTER, equipmentRenderer); + renderArmor(pony, matrices, provider, light, entity, limbDistance, limbAngle, i, EquipmentModel.LayerType.HUMANOID_LEGGINGS, equipmentRenderer); + renderArmor(pony, matrices, provider, light, entity, limbDistance, limbAngle, i, EquipmentModel.LayerType.HUMANOID, equipmentRenderer); } } } - private static > void renderArmor( - Models> models, MatrixStack matrices, + private static > void renderArmor( + Models models, MatrixStack matrices, VertexConsumerProvider vertices, int light, S entity, float limbDistance, float limbAngle, - EquipmentSlot armorSlot, ArmourLayer layer, PonifiedEquipmentRenderer equipmentRenderer) { + EquipmentSlot armorSlot, EquipmentModel.LayerType layerType, PonifiedEquipmentRenderer equipmentRenderer) { ArmourRendererPlugin plugin = ArmourRendererPlugin.INSTANCE.get(); - for (ItemStack stack : plugin.getArmorStacks(entity, armorSlot, layer, ArmourRendererPlugin.ArmourType.ARMOUR)) { + for (ItemStack stack : plugin.getArmorStacks(entity, armorSlot, layerType, ArmourRendererPlugin.ArmourType.ARMOUR)) { EquippableComponent equippableComponent = stack.get(DataComponentTypes.EQUIPPABLE); if (hasModel(equippableComponent, armorSlot)) { - EquipmentModel.LayerType layerType = layer == ArmourLayer.INNER - ? EquipmentModel.LayerType.HUMANOID_LEGGINGS - : EquipmentModel.LayerType.HUMANOID; - Identifier modelId = equippableComponent.model().orElseThrow(); - equipmentRenderer.render(armorSlot, layerType, modelId, entity, models, stack, matrices, vertices, light); + equipmentRenderer.render(armorSlot, layerType, equippableComponent.model().orElseThrow(), entity, models, stack, matrices, vertices, light); } } - plugin.onArmourRendered(entity, matrices, vertices, armorSlot, layer, ArmourRendererPlugin.ArmourType.ARMOUR); + plugin.onArmourRendered(entity, matrices, vertices, armorSlot, layerType, ArmourRendererPlugin.ArmourType.ARMOUR); } private static boolean hasModel(@Nullable EquippableComponent component, EquipmentSlot slot) { diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/CapeFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/CapeFeature.java index 3ee60025..69f9a2a9 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/CapeFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/CapeFeature.java @@ -2,7 +2,6 @@ package com.minelittlepony.client.render.entity.feature; import com.minelittlepony.api.model.BodyPart; import com.minelittlepony.client.model.ClientPonyModel; -import com.minelittlepony.client.model.armour.ArmourLayer; import com.minelittlepony.client.model.armour.ArmourRendererPlugin; import com.minelittlepony.client.render.PonyRenderContext; import com.minelittlepony.client.render.entity.state.PlayerPonyRenderState; @@ -16,6 +15,7 @@ import net.minecraft.client.render.entity.model.EntityModelLoader; import net.minecraft.client.render.entity.state.PlayerEntityRenderState; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.EquipmentSlot; +import net.minecraft.item.equipment.EquipmentModel; import net.minecraft.util.Identifier; public class CapeFeature extends CapeFeatureRenderer { @@ -63,7 +63,7 @@ public class CapeFeature extends CapeFeatureRenderer { matrices.pop(); if (rendered[0]) { - plugin.onArmourRendered(player, matrices, vertices, EquipmentSlot.BODY, ArmourLayer.OUTER, ArmourRendererPlugin.ArmourType.CAPE); + plugin.onArmourRendered(player, matrices, vertices, EquipmentSlot.BODY, EquipmentModel.LayerType.HUMANOID, ArmourRendererPlugin.ArmourType.CAPE); } } } diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/ElytraFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/ElytraFeature.java index 06ca5069..28caab07 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/ElytraFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/ElytraFeature.java @@ -2,7 +2,6 @@ package com.minelittlepony.client.render.entity.feature; import com.minelittlepony.api.model.BodyPart; import com.minelittlepony.client.model.*; -import com.minelittlepony.client.model.armour.ArmourLayer; import com.minelittlepony.client.model.armour.ArmourRendererPlugin; import com.minelittlepony.client.render.PonyRenderContext; import com.minelittlepony.client.render.entity.state.PonyRenderState; @@ -42,7 +41,7 @@ public class ElytraFeature< public void render(MatrixStack matrices, VertexConsumerProvider provider, int light, S state, float limbAngle, float limbDistance) { ArmourRendererPlugin plugin = ArmourRendererPlugin.INSTANCE.get(); - for (ItemStack stack : plugin.getArmorStacks(state, EquipmentSlot.CHEST, ArmourLayer.OUTER, ArmourRendererPlugin.ArmourType.ELYTRA)) { + for (ItemStack stack : plugin.getArmorStacks(state, EquipmentSlot.CHEST, EquipmentModel.LayerType.WINGS, ArmourRendererPlugin.ArmourType.ELYTRA)) { EquippableComponent equippable = stack.get(DataComponentTypes.EQUIPPABLE); if (equippable != null && !equippable.model().isEmpty()) { @@ -61,7 +60,7 @@ public class ElytraFeature< } } - plugin.onArmourRendered(state, matrices, provider, EquipmentSlot.BODY, ArmourLayer.OUTER, ArmourRendererPlugin.ArmourType.ELYTRA); + plugin.onArmourRendered(state, matrices, provider, EquipmentSlot.BODY, EquipmentModel.LayerType.WINGS, ArmourRendererPlugin.ArmourType.ELYTRA); } @SuppressWarnings("unchecked") diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/GearFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/GearFeature.java index a4b7298a..841f68d5 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/GearFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/GearFeature.java @@ -8,6 +8,7 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; import net.minecraft.item.*; +import net.minecraft.item.equipment.EquipmentModel; import net.minecraft.util.Colors; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.random.Random; @@ -20,7 +21,6 @@ import com.minelittlepony.api.model.gear.Gear; import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.client.model.ClientPonyModel; import com.minelittlepony.client.model.ModelType; -import com.minelittlepony.client.model.armour.ArmourLayer; import com.minelittlepony.client.model.armour.ArmourRendererPlugin; import com.minelittlepony.client.render.PonyRenderContext; import com.minelittlepony.client.render.entity.state.PonyRenderState; @@ -65,7 +65,7 @@ public class GearFeature< } boolean hasSkull = false; - for (ItemStack skull : ArmourRendererPlugin.INSTANCE.get().getArmorStacks(entity, EquipmentSlot.HEAD, ArmourLayer.OUTER, ArmourRendererPlugin.ArmourType.SKULL)) { + for (ItemStack skull : ArmourRendererPlugin.INSTANCE.get().getArmorStacks(entity, EquipmentSlot.HEAD, EquipmentModel.LayerType.HUMANOID, ArmourRendererPlugin.ArmourType.SKULL)) { if (skull.getItem() instanceof BlockItem b && (b.getBlock() instanceof SkullBlock || b.getBlock().getDefaultState().isSolidBlock(EmptyBlockView.INSTANCE, BlockPos.ORIGIN))) { hasSkull = true; break; diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java index 55b8990b..99e3f2b5 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java @@ -2,7 +2,6 @@ package com.minelittlepony.client.render.entity.feature; import com.minelittlepony.api.model.BodyPart; import com.minelittlepony.client.model.ClientPonyModel; -import com.minelittlepony.client.model.armour.ArmourLayer; import com.minelittlepony.client.model.armour.ArmourRendererPlugin; import com.minelittlepony.client.render.PonyRenderContext; import com.minelittlepony.client.render.blockentity.skull.PonySkullRenderer; @@ -19,6 +18,7 @@ import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.EquippableComponent; import net.minecraft.entity.EquipmentSlot; import net.minecraft.item.*; +import net.minecraft.item.equipment.EquipmentModel; public class SkullFeature< S extends PonyRenderState, @@ -42,7 +42,7 @@ public class SkullFeature< public void render(MatrixStack matrices, VertexConsumerProvider provider, int light, S state, float limbAngle, float limbDistance) { ArmourRendererPlugin plugin = ArmourRendererPlugin.INSTANCE.get(); - for (ItemStack stack : plugin.getArmorStacks(state, EquipmentSlot.HEAD, ArmourLayer.OUTER, ArmourRendererPlugin.ArmourType.SKULL)) { + for (ItemStack stack : plugin.getArmorStacks(state, EquipmentSlot.HEAD, EquipmentModel.LayerType.HUMANOID, ArmourRendererPlugin.ArmourType.SKULL)) { BakedModel headModel = state.equippedHeadItemModel; @@ -83,6 +83,6 @@ public class SkullFeature< matrices.pop(); } - plugin.onArmourRendered(state, matrices, provider, EquipmentSlot.BODY, ArmourLayer.OUTER, ArmourRendererPlugin.ArmourType.SKULL); + plugin.onArmourRendered(state, matrices, provider, EquipmentSlot.BODY, EquipmentModel.LayerType.HUMANOID, ArmourRendererPlugin.ArmourType.SKULL); } }