How would I prevent structures from generating over edges?

Started by tazzan on

Topic category: Help with modding (Java Edition)

Last seen on 19:56, 31. Oct 2022
Joined Oct 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How would I prevent structures from generating over edges?

I have a couple of structures in a mod I'm developing, and every time without fail, it seems that they generate over ledges or on the sides of steep hills which make them look completely out of place. The image below shows one of these structures on the edge of a mountain, which is almost the exact opposite of what I want to happen. The structure block is generating on a solid block, yet the rest of the structure is not. The only thing I'm worried about is that by throttling the structure's generation too much it could make an already uncommon structure almost impossible to find, so I'm looking for a solution that strikes the right balance but I have no idea how to execute it.

Abandoned outpost structure which generated off the side of a mountain

Last seen on 13:35, 29. Mar 2024
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Check y-1 blocks to be solid
Sat, 10/16/2021 - 06:38

Check y-1 blocks to be solid

Last seen on 19:56, 31. Oct 2022
Joined Oct 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@woodcreatures thought it's…
Sat, 10/16/2021 - 19:27

@woodcreatures thought it's not exactly what you said, your statement made me think of a seemingly simple solution

I could check if y=1 of the middle of the structure is solid and if not then don't generate, making it so that at least most of the structure would generate on solid ground with few code to check