KubeJS (Old)

KubeJS (Old)

3M Downloads

addJson does not work in 1.18.2

ChiefArug opened this issue ยท 3 comments

commented

Minecraft Version

1.18.2

KubeJS Version

kubejs-forge-1802.5.1-build.353

Rhino Version

rhino-forge-1801.1.9-build.135

Architectury Version

architectury-4.2.50

Forge/Fabric Version

40.1.0

Describe your issue

Tested by adding a tag to red or black wool. Neither work, but the message does get logged.

  onEvent('server.datapack.last', event => {
	console.log('datapack last event triggered')
	event.addJson('minecraft:tags/blocks/floofs', {
		"replace": false,
		"values": [
			"minecraft:black_wool"
		]
	})
})

onEvent('server.datapack.high_priority', event => {
	console.log('datapack high priority event triggered')
	event.addJson('minecraft:tags/blocks/floofiest', {
		"replace": false,
		"values": [
			"minecraft:red_wool"
		]
	})
})

Also tried with some worldgen data while testing for #325. Didnt work.

Crash report/logs

No response

commented

Same as #309

commented

Nevermind, Mojang changed the way data loads yet again, ugh...

commented

Alright, so in short, there was an issue here, which is that KubeJS virtual datapacks couldn't add JSONs to new namespaces (i.e. ones that don't have any data attached already).

However, the code you posted wouldn't do what you want it to do anyways because you forgot the .json at the end of the filename, meaning it would've been added to the datapack as a file without an extension :p

I've "fixed" both of these indev, the first using a horrible, horrible workaround, the other one by just appending .json if the user forgets to do that