Magic

Magic

190k Downloads

Arrow spells can't be configured to not despawn too early

Ferocimo opened this issue ยท 6 comments

commented

Hello,

Currently it seems I'm unable to customize the duration of an arrow fired by a spell. It doesn't matter what parameters or actions I use, as long as there is a projectile "TippedArrow", it will despawn after a few seconds in flight.
I've created the following spell :

arrowblink:

icon_url: http://textures.minecraft.net/texture/3186699cf52cb2f732b7948784b262a49d43a57c801368f776e3c9a88151d
icon: arrow
category: movement
pvp_restricted: true
worth: 500
earns_sp: 1
upgrade_required_path: sorcier
upgrade_required_casts: 300
actions:
    cast:
    - class: Projectile
      actions:
      - class: Teleport
effects:
  cast:
  - class: EffectSingle
    sound: entity.arrow.shoot
    sound_pitch: 0.2
    sound_volume: 0.3
    location: origin
  projectile:
  - location: origin
    effectlib:
      class: Sphere
      iterations: 10
      period: 2
      particles: 5
      particle_count: 20
      particle_offset_x: 0.2
      particle_offset_y: 0.2
      particle_offset_z: 0.2
      particle: portal
      disappear_with_origin_entity: true
  - location: origin
    effectlib:
      class: Sphere
      iterations: 10
      period: 2
      particles: 10
      particle: redstone
      color: FF00FF
      disappear_with_origin_entity: true
  hit:
  - class: EffectSingle
    target_offset: 0,0.5,0
    location: target
    color: FACC2E
    firework: burst
  teleport:
  - class: EffectSingle
    sound: entity.illusion_illager.mirror_move
    location: both
    particle_override: particle_nucleus
    color_override: colorOrbital
    source_location: eyes
    effectlib:
      class: AtomEffect
      particle_nucleus: fireworks_spark
      particle_orbital: redstone
      iterations: 16
      offset: 0,-1,0
  - class: EffectSingle
    location: target
    source_location: body
    color_override: colorNucleus
    effectlib:
      class: AtomEffect
      particle_nucleus: redstone
      particle_orbital: fireworks_spark
      iterations: 8
parameters:
  target: none
  projectile: TippedArrow
  speed: 1.8
  spread: 1
  damage: 0.1
  fire: false
  cooldown: 30000
  bypass_build: true
  bypass_break: true
  bypass_friendly_fire: true
  bypass_pvp: false
  bypass_protection: true
  source_location: head
costs:
    mana: 100

It basically works similarly to an enderpearl, except it's an arrow spell. But when you cast the spell in the air, the arrow will quickly despawn before it hits the ground, making the spell useless.

Is there a way to configure that despawn time that I don't know of ?

commented

The arrow indeed no longer despawns, however the action that should be performed when the arrow hit the ground (here, Teleport) is actually not performed anymore, when the arrow hit the ground.

commented

Try adding tick_increase: 0 to parameters.

commented

The actions were performed before tweaking the tick increase parameter though? :\

commented

Yes they were, but only when the arrow hit something before disappearing.

commented

Sorry it took me so long to get back to you, but apparently you need allow_passthrough: false in parameters for this to work.

I'm thinking of making that false by default in the next build since it causes some strange behavior like this and people probably don't want it, in general.

And then finally in case you were not aware this is nearly identical to one of the builtin spells:

https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/arrow_blink.yml

The main difference is the builtin one is meant for use on the magic bow, so its speed/spread vary by pull strength.

commented

I did end up making allow_passthrough false by default to hopefully avoid this unexpected behavior in the future.