一、基础指令与目标选择器
1. 核心目标选择器
/give @s diamond 给自己钻石
/heal @p 治疗最近玩家
/kill @a 杀死所有玩家(慎用)
/kill @e[type=creeper] 清除所有苦力怕
/give @r minecraft:apple 随机给一位玩家苹果
@s[distance=..5]
/effect give @a[distance=..10] speed 60 2 给 10 格内玩家速度效果
/help [命令]
/help tp 查看传送指令用法
/say 欢迎来到服务器!
/tell <玩家> <消息>
/tell Steve 来我这拿装备
/w <玩家> <消息>
/me 正在挖掘钻石 显示为 "[玩家] 正在挖掘钻石"
直接输入获取当前世界种子
二、游戏模式与玩家状态
/gamemode survival 或 /gamemode 0
/gamemode creative 或 /gamemode 1
/gamemode adventure 或 /gamemode 2
/gamemode spectator 或 /gamemode 3
示例 :/gamemode creative @a 将所有玩家切换到创造模式
/kill <目标>
/kill @e[type=zombie] 清除所有僵尸
/heal <目标>
恢复满生命值(基岩版)
/heal @p 治疗最近玩家
/effect give <目标> <效果> [时间] [等级]
/effect give @s strength 30 2 给自己 2 级力量 30 秒
/effect clear <目标> [效果]
/effect clear @a poison 清除所有玩家中毒效果
/experience add <目标> <数量> [类型]
/xp add @s 100 levels 给自己 100 级经验
/xp set <目标> <数量> [类型]
/xp set @p 50 points 设置最近玩家 50 点经验
/time set <值>
0= 日出,6000= 中午,12000= 日落,18000= 午夜
/time add <值>
/time add 1000 快进 1000 刻
/time query
/time query daytime 查看当前游戏时间
/time set day
等效/time set 1000
/time set night
等效/time set 13000
/weather clear [时长]
/weather clear 600 晴天 10 分钟
/weather rain [时长]
/weather rain 无限雨天
/weather thunder [时长]
/weather thunder 300 雷雨 5 分钟
/weather query
/toggledownfall
3. 游戏规则(gamerule)
/gamerule <规则> <值>
布尔值用true/false
/gamerule keepInventory true 开启死亡不掉落
/gamerule mobGriefing false 禁止生物破坏方块
/gamerule naturalRegeneration false 关闭自然回血
/gamerule showCoordinates true 显示坐标
/gamerule doFireTick false 禁止火焰蔓延
/gamerule fallDamage false 关闭摔落伤害
/tp <目标> <目的地>
传送实体到位置 / 玩家
/tp @s Steve 传送到 Steve 身边
/tp
/tp 100 70 -200 传送到 (100,70,-200)
/tp <目标>
/tp @p 0 64 0 90 0 传送到原点并朝东
/locate <结构>
/locate village 查找最近村庄
/locatebiome <生物群系>
/locatebiome minecraft:desert 查找最近沙漠
/forceload add
/forceload add 0 0 10 10 加载 (0,0) 到 (10,10) 区块
/forceload remove
同上,替换 add 为 remove
/give <目标> <物品> [数量] [数据值]
/give @a diamond 64 给所有玩家一组钻石
/give <目标> <物品>{标签}
给予带 NBT 的物品
/give @s minecraft:diamond_sword{Enchantments:[{id:"minecraft:sharpness",lvl:5}]} 锋利 V 钻石剑
/clear <目标> [物品] [数量]
/clear @s diamond 清除自己所有钻石
/item replace entity <目标> <槽位> with <物品>
替换装备(1.17+)
/item replace entity @s weapon.mainhand with minecraft:netherite_sword
2. 附魔命令 /enchant <目标> <附魔ID> [等级]
/enchant @p protection 4 给最近玩家装备附上保护 IV
/enchant @s sharpness 5 给自己主手武器附上锋利 V
/enchant @a mending 1 给所有玩家装备附上经验修补
/summon <实体> [x] [y] [z] [NBT]
/summon minecraft:creeper ~ ~1 ~ {powered:1} 生成高压苦力怕
/kill <目标>
/kill @e[type=item] 清除所有掉落物品
/tag <目标> add/remove <标签>
/tag @s add boss 给自己添加 "boss" 标签
/entitydata <目标>
修改实体数据(Java 版)
/entitydata @e[type=zombie,limit=1] {CustomName:"\"愤怒僵尸\""}
2. 实用实体生成示例
/summon minecraft:skeleton ~ ~1 ~ {HandItems:[{id:"minecraft:bow",Count:1b,tag:{Enchantments:[{id:"minecraft:infinity",lvl:1}]}},{}],ArmorItems:[{id:"minecraft:diamond_helmet",Count:1b},{},{},{}]}
/summon minecraft:chest ~ ~1 ~ {LootTable:"minecraft:chests/simple_dungeon"}
/fill
/fill 0 64 0 10 74 10 minecraft:stone 填充 11x11x11 的石头立方体
/fill
/fill ~-5 ~-1 ~-5 ~5 ~-1 ~5 minecraft:diamond_block replace minecraft:stone 将脚下区域石头替换为钻石块
/setblock
/setblock ~ ~1 ~ minecraft:command_block 在头顶放置命令方块
/clone
/clone 0 64 0 10 74 10 20 64 0 复制区域到新位置
八、高级指令(命令方块 / 地图制作)
/give @s minecraft:command_block
/give @s minecraft:chain_command_block
/give @s minecraft:repeating_command_block
/gamerule commandBlockOutput false
2. 计分板系统 /scoreboard objectives add <名称> <类型> [显示名称] /scoreboard players set <目标> <计分板> <值> /scoreboard players add <目标> <计分板> <值>
示例 :创建击杀计数板 /scoreboard objectives add kills playerKillCount "击杀数" /scoreboard objectives setdisplay sidebar kills
/function <命名空间:路径>
/function mydatapack:spawn_boss
/datapack enable/disable <数据包>
/datapack enable "file/mydatapack.zip"
/tag <目标> add <标签>
/tag @e[type=zombie] add my_zombies
九、1.21 新增指令(Java 版)
/give @s minecraft:mace{Enchantments:[{id:"minecraft:smite",lvl:5}]}
/setblock ~ ~1 ~ minecraft:brushable_block{brushable_type:"minecraft:suspicious_gravel"}
/locate minecraft:trial_chamber
十、使用须知与常见问题
权限要求 :大部分指令需要 OP 权限(服务器管理员),单人模式需开启作弊
坐标表示 :~表示当前位置,~~1~表示当前位置上方一格
NBT 标签 :复杂实体 / 物品设置需使用 NBT,格式为{标签:值}
版本差异 :部分指令(如/locatebiome)仅 Java 版可用,基岩版有细微差异
错误排查 :命令执行失败时,聊天框会显示具体错误信息,可根据提示调整参数
十一、实用指令速查(直接复制可用)
/gamerule keepInventory true
/gamerule mobGriefing false
/gamerule showCoordinates true
/effect give @s speed 99999 2
/effect give @s jump_boost 99999 1
/give @s minecraft:netherite_helmet{Enchantments:[{id:"minecraft:protection",lvl:4}]} 1
/give @s minecraft:netherite_chestplate{Enchantments:[{id:"minecraft:protection",lvl:4}]} 1
/give @s minecraft:netherite_leggings{Enchantments:[{id:"minecraft:protection",lvl:4}]} 1
/give @s minecraft:netherite_boots{Enchantments:[{id:"minecraft:protection",lvl:4}]} 1
/give @s minecraft:netherite_sword{Enchantments:[{id:"minecraft:sharpness",lvl:5}]} 1
/kill @e[type=item]
/kill @e[type=experience_orb]
/gamerule doMobSpawning false
全部评论