Adding data to a shot entity #6935
Replies: 1 comment 1 reply
-
This, to my knowledge, is functionally impossible. Things like scoreboard tags and metadata must be added to an entity, which must first exist. To have the entity exist, it must spawn (be shot), therefore the on shoot event must run before you can do any such modification to the entity. That said, some aspects may be possible in the same vein as the spawn section, where it runs just as the entitity is spawning in. See https://jd.papermc.io/paper/1.20.6/org/bukkit/projectiles/ProjectileSource.html#launchProjectile(java.lang.Class,org.bukkit.util.Vector,java.util.function.Consumer). This means a shoot section could be added, like #4792 attempted to. I am unsure of whether such a section supports things like scoreboard tags, but the javadocs explicitly forbid things like teleportation, nor do I know how it would behave relative to the shoot event. |
Beta Was this translation helpful? Give feedback.
-
My idea is that you should be able to shoot an entity with data into it and and not have to save it as last shot projectile and then make changes on it (data as in scoreboard tags, names, ect)
example:
make the player shoot an arrow with the scoreboard tag "ExampleTag"
such a thing could help with replacing a projectile with your own projectile if the previous one had some modifications done to it by a different plugin (i.e. projectile was shot by mythicmobs entity and has some custom properties that cannot be changed about it through mythicmobs or skript)
from my knowledge and research you cannot do such a thing and can only add data to the entity after it's being shot at which point an on shoot event can detect it and can cause an infinite loop.
Beta Was this translation helpful? Give feedback.
All reactions