BlockEvents.broken deny any block replacing
DevDyna opened this issue ยท 4 comments
Minecraft Version
1.20.1
KubeJS Version
kubejs-forge-2001.6.4-build.95
Rhino Version
rhino-forge-2001.2.2-build.13
Architectury Version
architectury-9.1.12-forge
Forge/Fabric Version
Forge - 47.2.1
Describe your issue
BlockEvents.broken event deny to use event.block.set or other ways to place a block
example :
BlockEvents.broken('minecraft:stone',event=>{
let toplace = 'minecraft:dirt'
event.block.set(toplace) //doesn't place the block and no errors
})
BlockEvents.broken('minecraft:stone',event=>{
let toplace = 'minecraft:dirt'
//doesn't place the block and no errors
event.server.runCommandSilent(`setblock ${event.block.x} ${event.block.y} ${event.block.z} ${toplace}`)
})
Crash report/logs
No response
only something like this can fix temporarly
event.server.scheduleInTicks(0, () => e.block.set(toplace))```
You need to cancel the event with event.cancel()
to stop the original block breaking from happening.
(note cancelling it will also exit from the event block, so should be done last)