Jump to content

Custom Structure Spawn Conditions 1.14.4


izako

Recommended Posts

So after alot of messing around and trying random stuff I was able to get my structure to work. my problem is that i want the structure to only spawn once per world. I did that in 1.12.2 by using worldsaveddata but i cant do that here because the generate structure methods runs in every chunk and not for the whole structure. I tried looking at how the stronghold does it but i didn't really understand it. basically my question is how can I limit my structure spawning to x amount of times.

 

 

if you need it: 

 

Link to comment
Share on other sites

1 minute ago, diesieben07 said:

Using WorldSavedData or similar mechanisms isn't ideal because it means the world is no longer 100% dependent on the Seed (where your structure ends up being depends on in which order the chunks are generated).

 

The way I'd do it is derive another Random instance from the World seed and use that to generate the two chunk coordinates (x and z) of the chunk you want to be in. Then only generate in that chunk.

but my structure's size is several chunks, is your method still valid?

Link to comment
Share on other sites

1 hour ago, diesieben07 said:

Yes, the chunk coordinates you generate would be a fixed reference point on your structure, e.g. the north-west-most chunk of the structure.

If you then get a request to generate a specific chunk you can work out which part of your structure you need to generate (if any) from the position of the north-west-most chunk (generated by the seeded Random) and the chunk being generated.

how would i get a random chunkpos from the world seed?

Link to comment
Share on other sites

1 hour ago, diesieben07 said:

Yes, the chunk coordinates you generate would be a fixed reference point on your structure, e.g. the north-west-most chunk of the structure.

If you then get a request to generate a specific chunk you can work out which part of your structure you need to generate (if any) from the position of the north-west-most chunk (generated by the seeded Random) and the chunk being generated.

and how would i save that chunkPos so that it only ever spawns once(even when reloading the game)
sorry for the questions im really confused

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.