CraftTweaker

CraftTweaker

151M Downloads

Accessing keys or values of associative array crashes

dshadowwolf opened this issue ยท 0 comments

commented

Issue description

When trying to directly use .keys or (not fully tested) .values on an associative array there is a NoSuchMethodError thrown

java.lang.NoSuchMethodError: 'java.lang.Object java.util.Map.keys()'
	at scripts.test.run(test.zs:19)
	at Scripts.run(Unknown Source)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Steps to reproduce

Setup an associative array and try to use either .keys or .values

While the example provided is basic, it does demonstrate the issue (if not the exact use-case)

import crafttweaker.api.item.IItemStack;

val test as IItemStack[IItemStack] = { <item:minecraft:golden_sword>: <item:minecraft:iron_sword> };

print( <item:minecraft:golden_sword> in test.keys );
// or
// print( <item:minecraft:iron_sword> in test.values );

Script used

see "steps to reproduce"

The crafttweaker.log file

https://gist.github.com/dshadowwolf/fc28002a16dbd0d5e376bba12be94059

Minecraft version

1.20.1

Modloader

Forge

Modloader version

47.3.7

CraftTweaker version

14.0.43

Other relevant information

No response

The latest.log file

none