MagicPlugin icon indicating copy to clipboard operation
MagicPlugin copied to clipboard

lifetime parameter of ProjectileAction doesn't work after the projectile hits.

Open afoxxvi opened this issue 11 months ago • 4 comments

BaseProjectileAction has a parameter "lifetime", to remove projectile after a given delay. I have tested by arrowrain spell and found that the projectile will only be removed at expiration if it's still moving. Once the arrow hit on block, it can no longer be removed by Magic.

afoxxvi avatar Mar 06 '24 07:03 afoxxvi

That is strange. Magic doesn't actually remove projectiles either way. That field is mapped to an internal Minecraft projectile lifetime field, this is what causes projectiles to get removed by the server after some time.

So I'd expect it to either be completely broken or not. It does break frequently, it's one of the internal fields that still has no API access, so it is prone to breaking.

I wonder if they changed it for some reason to reset when the projectile hits? If that's the case there may not be anything I can (easily) do about the problem.

NathanWolf avatar Mar 06 '24 16:03 NathanWolf

I should've asked, what is your server and plugin version?

NathanWolf avatar Mar 06 '24 16:03 NathanWolf

Magic 10.8.13 (latest) and Paper-550(1.19.4) I tested with the following config:

arrowrain:
  actions:
    cast:
      - class: Projectile
  parameters:
    target: none
    projectile: arrow
    lifetime: 500
    count: 16
    spread: 30

Cast towards the sky and you can see all arrows disappear after 500ms, and cast towards the ground, all arrows will be existing. "lifetime" is handled in BaseProjectileAction, checked in method step() and once they're expired, Magic removes them(please check ), and when debug level is above 4, I can also receive a debug message of "Projectiles expired".

I guess the spell has lost track after the arrows hit. Would you please check it?

afoxxvi avatar Mar 07 '24 04:03 afoxxvi

Another observation: mc remove projectiles that have lived for 1200 ticks, I can set "tick_increase" paramter to 1180 to make the projectile live for 20 ticks after landing. This may actually solved my problem.

afoxxvi avatar Mar 07 '24 07:03 afoxxvi