#Prevent farmland from dehydrating
24 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
so far it seems the best solution for me is to disable random game tick...
i made this just to realize that it doesn't work for randomTicks only when the player steps
ForgeEvents.onEvent( 'net.minecraftforge.event.level.BlockEvent$FarmlandTrampleEvent', e => {
global.trampleEvent(e)
})
/**
*
* @param {Internal.BlockEvent$FarmlandTrampleEvent} e
*/
global.trampleEvent = e => {
const { level, pos } = e
if(level.isClientSide()) return
console.log('Yo')
Utils.server.getLevel(Client.level.dimension).getBlock(pos).set('farmland', {moisture:'7'} )
e.cancelable(true)
}```
idk if is possible to detect randomTicks
Yeah idk, from what i can tell detecting random ticks isn't a thing, and forge doesn't seem to have any block events specific to farmland moisture or reversion :(
true indeed
I think this does the same as
// prevent all trampling
BlockEvents.farmlandTrampled( event => {
event.cancel()
})
well, not the same but its the same event
neat. i found this after i made my code, lol
nice lol
i think it's possible to create new events in KubeJS but idk how it works, how it hooks to thing or how java works

It is possible to disable the random ticking of a block though.
Ex: ```js
BlockEvents.modification((e) => {
e.modify('minecraft:budding_amethyst', (block) => {
block.setIsRandomlyTicking(false)
})
})
I don't know if disabling the random ticking of farmland would work tho
OH, perfect, thank you!
do you know how i could get a list of all blocks in a specific tag at startup?
How could i pass in a long list of blocks? can the first argument of modify be an array of block ids?
No, but just loop through the blocks you need.
right, thanks!
that's really cool.
you just need something to make the farmland wet, but just need use the block.set() like i did and you're good to go