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_WIDTHFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES - 
Constructor Summary
ConstructorsConstructorDescriptionSwordItem(Tier p_43269_, Item.Properties p_43272_) 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 Summary
Modifier and TypeMethodDescriptionbooleancanAttackBlock(BlockState p_43291_, Level p_43292_, BlockPos p_43293_, Player p_43294_) booleancanPerformAction(ItemStack stack, ToolAction toolAction) Queries if an item can perform the given action.static ItemAttributeModifierscreateAttributes(Tier p_330371_, float p_331976_, float p_332104_) Neo: Method overload to allow giving a float for damage instead of an int.static ItemAttributeModifierscreateAttributes(Tier p_330371_, int p_331976_, float p_332104_) static ToolbooleanhurtEnemy(ItemStack p_43278_, LivingEntity p_43279_, LivingEntity p_43280_) voidpostHurtEnemy(ItemStack p_345553_, LivingEntity p_345771_, LivingEntity p_346282_) Methods inherited from class net.minecraft.world.item.TieredItem
getEnchantmentValue, getTier, isValidRepairItemMethods 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, getRenderPropertiesInternal, 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, verifyComponentsAfterLoadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension
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, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation 
- 
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 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:
 canAttackBlockin classItem
 - 
hurtEnemy
 - 
postHurtEnemy
- Overrides:
 postHurtEnemyin classItem
 - 
canPerformAction
Description copied from interface:IItemExtensionQueries if an item can perform the given action. SeeToolActionsfor a description of each stock action- Parameters:
 stack- The stack being usedtoolAction- The action being queried- Returns:
 - True if the stack can perform the action
 
 
 -