#how to detect if a mod is installed
25 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
if (Platform.isLoaded('mod')) {
// the rest of the owl
}
Wait what do you mean 'where'
Mods can only be in the mods folder
Or bundled in other mods
i mean detect if a mod is installed
Ah
how to detect if a mod is installed
with 1.19 you can also do it in the header of the file
if you start your js file with
//requires: mod
it'll only run that whole file if the mod is installed
lexxie that might be a good slash command? This post by chief
[Quote ➤](#archived-example-scripts message) In 1.19.2 you can use various comments at the top of a script to change its load conditions.
For example: ```js
//ignored: true
console.log("I am never printed")
```js
//packmode: default
console.log('I will only print when packmode in kubejs/config/common.properties is set to default')
//requires: minecraft
//requires: create
console.log('I will only print when mods with ids of minecraft AND create are loaded')
You can stack these too, like so
//priority: 10
//packmode: hard
//requires: create
//requires: tconstruct
console.log('I am complicated!')
Will do soon, not at the pc
for the if statement i get this error Error occurred while handling event 'ServerEvents.recipes': Java class "dev.latvian.mods.kubejs.script.PlatformWrapper" has no public instance field or method named "isloaded".
Capital L
now it seems to have affected my variable inside the if statement and i get this error (i suck at coding)
Error occurred while handling event 'ServerEvents.recipes': TypeError: redeclaration of var compacting.
now im here
just show your code?
should i just link the command or rewrite it as part of the response 
link the post i mean
that's your domain 😄
if (Platform.isLoaded('thermal')) {
const compacting = (modname, name, isIngot) => {
if (isIngot) {
event.recipes.createCompacting(`thermal:${name}_gear`, [
`${modname}:${name}_ingot`,
`${modname}:${name}_ingot`,
`${modname}:${name}_ingot`,
`${modname}:${name}_ingot`
])
}
else {
event.recipes.createCompacting(`thermal:${name}_gear`, [
`${modname}:${name}`,
`${modname}:${name}`,
`${modname}:${name}`,
`${modname}:${name}`
])
}
}
event.recipes.createCompacting(`thermal:lapis_gear`, [
'minecraft:lapis_lazuli',
'minecraft:lapis_lazuli',
'minecraft:lapis_lazuli',
'minecraft:lapis_lazuli'
])
compacting('minecraft', 'iron', true)
compacting('minecraft', 'gold', true)
compacting('minecraft', 'copper', true)
compacting('minecraft', 'netherite', true)
compacting('minecraft', 'diamond', false)
compacting('minecraft', 'emerald', false)
compacting('minecraft', 'quartz', false)
compacting('thermal', 'signalum', true)
compacting('thermal', 'lumium', true)
compacting('thermal', 'enderium', true)
compacting('thermal', 'tin', true)
compacting('thermal', 'nickel', true)
compacting('thermal', 'lead', true)
compacting('thermal', 'silver', true)
compacting('thermal', 'bronze', true)
compacting('thermal', 'electrum', true)
compacting('thermal', 'invar', true)
compacting('thermal', 'constantan', true)
}
})```
/headers 