Jump to content

Check if Chunk has generated a structure?


TheMasterGabriel

Recommended Posts

I was wondering if there was a reliable way of checking if a chunk has generated a specific structure. I noticed that the PopulateChunkEvent provides a flag for when a village has generated in a chunk, but what about the other types of structures? From what I can tell, there isn't. I have some ideas for a PR if there isn't a way currently (as I think this would be a useful addition), but I just wanted to check to see if anybody else knows something that I missed.

Link to comment
Share on other sites

39 minutes ago, TheSunCat said:

What are you trying to do exactly? You can check for the world decoration, or for the structure spawning, depending on what you want to make.

 
 
 

Say I wanted to check if a chunk has spawned a specific structure. I know that I can check to see if a chunk has generated a specific terrain feature, like Dungeons or Lakes (etc), with the PopulateChunkEvent.Populate event. However, I can't seem to find something similar for physical structures, like Mineshafts or Ocean Monuments. I was wondering if something like that existed.

 

An example use-case would be to say, alert the player via a message if a Mineshaft or Stronghold has generated in a nearby chunk.

Edited by TheMasterGabriel
Link to comment
Share on other sites

You might get a lot of mileage out of detecting mob-spawners. Each stronghold generates at least the silverfish spawner, and each mine complex usually generates a couple spider spawners. And of course there are "dungeons".

 

Since these are very specific blocks, they might be easier to work with. If there's some other structure you want to detect, then think whether it generates a block that doesn't occur in nature (e.g. gold blocks in a sea temple).

Edited by jeffryfisher

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

That would certainly work for vanilla, I think, but how would I account for modded structures? If a mod decides to spawn an aboveground temple with a throne made of gold blocks, it might flag it as an Ocean Monument when it's obviously not. I suppose I could check the biome, but that wouldn't work if that mod decides to spawn that temple structure in ocean biomes as well.

Edited by TheMasterGabriel
Link to comment
Share on other sites

1 hour ago, diesieben07 said:

Every MapGenStructure will contain a list of known structures, keyed by chunk coordinates.

 
 
 
 

In a future update? Will that be easily accessible, say whenever a Chunk in generated, so I could theoretically make a mod as I described above?

 

5 hours ago, TheMasterGabriel said:

An example use-case would be to say, alert the player via a message if a Mineshaft or Stronghold has generated in a nearby chunk.

 
Edited by TheMasterGabriel
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.