mojira.dev
MC-127181

Unable to set item name with loot table "set_nbt" function

set_nbt works well with all nbttags but the name one.
my loottable file:

{
    "pools": [
        {
            "rolls": 1,
            "entries": [
                {
                    "type": "item",
                    "name": "minecraft:salmon",
                    "weight": 1,
					"conditions": [
                                {
                                    "condition": "entity_properties",
                                    "entity": "this",
                                    "properties": {
                                        "on_fire": false
                                    }
                                }
                            ],
                    "functions": [
                        {
                            "function": "set_count",
                            "count": {
                                "min": 1,
                                "max": 1
                            }
                        },
						{
                            "function": "minecraft:set_nbt",
                            "tag": "{display:{Name:\"Name\",Lore:[\"Lore\"]}}"
                        }
                    ]
                },
				{
                    "type": "item",
                    "name": "minecraft:cooked_salmon",
                    "weight": 1,
					"conditions": [
                                {
                                    "condition": "entity_properties",
                                    "entity": "this",
                                    "properties": {
                                        "on_fire": true
                                    }
                                }
                            ],
                    "functions": [
                        {
                            "function": "set_count",
                            "count": {
                                "min": 1,
                                "max": 1
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

I will get the item with the Lore "Lore" but the name is still the default name.

Comments 1

The value of the Name nbt tag needs to be valid json in an nbt string, Lore does not use json strings (yet).

To prevent 2 layer deep nesting, use the new "set_name" function

{
    "function": "set_name",
    "name": JSON TEXT HERE
}

PlanetNebulirion

(Unassigned)

Unconfirmed

Minecraft 18w10d

Retrieved