Hello. I am using a few mods on this world, but the ones that will be effected by the code would be TerraFirmaCraft, ArbourFirmaCraft, and Ex Nihilo: Sequentia.
My goal is to enable a function of ENS to be used with TFC. The mod currently works with vanilla leaves, and I cannot figure out how to get it to work with TFC. With the normal pack in mostly vanilla minecraft, you hold a silkworm item in your hand, then right click on a leaf block. This turns the leaf block into an infesting leaf block, which then turns into an infested leaf block after a cool down.
I have tested this in a superflat world with the mods I am trying to compat with, and it still works just fine with vanilla leaves, just not the modded ones.
This is the code I am attempting to use in the server_scripts folder.
if (event.block.id === 'minecraft:leaves' && !(event.block.id === 'tfc:fruit_tree_leaves')) {
if (event.player.getHeldItem('main_hand').id === 'exnihilosequentia:silkworm') {
event.block.set('exnihilosequentia:infesting_leaves')
ItemEvents.rightClicked('exnihilosequentia:silkworm', (event) => {
const { item } = event
item.count--
})
}
}
})
I primarily work with normal Java, so this is a bit of a learning curve/adjustment for me. Therefore I may have some incorrect syntax. Any advice would be appreciated.




