How to get Portal type from MoveEntityEvent.Teleport.Portal

The title says it all. How do I find out if an entity teleported through a nether portal or an end portal?

The Cause only contains a PortalTeleportCause but that doesn’t help much…

This is both a little bit unclean, but:
You could check the From/To Locations:
To is Nether -> Nether
To is End -> End
To is Overworld and From is Nether -> Nether
To Is Owerworld and From is End -> End

Or you check the From location for an end or nether portal block ^^

1 Like