Minecraft:Projectile
More actions
Template:Relevant category A projectile is an Minecraft:entity that can be fired, shot, or thrown by Minecraft:mobs, other entities, Minecraft:dispensers, and players. Projectiles can also be summoned using Template:Cmd.
List of projectiles
Inheritance
Template:Main Template:Exclusive Template:Blist
Table
Mobs and players equipped with Minecraft:bows and Minecraft:crossbows can use them to shoot Minecraft:arrows. The player can also throw various items as projectiles. Some mobs shoot projectiles directly as an attack.
Picking up
An Minecraft:eye of ender has a 80% chance of surviving when thrown. If it survives, it drops as an item where it stopped, which can then by picked up.
A trident thrown by a player can be picked up (in its projectile form), as long as its on the ground, doesn't have Minecraft:Loyalty, and the player didn't throw it while in Minecraft:Creative mode.
All other projectiles are either destroyed, turned into something else, or exist as a projectile which despawns after some time, and cannot be picked up or grabbed in their projectile form.
Initial conditions
Shot from dispenser
<section begin="initialconditions-dispenser"/>All projectiles use the following calculations to get shot by a dispenser:
- To find the position, move out from the center of the block by
DISTANCEand addY OFFSET. - Get the unit vector straight out of the dispenser.
- For each axis, add a random (64-bit) number between
-0.0172275 * UNCERTAINTYand0.0172275 * UNCERTAINTY, using a triangular distribution. - To find the velocity, scale by
POWER.
| Projectile | Distance (double) | Y Offset (double) | Power (float) | Uncertainty (float) |
|---|---|---|---|---|
| Default | 0.7 | 0.1 | 1.1 | 6.0 |
| Potion, Experience bottle | 0.7 | 0.1 | 1.375 | 3 |
| Wind charge, fire charge | 1.0 | 0.0 | 1.0 | 6.6666665 |
| Firework rocket | 0.5000099999997474 | 0.0 | 0.5 | 1.0 |
<section end="initialconditions-dispenser"/>
Throwable projectiles (except eye of ender)
<section begin="initialconditions-throwable"/>The direction and velocity of throwable projectiles is slightly randomized and affected by the player's movement. More specifically, the game does these calculations in order:
- Get the facing vector of the player, with length 1. For the pitch, this uses the player's pitch plus
PITCH(where positivePITCHmakes the vector point lower). - For each axis, add a random (64 bit) number between -0.0172275 and 0.0172275, using a triangular distribution.
- Scale the velocity by
POWER. - Add the player's velocity. If the player is on the ground, the Y component is unaffected.
The result is a shooting speed of around POWER towards where the player is facing, depending on randomness and the player's velocity.
| Projectile | Power (Template:Wikipedia) | Pitch (float) |
|---|---|---|
| Snowball, ender pearl, egg | 1.5 | 0 |
| Potions | 0.5 | -20° |
| Experience bottle | 0.7 | -20° |
<section end="initialconditions-throwable"/>
Motion
Template:Main {{#lst:Entity|tableheader}} {{#lst:Entity|projectiles}} |} Template:Notelist Calculators/Projectile motion
Collision
Projectiles perform a raycast from their current position to their next position and check for blocks and entities that would get hit.
Entity collision
Throwable projectiles
<section begin="collision-entity-throwable"/>Throwable projectiles (Minecraft:Ender pearl, Minecraft:snowball, Minecraft:egg, Minecraft:potion, Minecraft:experience bottle, Minecraft:eye of ender) treat entities as being 0.6 blocks larger than they actually are in every axis (0.3 in every direction). They collide with all living entities, all Minecraft:minecart types, Minecraft:boats, Minecraft:end crystals, Minecraft:falling blocks, and Minecraft:tnt.
To calculate the collision, the game uses the following process:
- Make a box from the current tick's position to next tick's position
- Inflate it by 1 in every direction
- Get every entity in the box
- For each entity:
- Inflate it by 0.3 in every direction
- Check if it intersects the line connecting the current position and the next position
- Keep the intersection if it's the closest to the projectile so far, otherwise throw it out<section end="collision-entity-throwable"/>
Abstract arrows and abstract hurting projectiles
Abstract arrows (Minecraft:Arrow, Minecraft:tipped arrow, Minecraft:spectral arrow, Minecraft:trident) and abstract hurting projectiles (Minecraft:Fireball, Minecraft:dragon fireball, Minecraft:wind charge, wither skull, dangerous wither skull) use a raycast to calculate entity collisions, and don't inflate entities like ThrowableProjectiles.Template:Verify
Block collisions
<section begin="collision-block"/>All blocks collisions are checked using a raycast from the projectile's current position to its next position, which hits the block's collision box, with a few special cases:
- The top of Minecraft:scaffolding is only hit if the projectile begins its movement below it, because that collision box only exists for entities that are above it.
- Minecraft:Walls, Minecraft:fences, moving Minecraft:pistons, the back of piston arms, and other blocks whose collision box extends beyond a full cube are only seen by the projectile if the raycast intersects the full cube space where the block is actually located.
- Minecraft:End portal blocks and Minecraft:exit portal blocks have no hard hitbox, so projectiles will only enter if they tick inside the portal blocks.<section end="collision-block"/>
Ender pearl specific block collisions
<section begin="collision-block-pearl"/>
- If a pearl hits a Minecraft:Nether portal, it is sent to the Nether. If the pearl would have hit other blocks after the portal, that collision position is used as the position where the pearl entered the portal. Otherwise, the final position it would've ended at is used. See Minecraft:Nether portal for more details on how entities get placed after going through portals.
- If a pearl hits an Minecraft:End gateway, it teleports the player as if the player had gone into the gateway. The pearl itself is deleted.<section end="collision-block-pearl"/>
Data values
ID
Template:JE: Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table
Template:BE: Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table Template:ID table
History
Java Edition
Bedrock Edition
Legacy Console Edition
Issues
See also
- Minecraft:Projectile Protection - an Minecraft:enchantment that reduces damage received from projectiles.