Class ArmorRenderingRegistry

java.lang.Object
net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderingRegistry

@Environment(CLIENT) public final class ArmorRenderingRegistry extends Object
A class for registering custom armor models and textures for Item, to be provided by a ArmorRenderingRegistry.ModelProvider or ArmorRenderingRegistry.TextureProvider.

This can be used to replace existing vanilla armor models and textures conditionally, however each Item instance can only allow one ArmorRenderingRegistry.ModelProvider or ArmorRenderingRegistry.TextureProvider respectively, causing potential conflicts with other mods if you replace the model or texture for vanilla items. Consider using a separate item instead.

A custom model would probably also require a custom texture to go along it, the model will use the vanilla texture if it is undefined.

Since armor textures identifier in vanilla is hardcoded to be in the minecraft namespace, this registry can also be used to use a custom namespace if desired.

  • Method Details

    • registerModel

      public static void registerModel(@Nullable @Nullable ArmorRenderingRegistry.ModelProvider provider, net.minecraft.item.Item... items)
      Registers a provider for custom armor models for an item.
      Parameters:
      provider - the provider for the model
      items - the items to be registered for
    • registerModel

      public static void registerModel(@Nullable @Nullable ArmorRenderingRegistry.ModelProvider provider, Iterable<net.minecraft.item.Item> items)
      Registers a provider for custom armor models for an item.
      Parameters:
      provider - the provider for the model
      items - the items to be registered for
    • registerTexture

      public static void registerTexture(@Nullable @Nullable ArmorRenderingRegistry.TextureProvider provider, net.minecraft.item.Item... items)
      Registers a provider for custom texture models for an item.
      Parameters:
      provider - the provider for the texture
      items - the items to be registered for
    • registerTexture

      public static void registerTexture(@Nullable @Nullable ArmorRenderingRegistry.TextureProvider provider, Iterable<net.minecraft.item.Item> items)
      Registers a provider for custom texture models for an item.
      Parameters:
      provider - the provider for the texture
      items - the items to be registered for
    • registerSimpleTexture

      public static void registerSimpleTexture(net.minecraft.util.Identifier identifier, net.minecraft.item.Item... items)
      Register simple armor items to use the vanilla armor file name under the mods namespace.
      Parameters:
      identifier - The namespace + path to use for the armor texture location.
      items - the items to be registered
    • getArmorModel

      @NotNull public static @NotNull net.minecraft.client.render.entity.model.BipedEntityModel<net.minecraft.entity.LivingEntity> getArmorModel(net.minecraft.entity.LivingEntity entity, net.minecraft.item.ItemStack stack, net.minecraft.entity.EquipmentSlot slot, net.minecraft.client.render.entity.model.BipedEntityModel<net.minecraft.entity.LivingEntity> defaultModel)
      Gets the model of the armor piece.
      Parameters:
      entity - The entity equipping the armor
      stack - The item stack of the armor
      slot - The slot which the armor is in
      defaultModel - The default model that vanilla provides
      Returns:
      The model of the armor piece.
    • getArmorTexture

      @NotNull public static @NotNull net.minecraft.util.Identifier getArmorTexture(net.minecraft.entity.LivingEntity entity, net.minecraft.item.ItemStack stack, net.minecraft.entity.EquipmentSlot slot, boolean secondLayer, @Nullable @Nullable String suffix, net.minecraft.util.Identifier defaultTexture)
      Gets the armor texture Identifier.
      Parameters:
      entity - The entity equipping the armor
      stack - The item stack of the armor
      slot - The slot which the armor is in
      secondLayer - True if using the second texture layer
      suffix - The texture suffix, used in vanilla by DyeableArmorItem
      defaultTexture - The default vanilla texture identifier
      Returns:
      the custom armor texture identifier, return null to use the vanilla ones. Defaulted to the item's registry id.