Mount and unmount brooms with API
christophe6 opened this issue · 11 comments
Hi
Is there a way with the magic api to let a player mount a broom that's not in their inventory? After unmounting they should not get the broom.
Any ideas? Thank you!
Yes, basically make a new broom spell like
instabroom:
inherit: broom
parameters:
mount_wand: false
helmet_item: wood_hoe:11
Then cast that via the API.
The PlayerMoveEvent does not seem to detect the movement of brooms? Is this possible? If so, do you have an alternative?
Thanks!
Oh, thank you! I guess I should start a scheduled task when mounting the broom and stop it when the player is no longer on a broom. Is there an API method to check wether someone's flying a broom or not?
Not really, you can call getActiveSpells
and check for the broom
spell being in there but that's about it.
No, brooms work by applying velocity, PME is only for move packets sent from clients.
I don’t think so, sorry- that’d be an event I’d have to fire every tick for every player on a broom.
What are you trying to do, exactly?
I’m mounting players on a broom and they have to fly to the right flying key. When they reach it, they receive the key.
Thanks for your help!
Few suggestions that seem like they’d work better:
- set a scheduled task checking player locations each tick
- use an entity for the key and detect collisions (I think there’s an event for that)
- use a dropped item for the key and detect player pickup event
Could you add a broommoveevent which is called upon multiplying velocity please?