TransWikia.com

What is the function to add a lore to a custom items in a custom loot table

Arqade Asked by Sjam on April 26, 2021

Part 2:

So, I have created a custom fish that comes out of a custom loot table, and it took a while to get it to have a name. It turned out that there is a function called “set_name” and I could name the item. Now I want to add a lore to the item, however, I tried “set_lore” and it broke the loot table like before. (You Get Nothing From Fishing). So I need to know what the function is to add a lore to the object.

Here is the Fish Item (Working Without Lore):

{
  "type": "minecraft:fishing",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:tropical_fish",
          "weight": 1000,
          "quality": -1,
          "functions": [
            {
              "function": "set_nbt",
              "tag": "{CustomModelData:3}"
            },
            {
              "function": "minecraft:set_name",
              "name": {
                "text": "Bluegill",
                "color": "white",
                "italic": "false"
              }
            }
          ]
        }
      ]
    }
  ]
}

Here is what I tried to add the lore with (Errors Out And No Fish For You):

{
  "type": "minecraft:fishing",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:tropical_fish",
          "weight": 1000,
          "quality": -1,
          "functions": [
            {
              "function": "set_nbt",
              "tag": "{CustomModelData:3}"
            },
            {
              "function": "minecraft:set_name",
              "name": {
                "text": "Bluegill",
                "color": "white",
                "italic": "false"
              }
            },
            {
              "function": "minecraft:set_lore",
              "lore": {
                "text": "Test",
                "color": "gray",
                "italic": "false"
              }
            }
          ]
        }
      ]
    }
  ]
}

So if anyone knows the magic Minecraft json function to add a lore, i would be very grateful to know it. 🙂 Thanks!

One Answer

The wiki (archive) explains lore in set_lore as "List of JSON text components", so you probably need square brackets around it:

              "function": "minecraft:set_lore",
              "lore": [
                {
                  "text": "Test",
                  "color": "gray",
                  "italic": "false"
                }
              ]

Disclaimer: I didn't test this, I just applied the usual Minecraft commands logic to the wiki's explanation.

Answered by Fabian Röling on April 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP