[Bug]: Incorrect armor points calculation #6

Closed
opened 2025-03-21 03:41:40 +00:00 by Disketaa · 9 comments
Disketaa commented 2025-03-21 03:41:40 +00:00 (Migrated from github.com)

Version information

alpha 6

Expected Behavior

Armor with changed attribute modifier stops giving armor points

Actual Behavior

Image

Reproduction Steps

{
  "add": {
    "minecraft:attribute_modifiers": {
      "modifiers": [
        {
          "type": "minecraft:generic.armor",
          "id": "minecraft:generic.armor",
          "amount": 6,
          "operation": "add_value",
          "slot": "body"
        },
        {
          "type": "minecraft:generic.movement_speed",
          "id": "minecraft:base.movement_speed",
          "amount": -0.015,
          "operation": "add_multiplied_base",
          "slot": "body"
        }
      ]
    }
  }
}

Java version

21.0.4

Additional information

No response

### Version information alpha 6 ### Expected Behavior Armor with changed attribute modifier stops giving armor points ### Actual Behavior ![Image](https://github.com/user-attachments/assets/e0d73421-1733-4f16-b743-0cab282e1a1f) ### Reproduction Steps ``` { "add": { "minecraft:attribute_modifiers": { "modifiers": [ { "type": "minecraft:generic.armor", "id": "minecraft:generic.armor", "amount": 6, "operation": "add_value", "slot": "body" }, { "type": "minecraft:generic.movement_speed", "id": "minecraft:base.movement_speed", "amount": -0.015, "operation": "add_multiplied_base", "slot": "body" } ] } } } ``` ### Java version 21.0.4 ### Additional information _No response_
Awakened-Redstone commented 2025-03-21 05:11:44 +00:00 (Migrated from github.com)

There is a slight difference on how Mojang named the description for modifiers for the chest slot and how the data is taken, while is says "While on Body" it expects you to set the slot as "chest"

In your gif it says "When equipped" instead of "While on Body"
I'm unsure on the difference between this two but it seems to be enough for the armor points to not apply

While I was able to get things working by changing the slot type I am noticing a weird behavior on your gif, where the armor bars drop when you equip the boots

I'm looking into that part

There is a slight difference on how Mojang named the description for modifiers for the chest slot and how the data is taken, while is says "While on Body" it expects you to set the slot as "chest" In your gif it says "When equipped" instead of "While on Body" I'm unsure on the difference between this two but it seems to be enough for the armor points to not apply While I was able to get things working by changing the slot type I am noticing a weird behavior on your gif, where the armor bars drop when you equip the boots I'm looking into that part
Awakened-Redstone commented 2025-03-21 05:16:33 +00:00 (Migrated from github.com)

ok this is very weird
I'll look more into it once I wake up

ok this is very weird I'll look more into it once I wake up
Awakened-Redstone commented 2025-03-21 14:48:58 +00:00 (Migrated from github.com)

found the reason, all items were using the same id for the attributes

As by the Minecraft Wiki:

for some reason there is an id for the attribute modifiers and you can override them by using another item with the same id
but it behaves really inconsistently

found the reason, all items were using the same id for the attributes As by the [Minecraft Wiki](https://minecraft.wiki/w/Data_component_format#attribute_modifiers): - id: The unique [resource location](https://minecraft.wiki/w/Resource_location) to identify this modifier for some reason there is an id for the attribute modifiers and you can override them by using another item with the same id but it behaves really inconsistently
Awakened-Redstone commented 2025-03-21 14:49:14 +00:00 (Migrated from github.com)

oops

oops
Disketaa commented 2025-03-21 15:36:22 +00:00 (Migrated from github.com)

tysm!
will wait for the update on modrinth!

tysm! will wait for the update on modrinth!
Awakened-Redstone commented 2025-03-21 16:41:21 +00:00 (Migrated from github.com)

that is just a change needed on the datapack, where you set "id": "minecraft:generic.armor", and "id": "minecraft:base.movement_speed",, give a unique one for each armor piece

weirdly enough, I only found out by going to 1.21.4 where it showed me the details of the vanilla default attribute modifiers, and it didn't show me on 1.21

that is just a change needed on the datapack, where you set `"id": "minecraft:generic.armor",` and `"id": "minecraft:base.movement_speed",`, give a unique one for each armor piece weirdly enough, I only found out by going to 1.21.4 where it showed me the details of the vanilla default attribute modifiers, and it didn't show me on 1.21
Disketaa commented 2025-03-21 17:21:13 +00:00 (Migrated from github.com)

Seems like armor attributes was hardcoded in 1.21.1

Image

Image

Seems like armor attributes was hardcoded in 1.21.1 ![Image](https://github.com/user-attachments/assets/78f1574a-c259-46a5-b3d2-e415fafdfe05) ![Image](https://github.com/user-attachments/assets/b50276e6-3326-4fc7-9912-039bf0f5664d)
Awakened-Redstone commented 2025-03-21 17:22:48 +00:00 (Migrated from github.com)

yeah, that is what I was getting from my debug command
It seems that setting the component with the mod does override it tho, just need to have the id different for each armor slot

yeah, that is what I was getting from my debug command It seems that setting the component with the mod does override it tho, just need to have the id different for each armor slot
Disketaa commented 2025-03-21 17:39:48 +00:00 (Migrated from github.com)

yeah ID works well. Thanks a lot

yeah ID works well. Thanks a lot
Commenting is not possible because the repository is archived.
No description provided.