Class SwordItem

All Implemented Interfaces:
FeatureElement, ItemLike, IItemExtension

public class SwordItem extends TieredItem
  • Constructor Details

    • SwordItem

      public SwordItem(Tier p_43269_, Item.Properties p_43272_)
    • SwordItem

      public SwordItem(Tier tier, Item.Properties 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 p_330371_, int p_331976_, float p_332104_)
    • 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 p_43291_, Level p_43292_, BlockPos p_43293_, Player p_43294_)
      Overrides:
      canAttackBlock in class Item
    • hurtEnemy

      public boolean hurtEnemy(ItemStack p_43278_, LivingEntity p_43279_, LivingEntity p_43280_)
      Overrides:
      hurtEnemy in class Item
    • postHurtEnemy

      public void postHurtEnemy(ItemStack p_345553_, LivingEntity p_345771_, LivingEntity p_346282_)
      Overrides:
      postHurtEnemy in class Item
    • canPerformAction

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