Interface AttributeHelper

All Known Implementing Classes:
GenericAttributeHelper

public interface AttributeHelper
Defines a strategy for applying combat attribute modifiers to tool items.

Implementations of this interface enhance item properties with combat attributes such as attack damage and attack speed. This abstraction allows for different attribute application strategies across various modding environments or attribute systems, while maintaining compatibility with Minecraft's attribute system.

Common Implementations:

  • GenericAttributeHelper: Standard implementation using Minecraft's attribute modifier system
  • Custom implementations for specialized mod environments or alternative attribute systems
Since:
1.0.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.item.Item.Properties
    applyAttributes(net.minecraft.world.item.Item.Properties properties, float damage, float speed)
    Applies combat attributes to tool item properties.
  • Method Details

    • applyAttributes

      net.minecraft.world.item.Item.Properties applyAttributes(net.minecraft.world.item.Item.Properties properties, float damage, float speed)
      Applies combat attributes to tool item properties.

      This method enhances the provided item properties with the specified attack damage and speed values. The exact implementation may vary: some may use Minecraft's attribute modifier system, while others might apply custom NBT data or alternative attribute systems.

      Implementation Notes:
      • The returned Item.Properties should be a modified copy or enhanced version of the input
      • Implementations must not mutate the input properties directly
      • The method should handle any necessary attribute registration or validation
      Parameters:
      properties - initial item properties to enhance, never null
      damage - total attack damage value (including tier base damage)
      speed - attack speed value
      Returns:
      enhanced item properties with combat attributes applied, never null
      Throws:
      NullPointerException - if properties is null
      IllegalArgumentException - if attribute values are outside acceptable ranges for the implementation