The bug
When entering a tall portal that takes you to a short portal from the top, you take suffocation damage. This also happens when going from a wide portal to a thin portal.
How to reproduce
Download the attached test world
Enter the portal from the very top platform (you should spawn at it; be careful not to fall down inside the portal)
Observe that when you enter the nether, note blocks triggered by pressure plates on top of the portal play, and you take a few hits of suffocation damage. (Also, you spawn at y=46.71429, while the max y you can fly up to under the portal is 45.2)
Code analysis
By @unknown, based on 1.12.2 decompiled using MCP 9.40. The problem is that the player's height and width aren't accounted for in net.minecraft.entity.Entity.setPortal(BlockPos)
when calculating lastPortalVec
. Player height and width then also need to be accounted for in net.minecraft.world.Teleporter.placeInExistingPortal(Entity, float)
.
Linked issues
is duplicated by 3
relates to 2
Attachments
Comments 7
This also occurs for wide portals - in a 5 block wide portal, teleporting from the end of either side causes the player to be teleported inside the nether portal frame, taking suffocation damage and being pushed inside the nether portal.
If the portal is 1 tall, it should make you crawl in the 1 tall space instead of taking suffocation damage.
Is this still an issue in 1.16.3 or later? It might have been fixed with some recent portal changes.
It seems to have been fixed with some portal changes in 20w28a, along with MC-80032.
here is the partial solution that I implemented (names based on MCP 9.40 pre1)
Location: world/Teletporter.java#placeInExistingPortal
its a partial fix - fixes offset in X and Z dimentions, not the Y. In essence translated offset in the exit portal doesn't account for enity width/height which may end up it spawning inside obsidian blocks.
Side note - I presented the fix in a video of mine with a poll (along other fixes and QOL improvements and this one got the most upvotes)