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
FieldsModifier and TypeFieldDescriptionprivate final floatprivate 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_SIZEFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
ConstructorsConstructorDescriptionSwordItem(Tier p_43269_, int p_43270_, float p_43271_, Item.Properties p_43272_) -
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.floatcom.google.common.collect.Multimap<Attribute,AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot p_43274_) floatgetDestroySpeed(ItemStack p_43288_, BlockState p_43289_) booleanhurtEnemy(ItemStack p_43278_, LivingEntity p_43279_, LivingEntity p_43280_) booleanisCorrectToolForDrops(BlockState p_43298_) booleanmineBlock(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, isValidRepairItemMethods 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, verifyTagAfterLoadMethods 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.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:
canAttackBlockin classItem
-
getDestroySpeed
- Overrides:
getDestroySpeedin classItem
-
hurtEnemy
-
mineBlock
public boolean mineBlock(ItemStack p_43282_, Level p_43283_, BlockState p_43284_, BlockPos p_43285_, LivingEntity p_43286_) -
isCorrectToolForDrops
- Overrides:
isCorrectToolForDropsin classItem
-
getDefaultAttributeModifiers
public com.google.common.collect.Multimap<Attribute,AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot p_43274_) - Overrides:
getDefaultAttributeModifiersin classItem
-
canPerformAction
Description copied from interface:IForgeItemQueries if an item can perform the given action. SeeToolActionsfor a description of each stock action- Specified by:
canPerformActionin interfaceIForgeItem- Parameters:
stack- The stack being usedtoolAction- The action being queried- Returns:
- True if the stack can perform the action
-