Attribute Command Generator — /attribute Get, Set Base & Modifiers (Java Edition)
Run these from an operator’s chat, a command block, or the server console. Rotate, Swing and Display Entity use newer command/entity features — check they’re available on your Minecraft version.
How to Use the Attribute Command Generator
- Pick a mode: Get (read the current value), Set Base (change the base stat), Add Modifier, Remove Modifier, or Get Modifier Value.
- Enter a target selector, defaulting to
@p, and pick an attribute such asminecraft:max_healthorminecraft:movement_speed. - Fill in the extra fields that appear for your mode – a scale for Get, a base value for Set Base, or a modifier ID/value/operation for the modifier modes.
- Copy the generated
/attributecommand into a command block, the console, or an operator’s chat.
Command Syntax Reference
/attribute <target> <attribute> get [scale] /attribute <target> <attribute> base set <value> /attribute <target> <attribute> modifier add <id> <value> <operation> /attribute <target> <attribute> modifier remove <id> /attribute <target> <attribute> modifier value get <id> [scale]
Attributes are an entity’s underlying numeric stats – max health, movement speed, attack damage, armor, knockback resistance, and many more modern ones like step height and gravity. Every attribute has a base value plus any number of modifiers stacked on top, and the final effective value is computed from all of them combined, which is exactly what the plain get mode returns.
Base set permanently changes the attribute’s underlying value – for example, setting minecraft:max_health‘s base to 40 doubles a player’s normal max health, independent of any Health Boost effect or modifier layered on top.
Modifiers are the mechanism behind effects, enchantments, and equipment bonuses internally, and the command exposes the same system directly. Each modifier needs a unique ID (a resource-location-style name you choose) and an operation that controls how its value combines with the base:
add_value– adds the flat value directly to the running total.add_multiplied_base– addsbase × valueto the running total (a percentage of the base stat alone).add_multiplied_total– addscurrentTotal × value, applied after other modifiers, compounding on top of whatever the value already is.
A modifier stays attached until removed with modifier remove <id> – it persists across relogging and respawning, unlike a timed status effect. modifier value get <id> reports what that one specific modifier is currently contributing, separate from the attribute’s total.
Frequently Asked Questions
What’s the difference between base set and adding a modifier?
Base set directly overwrites the attribute’s foundational value, discarding whatever the old base was, while a modifier is a separate, additional adjustment layered on top of the base without touching it – you can add, and independently remove, several modifiers while the base stays exactly what you set it to.
Why do I need a unique modifier ID?
The ID is how you (or later commands) reference that specific modifier again – to remove it, or to read exactly how much it’s contributing with modifier value get. Reusing an existing ID typically fails or is rejected rather than silently overwriting the old modifier, so pick something identifiable, like minecraft:my_speed_boost.
What does the operation (add_value / add_multiplied_base / add_multiplied_total) actually change?
add_value is a flat bonus. add_multiplied_base scales only off the attribute’s base value, so it won’t compound with other percentage modifiers. add_multiplied_total scales off the running total after other modifiers have already been applied, so several add_multiplied_total modifiers compound multiplicatively with each other.
Do attribute changes survive death, relogging, or a server restart?
A changed base value and any added modifiers are stored as part of the entity’s persistent data, so they survive relogging and (for saved entities/players) a server restart. They do not automatically reset on death the way a status effect clears – a modifier or base change stays until explicitly removed or reset, or until the entity itself stops existing.
Related Tools
- Effect Command Generator – apply a temporary status effect instead of a permanent attribute change.
- Enchant Command Generator – boost combat stats through an item enchantment instead of a raw attribute edit.
- Damage Command Generator – test how a modified max_health or armor attribute holds up against a hit.