Add EvtEntityLunge and ExprLungePower#8649
Open
vuxeim wants to merge 10 commits into
Open
Conversation
add test environment file for 26.1.2
feat: add lunge power expression
This comment has been minimized.
This comment has been minimized.
vuxeim
commented
May 17, 2026
vuxeim
commented
May 17, 2026
erenkarakal
requested changes
May 17, 2026
erenkarakal
approved these changes
May 17, 2026
Member
erenkarakal
left a comment
There was a problem hiding this comment.
looks fine, thank you for contributing!
erenkarakal
reviewed
May 17, 2026
vuxeim
commented
May 17, 2026
APickledWalrus
requested changes
May 20, 2026
APickledWalrus
requested changes
May 27, 2026
Comment on lines
+23
to
+27
| .examples("on lunge:", | ||
| "\tset lunge power to 4", | ||
| "on ravager lunge:", | ||
| "\tcancel event" | ||
| ) |
Member
There was a problem hiding this comment.
It'll be better to format this as two distinct examples:
Suggested change
| .examples("on lunge:", | |
| "\tset lunge power to 4", | |
| "on ravager lunge:", | |
| "\tcancel event" | |
| ) | |
| .examples( | |
| """ | |
| on lunge: | |
| set lunge power to 4 | |
| """, | |
| """ | |
| on ravager lunge: | |
| cancel event | |
| """ | |
| ) |
Comment on lines
+42
to
+47
| EntityLungeEvent lungeEvent = (EntityLungeEvent) event; | ||
|
|
||
| if (entityTypes == null) { | ||
| return true; | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
Suggested change
| EntityLungeEvent lungeEvent = (EntityLungeEvent) event; | |
| if (entityTypes == null) { | |
| return true; | |
| } | |
| if (entityTypes == null) { | |
| return true; | |
| } | |
| EntityLungeEvent lungeEvent = (EntityLungeEvent) event; |
Comment on lines
+58
to
+63
| SyntaxStringBuilder builder = new SyntaxStringBuilder(event, debug); | ||
| if (entityTypes != null) { | ||
| builder.append(entityTypes).append(" "); | ||
| } | ||
| builder.append("lunge"); | ||
| return builder.toString(); |
Member
There was a problem hiding this comment.
You can also use appendIf to simplify this
Suggested change
| SyntaxStringBuilder builder = new SyntaxStringBuilder(event, debug); | |
| if (entityTypes != null) { | |
| builder.append(entityTypes).append(" "); | |
| } | |
| builder.append("lunge"); | |
| return builder.toString(); | |
| return new SyntaxStringBuilder(event, debug) | |
| .appendIf(entityTypes != null, entityTypes) | |
| .append("lunge") | |
| .toString(); |
Another nice benefit of SSB is that you do not need to worry about appending spaces, it's handled internally.
| } | ||
|
|
||
| @Override | ||
| public Integer[] get(Event event) { |
Member
There was a problem hiding this comment.
Should be placed immediately after init
| @Override | ||
| public void change(Event event, @Nullable Object[] delta, ChangeMode mode) { | ||
| int deltaValue = delta != null ? (Integer) delta[0] : 0; | ||
| int currentValue = getSingle(event); |
Member
There was a problem hiding this comment.
I think it's worth avoiding the overhead here and just doing
((EntityLungeEvent) event).getLungePower();
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.
Problem
This adds syntax to work with Paper event
EntityLungeEventas requested in #8586.As well as expression to get/set/add/remove
lunge powerinside of the event.Solution
I've added
EvtEntityLunge.javaandExprLungePower.javaso that working with lunge event is possible from Skript land.Event:
[%-entitytypes%] lungeExpression:
[the] [event-]lunge powerExample:
Testing Completed
I managed to successfully run both
./gradlew clean quickTestand./gradlew build test.(In new test environment
java25/paper-26.1.2.json)And I did manual in-game testing with this script:
Supporting Information
I had to bump version of Paper API to
26.1.2-EntityLungeEventwas made available in that version.I've added test environment
java25/paper-26.1.2.json.I also want to propose additional changes:
lunge poweradd 1 to lunge powerlunge item(orlunge weapon) in entity lunge eventBut I would like some feedback on what I already introduced in this PR. As #8586 was marked
good first issueI wanted to try and contribute to the Skript project. I did my best to make this a reasonable contribution.It is worth mentioning that entity has to hold a weapon (e.g. a spear enchanted with lunge enchantment) (event if that weapon isn't visibly equipped) in order to perform lunge attack that fires this
EntityLungeEvent, but this isn't true for every mob type. (e.g. Zombies can't preform lunge attack at all)A list of entities that in general can perform lunge attack consists of (but is probably not limited to):
See the list
Completes: #8586
AI assistance: Copilot was active during development of this PR mainly for generating documentation part (
@Description([...]),@Example([...])). Though the rest of the code I wrote is based on classes that already exist:ExprLungePowerfromExprLocationandEvtEntityLungefromEntityTeleport.