[Bug]: Can't apply rules on tool component #2

Closed
opened 2025-03-15 23:09:12 +00:00 by Disketaa · 2 comments
Disketaa commented 2025-03-15 23:09:12 +00:00 (Migrated from github.com)

Version information

Latest

Expected Behavior

I was trying to add rules in tool component but there is error with "tags". If I'm using "minecraft:dirt" for example, everything works correctly, but with "#" not

Here the file

{
  "add": {
    "max_damage": 150,
    "minecraft:tool": {
      "default_mining_speed": 25,
      "damage_per_block": 20,
      "rules": [
        {
          "blocks": ["#minecraft:incorrect_for_iron_tool"],
          "correct_for_drops": false
        },
        {
          "blocks": ["#minecraft:mineable/pickaxe"],
          "correct_for_drops": true
        }
      ]
    }
  }
}

Actual Behavior

Here the log:
java.util.concurrent.CompletionException: java.lang.IllegalStateException: Not a valid resource location: #minecraft:mineable/pickaxe Non [a-z0-9_.-] character in namespace of location: #minecraft:mineable/pickaxe; Not a valid resource location: #minecraft:incorrect_for_iron_tool Non [a-z0-9_.-] character in namespace of location: #minecraft:incorrect_for_iron_tool missed input: {"minecraft:tool":{"default_mining_speed":25,"damage_per_block":20,"rules":[{"blocks":["#minecraft:incorrect_for_iron_tool"],"correct_for_drops":false},{"blocks":["#minecraft:mineable/pickaxe"],"correct_for_drops":true}]}}

Reproduction Steps

Create a file with JSON I sent above

With rules[...]
and without

Maybe I misspelled something

Java version

21.0.4

Additional information

No response

### Version information Latest ### Expected Behavior I was trying to add rules in tool component but there is error with "tags". If I'm using "minecraft:dirt" for example, everything works correctly, but with "#" not Here the file ``` { "add": { "max_damage": 150, "minecraft:tool": { "default_mining_speed": 25, "damage_per_block": 20, "rules": [ { "blocks": ["#minecraft:incorrect_for_iron_tool"], "correct_for_drops": false }, { "blocks": ["#minecraft:mineable/pickaxe"], "correct_for_drops": true } ] } } } ``` ### Actual Behavior Here the log: `java.util.concurrent.CompletionException: java.lang.IllegalStateException: Not a valid resource location: #minecraft:mineable/pickaxe Non [a-z0-9_.-] character in namespace of location: #minecraft:mineable/pickaxe; Not a valid resource location: #minecraft:incorrect_for_iron_tool Non [a-z0-9_.-] character in namespace of location: #minecraft:incorrect_for_iron_tool missed input: {"minecraft:tool":{"default_mining_speed":25,"damage_per_block":20,"rules":[{"blocks":["#minecraft:incorrect_for_iron_tool"],"correct_for_drops":false},{"blocks":["#minecraft:mineable/pickaxe"],"correct_for_drops":true}]}}` ### Reproduction Steps Create a file with JSON I sent above With rules[...] and without Maybe I misspelled something ### Java version 21.0.4 ### Additional information _No response_
Awakened-Redstone commented 2025-03-15 23:19:42 +00:00 (Migrated from github.com)

It seems minecraft expects only items in an array, or tags in a simple string
Changing it to use string instead of arrays works perfectly fine

{
  "add": {
    "max_damage": 150,
    "minecraft:tool": {
      "default_mining_speed": 25,
      "damage_per_block": 20,
      "rules": [
        {
          "blocks": "#minecraft:incorrect_for_iron_tool",
          "correct_for_drops": false
        },
        {
          "blocks": "#minecraft:mineable/pickaxe",
          "correct_for_drops": true
        }
      ]
    }
  }
}
It seems minecraft expects only items in an array, or tags in a simple string Changing it to use string instead of arrays works perfectly fine ```json { "add": { "max_damage": 150, "minecraft:tool": { "default_mining_speed": 25, "damage_per_block": 20, "rules": [ { "blocks": "#minecraft:incorrect_for_iron_tool", "correct_for_drops": false }, { "blocks": "#minecraft:mineable/pickaxe", "correct_for_drops": true } ] } } } ```
Disketaa commented 2025-03-15 23:31:00 +00:00 (Migrated from github.com)

Yay, you the best one!

Yay, you the best one!
Commenting is not possible because the repository is archived.
No description provided.