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

FieldTypeDefaultDescription
entity_typeIdentifierThe identifier of the projectile or entity that will be launched.
entity_idIdentifieroptionalIdentifier for tracking the projectile
texture_locationIdentifier or keywordoptionalIf 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.
countInteger or Expression1The amount of projectiles to fire each use.
intervalInteger0Ticks between consecutive shots. 0 fires the whole count on the same tick.
start_delayInteger0Ticks to wait before the first shot.
speedFloat or Expression1.5The speed applied to the fired projectile.
max_distanceFloat or Expression0Removes 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_zFloat0Where 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.
spaceSpaceworldHow the spawn offset is read. local is relative to the shooter’s facing, world to the world axes.
divergenceFloat1.0How much each projectile fired is affected by random spread.
soundIdentifieroptionalIf set, the sound with this ID will be played when the power is used.
tagNBToptionalNBT data to apply to projectiles
entity_action_before_firingEntity ActionoptionalIf specified, the entity action to execute on the entity firing the projectile just prior to the projectile being created.
bientity_action_after_firingBi-entity ActionoptionalIf 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_hitBlock ActionoptionalIf specified, the block action to execute on the block the projectile lands on upon having it land on it.
bientity_action_on_missBi-entity ActionoptionalIf 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_hitBi-entity ActionoptionalIf 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_hitBi-entity ActionoptionalIf 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_actionBooleanfalseDetermines if the block_action_on_hit action will cancel the bientity_action_on_miss action.
block_conditionBlock ConditionoptionalIf specified, the block condition that the block targeted by the block_action_on_hit field must meet in order for that to run.
bientity_conditionBi-entity ConditionoptionalIf 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_conditionBi-entity ConditionoptionalIf 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_actionBi-entity ActionoptionalIf 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_actionEntity Action TypeoptionalIf specified, this entity action will be executed on the projectile or entity that will be launched.
shooter_actionEntity Action TypeoptionalIf specified, this entity action will be executed on the entity firing the projectile.
reflectiveBooleanfalseWhen true, the projectile bounces off blocks instead of stopping on them. See Bouncing off walls.
max_bouncesInteger4How 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_speedFloat1.0The 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_bounceBi-entity ActionoptionalIf 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_speed above 1.0 compounds — at 1.3 a 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 low max_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.