Minecraft – Combining Custom Loot Table With Custom Name

minecraft-java-edition

Ok, I've created a custom loot table for fishing that adds a fish with a Custom-Model-Data tag. However, for some reason, I can't seem to be able to combine the custom name.

Here is the data of the item I want in the loot table:

/give @p minecraft:tropical_fish{display:{Name:"{\"text\":\"Bluegill\",\"italic\":false}"},CustomModelData:3} 1

Here is the current working loot table without the name:

{
  "type": "minecraft:fishing",
  "pools": [
    {
      "rolls": 1.0,
      "entries": [
        {
          "type": "minecraft:item",
          "weight": 10,
          "name": "minecraft:cod"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "name": "minecraft:salmon"
        },
        {
          "type": "minecraft:item",
          "weight": 3,
          "name": "minecraft:pufferfish"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "name": "minecraft:tropical_fish"
        },
        {
          "type": "minecraft:item",
          "name": "minecraft:tropical_fish",
          "weight": 85,
          "functions": [
            {
              "function": "set_nbt",
              "tag": "{CustomModelData:3}"
            }
          ]
        }
      ]
    }
  ]
}

It's the last one, the tropical fish. Thanks!


Ok, I found what I need but I still need to combine them. The custom name is a function

    {
    "function": "minecraft:set_name",
    "name": {
        "text": "Test",
        "color": "red
    }
}

I need to add this to:

"functions": [
            {
              "function": "set_nbt",
              "tag": "{CustomModelData:3}"
            }
          ]

I'm not the best at JSON so could someone help me add to this function set?

Best Answer

Got It!

{
  "type": "minecraft:fishing",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "weight": 10,
          "name": "minecraft:cod"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "name": "minecraft:salmon"
        },
        {
          "type": "minecraft:item",
          "weight": 3,
          "name": "minecraft:pufferfish"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "name": "minecraft:tropical_fish"
        },
        {
          "type": "minecraft:item",
          "name": "minecraft:tropical_fish",
          "weight": 85,
          "functions": [
            {
              "function": "set_nbt",
              "tag": "{CustomModelData:3}"
            },
            {
              "function": "minecraft:set_name",
              "name": {
                "text": "Bluegill",
                "color": "blue"
              }
            }
          ]
        }
      ]
    }
  ]
}