KubeJS (Old)

KubeJS (Old)

3M Downloads

`java.lang.Object` is not the fallback type of `number` or other primitives

Prunoideae opened this issue ยท 0 comments

commented

Minecraft Version

1.20.1

KubeJS Version

2001.6.4-build.114

Rhino Version

2001.2.2-build18

Architectury Version

9.1.12

Forge/Fabric Version

NeoForge 47.1.81

Describe your issue

A call to setValue<T extends Internal.Comparable<T>, V extends T>(arg0: Internal.Property_<T>, arg1: V): S; will almost always crash as arg1: V is resolved to java.lang.Object at runtime, while the JS primitive types are considered to be different types.

Example code (not complete):

let level = blockEntity.blockState.getValue($ComposterBlock.LEVEL)
blockEntity.blockState = blockEntity.blockState.setValue($ComposterBlock.LEVEL, level + 1)

Crash report/logs

https://gist.github.com/Prunoideae/7ca82c9220a7b4786b50f55a5153d779