Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Melee attack

From SAS Gaming Wiki

Template:For

File:Melee attack.gif
An example of a melee attack.

A melee attack is a type of Minecraft:attack that mobs and players use to cause damage through close contact with a target.

Attack damage

All entities have a base melee attack damage. The final attack damage calculation includes the mob's base attack damage, main hand item damage, and Minecraft:status effects.

Base value

Java Edition

Template:IN, base melee attack damage is the computed value of the Minecraft:attribute attack_damage. The damage from the main hand item and status effects are essentially Op0 attribute modifiers. Using the Template:Cmd command to modify the base value or modifiers can change the base melee attack damage for the corresponding entity. For example, the base melee attack damage of a player holding a wooden sword with the Strength II effect would be calculated as:

  1 (Player base attack value)
+ 3 (Wooden sword damage, Op0 modifier, value 3)
+ 6 (Strength II effect, Op0 modifier, value 6)
= 10

The attack damage of the main hand items is shown in the table below (including the player's Template:Hp base attack value, matching the value displayed in the tooltip):

Item Attack damage
Minecraft:Sword Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Axe Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Spear Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Pickaxe Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Shovel Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Hoe Template:ItemSprite Template:ItemSprite Template:ItemSprite Template:ItemSprite Template:ItemSprite Template:ItemSprite Template:ItemSprite Template:Hp
Minecraft:Trident Template:ItemSprite Template:Hp
Minecraft:Mace Template:ItemSprite Template:Hp
Other Items Template:Hp

The Minecraft:Strength status effect increases attack damage by Template:Hp per level, while the Minecraft:Weakness effect reduces it by Template:Hp per level.

Bedrock Edition

Template:IN, the base melee attack damage is calculated differently for different entities:

For Minecraft:players, the calculation sequence for base melee attack damage is as follows:

  1. Get the player's base attack value.
  2. Add the main hand item damage.
  3. Calculate the Strength status effect.
  4. Calculate the Weakness status effect.

For example, the base melee attack damage of a player holding a wooden sword with both Strength II and Weakness I effects would be calculated as:

1 (Player base attack value) + 4 (Wooden sword damage) = 5
(5 × 1.3 + 1) × 1.3 + 1 = 10.75 (Strength II)
10.75 × 0.8 - 0.5 = 8.1 (Weakness I)

For most non-player entities, the calculation sequence for base melee attack damage is as follows:

  1. Get the mob's base attack value.
  2. Calculate the Strength status effect.
  3. Calculate the Weakness status effect.
  4. Add the main hand item damage.

For example, the base melee attack damage of a Minecraft:zombie holding a wooden sword with both Strength II and Weakness I effects would be calculated as:

3 (Zombie base attack value)
(3 × 1.3 + 1) × 1.3 + 1 = 7.37 (Strength II)
7.37 × 0.8 - 0.5 = 5.396 (Weakness I)
5.396 + 4 (Wooden sword damage) = 9.396

The attack damage of the main hand items is shown in the table below (including the player's Template:Hp base attack value, so the values are 1 higher than what is displayed in the tooltip):

Item Attack damage
Minecraft:Sword Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Axe Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Spear Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Pickaxe Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Shovel Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Hoe Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp Template:ItemSprite Template:Hp
Minecraft:Trident Template:ItemSprite Template:Hp
Minecraft:Mace Template:ItemSprite Template:Hp
Other Items Template:Hp

The Strength status effect can be calculated using the recursive formula <math>d_n=1.3d_{n-1}+1</math> or the general formula <math>d_n=1.3^nd_0+\frac{1.3^n-1}{0.3}</math>, where <math>d_0</math> is the input attack damage, <math>d_n</math> is the output attack damage, and <math>n</math> is the level of the Strength status effect.

The Weakness status effect can be calculated using the recursive formula <math>d_n=0.8d_{n-1}-0.5</math> or the general formula <math>d_n=0.8^nd_0+\frac{0.8^n-1}{0.4}</math>, where <math>d_0</math> is the input attack damage, <math>d_n</math> is the output attack damage, and <math>n</math> is the level of the Weakness status effect. If the result is less than 0, the output attack damage is 0.

Enchanted values

The Minecraft:enchantments on items in the main hand will affect attack damage, referred to here as enchantment attack damage.

For different entities, enchantments have different attack damage:

The total of all enchantment attack damage is the current enchantment attack damage. Template:IN, enchantment attack damage is rounded down after summing, so if Sharpness I and Smite I are both active, the enchantment attack damage would be Template:Hp instead of Template:Hp.

Bonus attack damage

Template:See also After calculating the base melee attack damage and enchantment attack damage, the game also determines whether to add a bonus attack damage based on the nature of the current main hand item and the state of the attacked entity. Currently, only Minecraft:mace has bonus attack damage.

The bonus attack damage of the mace only takes effect when the entity falls from a height greater than 1.5 blocks and not glidingTemplate:Only, with the bonus attack damage adjusted according to the fall height:

  • If the fall height f is greater than 1.5 blocks but not more than 3 blocks, the bonus attack damage is <math>4f</math>.
  • If the fall height f is greater than 3 blocks but not more than 8 blocks, the bonus attack damage is <math>2f+6</math>.
  • If the fall height f is greater than 8 blocks, the bonus attack damage is <math>f+14</math>.
  • If the mace has the Minecraft:density enchantment and the enchantment level is I, an additional <math>0.5lf</math> bonus attack damage is added according to the fall height f.

Attack cooldown

File:Weapon attack speed comparison.gif
All of the different attack speed values from slowest to fastest.

Template:Exclusive

File:AttackIndicatorCrosshair.png
Attack indicator (below the crosshair), empty and full.
File:AttackIndicatorHotbar.png
Attack indicator (next to the hotbar), empty and full

The attack cooldown is a meter below the crosshair that reduces damage when attacking before the meter is full. An attack cooldown percentage of 84.8% or above is also required for critical hits, sprint-knockback attacks, and sweep attacks to activate. The indicator can be optionally changed to display next to the hotbar instead of under the crosshair in Minecraft:Video Settings.

Attack speed is controlled by the attack_speed attribute. The default value is 4, meaning that 4 full-damage melee attacks can be performed per Template:Convert, however Minecraft:damage immunity allows only 2 of these attacks to connect against a single target. The Minecraft:Haste effect increases attack speed by 10% per level, and the Minecraft:Mining Fatigue effect decreases it by 10% per level. Minecraft:Spear jab attacks specifically have a forced attack cooldown, meaning they cannot attack at all until they reach 100% cooldown charge.

Tools and weapons have different attack speeds that replace the base value of 4 when held in the mainhand. The following table lists all attack speeds from fastest to slowest:

Item attack speeds
Item type Attack speed
Value In seconds In ticks
Template:EntitySpriteTemplate:ItemSpriteTemplate:ItemSprite 4 0.25 seconds 5 ticks
Template:ItemSprite 3 0.333 seconds 6 ticks
Template:ItemSpriteTemplate:ItemSprite 2 0.5 seconds 10 ticks
Template:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSprite 1.6 0.625 seconds 12 ticks
Template:ItemSprite 1.54 0.65 seconds 12 ticks
Template:ItemSprite 1.33 0.75 seconds 15 ticks
Template:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSprite 1.2 0.833 seconds 16 ticks
Template:ItemSprite 1.18 0.85 seconds 16 ticks
Template:ItemSprite 1.1 0.909 seconds 18 ticks
Template:ItemSpriteTemplate:ItemSprite 1.05 0.95 seconds 19 ticks
Template:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSpriteTemplate:ItemSprite 1 1 second 20 ticks
Template:ItemSprite 0.95 1.05 seconds 21 ticks
Template:ItemSprite 0.9 1.111 seconds 22 ticks
Template:ItemSprite 0.87 1.15 seconds 22 ticks
Template:ItemSpriteTemplate:ItemSpriteTemplate:ItemSprite 0.8 1.25 seconds 25 ticks
Template:ItemSprite 0.6 1.667 seconds 33 ticks

The time from one melee attack, breaking a block, or switching the main-hand item to the next melee attack that can deal full damage is called the attack cooldown time. The ratio of the time elapsed since the above actions to the total attack cooldown time is the attack cooldown completion. The number of full-damage melee attacks a player can perform per Template:Convert is the attack speed.

Attack cooldown time can be calculated from attack speed. If the attack speed is <math>s</math>, the attack cooldown time <math>T</math> is <math>\frac{20}{s}</math> game ticks. Since game ticks do not have decimal values, the actual attack cooldown time is rounded: if the decimal part is greater than 0.5, it is rounded up; otherwise, it is rounded down.

Attack cooldown completion can also be calculated from these values. If the time since the last melee attack, block break, or main-hand item switch is <math>t</math> game ticks, then the attack cooldown completion <math>p</math> is <math>\text{clamp}(\frac{t+0.5}{T}, 0, 1)</math>. The visual component related to attack cooldown completion is the attack indicator, which has a slight difference in rendering percentage compared to the actual attack cooldown completion: <math>\text{clamp}(\frac{t}{T}, 0, 1)</math>, meaning the displayed value lags by half a game tick.

Attack cooldown affects base melee attack damage, enchanted attack damage, and additional attack damage differently. Given attack cooldown completion <math>p</math>, the base melee attack damage is modified by <math>0.2+0.8p^2</math>, the enchanted attack damage by <math>p</math>, while additional attack damage remains unaffected. The effect on base melee attack damage can stack with critical hits.

Calculator

Template:Calculator

Attack range

File:Weapon reach comparison.gif
The attack range of other weapons (3 blocks) compared to the spear (4.5 blocks).

Template:Main The reach in blocks of a given player attack is dependent on the player's weapon, and is controlled by the Template:Attr attribute. If the target is outside the reach of the attack range, the melee attack does not connect. For entities, it is instead dependent on the entity's attack bounding box.

Spear attacks

For both players using the jab or charge attacks of the Minecraft:spear and any entity that can use the spear's charge attacks, targets within range are selected by first attempting to find an obstructing block for the attack, which will then become the maximum range, then trying to find all entities within a bounding box representing the range that are directly between the maximum and minimum range (assuming no block intersections, 1-2.25 blocks for most entities, and 2-4.5 blocks for players) in the direction of the view vector (with inflated hitboxes of 0.125 blocks, effectively decreasing minimum range and increasing maximum range by that amount).

Player attacks

For players, the attack range is the range they can physically reach with an attack. The default attack range is 3 (3 blocks). Template:IN, attack range is dependent on the attack_range data component. When in Creative Mode, the attack range increases to 5 blocks when holding any item except a spear, while spears do not change their attack range in Creative Mode.

When Template:Attr and Template:Cd are set to different values, Template:Cd takes priority.

Entity attacks

For most entities, the attack range is defined as a horizontally extended area beyond their collision box, referred to below as the attack bounding box. Similarly, the attacked entity has a range within which it can be struck, referred to as the hit bounding box. A melee attack can occur when the attack bounding box intersects with the hit bounding box. Entities performing melee attacks must also maintain a clear line of sight to the attacked entity, preventing attacks through blocks. Since entities cannot see themselves, they cannot perform melee attacks on themselves. In Minecraft:Mounts of Mayhem, there is a second minimum bounding box representing the minimum reach of the entity, which will prevent the attacker from attacking the attacked entity if it is within its range.

The attack bounding boxes for an entity are obtained for the entity's minimum range (if non-zero) and maximum range boxes as follows: <ref group="note">If holding an item without the "minecraft:attack_range" Minecraft:data component, maximum range is <math>\sqrt{2.04}-0.6</math> (approximately 0.828 blocks).</ref>

  • Get the entity's collision box. If the entity is Minecraft:riding another entity, use the collision bounding box of both entities, with the height range taken from the entity's collision box.
  • Expand the collision box by the reach for this box (either minimum or maximum).
  • If the entity is a Minecraft:ravager, reduce the attack bounding box by 0.05 blocks horizontally.

The hit bounding box is calculated as follows:

  • If the entity is not riding another entity, the hit bounding box is the entity's collision box.
  • If the entity is riding another entity, the lowest point of the hit bounding box is set to the higher of the entity's collision box bottom and the riding position of the entity.

Attack knockback

Template:Main When melee attack damage is dealt, the attacked entity will be pushed backward; this is knockback. The horizontal direction of knockback aligns with the attacker's viewpoint. The knockback of an attack is dependent on the player's weapon, and is controlled by the attack knockback attribute.

The magnitude of knockback depends on whether the attacker is sprinting and the item in their main hand. This is described using knockback strength. Knockback strength is 0 by default. If the main-hand item has the Minecraft:knockback enchantment, the knockback strength increases by the enchantment's level.

Template:IN, only players can knock back non-living entities. Knockback strength determines the knockback speed, which is half of the knockback strength. If the target of the knockback is a non-living entity, it receives a vertical motion of 0.1 blocks per tick (2 blocks per second) and a horizontal knockback speed. If the target is a living entity, the knockback speed is reduced based on its knockback resistance (attribute knockback_resistance). If the knockback resistance is 1, knockback does not occur. Next, the entity's horizontal movement speed is halved, and knockback speed is applied. If the entity is touching the ground, its vertical speed is also halved, and upward knockback speed is applied. However, the final vertical speed does not exceed 0.4 blocks per tick (8 blocks per second). After knockback occurs, the attacking entity immediately stops sprinting, and their horizontal speed is reduced to 60% of its original value.

Hitbox margin

File:Spear hitbox inflation.gif
The 0.125 hitbox margin on spears.

The hitbox margin increases the distance at which an entity can still be hit when attacking outside of its hitbox. In vanilla this mechanic is only used by spears, with both their jab attack and charge attack having a hitbox margin of 0.125. All other items have a hitbox margin of 0. It is controlled by the attack_range component's hitbox_margin field, and the default value is 0.3 (this value in practice is only used if the component is included but no value is given, as if the component is not included the default value is 0).

Special attacks

Melee attacks can be special attacks<ref>Template:Reddit</ref> when meeting certain conditions:

Critical hit

File:Sword critical hit.gif
Performing a critical hit.

Template:For All weapons aside from Minecraft:spears have the ability to do critical hits, which deal 50% extra damage.

To perform a critical hit, the following conditions must be met:

Template:IN, critical hits increase damage before calculating damage enchantments, while Template:In they increase damage after calculating damage enchantments. When a critical hit is successfully performed, small star-shaped particles will burst out of the hit entity, and a unique sound effect is played. The Minecraft:ender dragon is immune to critical hits in Java Edition.

Sprint-knockback attack

File:Sword sprint knockback attack.gif
Performing a sprint-knockback attack.

Template:Main All weapons aside from spears have the ability to do Minecraft:sprint-knockback attacks, which deal extra knockback while sprinting and cancel the sprint. Template:IN, sprint-knockback attacks play a unique sound when performed, and they require an attack cooldown charge of at least 84.8%. Minecraft:Spears are the only item type that cannot do sprint-knockback attacks.

In Template:JE, sprint-knockback attacks cannot be performed at the same time as critical hits or sweep attacks. If a sprint-knockback attack is performed at the same time as a critical hit, the sprint-knockback attack takes priority. They can however be performed at the same time as Minecraft:smash attacks and Minecraft:crushing blows.

The extra inflicted knockback stacks with the Minecraft:Knockback enchantment. Like the Knockback enchantment, sprint-knockback attacks do not increase knockback against entities that are immune to knockback, such as Minecraft:iron golems or shielding Minecraft:players. The only exceptions to this are Minecraft:armor stands and Minecraft:boats, which ordinarily do not take knockback when hit but do when hit by a sprint-knockback attack.

Sweep attack

File:Sword sweep attack.gif
Performing a sweep attack.

Template:Exclusive Template:Main Minecraft:Swords have the special ability to do Minecraft:sweep attacks, which damage nearby entities with a gale particle.

A sweep attack occurs only if all of the following conditions are met:

  • The attack cooldown percentage is at 84.8% or above.
  • The player is not performing a critical hit.
  • The player is not performing a sprint-knockback attack.
  • The player is on the ground, meaning they must be standing on any solid surface.
  • The player's mainhand weapon is a sword.
  • The melee attack is able to do damage.
  • The difference in movement distance between the current game tick and the previous tick does not exceed the movement_speed attribute value (default: 0.1 blocks per tick, or 2 blocks per second).

The range of a sweep attack is determined by both the attacked entity and the player's position. Based on the attacked entity's collision box, the range extends 1 block horizontally in all directions and 0.25 blocks vertically both up and down. All entities within 3 blocks of the player (excluding the attacking player themselves, the primary attacked entity, and Minecraft:armor stands with the Template:Nbt tag set to true) will be affected by the sweep attack.

By default, a sweep attack deals Template:Hp damage. However, this damage can be increased using the Sweeping Damage Ratio Minecraft:attribute. If the calculated value of sweeping_damage_ratio is r, and the sum of base melee attack damage and additional attack damage is d, the sweep attack damage is calculated as <math>1+rd</math>.

Sweeping damage ratio

The Minecraft:Sweeping Edge enchantment increases the sweeping damage ratio attribute, which increases the damage of the sweep attack damage to entities close to the attacked entity, but not the attacked entity itself. If the level of Sweeping Edge is n, then the Sweeping Damage Ratio increases by <math>\frac{nd}{n+1}</math>. By default, Sweeping Edge I, II, and III increase sweep attack damage by 50%, 67%, and 75% of the base melee attack damage plus additional attack damage, respectively.

Similar to melee attacks, sweep attacks also apply knockback. However, knockback from sweep attacks is not affected by the knockback enchantment or sprinting. If the affected entity has 0 knockback resistance, the sweep attack applies a knockback speed of 0.4 blocks per tick.

Crushing blow

File:Crushing blow (inflicting).gif
Performing a crushing blow.
File:Crushing blow (receiving).gif
Being hit by a crushing blow.

Minecraft:Axes have the special ability to do crushing blows<ref>Template:Citation</ref>, which disable the use of the target's shield for 5 seconds. Crushing blows are triggered only against targets that are actively holding their shield up.

Crushing blows affect all of the target's shields, rather than affecting only the one that was being used. Crushing blows do not trigger against targets whose shields are not yet past their 250ms activation delay. Crushing blows are triggered regardless of attack cooldown percentage and, unlike sweep attacks, they can be triggered at the same time as critical hits and sprint-knockback attacks.

Crushing blows work by inflicting a 5 second Minecraft:use cooldown. When a shield is stunned, it cannot be used by pressing the Template:Ctrl buttonTemplate:Only or Template:Ctrl Template:Only. Performing a crushing blow does not consume durability from the axe, in the same way that other attacks do not consume durability when they're blocked by a shield.

Minecraft:Mobs that wield axes, such as Minecraft:vindicators or Minecraft:piglin brutes, perform crushing blows should they hit a player's shield. The melee attack of a Minecraft:warden also performs a crushing blow should it connect against a player's shield.

In the Minecraft:Java Edition Combat Tests, the stun duration from crushing blows is lengthened by the Minecraft:Cleaving Minecraft:enchantment, at an additional 0.5 seconds per level with a maximum level of III.

Smash attack

File:Mace wind charge.gif
Performing a smash attack.

Template:Main Minecraft:Maces have the special ability to do Minecraft:smash attacks, which cause extra damage depending on how many blocks were fallen prior to attacking. Connecting a smash attack clears all fall damage that was accumulated prior to the attack. All entities within 2.5 blocks of the smash attack are knocked back. Like crushing blows, smash attacks are triggered regardless of attack cooldown percentage,<ref>Template:Cite bug</ref> and can be triggered at the same time as critical hits and sprint-knockback attacks. Smash attacks trigger the Minecraft:Wind Burst enchantment.

To perform a smash attack, the player must not be grounded or in elytra flight, and the fall height used in calculation is simply the starting height (Y coordinate) minus the ending height (Y coordinate). Descending with an Minecraft:elytra counts as blocks fallen for smash attacks.<ref>Template:Cite bug</ref> In Template:JE, the elytra must be unequipped before attacking for the smash attack to activate, as being in elytra flight does not activate a smash attack.<ref name="mace-elytra">Template:Cite bug</ref> In Template:BE, unequipping the elytra before attacking is not necessary, as smash attacks activate even while the user is in elytra flight.<ref>Template:Cite bug</ref>

A successful smash attack causes a mace to deal Template:Hp extra damage for each of the first 3 blocks fallen, Template:Hp extra damage for each of the next 5 blocks fallen, and Template:Hp extra damage for each block fallen after that. The damage of smash attacks is increased by the Minecraft:Density enchantment by an additional Template:Hp for each block fallen per level of enchantment, at a maximum level of V.

Template:Calculator

Jab attack

Template:Main Minecraft:Spears have the special ability to do Minecraft:jab attacks, which have 4.5 blocks of reach rather than the typical 3 blocks, can hit multiple entities with a single attack, and inflate the hitboxes of targets by 0.125 making attacks easier to land. Jab attacks have a minimum reach requirement however, where they cannot connect hits if the target is within 2 blocks or less of the user. Jab attacks have a forced cooldown effect that cannot be bypassed:

  • In Template:JE, they use a variant of the attack cooldown where attacking is not possible until 100% charge, unlike other weapons.
  • In Template:BE, they instead have a Minecraft:use cooldown like that of an Minecraft:ender pearl, creating a similar forced-cooldown effect. The use cooldown triggers for all spear tiers in the inventory, not only the tier that was jabbed with.

A spear can still perform a charge attack while the jab attack is on cooldown, and thus by alternating between jab attacks and charge attacks the rate of attacks can be effectively doubled. Attacking with a jab attack and then following it up with a charge attack causes the charge attack to do less damage depending on the attack cooldown percentage of the prior jab attack.

Charge attack

Template:Main Spears have the special ability to do Minecraft:charge attacks by holding the Template:Ctrl button, which deal extra damage depending on the velocity of the user and the target. Like jab attacks, charge attacks have a 4.5 block attack reach, 0.125 hitbox inflation, and the 2 block minimum reach requirement, but do not have any sort of cooldown. Charge attacks can hit multiple entities, but only once for each entity.

Charge attacks can still deal damage while the user is standing still, if the target is moving towards the user. The damage done by the charge attack is its damage multiplier multiplied by the velocity of the attacker relative to the target in blocks per second. Charge attacks go through three stages when held out, and the Minecraft:tier of the spear influences the behavior of its charge attacks:

  • Engaged
  • Tired
    • The second state of a charge attack, indicated by the spear rotating sideways and shaking.
    • The attack deals damage and inflicts knockback.
  • Disengaged
    • The final state of a charge attack, indicated by the spear being lowered down to the bottom of the screen.
    • The attack only deals damage.

Calculators/Spear damage

Attack scenario

Melee attacks apply mob's base melee attack damage and deal damage to the target entity in mob_attack damage type. Most mobs perform one melee attack per second, targeting a single intended target for the melee attack, without accidentally harming other targets.

Some mobs melee attack in a different way and have special effects:

Attack resolution and attack failure

When performing a melee attack, the game first calculates the attack damage the attacker can deal, then applies damage to the attacked entity and attempts to disable the Minecraft:shield. After damage is dealt, it calculates knockback, sweep attackTemplate:Only, and Minecraft:Fire Aspect, processes the Minecraft:Thorns enchantment's reflected damage, applies Minecraft:Slowness effect by the Minecraft:Bane of Arthropods to arthropods, and may generate critical hit particles. Finally, the player's Minecraft:exhaustion increases by 0.1 per successful melee attack.

Melee attacks can fail, and failed melee attacks do not deal damage.

  • If an entity's base melee attack damage is Template:Hp and enchanted attack damage is Template:Hp, the melee attack always fails, making no sound and triggering no damage event. This also prevents players from damaging Minecraft:End crystals and Minecraft:armor stands with melee attacks in such cases.
  • If an entity can deal more than Template:Hp damage but the attacked entity is immune to this damage or is in a dying state, the melee attack fails, producing a special sound different from a successful melee attack.
  • If an entity's attack damage is not greater than the last damage of the attacked entity's Minecraft:damage immunity, the melee attack fails, producing a distinct sound.
  • In all other cases, a melee attack is considered successful, even if the damage is completely negated by the target's defense or damage immunity.

A failed melee attack does not consume item durability, does not apply knockback, sweep attackTemplate:Only, fire aspect, or shield disabling, and does not generate critical hit particles or increase the player's exhaustion.

Sounds

Template:El: Template:SoundTable

Template:Edition: Template:SoundTable

History

Java Edition

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

Notes

Template:Notelist

References

Template:Reflist

Navigation

Template:Navbox combat Template:Navbox gameplay

Minecraft:pt:Ataque corpo a corpo Minecraft:zh:近战攻击