Skip to content

Prevent softlocked end exit portal generation#6525

Merged
kennytv merged 1 commit into
PaperMC:masterfrom
NoahvdAa:prevent-end-exit-softlock
Sep 3, 2021
Merged

Prevent softlocked end exit portal generation#6525
kennytv merged 1 commit into
PaperMC:masterfrom
NoahvdAa:prevent-end-exit-softlock

Conversation

@NoahvdAa
Copy link
Copy Markdown
Member

As shown in this video, there are minecraft seeds, such as 4717237, where no block generates in the end at 0,0. Because of this, the exit end portal will be placed at a negative coordinate, causing the bottom two blocks of the exit portal to be cut off. When beating the dragon, the game tries to place the actual end portal blocks at Y=-1, which isn't possible. Because of this, after beating the dragon, players are stuck in the end until they kill themselves. This PR ensures the exit portal fully spawns above Y > 0, to prevent these types of softlocks.

@NoahvdAa NoahvdAa requested review from a team as code owners August 30, 2021 14:01
@lynxplay
Copy link
Copy Markdown
Contributor

i don't know if min-build-height is the best default here.
The above for-loop, which aims to find the location for the portal, limits the portal location to > this.level.getSeaLevel() which, while deprecated, defaults to 63.

The min-build-height might be quite far from the main island in terms of y level.

@NoahvdAa
Copy link
Copy Markdown
Member Author

I used min height to stay closer to vanilla's low generation (although that doesn't entirely make sense). Sea level (is there a sea in the end? 🤔 ) might be a better idea, since the dragon perches above the exit end portal every now and then, and fighting her that low seems a bit inconvenient, especially since arrows can't hit her in that stage. Would like to hear someone else's opinion about this as well.

@NoahvdAa
Copy link
Copy Markdown
Member Author

NoahvdAa commented Sep 1, 2021

Using sea level looks a bit... ehm...

2021-09-01_12 24 51

@lynxplay
Copy link
Copy Markdown
Contributor

lynxplay commented Sep 1, 2021

Using sea level looks a bit... ehm...

Yea I also played around with it.
To be honest, your initial draft might just be the most "This is not supposed to happen, take this as the bare minimum and be thankful you can finish the game" solution.

Tho purging is pretty horrible when using min-build height as the dragon takes forever to fly down.

@NoahvdAa
Copy link
Copy Markdown
Member Author

NoahvdAa commented Sep 2, 2021

"This is not supposed to happen, take this as the bare minimum and be thankful you can finish the game"

That's what I was going for here, wanted to make the game finish-able without altering vanilla too much.

@Amaroq-Clearwater
Copy link
Copy Markdown

I think an additional check should be added so that it the End Exit still fails to spawn correctly, then it would instead try to spawn one where the dragon died (essentially a fallback to the pre-1.9 behavior.)

Alternatively, one could also move the portal to spawn at a nearby location other than 0,0 if the blocks at 0,0 aren't available.

And if all of that still doesn't work? Maybe replace the void blocks beneath Y = 0 (or Y = –64, post caves-and-cliffs) with End Exit blocks as a final (albeit inelegant) fallback once the Ender Dragon is dead. They could be hidden by a simple black fog so that you can't really see them until you're touching them.

@NoahvdAa
Copy link
Copy Markdown
Member Author

NoahvdAa commented Sep 3, 2021

I don't think another check is needed. If the portal has somehow magically disappears in between entering the end and killing the dragon, the game already spawns back the portal, which should be enough, even for these edge-case seeds.

@kennytv kennytv force-pushed the prevent-end-exit-softlock branch from 2eb14a3 to 49c2064 Compare September 3, 2021 18:04
@kennytv kennytv merged commit 3562558 into PaperMC:master Sep 3, 2021
@NoahvdAa NoahvdAa deleted the prevent-end-exit-softlock branch September 3, 2021 18:05
LeonTG pushed a commit to LeonTG/Paper that referenced this pull request May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants