Class SwordItem

All Implemented Interfaces:
FeatureElement, ItemLike, IItemExtension

public class SwordItem extends TieredItem
  • Constructor Details

    • SwordItem

      public SwordItem(Tier tier, Item.Properties properties)
    • SwordItem

      public SwordItem(Tier p_tier, Item.Properties p_properties, Tool toolComponentData)
      Neo: Allow modded Swords to set exactly what Tool data component to use for their sword.
  • Method Details

    • createToolProperties

      public static Tool createToolProperties()
    • createAttributes

      public static ItemAttributeModifiers createAttributes(Tier tier, int attackDamage, float attackSpeed)
    • createAttributes

      public static ItemAttributeModifiers createAttributes(Tier p_330371_, float p_331976_, float p_332104_)
      Neo: Method overload to allow giving a float for damage instead of an int.
    • canAttackBlock

      public boolean canAttackBlock(BlockState state, Level level, BlockPos pos, Player player)
      Overrides:
      canAttackBlock in class Item
    • hurtEnemy

      public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker)
      Current implementations of this method in child classes do not use the entry argument beside ev. They just raise the damage on the stack.
      Overrides:
      hurtEnemy in class Item
    • postHurtEnemy

      public void postHurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker)
      Overrides:
      postHurtEnemy in class Item
    • canPerformAction

      public boolean canPerformAction(ItemStack stack, ItemAbility itemAbility)
      Description copied from interface: IItemExtension
      Queries if an item can perform the given action. See ItemAbilities for a description of each stock action
      Parameters:
      stack - The stack being used
      itemAbility - The action being queried
      Returns:
      True if the stack can perform the action