Basically, I have some recipe changes and events that run with the contents of a mod. However, I'm planning on removing said mod from my modpack, but don't want the code to go to waste in the case that a player decides to add the mod to the modpack. Is there a method that detects whether a mod exists in the mod loader, and if so, continues with the script code?
#How to detect whether a mod exists in the mod loader before continuing with a script
17 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Platform.isLoaded('mod')
ah thank you! I'll have to give this a test tomorrow
mod would be the mod's namespace, correct?
Should be iirc
Yeah that's correct
And then you Just Put that inside an If statement
You can also use comments at the top of the File to only make the File load If that Mod is pressnt
It's
// mod: mod_namespace iirc, but could be wrong
alright so I tested via the method and the comment at the top of the file, and it appears as if only the former method works
// mod: iceandfire
console.log('Ice and Fire: Dragons is loaded')
console.log('Neapolitan loaded: ' + Platform.isLoaded('neapolitan')) // Should log true
console.log('Ice and Fire: Dragons loaded: ' + Platform.isLoaded('iceandfire')) // Should log false
the method works fine in my favor though
thank you!
It was //requires: minecraft See here https://kubejs.com/wiki/tips/headers