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 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 TypeMethodDescriptionbooleancanAttackBlock(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer) booleancanPerformAction(ItemStack stack, ItemAbility itemAbility) 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 pTier, int pAttackDamage, float pAttackSpeed) static ToolbooleanhurtEnemy(ItemStack pStack, LivingEntity pTarget, LivingEntity pAttacker) Current implementations of this method in child classes do not use the entry argument beside ev.voidpostHurtEnemy(ItemStack pStack, LivingEntity pTarget, LivingEntity pAttacker) 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, 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
applyEnchantments, canBeHurtBy, canContinueUsing, canDisableShield, canElytraFly, canEquip, canFitInsideContainerItems, 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:
canAttackBlockin 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:
postHurtEnemyin classItem
-
canPerformAction
Description copied from interface:IItemExtensionQueries if an item can perform the given action. SeeItemAbilitiesfor 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
-