How to get the real world height, not just original terrain ?

Started by djécraft on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to get the real world height, not just original terrain ?
Fri, 07/04/2025 - 18:39 (edited)

Helloooo,

I’m a beginner with MCreator (version 2025.1) and I can’t figure out how to get the real world height at given X and Z coordinates.

I want my block or structure to appear above everything, even if a player built something (house, walls…).

The problem is world surface only gets the original terrain height, so sometimes the block spawns inside buildings or glitches underground.

I can’t find which block or method to use to get the current world height (with player-built blocks).

If someone could explain how to do this in a procedure, with a small MCreator example, that would really help me because I’m still a beginner.

Thank you very much for your help !

                          ------------------------------------------------------------Update-----------------------------------------------------------------

Hello everyone,

I finally found a solution!
To really get the world height including player-built blocks, I made a spawnY variable and set it to a high value (like 300).
Then I use a while loop with Get block at (X, Y, Z) to check if the block below spawnY is air:

  • If it’s air, I do Set global spawnY to spawnY - 1 to move down one block.
  • When the block below spawnY is no longer air, I have the true surface at that spot!

After that, I place my chest or structure with Place NBT structure at spawnY.

✅ Now the block always spawns above everything, even if players built houses or walls.

Hope this helps other beginners like me!
Good luck everyone!

Edited by djécraft on Fri, 07/04/2025 - 18:39