KubeJS (Old)

KubeJS (Old)

3M Downloads

[Bug] reschedule doesn't use correct timer

TheonlyTazz opened this issue ยท 1 comments

commented

Minecraft Version

1.20.1

KubeJS Version

kubejs-forge-2001.6.3-build.52.jar

Rhino Version

rhino-forge-2001.2.2-build.6.jar

Architectury Version

architectury-9.1.12-forge.jar

Forge/Fabric Version

Forge-47.1.47

Describe your issue

When using an event.server.scheduleInTicks and use a reschedule() it will not respect that the time is in ticks, but will default to miliseconds. This behaviour was different in 1.18

Example Script:

BlockEvents.placed ('minecraft:cobblestone', event => {
    console.log('This fired immediately')
    event.server.scheduleInTicks(200, e => {
        console.log('fired inside scheduleInTicks, every 200 ticks (10seconds)')
        e.reschedule(200)
    })
})

Output.log:

[19:51:06] [Server thread/INFO]: example.js#2: This fired immediately
[19:51:16] [Server thread/INFO]: example.js#4: fired inside scheduleInTicks, every 200 ticks (10seconds)
[19:51:16] [Server thread/INFO]: example.js#4: fired inside scheduleInTicks, every 200 ticks (10seconds)
[19:51:16] [Server thread/INFO]: example.js#4: fired inside scheduleInTicks, every 200 ticks (10seconds)
[19:51:17] [Server thread/INFO]: example.js#4: fired inside scheduleInTicks, every 200 ticks (10seconds)
[19:51:17] [Server thread/INFO]: example.js#4: fired inside scheduleInTicks, every 200 ticks (10seconds)
[19:51:17] [Server thread/INFO]: example.js#4: fired inside scheduleInTicks, every 200 ticks (10seconds)
[19:51:17] [Server thread/INFO]: example.js#4: fired inside scheduleInTicks, every 200 ticks (10seconds)

Code in Question in 1.18 link
Code in Quesiton in 1.20 link

Crash report/logs

No response

commented

Should be fixed