New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added option to ignore entities when lightning strikes #10689
Conversation
Hi, thank you for your PR 🎉 Could you please elaborate on the usage of this API over simply listening to the respective events (Combust, HangingBreak, DamageEvent) which all expose the lightning strike entity? This kind of API seems pretty counter active to the event driven design of the bukkit API. |
I would be more in favor of an event fired right before the lighting searches for an entity to hit to configure the parameters for that search or even to specify a specific entity before the search even happens. That seems more useful to me. |
For me it is better to use more "direct" way to somehow ignore other entities than to check with EntityDamageByEntityEvent, of course it could be done just with this event.
That's good idea, I'll look how could I make it. |
Yea, then go with Machines way 👍 |
Sure and thanks. |
Should I create the event in paper package? |
Yup! |
Hello, I am trying to rebase my commit as in method 1, though I am not able to select anything, could you help me please? |
Would probably be best if you ask for help on our discord, github isn't a good place for that. |
… would be hit by the lightning, so parameters can be specified
Added same things as it was previously in LightningStrike nms class, although added predicate, so anyone can define their own behavior. By setting null in setter, default predicate will be used |
patches/server/1050-Added-option-to-ignore-entities-when-lightning-is-st.patch
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding methods for ignoring entities seems wrong. Why not call the event right after the server looks for entities to hit? then you can pass in the entities to the event and let the user add/remove entities
In that case, I think it would make sense to be in LightningStrikeEvent then, though I don't really know how would I put entities there, as this method is called in tick method and I would be unable to get these entities. Though I think having event where you can specify your prediction on what entities do you really want there would be better. Passing a list with entities where you can add own entity could get little bit tricky and would probably require more checks, so making event through which you could make your own selection based on the predicate seems better for me. |
-> I may said little bit non sense, LightningStrikeEvent is called, before tick method is even called (where you are searching for the entities) |
why exactly do you not want to use EntityDamageByEntityEvent? this really seems like a very simple and intended way of doing this. we also don't have an event that gets called for when a zombie is checking for players they can attack, so why add one for this? |
You could use this event as a more direct way for filtering entities, I could also imagine more features in this event in the future as configuring selection radius which you wouldn't want in EntityDamageByEntityEvent. Event for zombie checking for players which he could attack does not exist though there is more general event for this EntityTargetEvent. |
I feel like that event is already as direct as you need it to be
Sure though i believe such a thing could be added to the LightningStrikeEvent or LightningStrike Entity. though you could also manually get the Entities in a specific area and damage them which gives you even more control over it.
EntityTargetEvent is called when a Mob starts targeting a player not when they check if they are in reach to attack |
alright, well then this commit has no use and I can close this |
oh i would have waited for other peoples opinion on this. Perhaps someone else has a different opinion on it |
Well, this can be reopened anytime, incase someone would really want this. Reason why I firstly made it, was I didn't get any idea how could I get entities which were struck by the lightning and in the lightningstrikeevent it wasn't contained, it had not occured me to use EntityDamageByEntityEvent, so I made this event where then lynx said normal events could be used instead, though I still saw some future potentional this event could have. |
Though I don't know what could I say on it :D You're right that normal events can be used instead and this could be only a excess event |
Thanks for your work on this anyways! |
sure, I am also thankful for your time you have given there |
Hey, in short, this patch adds option to ignore specific entity (or type of entity) from being damaged by lightning when lightning strikes.