Package net.minecraft.item
Class SwordItem
java.lang.Object
net.minecraft.item.Item
net.minecraft.item.ToolItem
net.minecraft.item.SwordItem
- All Implemented Interfaces:
ItemConvertible,Vanishable
public class SwordItem extends ToolItem implements Vanishable
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings -
Field Summary
Fields Modifier and Type Field Description private floatattackDamageprivate Multimap<EntityAttribute,EntityAttributeModifier>attributeModifiersFields inherited from class net.minecraft.item.Item
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, group, RANDOM -
Constructor Summary
Constructors Constructor Description SwordItem(ToolMaterial toolMaterial, int attackDamage, float attackSpeed, Item.Settings settings) -
Method Summary
Modifier and Type Method Description booleancanMine(BlockState state, World world, BlockPos pos, PlayerEntity miner)Checks if a player can break a block while holding the item.floatgetAttackDamage()Multimap<EntityAttribute,EntityAttributeModifier>getAttributeModifiers(EquipmentSlot slot)floatgetMiningSpeedMultiplier(ItemStack stack, BlockState state)booleanisEffectiveOn(BlockState state)booleanpostHit(ItemStack stack, LivingEntity target, LivingEntity attacker)booleanpostMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner)Methods inherited from class net.minecraft.item.ToolItem
canRepair, getEnchantability, getMaterialMethods inherited from class net.minecraft.item.Item
appendStacks, appendTooltip, asItem, byRawId, damage, finishUsing, fromBlock, getDefaultStack, getDrinkSound, getEatSound, getFoodComponent, getGroup, getMaxCount, getMaxDamage, getMaxUseTime, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getTranslationKey, getTranslationKey, getUseAction, hasGlint, hasRecipeRemainder, inventoryTick, isDamageable, isEnchantable, isFireproof, isFood, isIn, isIn, isNetworkSynced, isUsedOnRelease, onCraft, onStoppedUsing, postProcessTag, raycast, shouldSyncTagToClient, toString, usageTick, use, useOnBlock, useOnEntity
-
Field Details
-
attackDamage
private final float attackDamage -
attributeModifiers
-
-
Constructor Details
-
SwordItem
public SwordItem(ToolMaterial toolMaterial, int attackDamage, float attackSpeed, Item.Settings settings)
-
-
Method Details
-
getAttackDamage
public float getAttackDamage() -
canMine
Checks if a player can break a block while holding the item. -
getMiningSpeedMultiplier
- Overrides:
getMiningSpeedMultiplierin classItem
-
postHit
-
postMine
public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) -
isEffectiveOn
- Overrides:
isEffectiveOnin classItem
-
getAttributeModifiers
public Multimap<EntityAttribute,EntityAttributeModifier> getAttributeModifiers(EquipmentSlot slot)- Overrides:
getAttributeModifiersin classItem
-