KubeJS (Old)

KubeJS (Old)

3M Downloads

Tags empty with KubeJS (no recipes modified)

thiakil opened this issue ยท 1 comments

commented

Minecraft Version

1.20.1

KubeJS Version

2001.6.5-build.16

Rhino Version

2001.2.3-build.10

Architectury Version

9.2.14

Forge/Fabric Version

Forge 47.4.0

Describe your issue

Loading KubeJS in a Forge instance leaves tags empty at the time ServerStartedEvent is fired. Without KubeJS, this doesn't happen.

This script is enough to cause it. For some reason BOTH logs appear to be necessary.

//server_scripts/example.js
console.info('Hello, World! (Loaded server scripts)')
ServerEvents.recipes(event => {
  console.log('Hello! The recipe event has fired!')
})

It can be observed when loaded alongside Mekanism. We have a handler that runs during ServerStarted which scans our recipes' ingredients for missing tags.
There will be a large red warning printed to the player upon logging in.

Tags should only be empty at this stage if they failed during loading due to an invalid json in a mod.

Crash report/logs

https://gist.github.com/thiakil/aef12b3c245fcdf81d5b475f3e261d4b

commented

The issue is kubejs async/parallel recipe worker.
To fix, go to kubejs/config/common.properties and set allowAsyncStreams to false

Here is the reason it is randomly failing:

First thread trying to create a tag minecraft:water

Image

Second thread also trying to add water, also notice the map being desynced

Image

First thread apparently won the race

Image

Second thread will return a reference that is not in the maps

Image

As you can see here, that Tag failed to bind and resolve the contents

Image