Class ArmorRenderingRegistry
java.lang.Object
net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderingRegistry
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
-
Method Summary
Modifier and TypeMethodDescriptionstatic @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.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 String suffix, net.minecraft.util.Identifier defaultTexture)
Gets the armor textureIdentifier
.static void
registerModel(@Nullable ArmorRenderingRegistry.ModelProvider provider, Iterable<net.minecraft.item.Item> items)
Registers a provider for custom armor models for an item.static void
registerModel(@Nullable ArmorRenderingRegistry.ModelProvider provider, net.minecraft.item.Item... items)
Registers a provider for custom armor models for an item.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.static void
registerTexture(@Nullable ArmorRenderingRegistry.TextureProvider provider, Iterable<net.minecraft.item.Item> items)
Registers a provider for custom texture models for an item.static void
registerTexture(@Nullable ArmorRenderingRegistry.TextureProvider provider, net.minecraft.item.Item... items)
Registers a provider for custom texture models for an item.
-
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 modelitems
- 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 modelitems
- 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 textureitems
- 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 textureitems
- 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 armorstack
- The item stack of the armorslot
- The slot which the armor is indefaultModel
- 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 textureIdentifier
.- Parameters:
entity
- The entity equipping the armorstack
- The item stack of the armorslot
- The slot which the armor is insecondLayer
- True if using the second texture layersuffix
- The texture suffix, used in vanilla byDyeableArmorItem
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.
-