Question about LongbowItem Overrides
Cephelo opened this issue ยท 2 comments
I'm looking at the 1.20.1 source here, and I'm confused - why does LongbowItem override BowItem's releaseUsing method? They appear to function the exact same. Overriding this method may be inadvertently cutting off compat with other mods that use mixins to hook into the vanilla releaseUsing method, that's why I'm asking. Just curious!
Oh also, something weird happens with the lightning bows from Spartan fire - if you shoot an arrow from any given bow, then switch your hand to a lightning bow, it'll strike the target with lightning, even though the lightning bow itself didn't make the shot. This may also happen with other bows, but I haven't tested it.
While it is true that a lot of the code is identical, there are two major changes which afaik requires an override
- The method that calculates the draw time is static, which means that it can't be overridden. I had to make my own version to override that logic
- I'm also exposing the behavior to the API so that traits can do things like adjust projectile damage, etc. just before the projectile spawns
They are the main reasons that the code is the way it is. Is there any compatibility issues with mods that use Mixins to do what you said? It would be helpful if you know of any.
As far as your other question goes about Spartan Fire, I don't maintain that mod so I can't say for certain what is causing that issue, but it is likely that the lightning spawning is only checked on impact with a mob, which then checks the current weapon, regardless of what weapon originally shot it. That is most likely is what is happening there.