KubeJS

KubeJS

61M Downloads

Add handle for top level files

TiphaineLAURENT opened this issue ยท 2 comments

commented

Hi ๐Ÿ˜
Could you add support for top level files ?
By top level I mean : kubejs/

The goal of this feature is to be able to handle common file like constants:

// kubejs/constants.js

const removedItemsId = [...]
// kubejs/client_scripts/jei.js

onEvent('jei.hide.items', event => {
    event.hide(removedItemsId)
})
// kubejs/server_scripts/remove.js

onEvent('recipes', event => {
    removedItemsId.forEach(removedItemId => {
        event.remove({ input: removedItemsId })
        event.remove({ output: removedItemsId })
    }
})
commented

There's a global object you can use to share things across script types ^^

Just add a startup script that has global.removedItemsId = [โ€ฆ] and then you can use that across files

commented

There's a global object you can use to share things across script types ^^

Just add a startup script that has global.removedItemsId = [โ€ฆ] and then you can use that across files

Is there any way I can contribute to https://mods.latvian.dev/books/kubejs ?