Minecraft /data Command
Inspects, modifies, merges, or removes NBT data on block entities, non-player entities, and persistent command storage.
バージョン対応
コマンド構文
/data get (block|entity|storage) ... | /data merge (block|entity|storage) ... | /data modify (block|entity|storage) ... | /data remove (block|entity|storage) ...引数の解説
operationget / merge / modify / remove必須The data operation: get (reads value), merge (combines NBT), modify (sets/appends/prepends values), remove (deletes tag).
targetblock <pos> / entity <target> / storage <id>必須Target container: a block entity at coordinates, a single non-player entity, or command storage namespace.
pathNBT PathNBT tag key or array path (e.g. Health, Items[0].count, custom_data.score).
実用的な使用例
/data get entity @e[type=zombie,limit=1] HealthReads and prints the current health value of the nearest zombie.
Entity inspection.
/data merge entity @e[type=creeper,limit=1] {powered:1b,ExplosionRadius:10}Merges NBT to charge a creeper and increase its blast radius.
Live entity modification.
/data modify block ~ ~-1 ~ Items[0].count set value 64Modifies the chest below you, setting the first item slot count to 64.
Container manipulation.
/data modify storage rpg:quest State set value "completed"Sets a persistent global variable in command storage.
Datapack global state management.
よくあるミス
ミス:
Attempting to modify player data (/data modify entity @s ...)
修正方法:
Player data is read-only. You can read player data with /data get, but must modify players via scoreboards, /item, or /attribute.
ミス:
Targeting multiple entities without limit=1
修正方法:
/data strictly requires a single target entity. Always append limit=1 to selectors: @e[type=zombie,limit=1]
ミス:
Trying to run /data on Bedrock Edition
修正方法:
/data is exclusive to Java Edition. Bedrock requires the Scripting API.
Java版と統合版の違い
Exclusive to Java Edition. Bedrock Edition does not support /data.
Command Block Usage & Automation
In technical maps and datapacks, /data is the core state management engine. Store complex variables in "storage namespace:data", dynamically update display entities or sign text, or read mob attributes into scoreboards using "/execute store result score @p BossHP run data get entity @e[type=wither,limit=1] Health".
便利なヒント
Command storage (/data modify storage ...) persists across game restarts and dimension boundaries without needing physical chunk loading.
Use /data get entity @s SelectedItem to inspect the exact component structure of whatever item you are holding.
重要な注意事項
Exclusive to Java Edition. By design, Minecraft prohibits using /data to modify player data directly (to avoid player desync and inventory corruption). Use /item or /scoreboard to interact with player states.
よくある質問
Can I use /data to change a player's gamemode or inventory?
No, player entity data cannot be modified with /data. Use /gamemode or /item commands instead.
Is there a Bedrock equivalent to /data?
No direct slash command equivalent exists on Bedrock. Bedrock uses the JavaScript GameTest / Scripting API.