Suggestion: Allow "registering" a mod as optional.
MentalMouse opened this issue ยท 8 comments
This would be a simple way to allow scripts to survive some changes in mod configuration, without introducing full-fledged "if/else" logic. (I assume that if you wanted real conditionals, you'd have put them in by now.)
A statement early in the file such as "modoption quark;" would register the mod name as a known mod name, but warn that it might not actually be present.
The effect of the statement would be that if the mod is not present, any recipe producing or using an item from that mod would be silently ignored; that is, it would not produce error messages for the declared mod(s) being missing. However, it would not interfere with the normal errors for statements where the mod name was misspelled, or where a mod which was expected to be present, wasn't.
I have read through the tutorials linked by your Wiki -- where is the if/else statement documented?
Would you perhaps be amenable to a Wikia Fandom wiki for CraftTweaker, so that such things could be documented more easily by people who are familiar with the mod's sourcecode? I'd be happy to start the wiki, if you like.
We have a documentor, and the wiki is going to be getting an overhaul pretty soon.
if loadedMods.contains("modidhere") {
doStuff();
} else {
doOtherStuff()
}
While you're at it, can you add "/mt hand"?
Also, is it possible to test the version numbers for MC or a mod?
@MentalMouse Sure, That also can go in. As for the other I have no Idea.
Really the wiki should cover all of the CT/MT commands and the /blockdata trick, along with the various code elements. I hope you'll eventually get to that point, so we aren't guessing at what's been added or didn't get covered in the ancient tutorials.