Properly find portal material when teleporting an entity

An EntityPortalEvent may be fired, even when the entity is not exactly inside the portal.
In this case, the block at the entity's location is probably air, thus cancelling the teleport.
Fix players being teleported back to end world when exiting via end portal

Occasionally, the player's location when entering the portal is set
at one block above the portal. This fix makes sure to check the block
below this position when deciding the type of the portal.