KubeJS

KubeJS

61M Downloads

[Bug] reschedule() is unstable

Withaust opened this issue ยท 1 comments

commented

Minecraft Version

1.20.1

KubeJS Version

kubejs-forge-2001.6.4-build.114

Rhino Version

rhino-forge-2001.2.2-build.18

Architectury Version

architectury-9.1.12-forge

Forge/Fabric Version

1.20.1-47.2.16

Describe your issue

Currently, for some reason this example does not seem to work:

BlockEvents.placed ('minecraft:cobblestone', event => {
    console.log('This fired immediately')
    event.server.scheduleInTicks(20, e => {
        console.log('fired inside scheduleInTicks, every 20 ticks (1second)')
        e.reschedule(20)
        //e.reschedule() also does nothing
    })
})

This fired immediately gets properly displayed, while fired inside scheduleInTicks sometimes outputs, sometimes outputs multiple times and sometimes it does not output anything at all, it is extremely inconsistent. Did the API change or was there some other breaking change that I am unaware about? I need this event to keep rescheduling itself constantly. This was working previously without any issues.

Crash report/logs

No response

commented

I find scheduleInTicks to only works when the server is reloaded (runs the reload command), before that it does nothing. A new instance of a server and schedule will not work. A temporary solution would be to run the reload command on server startup. I found that Create: Astral does this for some other reload specific fix