KubeJS

KubeJS

61M Downloads

/kjs_hand not copying renamed item nbt correctly

ClockwiseGear opened this issue ยท 2 comments

commented

Hi there. For some reason it seems that after renaming an item in an anvil, if you use the /kjs_hand command to get its information, the NBT data is copies uses a double quote around the Name parameter instead of a single.

Example:
/kjs_hand output:
Item.of('minecraft:iron_pickaxe', {RepairCost:0,AS_Amulet_Holder:[500538663,-1269806954,-1415675971,-885464155],Damage:0,display:{Name:"{"text":"test pick please ignore"}"}})

expected:
Item.of('minecraft:iron_pickaxe', {RepairCost:0,AS_Amulet_Holder:[500538663,-1269806954,-1415675971,-885464155],Damage:0,display:{Name:'{"text":"test pick please ignore"}'}})
(emphasis mine)

Edit since the formatting isn't very visible: The punctuation in question immediately follows the text Name: and before the next {

minecraft version 1.16.4
forge version 35.1.37
Java version 1.8.0.281 (64 bit)

commented

I might be completely wrong here, but it looks like Minecraft doesn't care about the type of string punctuation used as a string is simply a string.

As that information is not preserved (as far as I can see) it is completely within the scope of KubeJS's serialization of the data, found here: https://github.com/KubeJS-Mods/KubeJS/blob/master/common/src/main/java/dev/latvian/kubejs/util/MapJS.java#L104

@MaxNeedsSnacks this could be fixed by changing the string serialization above, but wouldn't that just end up creating the same problem with:

Item.of('minecraft:iron_pickaxe', {RepairCost:0,AS_Amulet_Holder:[500538663,-1269806954,-1415675971,-885464155],Damage:0,display:{Name:"{"text":"test pick please ignore"}"}})

This might simply be something that is not fixable.

commented

You could escape the double quotes by using "
This should fix that exact problem, right?