ProjectileLaunchedScriptEvent updates#2701
Merged
tal5 merged 4 commits intoDenizenScript:devfrom Mar 6, 2025
Merged
Conversation
Contributor
MC-Samuel
commented
Jan 24, 2025
- <context.shooter> added to "ProjectileLaunchedScriptEvent"
- <context.entity> deprecated and replaced with <context.projectile> since there are technically multiple entities.
- <context.entity> deprecated and replaced with <context.projectile> since there are technically multiple entities.
| public static Warning playEffectSpecialDataListInput = new FutureWarning("playEffectSpecialDataListInput", "List input for the special_data argument in playeffect command is now deprecated. Please use a MapTag instead."); | ||
|
|
||
| // Added 2025/01/23 | ||
| public static Warning projectileLaunchedEntityContext = new FutureWarning("projectileLaunchedEntityContext", "'context.entity' in the '<projectile>/<entity> launched' event is deprecated in favor of 'context.projectile'."); |
Member
There was a problem hiding this comment.
the 'projectile launched' event
|
|
||
| @Override | ||
| public boolean matches(ScriptPath path) { | ||
| if (!path.tryObjectSwitch("by", shooter)) { |
Member
There was a problem hiding this comment.
should be placed below the primary test
| public EntityTag shooter; | ||
|
|
||
| @Override | ||
| public boolean couldMatch(ScriptPath path) { |
Member
There was a problem hiding this comment.
if you're editing this event anyway, it'd be nice to modernize the format
|
|
||
| public ProjectileLaunchedScriptEvent() { | ||
| registerCouldMatcher("<entity> launched"); | ||
| registerCouldMatcher("projectile launched"); |
Member
There was a problem hiding this comment.
this is redundant, <entity> covers it for registration purposes
tal5
requested changes
Jan 29, 2025
Member
tal5
left a comment
There was a problem hiding this comment.
Can also remove the @Regex thing in the meta comment when modernizing events
| yield projectile; | ||
| } | ||
| case "projectile" -> projectile; | ||
| case "shooter" -> shooter; |
| shooter = projectile.getShooter(); | ||
| fire(event); | ||
| EntityTag.forgetEntity(projectile); | ||
| EntityTag.forgetEntity(event.getEntity()); |
Member
There was a problem hiding this comment.
Any reason to call #getEntity again here?
mcmonkey4eva
approved these changes
Feb 3, 2025
tal5
approved these changes
Mar 6, 2025
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.