Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-192982

Loot Table function enchant_randomly can give Non-Stored Enchantments to books if another function enchants it first.

XMLWordPrintable

    • Confirmed
    • (Unassigned)

      The Bug

      The game has two kinds of enchantments, StoredEnchantments for books and Enchantments for everything else. The loot table function enchant_randomly will give the wrong kind of enchantment to books if another function has already enchanted it.

      {
        "type": "minecraft:chest",
        "pools": [
          {
            "rolls": {
              "min": 4.0,
              "max": 8.0,
              "type": "minecraft:uniform"
            },
            "entries": [
              {
                "type": "minecraft:item",
                "functions": [
      	    {
                    "function": "minecraft:enchant_with_levels",
                    "levels": 30,
                    "treasure": true
                  },
      	    {
                      "function": "enchant_randomly",
                      "enchantments": [
                          "protection",
                          "fire_protection",
                          "feather_falling",
                          "blast_protection",
                          "projectile_protection",
                          "thorns",
                          "depth_strider",
                          "frost_walker",
                          "sharpness",
                          "knockback",
                          "fire_aspect",
                          "looting",
                          "efficiency",
                          "silk_touch",
                          "unbreaking",
                          "fortune",
                          "power",
                          "punch",
                          "flame",
                          "infinity",
                          "mending"
                      ]
                  }
                ],
                "name": "minecraft:book"
              }
            ]
          }
        ]
      }
      

      The same thing happens if the function enchant_randomly is used twice, with the second enchantment being bugged.

      If the function enchant_randomly is used on its own, then it gives a StoredEnchantment as intended.

      If the function enchant_randomly is used, then enchant_with_levels, then enchant_with_levels won't give any enchantments at all.

            Unassigned Unassigned
            paint Paint
            Votes:
            6 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: