Class SwordItem

java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.SwordItem
All Implemented Interfaces:
FeatureElement, ItemLike, IItemExtension

public class SwordItem extends Item
  • Constructor Details

    • SwordItem

      public SwordItem(ToolMaterial pMaterial, float pAttackDamage, float pAttackSpeed, Item.Properties pProperties)
    • SwordItem

      public SwordItem(Item.Properties properties)
      Neo: Allow modded Swords to set exactly what properties to use for their sword.
  • Method Details

    • 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 p_345553_, LivingEntity p_345771_, LivingEntity p_346282_)
      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