mojira.dev
MC-305476

/item replace into armor slot with non-armor items (e.g., Glass) corrupts armor attribute

Steps to Reproduce

  1. Start a Vanilla Minecraft Java Edition server (version 1.21.11 confirmed).

  2. Join the server with operator (OP) permissions.

  3. Ensure your character's armor slots are empty. You can verify the baseline armor value by executing: /attribute @s minecraft:generic.armor get (It should return approximately 0.0E-7).

  4. Execute the command to force a non-armor item into the helmet slot: /item replace entity @s armor.head with minecraft:glass

  5. Immediately query the armor attribute again: /attribute @s minecraft:armor get

  6. Manually remove the glass from the helmet slot via the inventory.

  7. Query the armor attribute a third time: /attribute @s minecraft:armor get

What I expected to happen :

  • The glass item, not being armor, should not be equippable in the armor slot or should contribute zero armor points.

  • After removing the glass, the player's armor attribute should return exactly to its correct baseline (0).

What happened instead:

  • After step 4 and step 5: The armor attribute value becomes 11.0 (which equals 11 armor points, visually increasing the armor bar). This is an incorrect, massively inflated value.

  • After step 6 and step 7: The attribute value does not reset to zero. It persists at an incorrect residual value (e.g., 2.0E). This proves a state corruption.

Additional Information :

  • Severity : This bug allows players with command access to grant permanent, unfair armor bonuses, breaking survival mode balance.

  • Environment: Reproduced on an Aternos-hosted Vanilla server, confirming it is a bug in the official Mojang server software.

  • Suggested Fix : The /item replace command (or the underlying game logic) should validate that an item belongs to the armor category before allowing it to be placed in an armor slot and before calculating its attribute contributions.

Environment

Server Environment :

Software: Official Minecraft Java Edition Vanilla server JAR.

Version: 1.21.11 (Confirmed via /version command output: "This server is running Vanilla Minecraft version 1.21.11").

Hosting: Aternos (providing an unmodified Vanilla server environment).

Key Configuration: The server was running with online-mode=false and the user had operator (OP) permissions, which were necessary to execute the /item replace command for testing.

Client Environment :

Software Standard Minecraft Java Edition client.

Modifications: No mods, data packs, resource packs, or plugins were installed on either the client or the server. This was a pure Vanilla setup.

Attachments

Comments 4

This has got to be the craziest bug I've ever seen.

I cannot reproduce this.

Me neither. Can you upload a video recording showcasing the bug, with the debug overlay (F3) enabled and showing the game version for at least part of the recording?

You can record your screen using:

  • On Windows, the built-in Snipping Tool app (shift+win+S)

  • On macOS, the the built-in Screenshot app (shift+cmd+5)

  • Third-party software such as OBS

It is recommended that you trim, convert and/or reduce the quality of your recording so that it is under 10MB, as this will make the upload much quicker.

黄梓涵

(Unassigned)

Unconfirmed

(Unassigned)

1.21.11

Retrieved