Fire Projectile (Entity Action Type)
Fires one or more projectiles or entities.
Fires one or more projectiles or entities. It takes the same fields as the apoli:fire_projectile power type, minus the four that only make sense on a power — cooldown, hud_render, key and allow_conditional_cancelling.
Type ID: apoli:fire_projectile
Fields
| Field | Type | Default | Description |
|---|---|---|---|
entity_type | Identifier | The identifier of the projectile or entity that will be launched. | |
entity_id | Identifier | optional | Identifier for tracking the projectile |
texture_location | Identifier or keyword | optional | If specified, the texture used for the custom projectile and entity_type is ignored. The keywords held_item and offhand_item make the projectile render the shooter’s held stack as a real item model. |
count | Integer or Expression | 1 | The amount of projectiles to fire each use. |
interval | Integer | 0 | Ticks between consecutive shots. 0 fires the whole count on the same tick. |
start_delay | Integer | 0 | Ticks to wait before the first shot. |
speed | Float or Expression | 1.5 | The speed applied to the fired projectile. |
max_distance | Float or Expression | 0 | Removes the projectile once it has travelled this far, in blocks. 0 leaves it to fly until it hits something or expires. |
offset_x, offset_y, offset_z | Float | 0 | Where the projectile spawns, relative to the shooter’s eyes. Read through space, so local puts offset_z: 1.5 a block and a half in front of wherever they are looking. |
space | Space | world | How the spawn offset is read. local is relative to the shooter’s facing, world to the world axes. |
divergence | Float | 1.0 | How much each projectile fired is affected by random spread. |
sound | Identifier | optional | If set, the sound with this ID will be played when the power is used. |
tag | NBT | optional | NBT data to apply to projectiles |
entity_action_before_firing | Entity Action | optional | If specified, the entity action to execute on the entity firing the projectile just prior to the projectile being created. |
bientity_action_after_firing | Bi-entity Action | optional | If specified, the bi-entity action to execute with the projectile owner the actor, and the projectile as the target as soon as the projectile is created. |
block_action_on_hit | Block Action | optional | If specified, the block action to execute on the block the projectile lands on upon having it land on it. |
bientity_action_on_miss | Bi-entity Action | optional | If specified, the bi-entity action to execute with the projectile owner as the actor, and the projectile as the target upon missing. |
bientity_action_on_hit | Bi-entity Action | optional | If specified, the bi-entity action to execute with the projectile as the actor, and the hit entity as the target upon hitting an entity. |
owner_target_bientity_action_on_hit | Bi-entity Action | optional | If specified, the bi-entity action to execute with the projectile owner as the actor, and the hit entity as the target upon hitting an entity. |
block_action_cancels_miss_action | Boolean | false | Determines if the block_action_on_hit action will cancel the bientity_action_on_miss action. |
block_condition | Block Condition | optional | If specified, the block condition that the block targeted by the block_action_on_hit field must meet in order for that to run. |
bientity_condition | Bi-entity Condition | optional | If specified, the bi-entity condition with the projectile as the actor and the target as the target for the projectile to actually hit the target instead of pass through. |
owner_bientity_condition | Bi-entity Condition | optional | If specified, the bi-entity condition with the projectile owner as the actor and the target as the target for the projectile to actually hit the target instead of pass through. |
tick_bientity_action | Bi-entity Action | optional | If specified, the bi-entity action with the projectile owner as the actor, and the projectile as the target that is run each tick of the projectile’s lifespan. |
projectile_action | Entity Action Type | optional | If specified, this entity action will be executed on the projectile or entity that will be launched. |
shooter_action | Entity Action Type | optional | If specified, this entity action will be executed on the entity firing the projectile. |
reflective | Boolean | false | When true, the projectile bounces off blocks instead of stopping on them. See Bouncing off walls. |
max_bounces | Integer | 4 | How many times a reflective projectile may bounce before the next block hit stops it. -1 bounces forever, which needs max_distance or a tick_bientity_action to end the shot. |
bounce_speed | Float | 1.0 | The fraction of its speed the projectile keeps after each bounce. 1.0 loses nothing, 0.6 is a rubber ball, values above 1 accelerate it. |
bientity_action_on_bounce | Bi-entity Action | optional | If specified, the bi-entity action to execute with the projectile owner as the actor and the projectile as the target every time it bounces. |
Bouncing off walls
reflective turns a block hit into a rebound: the projectile’s velocity is mirrored through the face it struck, scaled by bounce_speed, and it carries on flying. Entity hits are unaffected — a reflective projectile still hits the first entity it reaches, subject to bientity_condition.
Each bounce still runs block_action_on_hit (honouring block_condition), so a bouncing shot can leave a mark on every wall it kisses. bientity_action_on_miss is held back until the projectile actually stops, so “it missed” means what it says.
Once max_bounces is used up the next block hit ends the shot normally. Give a forever-bouncing projectile (max_bounces: -1) a max_distance so it cannot outlive the player who fired it.
{
"type": "apoli:fire_projectile",
"texture_location": "example:textures/entity/bouncy_orb.png",
"speed": 1.2,
"reflective": true,
"max_bounces": 6,
"bounce_speed": 0.85,
"max_distance": 64,
"bientity_action_on_bounce": {
"type": "apoli:play_sound",
"sound": "minecraft:entity.slime.squish"
}
}
bounce_speedabove1.0compounds — at1.3a projectile is travelling nearly four times its launch speed after six bounces, fast enough to tunnel through a one-block wall between ticks. Pair it with a lowmax_bounces.
Examples
"entity_action": {
"type": "apoli:fire_projectile",
"entity_type": "minecraft:snowball",
"divergence": 3.0,
"count": 3
} This example will fire three snowballs at where the player is facing.
"entity_action": {
"type": "apoli:fire_projectile",
"entity_type": "minecraft:arrow",
"count": 5,
"interval": 3,
"start_delay": 10,
"offset_z": 1.5,
"space": "local",
"speed": 2.5
} Half a second after the action runs, five arrows leave a point a block and a half in front of the shooter’s eyes, one every three ticks.