TheMasterGabriel Posted February 21, 2017 Share Posted February 21, 2017 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. Quote Link to comment Share on other sites More sharing options...
SecondAmendment Posted February 21, 2017 Share Posted February 21, 2017 I know how to in spiggot, not sure about forge though. Quote Link to comment Share on other sites More sharing options...
TheMasterGabriel Posted February 21, 2017 Author Share Posted February 21, 2017 (edited) 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 February 21, 2017 by TheMasterGabriel Quote Link to comment Share on other sites More sharing options...
jeffryfisher Posted February 21, 2017 Share Posted February 21, 2017 (edited) 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 February 21, 2017 by jeffryfisher Quote 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 More sharing options...
TheMasterGabriel Posted February 21, 2017 Author Share Posted February 21, 2017 (edited) 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 February 21, 2017 by TheMasterGabriel Quote Link to comment Share on other sites More sharing options...
TheMasterGabriel Posted February 21, 2017 Author Share Posted February 21, 2017 (edited) 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 February 21, 2017 by TheMasterGabriel Quote Link to comment Share on other sites More sharing options...
TheMasterGabriel Posted February 21, 2017 Author Share Posted February 21, 2017 How would I go about doing that then? The MapGen fields in the chunk provider are private, so I can't access them through the World object. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.