Structure Spawning and Offset

Started by TheVoidShadows on Sun, 11/20/2022 - 05:39

Topic category: Help with modding (Java Edition)

Last seen on 03:11, 29. Nov 2022
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Structure Spawning and Offset
Sun, 11/20/2022 - 05:39

1.) How exactly do structures decide where to generate?

Do they generate based on where the structure block was when the structure was made?
Do they generate based on the south-east corner of the structure?

Or do they generate based on the corner of the structure?

 

2.) If I am to offset the structure so that it is centered on where it generates, would I offset negative or positive?
    Positive would be x: 1 y: 1 z:1
    Nagative would be x: -1 y: -1 z: -1

Last seen on 16:27, 27. Jan 2023
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Structures generate facing…
Sun, 11/20/2022 - 06:07

Structures generate facing the positive x and z axis; essentially, the default option is the same thing as the game placing down a structure block on top of the ground, and triggering it. If rotation is randomized, it uses the same rotation system as the structure block.

I learned this the hard way. 

Mcreator's instructions are kind of vague, but through a bit of trial and error, I've learned the following that might be useful to you:

  • If you want the structure to be centered on the chosen location, you'll need to subtract half the width/length of the structure from the z and x values respectively. (And you'll need to have an odd length/width if you want it to be exact.
  • If you don't want your structure cutting through terrain or generating floating, there are a couple options: making a condition that checks if the terrain is viable, making procedures that adapt the structure to the terrain, or just making a structure in such a way that the terrain doesn't really matter. (If it's big enough, the surrounding terrain won't make much of a difference.) 
  • That last one is important: By default, structure only check the single block they generate on. Unless you add additional procedures, you can get stuff generating on cliffs, partly buried, partly underwater, inside other features, etc. It's not always clear whether biome features generate before custom structures, but you're better safe than sorry.

 

Last seen on 03:11, 29. Nov 2022
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thank you. I'm safe to…
Sun, 11/20/2022 - 06:43

Thank you. I'm safe to assume that the structure rotates BEFORE it offsets?