Skip to content

Fix NoSuchElementException in EntityTransformEvent for slimes#12510

Merged
lynxplay merged 3 commits into
PaperMC:mainfrom
Doc94:fix/slime-double-transform-event-issues
May 2, 2025
Merged

Fix NoSuchElementException in EntityTransformEvent for slimes#12510
lynxplay merged 3 commits into
PaperMC:mainfrom
Doc94:fix/slime-double-transform-event-issues

Conversation

@Doc94
Copy link
Copy Markdown
Member

@Doc94 Doc94 commented May 2, 2025

Related to #12509 the current code from NMS can have the edge case where the slimes from a convertion can be null and not added to the list causing later pass an empty list to the event and fails when try to get the first entity, this PR just skip the call if that happen.

also include a minor cleanup of the event class

@Doc94 Doc94 requested a review from a team as a code owner May 2, 2025 13:40
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue May 2, 2025
@lynxplay
Copy link
Copy Markdown
Contributor

lynxplay commented May 2, 2025

I am a bit torn between early exiting there vs potentially just not running the event and skipping it if the list is for some reason empty.

E.g. if there is some logic down below, an empty list of slimes to spawn should still run that, just not call the transform event given the slime isn't transforming into anything.

Doc94 and others added 3 commits May 2, 2025 20:26
… wake up and code its like code in the night :)
Instead of returning if slime list is empty, skip the event call and
progress with the rest of the method (which is a noop rn). If for some
reason slimes can normally be removed with size > 1 and no children (via
e.g. future event calls prior), follow up logic should not be skipped
because the transform event cannot be called.
@lynxplay lynxplay force-pushed the fix/slime-double-transform-event-issues branch from 5aa539c to 99d5160 Compare May 2, 2025 18:26
@github-project-automation github-project-automation Bot moved this from Awaiting review to Awaiting final testing in Paper PR Queue May 2, 2025
@lynxplay lynxplay merged commit d637ae8 into PaperMC:main May 2, 2025
3 checks passed
@github-project-automation github-project-automation Bot moved this from Awaiting final testing to Merged in Paper PR Queue May 2, 2025
@Doc94 Doc94 deleted the fix/slime-double-transform-event-issues branch May 2, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

3 participants