How can I make a player spawn into a building in The End?

I tried to build a small building around the End gateway (to the outer islands) to protect players to spawning out in the open with million Endermans around them).

Save house

My Problem is, no matter how I build the "arrival room" the players always spawn on the roof.

I would like to know if there is a way to make players spawn in a room instead of the highest possible block.

According the Minecraft Wiki about Player spawning (at world spawn) there should be a way to use a grassblock to force the player to spawn there if no other valid locations was found.

Unfortunately there are no further information in the wiki, if the End gateway teleport acts in the same way like the world-spawn.

So my question is:

  1. Are spawning rules for End gateway and world spawn the same like written above?
  2. Is it possible to make the roof an "invalid" spawn-area (e.g. with half-slabs, buttons or anything else)?
  3. Can anybody explain more detailed (e.g. with pictures) how the area must be build to make players spawn in my building?

EDIT: With the information from pinckerman`s answer, I made some more experiments in a copy of our server world and found some new information (in version 1.17.1):

  • when I build my whole roof with half slabs, I spawn on the wall around my building in the fancegate in the corner
  • when I remove the fance, I spawn in the same spot, crouched under the roof (technically "in the building")
  • when I replace the walls against fences (that are too high for a player to crouch, I spawn on the bedrock on the side of the gateway stucking in my roof
  • I tried to raise the whole floor (and ceiling) by one block and repeated the tests -> same result
  • BUT as soon as I replace one of the facegates around the build with a solid block, I keep spawning there

I made multiple testruns for each build-constellation and I was always spawning on exact the same location like listed above.

That means in total:

pinckerman`s answer is mostly correct with following additions:

  • because half slabs are no full blocks, they are considered as "invalid spawn location", but bedrock CAN be a valid spawn locations (when no other full-block is there)
  • when there are no valid spawnblocks under the open sky the game spawns you on the next full block that is next to the open sky, but only when this area is 1.5 blocks high (it doesn't work when it is 2 blocks high)

So it seams that the only way to spawn "inside" is when your build does not have outside-walls and is covered by half slabs e.g. like on this picture:

save house v2

My tests showed that in some points the spawn-rules for gateways are very confusion, so I still would be happy if anybody could find a better solution (at least that you can spawn in a 2 blocks high house).


Solution 1:

The algorithm works this way [emphasis mine]:

The gateway searches for a full block (which isn't bedrock), starting from the north-west corner at the topmost height (Y=255) within a 5 block radius around the gateway block. If there is a block at that position, then the entity is teleported onto that block. If there is no block, then the next position along the Z-axis is searched.
This continues along each column in an 11 × 11 area at the same Y-level with the exception of blocks above, below, or directly adjacent (including diagonals) to the gateway block. If there are no blocks, it moves one Y-level down and repeats the sequence from the north-west corner again.

This means that the game searches for a valid spot to spawn layer by layer from above, that's why you keep spawning on the roof.

So, apparently, a way to make the roof an "invalid" spawn-area is building it with bedrock blocks.

BUT, it also specifies full blocks, this means that half slabs should prevent the spawning on the roof.

EDIT

I spawn on the wall around my building in the fancegate in the corner

And that's how it's supposed to work, since it's higher than the floor. Try replacing the whole wall around with fences or stair pieces, that should make you spawn inside your building.

Solution 2:

With the help of pinckerman`s answer (keep an eye on the comments too), I was able to spawn inside a building arround the end-gateway.

Unfortunally the final build is 3 blocks high so enderman could technically spawn there, but it seems to be the only way to spawn INSIDE the building.

save house v3

So here are the important facts you need to know what you need to know this build

  • The bottom blocks inside your Building must be full blocks
  • the outer blocks must be stairs (otherweise you would spawn inside the fences)
  • the roof must be build out of halfslabs
  • the roof must be 3 blocks high (with all lower roof builds, you get strange situations where you spawn inside fences, or inside the stairs on the side of the gateway)