Class SwordItem

All Implemented Interfaces:
FeatureElement, ItemLike, IItemExtension

public class SwordItem extends TieredItem
  • Constructor Details

    • SwordItem

      public SwordItem(Tier pTier, Item.Properties pProperties)
    • SwordItem

      public SwordItem(Tier pTier, Item.Properties pProperties, 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 pTier, int pAttackDamage, float pAttackSpeed)
    • 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 pState, Level pLevel, BlockPos pPos, Player pPlayer)
      Overrides:
      canAttackBlock in class Item
    • hurtEnemy

      public boolean hurtEnemy(ItemStack pStack, LivingEntity pTarget, LivingEntity pAttacker)
      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 pStack, LivingEntity pTarget, LivingEntity pAttacker)
      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