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

Can't change default_mining_speed with data set value if that component isn't already set on item

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Awaiting Response
    • None
    • 1.21
    • None
    • Unconfirmed
    • Commands

      **
      I was trying to change the value of the default_mining_speed of an item by using

      /data modify entity @n[type=minecraft:chest_minecart] Items[0].components.minecraft:tool.default_mining_speed set value 1.6f

      (The Item was in the minecarts first slot)

       

      This works, as long as the item already had a default_mining_speed set.

      If it did not have that component already, nothing happens if you try to set it with the above command.

       

      It works perfectly well with

      /data modify entity @n[tag=xpc.minecart] Items[0].components.minecraft:max_damage set value 100

       

      And it also works in the minecraft:tool component with

      /data modify entity @n[type=minecraft:chest_minecart]  Items[0].components.minecraft:tool.rules.[].blocks set value "#minecraft:needs_stone_tool"

       

      Steps to Reproduce:

      Loottable for testing:

      {{{}}
          "pools": [
            {
              "rolls": 1,
              "entries": [
                {
                  "type": "minecraft:item",
                  "name": "minecraft:stone_pickaxe",
                  "functions": [
                    {
                      "function": "minecraft:set_components",
                      "components": {
                        "minecraft:max_damage": 500,
                        "minecraft:rarity": "rare",
                        "minecraft:tool": {
                          "rules": [
                            {
                              "blocks": "#minecraft:needs_iron_tool",
                              "correct_for_drops": true
      {{                      }}}
                          ],
                          "default_mining_speed": 1.2,
                          "damage_per_block": 1
                        },
                        "minecraft:lore": [
                          "{\"color\":\"gray\",\"text\":\"reinforced\"}"
                        ]
      {{                }}}
      {{              }}}
                  ]
      {{          }}}
              ]
      {{      }}}
          ]
      {{  }}}

       

      If you try to change the default_mining_speed of the item the loottable gives with the above command (with 1.6 or 1.6f) it will work.

      If you try to set the default_mining_speed on a item that doesnt already have a default_mining_speed  set, it wont work.

      Just to be clear, i have added the other minecraft:tool components to items that did not have any components on them. Just the default_mining_speed doenst work.
       

      This is a link of me trying to set the component

      https://imgur.com/a/TSuYh4Z

            Unassigned Unassigned
            imalittlhigh imalittlhigh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: