KubeJS (Old)

KubeJS (Old)

3M Downloads

clickEventOf does not work with maps.

ChiefArug opened this issue ยท 0 comments

commented

Minecraft Version

1.18.2

KubeJS Version

kubejs-forge-1802.5.4-build.502

Rhino Version

rhino-forge-1802.1.14-build.190

Architectury Version

architectury-4.5.75-forge

Forge/Fabric Version

40.1.19

Describe your issue

clickEventOf does not recognise a normal map input, such as {action: 'run_command', value: '/tp 0 64 0'} as a proper click event and instead passes it to mc literally as an open url click event.
Full script: ```js
onEvent('player.chat', event => {
let message = Component.string('Quick Commands').bold()
let teleportClickEvent = Component.clickEventOf({action: 'run_command', value: '/tp 0 64 0'})
let teleportCommand = Component.yellow('Teleport').bold(false).click(teleportClickEvent)
message.append(teleportCommand)
event.player.tell(message)
})

It results in this error, which makes me think its passing it along literally: ```
[26Jun2022 21:37:34.806] [Render thread/ERROR] [net.minecraft.client.gui.screens.Screen/]: Can't open url for ClickEvent{action=OPEN_URL, value='{action: run_command, value: /tp 0 64 0}'}
java.net.URISyntaxException: Illegal character in scheme name at index 0: {action: run_command, value: /tp 0 64 0}
	at java.net.URI$Parser.fail(URI.java:2974) ~[?:?]
	at java.net.URI$Parser.checkChars(URI.java:3145) ~[?:?]
	at java.net.URI$Parser.checkChar(URI.java:3155) ~[?:?]
	at java.net.URI$Parser.parse(URI.java:3170) ~[?:?]
	at java.net.URI.<init>(URI.java:623) ~[?:?]
	at net.minecraft.client.gui.screens.Screen.m_5561_(Screen.java:353) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at net.minecraft.client.gui.screens.ChatScreen.m_6375_(ChatScreen.java:148) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at net.minecraft.client.MouseHandler.m_168084_(MouseHandler.java:88) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at net.minecraft.client.gui.screens.Screen.m_96579_(Screen.java:528) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at net.minecraft.client.MouseHandler.m_91530_(MouseHandler.java:85) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at net.minecraft.client.MouseHandler.m_168091_(MouseHandler.java:185) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:103) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at net.minecraft.client.MouseHandler.m_91565_(MouseHandler.java:184) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar%2347!/:build 10]
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar%2343!/:build 10]
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) ~[lwjgl-glfw-3.2.2.jar%2347!/:build 10]
	at com.mojang.blaze3d.systems.RenderSystem.m_69495_(RenderSystem.java:204) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at com.mojang.blaze3d.platform.Window.m_85435_(Window.java:333) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1066) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:663) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at net.minecraft.client.main.Main.main(Main.java:205) ~[client-1.18.2-20220404.173914-srg.jar%2376!/:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:31) ~[fmlloader-1.18.2-40.1.19.jar%2316!/:?]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.3.jar%235!/:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.3.jar%235!/:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.3.jar%235!/:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.3.jar%235!/:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.3.jar%235!/:?]
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.3.jar%235!/:?]
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.3.jar%235!/:?]
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?]

Setting a variable to the map and then passing that variable in does not work either.

Crash report/logs

No response