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
,Vanishable
,ItemLike
,IForgeItem
- Direct Known Subclasses:
PlayerAttackKnockbackTest.KnockbackSwordItem
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.Item
Item.Properties
-
Field Summary
Modifier and TypeFieldDescriptionprivate final float
private final com.google.common.collect.Multimap<Attribute,
AttributeModifier> Fields inherited from class net.minecraft.world.item.Item
BASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, canRepair, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZE
Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES
-
Constructor Summary
ConstructorDescriptionSwordItem
(Tier p_43269_, int p_43270_, float p_43271_, Item.Properties p_43272_) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canAttackBlock
(BlockState p_43291_, Level p_43292_, BlockPos p_43293_, Player p_43294_) boolean
canPerformAction
(ItemStack stack, ToolAction toolAction) Queries if an item can perform the given action.float
com.google.common.collect.Multimap<Attribute,
AttributeModifier> getDefaultAttributeModifiers
(EquipmentSlot p_43274_) float
getDestroySpeed
(ItemStack p_43288_, BlockState p_43289_) boolean
hurtEnemy
(ItemStack p_43278_, LivingEntity p_43279_, LivingEntity p_43280_) boolean
isCorrectToolForDrops
(BlockState p_43298_) boolean
mineBlock
(ItemStack p_43282_, Level p_43283_, BlockState p_43284_, BlockPos p_43285_, LivingEntity p_43286_) 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, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, finishUsingItem, getBarColor, getBarWidth, getCraftingRemainingItem, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDrinkingSound, getEatingSound, getEquipSound, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getRenderPropertiesInternal, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isEdible, isEnchantable, isFireResistant, isFoil, isRepairable, onCraftedBy, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, releaseUsing, requiredFeatures, shouldOverrideMultiplayerNbt, toString, use, useOn, useOnRelease, verifyTagAfterLoad
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.minecraftforge.common.extensions.IForgeItem
canApplyAtEnchantingTable, canContinueUsing, canDisableShield, canElytraFly, canEquip, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getAttributeModifiers, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultTooltipHideFlags, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getShareTag, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, initCapabilities, isBookEnchantable, isCorrectToolForDrops, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onItemUseFirst, onLeftClickEntity, onUsingTick, readShareTag, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
-
Field Details
-
attackDamage
private final float attackDamage -
defaultModifiers
-
-
Constructor Details
-
SwordItem
-
-
Method Details
-
getDamage
public float getDamage() -
canAttackBlock
public boolean canAttackBlock(BlockState p_43291_, Level p_43292_, BlockPos p_43293_, Player p_43294_) - Overrides:
canAttackBlock
in classItem
-
getDestroySpeed
- Overrides:
getDestroySpeed
in classItem
-
hurtEnemy
-
mineBlock
public boolean mineBlock(ItemStack p_43282_, Level p_43283_, BlockState p_43284_, BlockPos p_43285_, LivingEntity p_43286_) -
isCorrectToolForDrops
- Overrides:
isCorrectToolForDrops
in classItem
-
getDefaultAttributeModifiers
public com.google.common.collect.Multimap<Attribute,AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot p_43274_) - Overrides:
getDefaultAttributeModifiers
in classItem
-
canPerformAction
Description copied from interface:IForgeItem
Queries if an item can perform the given action. SeeToolActions
for a description of each stock action- Specified by:
canPerformAction
in interfaceIForgeItem
- Parameters:
stack
- The stack being usedtoolAction
- The action being queried- Returns:
- True if the stack can perform the action
-