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

The loot table function set_damage not applied if the item is unbreakable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.12.2, Minecraft 18w11a, Minecraft 18w19b, Minecraft 1.13-pre5, Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9, Minecraft 1.13, Minecraft 18w30a, Minecraft 18w30b, Minecraft 18w31a, Minecraft 18w32a, Minecraft 18w33a, Minecraft 1.13.1-pre1, Minecraft 1.13.1-pre2, Minecraft 1.13.1, Minecraft 1.13.2-pre1, Minecraft 1.13.2-pre2, Minecraft 1.13.2, Minecraft 18w43a, Minecraft 18w43b, Minecraft 18w43c, Minecraft 18w44a, Minecraft 18w45a, Minecraft 18w46a, Minecraft 18w47a, Minecraft 18w47b, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w02a, Minecraft 19w03a, Minecraft 19w03b, Minecraft 19w03c, Minecraft 19w04b, Minecraft 19w05a, Minecraft 19w06a, Minecraft 19w07a, Minecraft 19w08a, Minecraft 19w08b, Minecraft 19w09a, Minecraft 19w11a, Minecraft 19w11b, Minecraft 19w12a, Minecraft 19w12b, Minecraft 19w13a, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14 Pre-Release 1, Minecraft 1.14 Pre-Release 2, Minecraft 1.14 Pre-Release 3, Minecraft 1.14 Pre-Release 4, Minecraft 1.14 Pre-Release 5, Minecraft 1.14, Minecraft 1.14.1 Pre-Release 1, Minecraft 1.14.1 Pre-Release 2, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 1, Minecraft 1.14.2 Pre-Release 2
    • Fix Version/s: None
    • Labels:
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      See title, the tool is not getting a Damage value when it is also setting Unbreakable.

      Loot table used to test:

      {
          "pools": [
              {
                  "rolls": 1,
                  "entries": [
                      {
                          "type": "item",
                          "name": "minecraft:fishing_rod",
                          "functions": [
                              {
                                  "function": "set_nbt",
                                  "tag": "{Unbreakable:1b}"
                              },
                              {
                                  "function": "set_damage",
                                  "damage": 0.5
                              }
                          ]
                      }
                  ]
              }
          ]
      }

      The log file returns the following:

      [20:27:25] [Server thread/WARN]: Couldn't set damage of loot item 1xitem.minecraft.fishing_rod

      Code analysis

      Using MCP1.12 names, in method net.minecraft.world.storage.loot.functions.apply(), it checks if the item can be damaged using isItemStackDamageable(), which returns false if the item does have a damage value but is set to Unbreakable. It could check instead if getMaxDamage() isn't 0.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              AlexMCool Alex³
            • Votes:
              11 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: