Conditional nodes with .mcdoc #672
-
So I noticed that the new .mcdoc system is now in use, and so I need to update my modded generator I plan to add to the new system. However I can't find very much information on mcdoc, and specifically on having conditional nodes. I know that the immersive weathering generator has something like this, but I haven't been able to untangle the mcdoc enough to figure out how. If anyone could give me a really simple example of how to do this kind of thing, it would be much appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
It depends on what exactly you need when you say "conditional nodes". There is no generic "if predicate, then use this schema" concept, but almost everything can be represented either by using union types or dispatchers: type Example = (
struct {
present: string,
} |
struct {
width: int,
height: int,
} |
) Or: struct Example {
preset?: string,
...myproject:example[[preset]],
}
dispatch myproject:example[%none] to struct {}
dispatch myproject:example[%unknown] to struct {
width: int,
height: int,
} The above two examples describe the same schema in practice. The second case is more meant when you actually want to dispatch something based on the value of Feel free to ask for more help if you have a specific schema that you're not sure how to represent with mcdoc! |
Beta Was this translation helpful? Give feedback.
-
@blockninja124 I've just written a short section with info about forking on the readme: https://github.com/misode/misode.github.io?tab=readme-ov-file#forking |
Beta Was this translation helpful? Give feedback.
It depends on what exactly you need when you say "conditional nodes". There is no generic "if predicate, then use this schema" concept, but almost everything can be represented either by using union types or dispatchers:
Or:
The above two examples describe the same schema in practice. The second case is more meant when you actually want to dispatch something based on the value of
preset
, but that's n…