minecraft:projectile for you with a switch.Get GodCraftOverview
minecraft:projectile is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Makes the entity behave like a thrown or fired object, such as an arrow or snowball: it flies in an arc and does something when it hits. Use the on_hit settings to choose what happens on impact.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
offset | vec3 | [0,0,0] | Where the projectile appears, measured from the anchor point on the shooter. |
anchor | ProjectileAnchor | "origin" | Which point on the shooter to launch from: 0 feet, 1 eyes, 2 middle of the body. |
power | number | 1.3 | How fast the projectile leaves the shooter, in blocks per tick. |
angle_offset | number | 0 | Extra upward tilt in degrees added to the aim; negative aims lower. |
uncertainty_base | number | 0 | How inaccurate the shot is; higher numbers spread shots more. |
uncertainty_multiplier | number | 0 | How much the inaccuracy shrinks per difficulty level, so harder difficulties shoot straighter. |
shoot_target | boolean | true | If true, the shot aims at the shooter's target instead of straight ahead. |
gravity | number | 0.05 | How quickly the projectile drops each tick; set it to 0 for a straight line. |
inertia | number | 0.99 | How much speed it keeps each tick in the air; below 1 it slows down. |
liquid_inertia | number | 0.6 | How much speed it keeps each tick while moving through water or lava. |
isolated_physics | boolean | true | If true, it uses its own simple flight physics and ignores normal friction and drag. A good choice for custom projectiles. |
homing | boolean | false | If true, the projectile curves toward its target while flying. |
should_bounce | ShouldBounce | "no" | When it bounces off an entity: never, only off invulnerable ones, or whenever it deals no damage. |
multiple_targets | boolean | false | If true, it can pass through and hit several entities, like a piercing arrow. |
hit_nearest_passenger | boolean | false | If true, hitting a ridden vehicle affects the closest rider instead of the vehicle. |
ignored_entities | Entity Reference[] | none | Entity types the projectile flies through without hitting. |
is_dangerous | boolean | false | If true, mobs treat the projectile as a threat and may react to it. |
reflect_on_hurt | boolean | false | If true, hitting the projectile sends it back toward the attacker, like a ghast fireball. |
reflect_immunity | number | 0 | Seconds after launch during which the projectile can't be knocked back. |
destroy_on_hurt | boolean | false | If true, the projectile is removed when something hits it. |
stop_on_hurt | boolean | false | If true, the projectile stops moving when something hits it. |
crit_particle_on_hurt | boolean | false | If true, critical hit sparkles appear when the projectile is struck. |
particle | ParticleType | "iconcrack" | Particle shown where the projectile hits. |
shoot_sound | string | "" | Sound played when the projectile is fired. |
hit_sound | string | "" | Sound played when it hits an entity, and also blocks if no ground sound is set. |
hit_ground_sound | string | "" | Sound played when it hits a block. |
catch_fire | boolean | false | Old way to set targets on fire; prefer the catch_fire option inside on_hit. |
on_fire_time | number | 5 | How many seconds a target burns after being set on fire by this projectile. |
lightning | boolean | false | If true, it can call down lightning on the entity it hits during a thunderstorm, like a channeling trident. |
potion_effect | integer | -1 | Potion type the projectile carries, usually filled in by potion items. |
splash_range | number | 4 | Radius in blocks for splash potion effects. |
on_hit | OnHitCommandsStorage | none | What happens on impact, such as dealing damage, spawning an entity or removing the projectile. |
hit_water | boolean | false | If true, the projectile stops when it touches water. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:projectile": {
"offset": [
0,
0,
0
],
"anchor": "origin",
"power": 1.3,
"angle_offset": 0,
"uncertainty_base": 0,
"uncertainty_multiplier": 0,
"shoot_target": true,
"gravity": 0.05
}
}