TelepathicGrunt / StructureTutorialMod

A short example showing how to register a structure and get it to generate in all biomes in NeoForge, Forge, and Fabric! (check the branches)
MIT License
264 stars 29 forks source link

Question! #8

Closed Zathrox closed 3 years ago

Zathrox commented 3 years ago

Hey dude! been working with some new structures and just wanted to bounce something off you.

But do you know, if you can use jigsaw pieces inside another structure? for example I have a 30x30 structure which is a ring and inside I have a courtyard with a jigsaw pointing into it. The idea is to randomly generate a different courtyard but all my tests seem to not be spawning it.

If I use the jigsaw piece manually, it'll generate my courtyard but if I generate my starting jigsaw/structure with max generation, it doesn't work! :( Even tried spawning it naturally in the world using the code, etc and no avail/ not sure what i'm doing wrong or if i'm missing something.

TelepathicGrunt commented 3 years ago

Yes it is possible to spawn jigsaw pieces inside other pieces but the limitation is that the jigsaw pieces cannot be partially intersection. The child piece must either fit entirely within the parent piece or entirely outside the parent piece. Pillager outposts has a base plate piece which is ginormous and inside it, they have a Jigsaw piece that generates the outpost so that the outpost fits entirely within the base plate piece's bounds.

If you are still stuck, can you share your repo? I can clone and take a look.

Zathrox commented 3 years ago

I think that make sense actually, my initial structure is only 8 blocks or so tall but I made my courtyards atleast 15 blocks tall to have something tall like a tree, so i'm guessing its extruding outside the parent and not spawning, so if thats the case, if I increase the base structure height, I should be good? i'll go test that out and if not, i'll send you the repo! Thanks :D

Also do you have any tutorials or tips for processors? I was checking out your repurposed structures and saw that you use them to randomise or spawn pillars with the data blocks? I'd love to know more about them also!

Zathrox commented 3 years ago

Yup, that fixed the issue! thanks a lot! Just got to remember that room for later!

TelepathicGrunt commented 3 years ago

Glad that helps!

For processors, I would recommend sticking with the json ones. Specifically, the rule processor as that is easiest to understand and randomize blocks for instead of making your own processors.

The first step is to make a json file in resources/data/<mod_id>/worldgen/processor_list and then fill it with this. The input_predicate will look for the block to replace along with a probability of how often it will use the output_state for what blockstate to use as the replacement for the block. output_state must always list every property of the block though so keep that in mind. This rule processor has only 1 rule. https://github.com/TelepathicGrunt/RepurposedStructures/blob/master/src/main/resources/data/repurposed_structures/worldgen/processor_list/village/birch/mossify.json

Then in your pool file, put in the resourcelocation for the processor file you made and the game will use that https://github.com/TelepathicGrunt/RepurposedStructures/blob/d2383aaa70fd5f7480d69aa2810aca5b5046f53d/src/main/resources/data/repurposed_structures/worldgen/template_pool/village/birch/houses.json#L9

In fact, you can list multiple rules like this. Notice how some of the location_predicate will check for if the structure block is going to replace water. This is how villages turns their roads into planks when replacing water! https://github.com/TelepathicGrunt/RepurposedStructures/blob/master/src/main/resources/data/repurposed_structures/worldgen/processor_list/village/birch/path_randomizer.json

This should help you really get started! If you get stuck or want to dive deeper, check out this discord full of modders who will be glad to help! I'm often on there as well too in my #telepathicgrunt-mods channel as well as in the #mod-dev-1.16 channel for helping people