Package net.xun.armory.api.item.armor
Interface ArmorCustomizer
public interface ArmorCustomizer
Factory interface for creating custom armor items with specialized initialization logic.
Implementations of this interface provide fine-grained control over armor item creation,
allowing for custom armor classes, modified durability calculations, or additional
properties beyond the standard ArmorItem behavior. The DefaultArmorCustomizer.INSTANCE
serves as the default implementation producing standard armor items with vanilla durability calculation.
Usage Examples:
// Example 1: Fire-resistant armor with standard durability
ArmorCustomizer FIRE_RESISTANT = (type, material, factor, props) -> {
int durability = type.getArmorType().getDurability(factor);
return new ArmorItem(material, type.getArmorType(),
props.durability(durability).fireResistant());
};
// Example 2: Custom armor class with special behavior
ArmorCustomizer CUSTOM_CLASS = (type, material, factor, props) -> {
int durability = type.getArmorType().getDurability(factor);
return new CustomArmorItem(material, type.getArmorType(),
props.durability(durability), type.getEquipmentSlot());
};
// Example 3: Variable durability based on armor piece
ArmorCustomizer UNBALANCED = (type, material, factor, props) -> {
int durability = type.getArmorType().getDurability(factor);
// Helmets and boots receive additional durability
if (type == ArmorType.HELMET || type == ArmorType.BOOTS) {
durability += 100;
}
return new ArmorItem(material, type.getArmorType(),
props.durability(durability));
};
- Since:
- 1.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.ArmorItemcreateArmorItem(ArmorType type, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int durabilityFactor, net.minecraft.world.item.Item.Properties props) Creates a fully configured armor item instance of the specified type.
-
Method Details
-
createArmorItem
net.minecraft.world.item.ArmorItem createArmorItem(ArmorType type, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int durabilityFactor, net.minecraft.world.item.Item.Properties props) Creates a fully configured armor item instance of the specified type.Implementations are responsible for constructing the armor item with appropriate durability calculation and property configuration. The returned item should be ready for registration and use in-game.
Implementation Notes:- Durability calculation should typically use
type.getArmorType().getDurability(factor) - Properties may be modified but should not be shared between item instances
- The material holder provides armor statistics and enchantability
- Parameters:
type- the type of armor piece to create (helmet, chestplate, leggings, or boots)material- holder for the armor material defining protection values and toughnessdurabilityFactor- multiplier applied to the base material durabilityprops- base item properties (durability should be set by the implementation)- Returns:
- a fully configured armor item instance, never
null - Throws:
NullPointerException- iftype,material, orpropsisnullIllegalArgumentException- if the durability factor is negative or invalid- See Also:
- Durability calculation should typically use
-