在这个充满创意与无限可能的沙盒游戏——《我的世界》中,命令方块是玩家实现自动化和创造奇迹的重要工具。掌握各种命令方块代码指令,能让你的游戏体验提升到新的层次。本文将为你揭示详细的命令方块指令大全,无论是初学者还是资深玩家,都能从中获益匪浅。
一、基础命令方块指令
/setblock: 用于设置指定位置的方块类型,如`/setblock ~ ~1 ~ stone`放置一块石头。
/fill: 填充一个区域,如`/fill ~ ~1 ~ ~5 ~ ~1 ~ diamond_block`填满钻石方块。
/clone: 复制方块或实体,如`/clone ~ ~1 ~ ~ ~ ~ ~1 ~ ~2 ~ 10 10 10`复制10x10x10的空间。
二、逻辑与控制类指令
/if: 条件判断,如`/if score @e[type=player] > 10`检查玩家分数是否大于10。
/execute: 执行特定的命令,如`/execute at @e[type=item] run tp @s ~ ~1 ~`传送所有物品到玩家位置。
/time: 调整游戏时间,如`/time set day`设置游戏时间到白天。
三、数据与操作类指令:
/scoreboard objectives add: 创建新得分板对象,如`/scoreboard objectives add points dummy`。
/tag: 管理游戏内的标签,如`/tag add @a[tag=VIP]`添加VIP标签给所有玩家。
/data merge: 合并数据包,如`/data merge storage:player/username`读取玩家数据。
四、事件触发与循环类指令
/schedule: 定时任务,如`/schedule execute at 0 0/10 run say Hello World`每10秒说一次话。
/chain: 连续执行命令,如`/chain command1 command2`顺序执行两个命令。
/repeat: 循环执行,如`/repeat 10 /tp @s ~ ~1 ~`重复移动10次。
五、高级功能与自定义
/execute in: 在指定方块内执行,如`/execute in @e[type=air] run summon creeper`只对空气块召唤爬行者。
/execute under: 在指定方块下执行,如`/execute under @e[type=player] run tp @s ~ ~1 ~`只在玩家脚下执行。
/execute store result: 结果存储,如`/execute store result storage:commands/command_result`保存执行结果。
