Package net.minecraft.world.item
Class SwordItem
java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.TieredItem
net.minecraft.world.item.SwordItem
- All Implemented Interfaces:
FeatureElement
,ItemLike
,IItemExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.Item
Item.Properties, Item.TooltipContext
-
Field Summary
Fields inherited from class net.minecraft.world.item.Item
ABSOLUTE_MAX_STACK_SIZE, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, canRepair, DEFAULT_MAX_STACK_SIZE, MAX_BAR_WIDTH
Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES
-
Constructor Summary
ConstructorsConstructorDescriptionSwordItem
(Tier pTier, Item.Properties pProperties) 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 Summary
Modifier and TypeMethodDescriptionboolean
canAttackBlock
(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer) boolean
canPerformAction
(ItemStack stack, ItemAbility itemAbility) Queries if an item can perform the given action.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.static ItemAttributeModifiers
createAttributes
(Tier pTier, int pAttackDamage, float pAttackSpeed) static Tool
boolean
hurtEnemy
(ItemStack pStack, LivingEntity pTarget, LivingEntity pAttacker) Current implementations of this method in child classes do not use the entry argument beside ev.void
postHurtEnemy
(ItemStack pStack, LivingEntity pTarget, LivingEntity pAttacker) Methods inherited from class net.minecraft.world.item.TieredItem
getEnchantmentValue, getTier, isValidRepairItem
Methods inherited from class net.minecraft.world.item.Item
appendHoverText, asItem, builtInRegistryHolder, byBlock, byId, canFitInsideContainerItems, components, finishUsingItem, getAttackDamageBonus, getBarColor, getBarWidth, getBreakingSound, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDefaultMaxStackSize, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getId, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEnchantable, isFoil, isRepairable, mineBlock, modifyDefaultComponentsFrom, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, releaseUsing, requiredFeatures, toString, use, useOn, useOnRelease, verifyComponentsAfterLoad
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabled
Methods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension
applyEnchantments, canBeHurtBy, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultAttributeModifiers, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, isBookEnchantable, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, isPrimaryItemFor, makesPiglinsNeutral, onAnimalArmorTick, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onEntitySwing, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation, supportsEnchantment
-
Constructor Details
-
SwordItem
-
SwordItem
Neo: Allow modded Swords to set exactly what Tool data component to use for their sword.
-
-
Method Details
-
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
- Overrides:
canAttackBlock
in classItem
-
hurtEnemy
Current implementations of this method in child classes do not use the entry argument beside ev. They just raise the damage on the stack. -
postHurtEnemy
- Overrides:
postHurtEnemy
in classItem
-
canPerformAction
Description copied from interface:IItemExtension
Queries if an item can perform the given action. SeeItemAbilities
for a description of each stock action- Parameters:
stack
- The stack being useditemAbility
- The action being queried- Returns:
- True if the stack can perform the action
-