Throw accuracy
0ffz opened this issue · 7 comments
Thrown items are inaccurate right now because they are based off Minecraft's code. We should rewrite them to be completely custom and add an accuracy parameter to the goal.
Taking a look at this, and it appears to me that the NMS shoot function already provides projectile speed and accuracy parameters. Would you still prefer it if we write completely custom shooting logic without using NMS? Seems a bit unnecessary to me.
You can just use the nms code. Feel free to make an extension function for it though. This should be really easy then
Would the extension function just serve as an alias for the NMS function with clearer parameter names then?
On further exploration, in the current NMS shoot function it seems that the accuracy parameter also affects the randomness of the projectile speed.... I'll just write a custom function. Should not be too difficult since all the required attributes and functions required to set delta movement are public.
Sure, feel free. If you're writing it yourself, try to keep NMS use to the lowest possible. I don't actually care much about using our own API that goes through nms, basically just avoid all NMS imports. As for the function, yeah just an alias is what I was thinking. Can also set some default parameters sometimes for even nicer usage.
Hm, I was thinking of still using NMS. We basically need everything in the nms shoot
function the same, except for the direction vector calculation (the first line of the function). Take a look at Projectile.shoot()
to see what I mean.
If you'd rather avoid NMS entirely, we'd need to implement delta movement for entities ourselves using a tick system. This would take more time.
I think performance wise we won't gain enough to justify the time spend to develop such a system right now. Maybe for now using the required NMS functions/attributes, and add a TODO/Issue for implementing the logic ourselves at a later time?
Sounds good