How would I prevent structures from generating over edges?

Started by tazzan on

Topic category: Help with Minecraft modding (Java Edition)

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

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

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

Joined Oct 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I know this is an older…
Sun, 08/17/2025 - 15:26

I know this is an older thread but I'll post my advice for future users:
You can tinker with structure placement via procedures, but an easier java-free method is to create a jigsaw structure.  You'll create your normal structure, and then also create a jigsaw structure that attaches to the bottom of it. It can be a basement or extension, or it can just be a column of dirt and stone. Below is an example of a castle I made that generates seamlessly onto the side of a hill by spawning in the top part, and then the lower section below it.