I see, so my ComponentMap is done with ComponentMap.CODEC.decode(NbtOps.INSTANCE, nbt).result().get().getFirst();
Still, StringNBTReader expects the regular styled NBT to open with a curly bracket. [STDERR]: com.mojang.brigadier.exceptions.CommandSyntaxException: Expected '{' at position 0: <--[HERE]
Before what would have been
"item": "minecraft:bread{Enchantments:[{id:\"knockback\",lvl:2}]}"
in a config is now
"item": "minecraft:bread[minecraft:enchantments={levels:{\"minecraft:knockback\":2}}]"
if (group.item.contains("[")) {
NbtCompound nbt;
ComponentMap component;
try {
nbt = StringNbtReader.parse(group.item.substring(index));
component = ComponentMap.CODEC.decode(NbtOps.INSTANCE, nbt).result().get().getFirst();
itemStack.applyComponentsFrom(component);
} catch (CommandSyntaxException e) {
e.printStackTrace();
}
}
I am using the substring of what corresponds to the component map in the same manner that I was doing for plain NBT, just now with the decode intermixed, but if it errors out from the initial parse, then where would I go from here?