Add EntityScareByEntityEvent for Armadillos#10798
Closed
joshuaprince wants to merge 1 commit into
Closed
Conversation
Add a new event for when an entity "scares" another entity. As of 1.20.6, only armadillos can be scared.
kennytv
reviewed
May 30, 2024
Member
kennytv
left a comment
There was a problem hiding this comment.
Having it generic is good I think, but then you should already add a call in AvoidEntityGoal for the other uses
| + isScared = entityhuman.isSpectator() ? false : entityhuman.isSprinting() || entityhuman.isPassenger(); | ||
| } else { | ||
| - return false; | ||
| + isScared = false; |
Contributor
Author
There was a problem hiding this comment.
It's also called at L29, even if the Player didn't actually scare the armadillo. Is it worth calling the event pre-cancelled in these cases? I put my reasoning in the PR body (choice 1).
Member
There was a problem hiding this comment.
Separate API to expand what it is scared by might be more appropriate, I think this would already be doable by adding a custom goal. In any case, we generally don't call events for such cases
Contributor
Author
|
Replaced by #10835 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a new event for when an entity "scares" another entity. As of 1.20.6, only armadillos can be scared.
As far as I could tell, there is no way* to prevent a player from scaring 1.20.5's armadillos and making them roll up into their shells. This adds a simple way to do so.
*tried: EntityPoseChangeEvent (not called for armadillos, also no scared-by entity reference), EntityTargetEvent (not called for armadillos)
Choices and Alternatives
This event is called pre-cancelled when any living entity is within 7 blocks of the armadillo.
ignoreCancelled = false.The event is named generically.
ArmadilloScareByEntityEvent.Testing
getEntity()andgetScaredBy()return the correct entities in a test plugin.setCancelled(true)makes armadillos unscareable.setCancelled(false)makes armadillos immediately scared as soon as any living entity is nearby.