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

item component repair_cost cannot be properly removed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 24w09a
    • None
    • Confirmed
    • Data Packs

      Unlike minecraft:damage, minecraft:repair_cost cannot be properly removed.

       

      Whereas, with damage, the value is not set to a default, but rather to `null`. Meaning the item cannot be damaged.

       

      But for repair_cost, the value is also not set to the default and also `null`, however, upon using an anvil (with this item on the left side, to retain its components) the repair cost is set to 1. Which is the same behavior as if the previous repair cost was the default '0'

       

      Reproduce:

      1. Create this item modifier in a datapack:
      {    
      "function": "set_components",  
        "components": {    
          "!minecraft:repair_cost": {} 
         }
      }
      1. Give yourself a sword and remove the repair cost from the sword.

       

      /item modify entity @s weapon.mainhand test:no_repair_cost 

       

       

      You can verify that the repair cost is nullified (/data get):

       

      [CHAT] Player has the following entity data: {components: {"minecraft:damage": 2, "!minecraft:repair_cost": {}}, id: "minecraft:netherite_sword"} 

       

      3. damage the sword a bit and repair with another sword in an anvil.

      4. Check the repair cost: it is now set to 1.

       

      I would expect that repair cost behaves the same as damage, where removing the component vs setting the default, does not result in the same behavior.

       

            Unassigned Unassigned
            m124367 AgentM
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: