This Minecraft tutorial explains how to use the /attribute command with screenshots and step-by-step instructions.

You can use the /attribute command to get the total value of an attribute, get the base value of an attribute, set the base value of an attribute, or work with attribute modifiers for a targeted entity in Minecraft. Let’s explore how to use this cheat (game command).

Requirements

To run game commands in Minecraft, you have to turn cheats on in your world.

Attribute Command

Attribute Command in Minecraft Java Edition (PC/Mac)

In Minecraft Java Edition (PC/Mac), there are different syntaxes depending on what you would like to do with the attribute.

To get the total value of an attribute for a targeted entity:

/attribute <target> <attribute> get [scale]

To get the base value of an attribute for a targeted entity:

/attribute <target> <attribute> base get [scale]

To set the base value of an attribute for a targeted entity:

/attribute <target> <attribute> base set <value>

To add a modifier to an attribute for a targeted entity (fails if a modifier already exists for that attribute):

/attribute <target> <attribute> modifier add <uuid> <name> <value> add¦multiply¦multiply_base

To get the value of a modifier for an attribute for a targeted entity:

/attribute <target> <attribute> modifier value get <uuid> [scale]

To remove a modifier from an attribute for a targeted entity:

/attribute <target> <attribute> modifier remove <uuid>

Definitions

  • target is the name of a player (or a target selector) whose attribute you wish to target.
    (only target a single player, mob and armor stand since these are the only entities that have attributes)
  • value is the value for the attribute.
  • uuid is the UUID (or universally unique identifier) for the modifier that is formatted as a hyphenated hexadecimal value such as d8f04f59-ee03-4af2-a861-90c4995b4226.
  • scale is optional. It is the scale of the return result.
  • attribute is the name of the attribute that you wish to target. It can be one of the following:
    attribute
    minecraft:generic.armor
    minecraft:generic.armor_toughness
    minecraft:generic.attack_damage
    minecraft:generic.attack_knockback
    minecraft:generic.attack_speed
    minecraft:generic.flying_speed
    minecraft:generic.follow_range
    minecraft:generic.knockback_resistance
    minecraft:generic.luck
    minecraft:generic.max_health
    minecraft:generic.movement_speed
    minecraft:horse.jump_strength
    minecraft:zombie.spawn_reinforcements

Examples

Example in Java Edition (PC/Mac)

To get the total value of the Jump Strength attribute for the nearest horse:

/attribute @e[type=horse,sort=nearest,limit=1] horse.jump_strength get

To get the total value of the Jump Strength attribute of a specific horse using its UUID value (universally unique identifier):

/attribute f439a454-a7a3-4b2e-b38f-e4a2ad2da676 horse.jump_strength get

To get the base value of the Max Health attribute for the player named 9Minecraft:

/attribute 9Minecraft generic.max_health base get

To set the base value of the Max Health attribute for the player named 9Minecraft:

/attribute 9Minecraft generic.max_health base set 30

How to Enter the Command

1. Open the Chat Window

The easiest way to run a command in Minecraft is within the chat window. The game control to open the chat window depends on the version of Minecraft:

  • For Java Edition (PC/Mac), press the T key to open the chat window.

2. Type the Command

In this example, we will set the base value for the Max Health attribute for 9Minecraft to 30 in Minecraft Java Edition (PC/Mac) with the following command:

/attribute 9Minecraft generic.max_health base set 30

Type the command in the chat window. As you are typing, you will see the command appear in the lower left corner of the game window. Press the Enter key to run the command.

Once the cheat has been entered, the base value for the attribute will be updated.

You will see the message “Base value for attribute Max Health for entity 9Minecraft set to 30.0” appear in the lower left corner of the game window to indicate that the base value of the attribute has been successfully updated.

Since the Max Health for 9Minecraft was originally 20.0 as represented by 10 hearts in the health bar, you should now see 5 additional hearts appear in the health bar above the original 10 hearts (showing a total of 15 hearts). These 5 new hearts can be replenished by your food bar.

Congratulations, you just learned how to use the /attribute command in Minecraft!

Click to rate this post!
[Total: 2 Average: 5]