Minecraft Wiki

除另有声明,转载时均必须注明出处若簡繁轉換出錯,請以遊戲內為準请勇于扩充与修正内容有兴趣逛逛我们的微博沟通交流,欢迎到社区专页需要协助,请在告示板留言

了解更多

Minecraft Wiki
Advertisement

命令(commands)是藉由输入特定文本字符串而激活的进阶功能。

使用方法

请注意,本条目所述皆为官方原版游戏中的指令。列表外的指令均非原版指令。


一般的客户中,命令由 Minecraft聊天视窗中输入,藉由按下 T 键(预设) 或 / 键叫出聊天视窗。使用 / 键也会同时输入命令必备的前缀斜线,因此这是个实用的快捷键。在输入命令时按下 Tab ↹ 键会循环可用的命令或参数。

命令也可以在多人服务器的控制台输入,但是不需要加入前缀的 / 。命令方块中的命令可以加入前缀 / ,但是非必要。命令方块中的命令可能还会要求可选择的参数,通常是玩家的名字。

大多数命令只能在以下状况有效:

有些命令在不允许作弊的生存模式中仍然可用

注意:在单人游戏中,如果不允许作弊,仍可以藉由公开目前的游戏至局域网 ( Esc → "公开至局域网" ,点选 "允许作弊" ,接着 "公开至局域网" ) 而暂时可以作弊。你不必真的在局域网上或让别人加入。这并不是永久的,但它可以允许命令的使用直到你离开该世界,你使用命令所改变的东西都会被存档 (items spawned 等命令) 。你可以在再次开启游戏时重复以上步骤。注意当公开至局域网时游戏便无法暂停,所以在打开游戏目录时最好找个安全的地方。你可以重新载入世界来取消公开至局域网。

如果在命令方块中执行测试类命令(例如/testfor),命令方块会将测试结果以红石信号形式输出到相连的红石比较器中。

波浪号

很多命令可以使用波浪号(~)来指定相对座标。在波浪号后方的数字是个 偏移量 而不是一个座标。偏移符号可以指定要往轴的正或负方向移动。一个单一的波浪号可以简写为 ~0

举例来说, tp 0 64 0 将会移动使用者到座标 (0, 64, 0),而 tp ~3 ~ ~-3 会使使用者往 x 轴正向移动3格 (也就是东方),保持原本高度,并在 z 轴移动-3格 (也就是北方)。

通常绝对座标和相对座标可以溷合使用。举例来说, tp ~ 64 ~ 会保持使用者的 x 轴和 z 轴座标,但是传送使用者到绝对高度64。

偏移量的基准点由命令本身决定。举例来说, /tp 的偏移是从起始位置来算。其他常见的偏移量包括命令的执行位置或者从另一个坐标由该命令指定。

目标选择器

:本段文字中,variable 翻译为变数,argument 翻译为参数,而value 代表数值。有些指令因为易读性的关系,并不会把它翻译出来。

大多数玩家被指定为参数的命令,可以藉由满足某些条件来选择一个或多个玩家,而不是用名字来指定玩家。要用条件来选择玩家,先选择一个目标选择器变数,然后随意地,选择一个或多个目标选择器参数以修改欲满足的条件。

举例来说,要改变红色组别所有玩家的游戏模式为创造模式,而不藉由个别玩家名字指定他们:

/gamemode creative @a[team=Red]


目标选择器变数

摘要
变数 功能
@p 距离最近的玩家
@r 随机玩家
@a 所有玩家
@e 所有实体

目标选择器变数可以指定选择该目标大类。共有四种变数:

@p
选择最近的玩家。如果有多个最近的玩家,他们与自己距离完全相同,那么会选择其中最常进入服务器的玩家。
目标选择器参数可以用来减少会被选择到的玩家群组。举例来说,@p[team=Red] 会选择在红色组别中距离最近的玩家,即使有其他玩家更靠近自己。
c 目标选择器参数可以用来增加被选择的玩家的数量。( 举例来说,@p[c=3] 会选择最近的三名玩家)。若是负值,c 会反转指定的目标 (举例来说,@p[c=-1] 会选择 最远的 玩家)。
@r
选择随机玩家 (或使用 type 目标选择器参数来包含实体)。
目标选择器参数可以用来减少会被随机选择到的玩家群组。举例来说,@r[team=Red] 会选择在红色组别中的随机玩家。
c 目标选择器参数可以用来增加被随机选择的玩家的数量。举例来说,@r[c=3] 会选择随机三名玩家。
如果没有使用 type 参数,@r 只会选择随机玩家。type 参数可以用来选择非玩家的实体 (举例来说,@r[type=Zombie] 会随机选择殭尸@r[type=!Player] 会随机选择非玩家实体,@r[type=!Zombie] 会选择非殭尸实体...等)。
@a
选择所有玩家。
目标选择器参数可以用来减少会被选择到的玩家群组。举例来说,@a[team=Red] 只会选择在红色组别中的玩家。
@e
选择所有实体 (包含玩家)。
目标选择器参数可以用来减少会被选择到的实体群组。举例来说,@e[type=Cow] 只会选择牛。


目标选择器参数

摘要
参数 选择标准
x, y, z 座标
r, rm 半径 (最大,最小)
m 游戏模式
c 数量
l, lm 经验等级 (最大,最小)
score_name 最高分数
score_name_min 最低分数
team 队伍名称
name 玩家名称
dx, dy, dz 体积尺寸
rx, rxm 垂直旋转 (最大,最小)
ry, rym 水平旋转 (最大,最小)
type 实体种类

在使用目标选择器之后,你可以随意地使用参数来修改所要选择的群组。当使用 @a@e 时,参数缩小所选的数量,从所有名单到特定的少数。当使用 @p@r 时,参数缩小所选的数量,从所有名单变成更小的群组来选择最近或随机的玩家。

在目标选择器变数之后增加参数 - 数值对做为以逗号分隔的列表,包含在中括号中:

@<variable>[<argument>=<value>,<argument>=<value>,…]

括号、等号和逗号旁不能有空白键,只有逗号可以用来分隔参数 - 数值对。

参数会区分大小写,不支持的参数会直接被忽略掉。举例来说,kill @e[type=Creeper,r=20] 会杀死20方圆格以内的所有爬行者,但是 kill @e[Type=Creeper,r=20] ('type' 变成大写) 会杀死20方圆格以内的 所有 实体 (包括玩家) ,因为参数不再有选择爬行者的限制。

如果最前面的四个参数值被简化为只有数值而没有参数,他们会被假定为,按照顺序的 x, y, z, 和 r。因此,下列两个指令是相同的:

/gamemode creative @a[x=10,y=20,z=30,r=4]
/gamemode creative @a[10,20,30,4]
通过坐标选择目标
[x=X,y=Y,z=Z] — 选择基于此准确位置一定距离的目标。结合选择半径以选择在特定位置的唯一目标。
坐标必须准确的符号 - #波浪号 不可以用于此参数座标选择器。
通过半径选择目标
[r=R] — 只选择以命令的执行处为中心,半径小于R的区块里的目标。
[rm=RM] — 只选择以命令的执行处为中心,半径大于RM的区块里的目标。
如果座标(参见上一段)和半径都已被定义,命令会以定义的座标为中心执行命令。如果使用极远的座标为中心以及极大的半径,如此可以模拟出一个近于线性的边缘,用以指定目标。
通过游戏模式选择目标
[m=M] — 只选择目标与指定的游戏模式M 允许值为:
  • -1: 所有的游戏模式
  • 0: 生存模式
  • 1: 创造模式
  • 2: 冒险模式
  • 3: 旁观模式
通过数量选择目标
[c=C] — 只选择指定数量的目标。通常按与命令执行者的距离排序。
当使用 @p@r 两种变数时,此参数被预设为1,因此更大的数值会增加回传的最近或随机的目标。当使用 @a@e 两种变数时,此参数只会回传最近的目标。
如果有多名距离最近的玩家,距离完全相同,那么玩家会藉由玩家最近一次加入服务器的时间来选择。举例来说,如果距离完全相同@a[c=1] 会选择进入服务器时间最久的玩家而 @e[type=Creeper,c=3] 会选择生成最久的三只爬行者。
当输入的值为负值时,目标的顺序会被反转。举例来说,@p[c=-3] 会回传三个最远的目标,而且,如果所有目标距离都一样远,@e[c=-3] 会选择三个刚生成的目标。
通过经验等级选择目标
[l=L] — 只选择不超过 L 经验等级的目标。
[lm=LM] – 只选择不低于 LM 经验等级的目标。
通过分数选择目标
[score_name=SCORE] — 只选择目标计分板 name 的分数的没有超过 SCORE 的目标。
[score_name_min=SCOREMIN] — 只选择目标计分板 name 的分数的不低于 SCOREMIN 的目标。
例如,@a[score_points_min=30,score_points=39] 将选择目标计分板 points 的分数的不低于 30 ,且不高于 39 的目标。
通过队伍选择目标
[team=TEAM] — 只选择队伍 TEAM 的目标。
[team=!TEAM] — 只选择不是队伍 TEAM 的目标。
[team=] — 只选择不在任何队伍的目标。
通过名字选择目标
[name=NAME] — 只选择名字为 NAME 的目标。
[name=!NAME] — 只选择名字不是 NAME 的目标。
通过体积选择目标
[dx=DX,dy=DY,dz=DZ]
只选择位于一定体积内部的目标,体积定义为从执行命令的地方开始,向正 "x" 方向 (也就是东方) 延伸 DX 格,向正 "y" 方向 (也就是上方) 延伸 DY 格,并向正 "z" 方向 (也就是南方) 延伸 DZ 格。所有的值都必须为正值。如果最初的座标已经使用 xyz 参数定义,则它会取代命令的执行位置成为最下方、最北方及最西方的角落。 (dxdydz 仍然用来指定与座标的距离;它们不是指定一个新的座标)。
玩家可以结合通过半径和通过体积选择目标,此命令将会选择重叠的区块。 (从西北下角算起在一定的半径以内,且不超过定义的体积)。
通过垂直旋转选择目标
[rx=RX] — 只选择最大不超过垂直旋转值 RX 的唯一目标。
[rxm=RXM] — 只选择最小不低于垂直旋转值 RXM 的唯一目标。
垂直旋转值从 -90.0 面对正上方到 90.0 面对正下方 (因此垂直旋转值增加时会旋转向下)。
通过水平旋转选择目标
[ry=RY] — 只选择与最大不超过水平旋转值 RY 的唯一目标。
[rym=RYM] — 只选择与最小不低于水平旋转值 RYM 的唯一目标。
水平旋转值从 -180.0 (面对正北方),到 -90.0 (面对正东方),到 0.0 (面对正南方),到179.9 (正北方偏西) ,旋转回 -180.0 (因此水平旋转值增加时会向右旋转,或者从上方看来是顺时针方向旋转)。
通过类型选择目标
[type=TYPE] — 只选择特定的实体类型的目标。
[type=!TYPE] — 只选择不是特定的实体类型的目标。
TYPE 必须是个用来内部判定不同种类实体的实体ID (举例来说,Creeper 指定爬行者MinecartRideable 指定一般的矿车PrimedTnt 指定TNT等等)。实体ID 必须区别大小写,且无效的实体ID 会造成命令失败。
当与 @r 一起使用时,原本用来选择玩家的指令也可以被用来选择其它实体。


数据标签

数据标签是一段文字序列,使用属性/值对描述资料结构。使用在命令的数据标签指定了较复杂的玩家、实体和一些方块的数据。

数据标签由零个以上、用逗号分隔的的属性/值对组成,且用大括号界定。每个属性/值对包含属性名称和属性值,用冒号分开。但是,有些属性值可能本身就包含了属性/值对,因此数据标签可以用来描述层次结构。

例: {name1:123,name2:"sometext",name3:{subname1:456,subname2:789}}

这些数据标签所描述的资料结构和 Minecraft 世界存档中的资料结构是一样的。这些资料结构在另一篇有详细描述,而命令会要求数据标签要使用一样的属性名字 (区分大小写):

资料结构规范连结
对象 举例
方块 箱子、熔炉、命令方块、刷怪蛋、告示牌...等等
物品 在物品栏中的物品 (包括附魔、自订名称...等等)
物品实体 在地上的物品
生物 爬行者、牛、村民...等等
弹射物 弓箭、火球、喷溅药水...等等
交通工具 船、矿车...等等
Dynamic tiles 引燃的 TNT、正在掉落的沙子、砾石
其它实体 烟火、画和物品展示框

定义的资料结构也要求正确种类的属性值

数据标签属性值种类
种类 说明
 Byte 介于 -128 和 127 之间 (包含) 的整数。
 Short 介于 -32768 和 32767 之间 (包含) 的整数。
 Int 介于 -2147483648 和 2147483647 之间 (包含) 的整数。
 Long 介于 -9,223,372,036,854,775,808 和 9,223,372,036,854,775,807 之间 (包含) 的整数。
 Float
 Double
可以有浮点数的数字 (举例来说:3.14159)
 String 一串文字,可以自由选择是否要加上双引号。

如果字符串包含逗号、中括号、大括号,一定 要加上双引号。如果字符串里面 要包含双引号,需在双引号前加上反斜线。

例: "Call me \"Ishmael\""
 List 值的序列,用逗号分离并用中括号包含。不必每个值都用同一种类型 -- 所需的类型由数据结构指定。.
例: [3.2,64,129.5]
 Byte Array 从 -128 到 127 的整数的序列,用逗号分离并用中括号包含。
 Int Array 从 -2147483648 到 2147483647 的整数的序列,用逗号分离并用中括号包含。
 Compound 属性值对的序列,用逗号分离并用大括号包含。
Example: {X:3,Y:64,Z:129}

每个数据标签的内容本身就是一种 Compound。

有些命令可能会要求那个数字的类型,以在数字后面加上一个字母来表示。举例来说, 3i 表示整数,3.2f 表示浮点数...等等

如果用 /testfor/testforblock/clear 等指令来寻找相符的数据标签,它们只会检查那些实体/方块/物品是否存在此标签。这表示当找到符合的实体/方块/物品时,它们可能同时还有其他标签。这在 lists (表单) 和 arrays (序列) 也适用:表单的顺序未被确认,只要每个要求的元素都在表单里面,那么即使有额外的元素存在,它也会符合条件。

数据结构的形式是 JSON 的一种形式 lenient

原始 JSON 文本

/tellraw/title 指令使用特殊的lenient JSON 格式来表示更复杂的文字。和上述 NBT 格式表示法相似,Strings (字串)、Objects (Compounds)(物件,或复合体)、Lists (表单) 被用来表示原始文本的不同性质。

JSON 文本的形式是支援以下 (大多是可选择的) 元素的 JSON 物件:

  • 基础聊天组成物件
    •  text:String (字串) 代表在聊天中直接出现的纯文字。注意像是"@a" 和 "@p" 的选择器并不会转译成玩家名字;必须使用 selector 代替。"\n" 是新的一行 (enter 键)。
    •  extra:外加物件的表单,使用和基础物件相同的格式。
      • 为使用和基础物件相同格式的表单元素 (递迴的)。注意所有物件的性质都会被子物件所继承,除了 textextratranslatewithscore。这表示子物件会保留和这个物件一样的格式和情况,除非子物件明确的覆盖原物件。
    •  color:用来渲染文字的颜色。有效值有:"black" 、 "dark_blue" 、 "dark_green" 、 "dark_aqua" (碧绿)、 "dark_red" 、 "dark_purple" 、 "gold" 、 "gray" 、 "dark_gray" 、 "blue" 、 "green" 、 "aqua" 、 "red" 、 "light_purple" 、 "yellow" 、 "white" 和 "reset" (取消母对象使用的颜色效果)。技术上来说,"bold" (粗体)、 "underline" (底线)、 "italic" (斜体)、 "strikethrough" (删除线) 和 "obfuscated" (模煳处理) 都是可接受的,不过最好还是使用下方提到的标籤格式。
    •  bold:布尔 (true/false) - 是否将文字渲染为粗体,预设为 false。
    •  underlined:布尔 (true/false) - 是否将文字渲染为加底线,预设为 false。
    •  italic:布尔 (true/false) - 是否将文字渲染为斜体,预设为 false。
    •  strikethrough:布尔 (true/false) - 是否将文字渲染为加上删除线,预设为 false。
    •  obfuscated:布尔 (true/false) - 是否将文字渲染为模煳处理,预设为 false。
    •  insertion:当玩家按着 shift 并点击时,这个字串就会插入至聊天文字栏。它不会覆盖原有的正在输入的文字。
    •  clickEvent:当玩家在文字上点击时发生动作。
      •  action:当点击时所引发的动作。有效值为 "open_url" (在玩家的预设浏览器中打开值为 value 的 URL 位址),"run_command" (在聊天栏输入 value ,就好像是玩家自己输入的一样。这可以用来执行命令,但是如果玩家没有所需的权限,命令会失败。), "change_page" (只能用在成书,翻至第 value 页如果该页存在),和 "suggest_command" (和 "run_command" 相似,但是命令文字只会出现在玩家的聊天输入栏,并不会自动执行。不像 insertion ,这会直接取代原先就存在于聊天输入栏中的内容)。
      •  value:特定的 action 会使用到的 URL 位址、聊天内容或命令。注意,命令之前一定要加上 "/" 斜线。
    •  hoverEvent:允许当玩家滑鼠在文字之上时显示提示。
      •  action:提示所显示的种类。有效值为 "show_text" (显示纯 JSON 文本), "show_item" (显示可能带有 NBT 标籤的物品的提示工具), "show_achievement" (显示用来描述成就或数据的标准格式。一般的成就是绿色的,最终的成就是深紫色的,数据名称是灰色的。除此之外,还有成就的描述),和 "show_entity" (显示实体的名字,或可能是它的种类、和它的通用唯一识别码)。
      •  value:这个标籤的格式取决于 action (动作)。注意, "show_text" 是唯一支援物体当作值的动作;其他动作的值都是字串,所以必须用引号包含。
        • "show_text":可以是纯字串,或是和这个基础物体的格式一样的物体。注意,clickEventhoverEvent 在提示工具中不会有效果,但是它的格式和 extra 标籤仍然有作用。
        • "show_item":像 NBT 标籤的格式化的字串。包含 "id" 标籤,和可选的 "Damage" 标籤和 "tag" 标籤 (和give指令所用的数据值和数据标籤一样)。
        • "show_achievement":这个成就或游戏数据的名字。它使用和成就、游戏数据记分板对象判据以及/achievement 命令一样的格式。
        • "show_entity":一个像是复合体,包含字符串值 "type" (例如 "Zombie")、 "name" 和 "id" (应该要是实体 UUID,但实际上可以是任何字串),的格式化字串
    •  translate:使用玩家选择的语言来显示的翻译识别器。此识别器和 assets 档案夹或资源包裡的 lang files 可以找到的识别器是一样的。翻译过的文字只会在 text 字串 被使用时显示。
    •  withtranslate所使用的聊天组件参数列表和/或字串参数。
      • The arguments are text corresponding to the arguments used by the translation string 在当前的语言中,依序(例如, the first list element corresponds to "%1$s" in a translation string)。
    •  score: A compound for displaying 一个玩家在一个objective里的分数。 Displays nothing 若该玩家 is not tracked in the given objective. 完全忽视可能存在的texttranslate
      •  name:要被显示分数的玩家的名字。选择器(例如@p)可被使用,除了被记分板系统创造的"假"玩家名。另外,如果名称为"*",它将会显示玩家自己的分数(例如, /tellraw @a {score:{name:"*",objective:"obj"}}将给每个在线玩家显示他们自己在"obj" objective里的分数)。注意非玩家实体不会显示分数(例如@e[type=Cow]),即使该实体已在objective里被给予了一个分数。
      •  objective: The internal name of the objective to display the player's score in.
      •  value:可选。如果存在,此值被使用作 regardless of what the score would have been.
    •  selector:一串包含了一个选择器(@p,@a,@r,或@e)的字符串以及,可选的,选择器参数。不像text,选择器将会被译解为正确的玩家/实体名。如果多于一个玩家/实体被选择器发现了,其将会被以例如'名字1和名字2'或'名字1,名字2,名字3,和名字4'的形式显示。完全忽视可能存在的text,translate,或score
外部连结

Skylinerw's JSON Formatting ExamplesTellraw Generator

玩家命令

这些命令可由联入服务器的任何玩家在聊天输入框里直接输入。

命令 描述
help [页码 | 命令名]
? [页码 | 命令名]
列出可以使用的命令或有关命令名更多的信息。
tell <玩家名称> <信息>
msg<玩家名称> <信息>
w <玩家名称> <信息>
用来发送给服务器里的玩家一条私信。 在需要和玩家交流时非常有用。
me <动作信息> 和 /emote 或 /action相似,而且其作用和IRC客户端里的 /me 命令一样, /me命令会以叙述的方式显示出这个玩家在做什么,具体显示为"* 你的名字 动作信息" (比如: "* 你的名字 打了个喷嚏。")。
trigger <目标> <add | set> <数值> 修改带有Trigger准则的目标(被称为触发器),此命令可以被非管理员玩家使用。见版本记录

只有管理员可用的命令

这些命令只有管理员(Operator)通过服务器或客户端使用。客户端使用时需要加“/”前缀。例如输入的应该是“/help”而非只是“help”。必需的参数由<尖括号>标出;可选的参数由[方括号]标出。用斜体标注的参数必须用一个适当的数值代替;用普通字体的参数直接照搬即可。

在单人生存模式中,开启作弊功能且对局域网开放单人世界的服主也可以使用下列命令。

注意: 在多人模式下,普通玩家通常看不见OP指令的输入,但是对于其他的在线OP却是可见的。

命令 描述
achievement give <数据名> [玩家名] 用于赐予玩家成就
blockdata <x> <y> <z> <数据标签> 用于编辑指定坐标的数据标签
clear <玩家名> [物品] [数据] 清空该玩家的物品栏,或只清除特定的物品。
clone <x1> <y1> <z1> <x2> <y2> <z2> <X> <Y> <Z> [主模式] [子模式] 复制指定区域的方块,目的坐标是(X,Y,Z),主模式有 [ replace ]复制每一个方块、[ masked ]只会复制非空气方块、[ filtered ]过滤不想被影响的方块。

子模式有 [ move | force | normal ]。

debug <start | stop> 开始一次新的除错进程或是停止当前进程。除错进程会监控任何控制台内的潜在信息并在停止之后将信息记录在debug文件夹内。
defaultgamemode <survival | creative | adventure | spectator> 设置默认的游戏模式。新加入的玩家将被设置为该模式。生存/创造/冒险/旁观也可以简写为“s/c/a/sp”或“0/1/2/3”。
difficulty <0 | 1 | 2 | 3> 改变游戏难度。0为和平,1为容易,2为普通,3为困难,
effect <玩家名> <药水效果> [秒数] [倍率] 给予目标玩家持续指定时间的指定药水效果(默认30秒,最长可设置1000000秒)。“倍率”代表效果强度(最大为255),0为取消该效果。药水效果用ID表示,详见药水效果
effect <玩家名> clear 清除该玩家身上的所有效果。
enchant <玩家名> <魔咒ID> [魔咒等级] 附魔玩家持有的物品。请注意用该命令附魔的魔咒无法超越正常附魔步骤的限制,例如最大等级、魔咒冲突、魔咒限制等,详见附魔
entitydata <实体名> <数据标签> 用于编辑指定实体的数据标签,对玩家无效
execute <玩家名 | 实体名> <x> <y> <z> <命令> 以目标玩家或实体为中心执行命令,可以用来通过玩家及实体的运动生成生物或放置方块。
fill <x1> <y1> <z1> <x2> <y2> <z2> <方块名> [数据值] [旧方块处理方式]<数据标签> 用指定方块填满指定区域。旧方块处理方式可为:[ replace | destroy | keep | hollow | outline ]。能指定要处理的旧方块种类,前提是不包含方块实体值,仅能在replace模式中使用,语法:/fill [x] [y] [z] [x] [y] [z] [方块名] [数据] replace [过滤方块名] [过滤数据]
gamemode <survival | creative | adventure | spectator> [玩家名] 改变该玩家的游戏模式。生存/创造/冒险/旁观也可以简写为“s/c/a/sp”或“0/1/2/3”。如果未定义玩家名,那么该命令会更改你自己的游戏模式。注意: 要成功改变游戏模式,该玩家必须在线。
gamerule <规则名> [true | false] 激活或取消规则名。规则包括:doFireTick, doMobLoot, doMobSpawning, doTileDrops, keepInventory, mobGriefing and commandBlockOutput(详见命令方块条目)
give <玩家名> <数据值> [数量] [附加数据值] 给予玩家的物品栏一定'数量(默认为1)的物品(由数据值方块实体值(默认为0)定义)。
kill [玩家名] 对指定的玩家造成1000(♥ × 500)点伤害(一击必杀),未指定则为使用该命令的玩家。 当你迷路或者被卡住的时候很有用。如果你有把握找回身上的物品,那么这也是个快速补满饥饿值的好方法。这个命令在创造模式下依然有效。
partcles <颗粒> <x> <y> <z> <x偏移量> <y偏移量> <z偏移量> <速度> [颗粒数] 显示颗粒效果。
playsound <音乐/声效> <玩家名> [x] [y] [z] [音量] [频率] [最小音量] 播放声效。
publish 将单人游戏向局域网玩家开放。
replaceitem <entity | block> 给予实体或方块物品。
say <信息> 广播 信息 至所有在线的玩家。(使用明亮的粉红色字体)
scoreboard <objective | players> 详细信息请参见计分板条目。
seed 显示服务器地图种子。
setblock <x> <y> <z> <方块名> [数据值] [旧方块处理方式] [数据标签] 用于创造,删除,或代替单个方块。旧方块处理方式可为:[ keep | replace | destroy ]
setworldspawn [x] [y] [z] 设置所有玩家的出生点(即使是从未进入服务器的玩家或是不在线的玩家,但不会覆盖床的设置)。
spawnpoint <玩家名> [x] [y] [z] 将该玩家的出生点移到指定位置。如果该位置没有定义,那么“指定位置”就是玩家当前位置。
spreadplayers <x> <z> <分布距离> <最大半径> <是否采用队伍> <玩家名> 把玩家分布到一个起始点.能够定义分散范围与最小间距。
summon <实体名> [x] [y] [z] [数据标签] 用于在游戏中生成任何实体,包括巨人,末影水晶,末影龙,和激活的TNT。
tellraw <玩家名> <原json消息> 运用json语言来在聊天窗口中显示高级文本(如创造出"按钮"和格式化文本)。
testfor <玩家名> 测试指定的玩家是否在线或指定玩家是否在指定位置,在1.7.6之前只可以由命令方块使用。
testforblock <x> <y> <z> <方块名> [数据值] [数据标签] 检测在指定位置的方块否与指定的方块相同。
testforblocks <x1> <y1> <z1> <x2> <y2> <z2> [模式] 检测在指定区域的方块是否与另一区域的方块相同。
time set <时间 | day | night> 设置世界时间。时间为0到24000之间的整数,0为凌晨,6000为正午,12000为傍晚,18000为午夜。"time set day"相当于把时间设为1000(旧版为0),"time set night"相当于把时间设为12500(旧版为12000)。
time add <时间> 将世界时间往后拨一段时间。时间必须为自然数。
toggledownfall 更改天气为下雨或下雪。
tp <目标玩家> 将玩家自己传送至目标玩家的位置。
tp <玩家名> <目标玩家> 将指定玩家传送至目标玩家的位置。
tp <玩家名> <x> <y> <z> 将指定玩家传送到指定位置。如果坐标号前加~,则代表相对坐标。例如/tp John ~3 64 ~3会将ID为John的玩家传送到他目前的x、z坐标各加3的位置,再将高度调到64。
weather <clear | rain | thunder> <持续秒数> 改变天气。持续秒数最大为1000000。
xp <数量> <玩家名> 给予该玩家指定数量的经验。最大数量为2,147,483,647。负数代表减少经验。数量后加L代表增加指定的等级。

只有多人生存模式可用的命令

命令 描述
ban <玩家名称> 封禁拥有玩家名称名称的玩家,列入黑名单,令其永远无法登进此服务器。 注意:封禁操作会覆盖之前的白名单操作。
ban-ip <ip 地址> 封禁一个特定的IP,列入黑名单,并从此拒绝任何从该地址而来的连接请求。
banlist [ips] 显示封禁名单。若要列出封禁的IP,请使用banlist ips指令。
deop <玩家名称> 撤销一个玩家的管理员身份。
kick <玩家名称> 强制断开玩家名称与服务器的连接。
list 显示当前在线的玩家列表。(按Tab ↹也会有同样的效果)。
op <玩家名称> 授予 玩家名称 在服务器里的管理员职位。
pardon <玩家名称> 玩家名称 移出黑名单,允许他再次连接到服务器。
pardon-ip <ip地址> ip地址 从IP黑名单移除,允许该IP连接到服务器。
save-all 强制将服务器尚未储存地变更写入存档。
save-off 取消服务器对地图存档的写入。所有的更改都会暂时进入等待队列。
save-on 允许服务器写入地图存档。这项是默认设定。
setidletimeout <闲置时限(分钟)> 会自动将挂机过久的玩家踢下线。
stop 正常关闭服务器。
whitelist <add|remove> <玩家名称> 玩家名称加进或移出白名单。
whitelist <list> 显示所有在白名单上的玩家。
whitelist <on|off> 启用/停用服务器的白名单机制。 注意: 服务器的OP总是能够在白名单打开时进入服务器,无论他们在与不在白名单上。
whitelist reload 重新从硬盘读取white-list.txt上的白名单。(当white-list.txt在Minecraft外被更改时可以使用此指令)。

命令摘要

下表列出了所有可用命令,点击第一列的命令了解该命令的详情。

命令列表
命令 描述 仅限 OP 仅限 MP  方块   实体   玩家   世界 
/achievement 获得/移除玩家的成就。 Op - - - 玩家 -
/ban 添加一个玩家到黑名单中。 Op MP - - 玩家 -
/ban-ip 添加一个IP地址到黑名单中。 Op MP - - 玩家 -
/banlist 显示黑名单。 Op MP - - 玩家 -
/blockdata 修改一个方块的数据标签。 Op - 方块 - - -
/clear 从玩家的物品栏清除物品。 Op - - - 方块 -
/clone 将方块从一个位置复制到另一位置。 Op - 方块 - - -
/debug 开始或终止一个 debugging session。 Op - - - - -
/defaultgamemode 设定默认的游戏模式 Op - - - - 世界
/deop 撤销一位玩家的管理员身份。 Op MP - - 玩家 -
/difficulty 设定难度。 Op - - - 玩家 -
/effect 添加或移除状态效果 Op - - 实体 玩家 -
/enchant 附魔一个玩家的物品。 Op - - - 玩家 -
/entitydata 修改实体的数据标签。 Op - - 玩家 - -
/execute 执行另一条命令。 Op - - - - -
/fill 用一种特定方块填充一块区域。 Op - 方块 - - -
/gamemode 设定一位玩家的游戏模式 Op - - - 玩家 -
/gamerule 设定或查询一个游戏规则值。 Op - - - - 世界
/give 给予一位玩家一个物品。 Op - - - 玩家 -
/help 提供命令的帮助。 - - - - - -
/kick 将一位玩家踢出服务器。 Op MP - - 玩家 -
/kill 杀死实体(玩家、生物、物品等)。 Op - - 实体 玩家 -
/list 列出在服务器上的玩家。 Op MP - - 玩家 -
/me 显示一条关于你自己的信息。 - - - - 玩家 -
/op 给予一位玩家管理员身份。 Op MP - - 玩家 -
/pardon 从黑名单移除项目。 Op MP - - 玩家 -
/particle 制造颗粒效果。 Op - - - 玩家 -
/playsound 播放一个音效。 Op - - - 玩家 -
/publish 对局域网开放单人世界。 Op - - - - 世界
/replaceitem 替换物品栏中的物品。 Op - 方块 实体 玩家 -
/save-all 将服务器保存至硬盘中。 Op MP - - - 世界
/save-off 禁用服务器自动保存。 Op MP - - - 世界
/save-on 启用服务器自动保存。 Op MP - - - 世界
/say 向多名玩家显示一条信息。 - - - - 玩家 -
/scoreboard 管理对象、玩家和队伍。 Op - - 实体 玩家 -
/seed 显示世界种子 Op - - - - 世界
/setblock 将一个方块变更至另一个方块。 Op - 方块 - - -
/setidletimeout 设定踢出挂机玩家的时间。 Op MP - - 玩家 -
/setworldspawn 设定出生点 Op - - - - 世界
/spawnpoint 设定一位玩家的出生点。 Op - - - 玩家 -
/spreadplayers 将实体传送至随机位置。 Op - - 实体 玩家 -
/stats 通过命令的返回改变记分板对象。 Op - 方块 实体 玩家 -
/stop 停止服务器。 Op MP - - - 世界
/summon 生成一个实体。 Op - - 实体 - -
/tell 向其他玩家显示一条私人信息。 - - - - 玩家 -
/tellraw 向玩家显示一条JSON信息。 Op - - - 玩家 -
/testfor 计算匹配特定条件的实体数。 Op - - 实体 玩家 -
/testforblock 探测一个方块是否在一个位置。 Op - 方块 - - -
/testforblocks 探测两块区域内的方块是否匹配。 Op - 方块 - - -
/time 改变或查询世界的游戏时间。 Op - - - - 世界
/title 管理屏幕标题。 Op - - - 玩家 -
/toggledownfall 切换天气。 Op - - - - 世界
/tp 传送实体。 Op - - 实体 玩家 -
/trigger 设定触发装置的激活。 Op - - - 玩家 -
/weather 设定天气。 Op - - - - 世界
/whitelist 管理服务器白名单。 Op MP - - 玩家 -
/worldborder 管理世界边界 Op - - - - 世界
/xp 增加或移除玩家的经验值 Op - - - 玩家 -

命令列表

格式
若你看到… 那么
纯文本 如所示地,完全依其输入
斜体 用一个适当的值替换此项
<尖括号> 这是一项必需参数
[方括号] 这是一项可选参数
x|y

从给出的选项中选择一个。 可选项被垂直线隔开列出: |

ellipsis … 参数可能由多个被空格隔开的词组成。
成功条件
一条命令的成功条件必须被满足来使游戏认为命令"成功"。这被用于决定各种各样的事件,比如反馈自输入了一条命令的命令方块的一个红石比较器的输出。注意不是所有"成功"命令都实际上完成了些什么,而不是所有"失败"命令都没能做些有用的事。
限制
描述了能使用命令的人或情况的限制。
多人命令的参数不能有目标选择器,且除了/list,多人命令不能在命令方块中使用。大多数命令能用于从未登入过服务器的玩家,甚至是没有在Minecraft 注册(或者不能注册)账号名字的玩家。


achievement

命令/infobox 给予一位玩家一项成就或提高统计数据。

格式
achievement <give|take> <stat_name|*> [玩家]
参数
stat_name
必须是以下中的:
  • achievement.achievement_nameachievement_name是合法的成就标识符。
  • stat.statistic_namestatistic_name 是合法的统计标识符。
  • *代表所有的成就。
玩家 (可选)
必须为一个玩家名或目标选择器。若未指定,默认为命令执行者。在命令方块中为必需项。
结果
若参数指定不正确则失败, 或者玩家中的玩家不在线也会失败。
若成功,给予或移除玩家的特定成就(包括所有的前提成就)或是给玩家特定的统计数据增加/减少1。
例子
给予你自己"Overkill"成就: achievement give achievement.overkill
给予Alice"Taking Inventory"成就: achievement give achievement.openInventory Alice
要给最近的玩家的"Mob Kills"增加1: achievement give stat.mobKills @p
清除所有玩家的所有成就: achievement take * @a
另见
修改玩家的命令:


ban

这些命令管理着服务器的封禁列表。封禁列表包含的是不允许连接服务器的玩家或IP地址。封禁会在适当的时候取代任何白名单。

参见:/whitelist


ban

命令/infobox 将玩家列入封禁名单。

格式
ban <名字> [原因 …]
参数
名字
被封禁的玩家名字。不需要玩家在线,甚至不需要真的存在这个玩家。
原因 (可选)
随着封禁显示的文字,呈献给其他管理员并记入服务器日志。
结果
总是成功。 玩家的名字将列入服务器的封禁名单,阻止任何使用这个名字的玩家连接服务器。


ban-ip

命令/infobox 将IP地址加入封禁列表

格式
ban-ip <address|name> [原因 …]
参数
address|name
必须为一个玩家名或一个IP地址。
原因 (可选)
随着封禁显示的文字,呈献给其他管理员并记入服务器日志。
结果
address|name的IP无效或指定玩家不在线则失败。
若成功, IP地址(在线玩家的,或是指定的)将加入服务器的封禁列表, 阻止任何来自这个IP的玩家连接服务器。


banlist

命令/infobox 显示封禁列表。

格式
banlist ips
banlist players
结果
总是成功。 显示被封禁的IP与被封禁的玩家。


blockdata

命令/infobox 修改方块的数据标签。

格式
blockdata <x> <y> <z> <dataTag>
参数
x y z
指定要修改的方块的坐标。可以使用波浪号代表与命令执行处的相对坐标。
dataTag
指定方块要被加入或覆盖的数据标签。必须是NBT格式组(例如,{CustomName:Fred})。
结果
若参数指定不正确则失败。
若成功, 修改目标方块的数据标签。
例子
将位于(0,64,0)的信标的初始效果改为急迫
blockdata 0 64 0 {Primary:3}
另见


clear

命令/infobox 清除玩家的物品栏。

格式
clear [玩家] [物品] [数据] [最大数量] [数据标签]
参数
玩家 (可选)
必须为一个玩家名或一个目标选择器。若未指定,默认为命令使用者。在命令方块中为必需项。
物品 数据(可选)
指定要被清除的物品的ID和数据。如果没有指定,就清除物品栏中所有的物品。如果物品已被指定,但没有数据,有着该物品ID的物品都会被清除,不论数据如何。数据可以设置为 -1 来忽略此项并清除某种指定了 最大数量数据标签的物品。
最大数量 (可选)
指定物品被清除的最大数量。若未指定或为-1,清除所有物品。若为0,不清除物品,但有物品可供清除时返回成功。 (用于检测物品的同时不清除物品)。
数据标签 (可选)
指定要被清除物品的数据标签(匹配指定数据标签的物品才会被清除 — 其它的物品不会被清除). 必须是NBT格式组 (例如, {display:{Name:Fred}})。
结果
若参数指定不正确,或玩家中的玩家不在线,或没有物品被清除则失败。
若成功,移除玩家的特定物品。
例子
清除所有物品: clear
清除Alice的所有物品: clear Alice
清除Alice身上的所有羊毛(无视颜色): clear Alice minecraft:wool
清除所有玩家的橙色羊毛(仅限橙色): clear @a minecraft:wool 1
清除离你最近的玩家身上带有“锋利I”的金剑(无视这把剑的耐久):
clear @p minecraft:golden_sword -1 -1 {ench:[{id:16s,lvl:1s}]}
另见
/give — 给予玩家物品


clone

命令/infobox 将方块从一个区域复制至另一个区域。

格式
clone <x1> <y1> <z1> <x2> <y2> <z2> <x> <y> <z> [遮罩模式] [复制模式] [TileName]
游戏中的帮助不会列出最后一项参数。TileName是为可选项留下的占位符
参数
x1 y1 z1x2 y2 z2
指定被复制区域(“源区域”)的任意两对角。可以使用波浪号 来指定一段相对于命令执行位置的距离。
构成角的方块在它们坐标的正方向上延伸。因此,各轴上较小的坐标将会正好符合区域边界,但较大的坐标将会超过边界一个方块,源区域的方块体积是(x最大 - x最小 + 1) × (y最大 - y最小 + 1) × (z最大 - z最小 + 1)。例如, 0 0 0 0 0 0 占一个方块体积, 而 0 0 0 1 1 11 1 1 0 0 0都占同一个8体积的源区域。
x y z
指定克隆区域(“目标区域”)的下西北角(即,各轴的最小坐标)。可以使用波浪号来指定一段相对于命令执行位置的距离。
遮罩模式 (可选)
必须是其中之一:
  • filtered — 仅复制拥有特定方块ID的方块(见下文的TileName)。
  • masked — 仅复制非空气方块。否则目标区域内的方块将会被源区域内的空气方块覆盖。
  • replace — 复制所有方块,用源区域的方块覆盖目标区域的“所有”方块。
若未指定,默认为replace.
复制模式 (可选)
必须是其中之一:
  • force — 强制复制,甚至当源区域与目标区域重叠时。
  • move — 复制源区域至目标区域,然后将源区域替换为空气。当在遮罩模式filtered下使用时,仅被复制的方块会被空气替换。
  • normal — 非move或force。 当需要指定“TileName”时使用。
若未指定,默认为normal.
TileName (可选)
指定使用遮罩模式filtered时复制的方块ID(例如, minecraft:stone)。当使用遮罩模式filtered时必选。
结果
若参数指定不正确,或源区域方块体积大小超过32768时(足够8个区块大小),或源区域与目标区域重叠(除非使用force复制模式), 或源区域或目标区域没有处于加载状态,则失败。
若成功,在目标区域填充源区域的方块,源区域不改变(除非使用克隆模式move)。
另见
/fill — 用一种方块填充一个区域


debug

命令/infobox 开始或停止一个调试会话。

格式
debug <start|stop>
参数
start
开始一个新的调试分析会话。
stop
停止这个调试分析会话。
结果
若当一个调试会话活动时尝试开始一个调试会话,或当没有调试会话运行时尝试停止一个调试会话,则失败。
若成功,开始或停止这个调试会话。 While active, includes notifications about potential performance bottlenecks in the console. When stopped, creates a profiler results file in the folder "debug".


defaultgamemode

命令/infobox 设置新玩家在服务器默认的游戏模式 (创造模式,生存模式,等等)。

格式
defaultgamemode <模式>
参数
模式
必须为其中之一:
"极限模式"不是一个有效的模式参数选项,因其技术上不是一个游戏模式。
结果
若参数指定不正确则失败。
若成功,设置默认的游戏模式,并显示在世界选择菜单中,加入世界的新玩家将会被置于默认的游戏模式。
例子
设定默认游戏模式为生存: defaultgamemode survival, defaultgamemode s,或defaultgamemode 0
另见
/gamemode – 更改一位玩家的游戏模式


deop

命令/infobox 撤销一位玩家的管理员身份。

格式
deop <玩家>
参数
玩家
指定一个玩家从管理员列表中移除。 可以是任何参数但目标选择器没什么用,只有确定的玩家才能会有有意义的结果。
满足参数条件则总会成功。 若玩家匹配管理员列表上的一个名字,从列表移除该名字而任何该名字的玩家都不再拥有管理员身份。
例子
将Alice从管理员列表中移除: deop Alice


difficulty

命令/infobox 设定难度等级(和平,简单,等。)。

格式
difficulty <新难度>
参数
新难度
必须为其中之一:
  • peaceful (可被简写为p0)为和平难度
  • easy (可被简写为e1)为简单难度
  • normal (可被简写为n2)为普通难度
  • hard (可被简写为h3)为困难难度
"极限模式"不是一个有效的新难度参数选项,因其不是一个难度。
结果
若参数指定不正确则失败。
若成功,更改游戏的难度。在多人服务器中难度保持到服务器重启——重启后将从server.properties读取难度。
例子
更改难度为困难: difficulty hard, difficulty h,或difficulty 3
另见
/gamemode – 更改一位玩家的游戏模式(创造,生存,等。)


effect

命令/infobox 命令effect管理玩家及其它实体上的状态效果

格式
effect <玩家> clear(移除所有效果)
effect <玩家> <效果> [秒数] [倍率] [隐藏粒子] (给予一种效果)
参数
玩家
指定目标(们)。必须是一位玩家的名字或目标选择器@e 允许选择玩家外其他实体目标)
效果
指定给予的效果。必须是一个状态效果ID(例如,1minecraft:speed)。
秒数 (可选)
以秒为单位指定效果时长。必须在0至1000000(包含)间。若未指定,默认为30秒。
倍率 (可选)
指定给效果的级别的数字。必须在0至255(包含)间。若未指定,默认为0。
隐藏粒子 (可选)
指定是否隐藏状态效果的粒子。必须为truefalse。若未指定,默认为false
结果
若参数指定不正确,或当玩家 不是有效实体(有名字的玩家必须在线),或当秒数被指定为0而目标没有该效果时,或当在clear模式下没有效果被移除时失败。
若成功:
  • clear — 从目标(们)身上清除所有状态效果。
  • 效果 — 给目标(们)添加状态效果。如果一个目标已经拥有该状态效果,同等级的新状态效果仅在拥有更长的持续时覆写旧的持续时间,但更高等级的新状态效果将会覆写之前的持续时间。如果秒数设为0,会取消特定效果作为代替。
例子
给予最近的玩家一个60秒的速度1效果: effect @p 1 60
给予最近的玩家一个60秒的速度3效果: effect @p 1 60 2
从所有玩家身上清除任何急迫效果: effect @a 3 0
清除所有僵尸身上的所有效果: effect @e[type=Zombie] clear


enchant

命令/infobox 给一位玩家选中的物品添加附魔。

格式
enchant <玩家> <附魔ID> [等级]
参数
玩家
指定目标(们)。必须是一个玩家名或目标选择器
附魔ID
指定添加至玩家手持物品的附魔。必须是一个有效的附魔ID(例如, 16minecraft:sharpness)。
等级 (可选)
指定附魔等级。必须至少为1且不大于特定附魔的最大等级。若未指定,默认为1。
结果
若参数指定不正确,或当玩家中的玩家不在线时,或当附魔对物品不可用或与现有附魔冲突时则失败(例如,"火焰保护"无法给予已附魔"保护"的盔甲,而"锋利III"无法给予已附魔"锋利I"的剑)。
若成功,添加指定的附魔至目标的手持物品。
例子
给所有手持弓的玩家附魔无限: enchant @a 51


entitydata

命令/infobox 修改实体的数据标签。

格式
entitydata <实体> <数据标签>
参数
实体
指定修改的实体。必须是实体的UUID或@e目标选择器
数据标签
指定实体要被加入或覆盖的数据标签必须是NBT格式组(例如, {CustomName:Fred})。
结果
若参数指定不正确,或没有符合实体的非玩家实体则失败。(玩家不可修改。)
若成功修改目标实体的数据标签。
例子
阻止所有现有僵尸捡拾物品:
entitydata @e[type=Zombie] {CanPickUpLoot:0}


execute

命令/infobox 让别的玩家在别的位置执行一条命令。

格式
execute <实体> <x> <y> <z> <命令 …>
一个替换格式可以让某个方块被检测到时才执行命令:
execute <实体> <x> <y> <z> detect <x2> <y2> <z2> <方块> <数据> <命令 …>
参数
实体
指定目标命令执行者。 必须为一个玩家名或目标选择器
x y z
指定命令运行的位置。 xz必须在-30,000,000到30,000,000内 (包括)。可使用目标选择器 来指定与目标的相对坐标。
命令
指定要运行的命令必须为一个有效命令。
x2 y2 z2 (仅在detect模式可用)
指定要检测方块的位置。 x2z2 必须在-30,000,000到30,000,000内 (包括)。可使用波浪号 来指定与目标的相对坐标。
方块数据 (仅在detect模式可用)
指定方块ID和数据,用于与(x2,y2,z2)的方块匹配来使命令运行。方块必须是有效的方块ID(例如,minecraft:stone),且数据 必须是适应方块的有效数据或填写-1 来匹配所有方块数据。
结果
若参数指定不正确,或实体不是有效实体(有名字的玩家必须在线),或检测到的方块与数据与命令不匹配,或预设的命令执行失败则失败。
若成功,让命令以目标的身份执行,且无视管理员权限限制。
例子
在每个僵尸的位置生成闪电:
execute @e[type=Zombie] ~ ~ ~ summon LightningBolt
在每个站在任意种类沙子上的僵尸的位置生成闪电:
execute @e[type=Zombie] ~ ~ ~ detect ~ ~-1 ~ minecraft:sand -1 summon LightningBolt
另见
/testforblock — 检测一个特定位置的某个方块(包括指定的数据标签)


fill

命令/infobox 用特定方块全部或部分填充一个区域。

格式
fill <x1> <y1> <z1> <x2> <y2> <z2> <方块名> [数据值] [旧方块处理方式] [数据标签]
当使用replace选项时,fill命令同样有一个可选的替代格式:
fill <x1> <y1> <z1> <x2> <y2> <z2> <方块名> <数据值> replace [替换方块名] [替换数据值]
参数
x1 y1 z1 and x2 y2 z2
指定将被填充的区域("填充区域")的任意两对角方块。可以使用tilde notation来指定相对于执行命令处的距离。
The blocks that make up the corners extend in the positive direction from the coordinates used to identify them。因此, the lesser coordinates of each axis will be right on the region boundary, but the greater coordinates will be one block from the boundary, and the block volume of the source region will be (xgreater - xlesser + 1) × (ygreater - ylesser + 1) × (zgreater - zlesser + 1)。例如,0 0 0 0 0 0拥有一个单方块的体积,而0 0 0 1 1 11 1 1 0 0 0 both identify the same region with an 8-block volume。
方块名
指定用于填充该区域的方块。必须为一个block id(例如,minecraft:stone)。
数据值(可选)
指定用于填充方块的方块数据。必须在0到15间(包含)。
旧方块处理方式(可选)
必须为其中之一:
  • destroy -用指定方块替换填充区域内所有方块(包括空气),以实体掉落被替换的方块及方块内容物就像它们被采掘了。
  • hollow -仅用指定方块替换填充区域外层的方块。内部方块被改变为空气,以实体掉落它们的内容物但本身不掉落。
  • keep -仅用指定方块替换填充区域内的空气方块。
  • outline -仅用指定方块替换填充区域外层的方块。内部方块不被影响。
  • replace -用指定方块替换填充区域内所有方块(包括空气),而不以实体掉落方块或方块内容物。可选的, instead of specifying a data tag for the replacing block, 方块id和数据值可被指定来限制哪些方块被替换(见下替换方块名替换数据值)
若未指定,默认为replace
数据标签(可选)
指定用于填充方块的数据标签(例如,一个箱子的内容物,一面旗帜上的图案,等)。必须为 a compound NBT tag (例如, {CustomName:Fred})。不能与替换方块名替换数据值参数合并。
替换方块名 替换数据值(可选)
仅当旧方块处理方式replace时可用的参数。不能与数据标签参数合并。
指定填充区域内被替换的方块的block id and data。若替换数据值未被指定,决定替换哪些方块时数据值将被忽视。若两参数均未被指定,替换填充区域内所有方块。
结果
若参数指定不正确,若填充区域未被载入,若填充区域的方块体积大于32768,若指定方块id的数据值数据标签是不可用的,或若没有方块被改变则失败。
若成功,将填充区域内的方块更改为特定方块。


gamemode

命令/infobox 设定一个玩家的游戏模式

格式
gamemode <模式> [玩家]
参数
模式
必须为其中之一:
"极限模式"不是一个有效的模式参数选项,因其技术上不是一个游戏模式。
玩家 (可选)
若指定,必须是一位玩家的用户名或一个目标选择器。若未指定,默认为使用命令的玩家。当在命令方块中使用,玩家为必需项。
结果
若参数指定不正确,或玩家中的玩家不在线则失败。
若成功,更改默认的或指定的玩家游戏模式。
例子
使你进入创造模式: gamemode creative, gamemode c,或gamemode 1
使所有玩家进入生存模式: gamemode 0 @a
另见
defaultgamemode – 设定加入世界玩家的初始游戏模式


gamerule

命令/infobox 设置或查询一条游戏规则值。

格式
gamerule <规则名> []
参数
规则名
指定了要设置或查询的游戏规则。可为任何值,但只有某些预设的游戏规则会影响游戏玩法(见下预设游戏规则)。
(可选)
指定将游戏规则设置的值。可为任何值,但只有truefalse指定预设的游戏规则会真正影响游戏玩法,除了randomTickSpeed的情况下,任何0或以上的数字将会影响游戏玩法(见下预设游戏规则)。
预设游戏规则
规则名 描述 默认值
commandBlockOutput 命令方块是否在执行命令时通知管理员 true
doDaylightCycle 时间是否演进 true
doEntityDrops 非生物实体是否掉落 true
doFireTick 火是否传播及自然熄灭 true
doMobLoot 生物是否掉落物品 true
doMobSpawning 生物是否自然生成 true
doTileDrops 方块是否掉落 true
keepInventory 玩家是否在死后保存物品栏内的物品 false
logAdminCommands 是否在服务器日志中记录管理员使用过的命令日志 true
mobGriefing 爬行者,僵尸,末影人,恶魂,凋灵,兔子,,及村民是否能改变方块及村民, 僵尸, 骷髅,及僵尸猪人是否能捡拾物品 true
naturalRegeneration 玩家是否能在饥饿值足够时自然恢复生命值(不影响外部的治疗,例如金苹果生命恢复效果,等。) true
randomTickSpeed How often a random block tick occurs (例如植物生长,树叶腐烂,等) per chunk section per game tick. 0 will disable random ticks, higher numbers will increase random ticks 3
reducedDebugInfo 调试画面显示所有或简化的信息 false
sendCommandFeedback 来自被一个玩家执行的命令的反馈是否应该在聊天框内显示。也影响命令方块是否保存它们输出文本的默认行为 true
showDeathMessages 当一位玩家死亡时是否在聊天框中出现一条信息 true
结果
规则名未被定义及未被提供(例如,尝试询问一条未定义的游戏规则)时失败。
成功时,返回游戏规则的值(若未被提供)或将游戏规则设为指定的值(若被提供)。
可定义新游戏规则及设值(通过给出一个值)或查询(通过不给出一个值)。
例子
停止日夜交替: gamerule doDaylightCycle false
停止自然恢复: gamerule naturalRegeneration false
定义一条叫MyNewRule的新游戏规则并将其值设为10: gamerule MyNewRule 10


give

命令/infobox 给一位玩家一种物品。

格式
give <玩家> <物品> [数量] [数据] [数据标签]
参数
玩家
指定给予物品的目标。必须为一个玩家名或目标选择器
物品
指定给予的物品。必须为一个可用的物品ID (例如, 256minecraft:iron_shovel),或为一个可用的方块ID
数量 (可选)
指定给予的物品数量。必须在1及64间(包含)。若未指定,默认为1
数据 (可选)
指定所给予物品的物品数据。必须为一个介于-2,147,483,648和2,147,483,647之间的整数(包含这两个数,不含逗号),但是当数据值对于指定的物品ID无效时,数据值默认为0。
数据标签 (可选)
指定给予物品的数据标签。必须是NBT格式组(例如,{display:{Name:Fred}})。
结果
若参数指定不正确则失败, or if player fails to resolve to one or more online players.
若成功, summons the specified item(s) at the location(s) of the target(s). If player resolves to multiple targets, each receives the specifed number of items. The item entity's Owner tag is set to the target and its PickupDelay tag set to 0[需要验证] so the item can be picked up immediately and only by the target (if the target has room in their inventory).
例子
To summon 30 blocks of spruce wood planks at John's location with Lore that says "Wooden planks":
give John minecraft:planks 30 1 {display:{Lore:["Wooden planks"]}}
另见
/summon — 在任意位置生成任何实体


help

命令/infobox 提供命令的帮助。

格式
help [页数|命令名]
? [页数|命令名]
参数
页数|命令名 (可选)
指定命令列表的页数或提供帮助的命令。若未指定,默认为1(命令列表的第一页)。
结果
页数不是一个可用页数则失败,或当命令名不是一个可用命令名。甚至当指定一个可用的命令名时技术上是失败的,虽然它显示了该命令的用法。
若成功,显示命令列表的一页。多人命令不会在单人模式下显示, even when open to LAN players.
若指定了一个可用的命令名,显示该命令的用法。 For some complicated commands may show only the basic usage — additional information can sometimes be gained by attempting to type the command and using the auto-complete control (默认为Tab ↹键) to explore 每个参数的可用选项。
例子
显示命令列表的第一页: ?help
显示命令列表的第三页: ? 3
显示命令help的用法: help help

kick

命令/infobox 将一位玩家踢出一个服务器。

格式
kick <玩家> [原因…]
描述
自服务器强制断开玩家的连接,向他们显示一条可选的原因
成功条件
玩家必须在线。


kill

命令/infobox 杀死实体(玩家,生物,物品,等)。

格式
kill [玩家|实体]
参数
玩家|实体
指定要杀死的目标(们)(包括"非生物" 实体例如物品,vehicles,等)。必须为一个玩家名或一个target selector。若未指定,默认为命令使用者。Not optional in command blocks.
结果
Fails if player|entity fails to resolve to one or more entities (named players must be online).
On success, inflicts 1000(♥ × 500) void damage to targets — killing them instantly even if in Creative mode or protected by a high-level Resistance effect — and issues the appropriate death message. Players and mobs killed this way drop loot, and slimes and magma cubes that aren't already of minimum size spawn smaller ones. Destroys boats, minecarts, loose items and experience orbs if they are targeted.
例子
杀死你自己: kill
杀死Bob: kill Bob
"杀死"所有物品实体(making them vanish from the world): kill @e[type=Item]


list

命令/infobox 列出在服务器上的玩家。

格式
list
描述
显示所有当前连接的玩家的名字(the same can be achieved when pressing tab)
成功条件
永远成功,甚至在命令方块中。


me

命令/infobox 显示一条关于你自己的信息。

格式
me <动作…>
描述
以"*你的名字 动作"(例,"*Alice打喷嚏。"或"*Alice爆炸了。")的格式发送一条叙述信息给其他玩家。若 a multi-person target selector (例如,@a)在动作中被使用, the list of names is formatted as "名字1,名字2,和名字3",或"名字和名字2" for two names。因此,无论任何目标选择器在动作中被使用,此命令仅会输出一次。
成功条件
All target selectors (例如,@p) in 动作 must evaluate.


op

命令/infobox 给予一位玩家管理员身份。

格式
op <玩家>
描述
在服务器上给予玩家operator身份。
成功条件
永远成功。


pardon

命令/infobox 从黑名单上移除项目。

格式
pardon <名字>
pardon-ip <地址>
参数
名字
指定自黑名单移除的名字。
地址
指定自黑名单移除的IP地址。必须为一个可用的IP地址。
结果
当参数未正确指定时失败。
成功时,若该名字或该IP地址在黑名单上,它会被移除,允许任何人使用该名字或从该IP地址连接至服务器。


particle

命令/infobox 创造粒子。

格式
particle <名字> <x> <y> <z> <xd> <yd> <zd> <速度> [数量] [模式]
参数
名字
指定创造的粒子。必须为一个particle name(例如, explode)。
x y z
指定创造粒子的位置。所有值(包括y)必须在-30,000,000 and 30,000,000(包含, without the commas)之间。可使用tilde notation来指定一个相对于命令执行处的位置。
xd yd zd
指定在其中生成粒子的区域的尺寸。
例外:名字reddust,mobSpell,或mobSpellAmbient数量为0或未指定,指定粒子的颜色 in RGB format offset from 粒子的默认颜色(reddust的默认是一个近红色(a random red tint 在0.8至1.0间),而其它的则默认为黑色)。例如, with reddust, 0 0 0产生一个红色粒子,-1 1 0产生一个绿色粒子(红被减少至0而绿增加至1),0 0 1产生一个紫色粒子(蓝被添加至了原本的红色),等。 With mobSpellmobSpellAmbient,0 0 0产生一个黑色粒子,0 1 0 产生一个绿色粒子,0 0 0.5产生一个深蓝色粒子,等。若数量大于0, colors are randomized.
速度
指定粒子的速度。必须至少为0。
数量(可选)
指定创造的粒子效果的数量。必须至少为0(which 产生一个粒子)。
模式(可选)
指定显示模式。可为 anything 但仅force会拥有一个效果:允许粒子在通常的16方块半径外被看见。
结果
当参数未正确指定时失败。
成功时,创造指定粒子。
例子
To create a stationary huge explosion particle 10 blocks to the east:
particle hugeexplosion ~10 ~ ~ 0 0 0 0


playsound

命令/infobox 播放一段声音。

格式
playsound <声音> <玩家> [x] [y] [z] [音量] [音调] [最小音量]
参数
声音
指定播放的声音。必须为在sounds.json中被定义的一个声音项目(例如,mob.pig.say)。
一个声音项目可被多个声音关联,而被实际产生的声音会从它们中随机挑选, modified by their "weight",就像游戏通常那样。例如,声音项目mob.pig.say会随机播放多个猪音效之一,因为有多个声音关联于该项目。
Resource packs 可能向sounds.json添加它们自己的项目;该命令会成功播放这些。文件名不是被该命令使用;它严格用于sounds.json内定义的项目(which may not even be similar to the original file names and paths),而因此一个资源包 adding new sound files must define events for them (this is not necessary when replacing old sounds which are already in defined events).
玩家
指定声音的目标。必须为一个玩家名或一个target selector
x y z(可选)
指定播放声音的位置。可用tilde notation来指定一个相对于目标(们)的位置。
音量(可选)
指定声音能被听见的距离。必须至少为0.0。对小于1.0的值,声音会较轻而拥有一个较小的,在其中能被听见的球体范围。对大于1.0的值,声音不会实际上增大,但其可闻范围(1.0时有一个16方块的半径)会被音量相乘。声音总会基于与球体中心的距离逐渐衰减至无声。
音调(可选)
指定声音的音调。必须在0.0至2.0间(包含),而小于0.5的值与0.5等价。小于1.0的值降低音调而提升持续时间;大于1.0的值提升音调而降低持续时间。音调的值 is a multiplier applied to the frequency, so if a value between 0.5 and 1.0 (inclusive) is doubled, the pitch will be an octave higher. (If you're a musician wishing to convert other intervals to pitch values, see Note block#Usage, but be aware that 1.0 won't be F♯ for all sound effects.)若未指定,默认为1.0。
最小音量(可选)
指定在声音的通常可闻球体范围外的目标们听到的音量。若一个目标在通常的球体范围外,作为替代,声音会 be centered some short distance from the target (少于四个方块远),而minimumVolume会决定它的音量。必须在0.0至1.0间(包含)。
结果
当参数未正确指定,当玩家 fails to resolve to one or more online players,或当目标们无法从声音被播放处听到其则失败。
成功时,为目标玩家们播放一段声音。


publish

命令/infobox 对局域网开放单人游戏世界。

格式
publish
描述
为你的LAN朋友们的加入开放你的单人游戏。该命令出现在单人作弊命令中。
成功条件
无法在一个命令方块中被使用。


replaceitem

命令/infobox 用给出的物品替换方块(箱子,熔炉,等)或实体(玩家们或生物们)物品栏内的物品。

格式
replaceitem block <x> <y> <z> <格数> <物品> [数量] [数据] [数据标签]
replaceitem entity <选择器> <格数> <物品> [数量] [数据] [数据标签]
参数
x y z (仅block模式)
指定要改变的方块的位置。可用tilde notation来指定一个相对于命令执行处的位置。
选择器 (仅entity模式)
指定要改变的实体。必须为一个玩家名或target selector
格数
指定要改变的物品栏格数。可用的值取决于一个方块或一个实体是否被改变。
对于方块,必须为slot.container.格数,格数被一个指定格子的数字代替。
  • 箱子,发射器,投掷器,漏斗,及陷阱箱左上角的格被编号为0而后先水平增长,再是垂直的(因此,例如,一个箱子的最上一行格子被从左至右编号为0至8)。双重箱子与双重陷阱箱被当做两个单独的容器方块。
  • 一个酿造台的底部格被从左至右编号为0至2,而其顶部格为3。
  • 一个熔炉的格子中输入格被编号为0,燃料格为1,而输出格为2。
其它能容纳物品但不拥有物品栏GUI的方块(花盆唱片机)仅能被/blockdata改变。
对于实体,必须为下列之一,格数被一个指定格子的数字代替:
格子 格数 限制
slot.armor.chest 盔甲架,生物们,及玩家们(虽然不是所有生物会显出或使用物品)
slot.armor.feet
slot.armor.head
slot.armor.legs
slot.weapon 盔甲架生物们(虽然不是所有生物会显出或使用物品)
slot.enderchest.格数 0 to 26 玩家
slot.hotbar.格数 0 to 8
slot.inventory.格数 0 to 26
slot.horse.saddle ,驴,及骡; 物品必须为一个
slot.horse.armor ; 物品必须为一种马铠
slot.horse.chest.格数 2 to 16 仅有箱子的驴与骡
slot.villager.格数 0 to 7 村民
一个物品展示框的物品栏仅能被用/entitydata改变。
物品
指定被放置于方块或实体的物品栏格内的物品。必须为一个item id,或一个block id for which an item exists (例如, minecraft:golden_sword)。
数量(可选)
为被放置于方块或实体的物品栏格内的物品指定数量。必须在1至64间(包含), even for items with a smaller stack size.
数据(可选)
为被放置于方块或实体的物品栏格内的物品指定物品数据。必须为一个在-2,147,483,648至2,147,483,647间(包含,去除逗号)的整数,但 values which are invalid for the specified 物品id会默认为0。若未指定,默认为0.
数据标签(可选)
为被放置于方块或实体的物品栏格内的物品指定data tag。必须为一个 compound NBT tag (例如, {display:{Name:Fred}})。
结果
当参数指定不正确时,当指定方块不是一个容器时,当选择器 fails to resolve to one or more entities (named players must be online),或当目标实体没有 the specified slot 时(例如,僵尸没有slot.horse.armor)失败。
成功时,用特定物品替换特定格内的物品(失去格内之前的物品)。
例子
用四棵云杉树苗替换上方一个方块的一个单箱子右下格内的物品:
replaceitem block ~ ~1 ~ slot.container.26 minecraft:sapling 4 1
用四棵云杉树苗替换最近的玩家的快捷栏最右格内的物品:
replaceitem entity @p slot.hotbar.8 minecraft:sapling 4 1
另见
/blockdata —也能替换一个容器中的物品
/entitydata —也能替换一个生物物品栏中的物品,或改变盔甲与武器的掉落率
/give —给予玩家们物品而不指定特定物品栏格子或复写其它物品


save

命令/infobox 这些命令管理服务器的保存。

save-all

将服务器保存至硬盘。

格式
save-all
描述
强制服务器将未处理的对世界变更与玩家数据保存至硬盘。
成功条件
总是成功。

save-off

禁用自动的服务器保存。

格式
save-off
描述
禁用服务器编写世界文件。所有的变更将会暂时 be queued.
成功条件
总是成功。

save-on

启用自动的服务器保存。

格式
save-on
描述
启用服务器编写世界文件。这是默认行为。
成功条件
总是成功。


say

命令/infobox 向多个玩家发送信息。

格式
say <message …>
描述
向所有在线玩家播送message。若使用了多人的target selector(例如,@a),名单格式为"名字1,名字2,和名字3",两个名字时为"名字1和名字2"。因此,无论使用了何种目标选择器,此命令仅会输出一次。
成功条件
所有信息里的目标选择器(例如, @p)evaluate。


scoreboard

命令/infobox 这些命令管理记分板的objectives, players,和teams。

格式
scoreboard <objectives|players|teams> …

更多资料见Scoreboard#Command reference


seed

命令/infobox 显示世界seed

格式
seed
描述
显示种子。此命令总是能在单人游戏中使用,无论作弊是否被启用。
成功条件
总是成功(若使用者是一个命令方块,单人游戏的玩家,或服务器管理员)。


setblock

命令/infobox 将一个方块更改为另一个方块。

格式
setblock <x> <y> <z> <TileName> [dataValue] [oldBlockHandling] [dataTag]
参数
x y z
指定要更改的方块坐标。可使用tilde notation来指定一个相对于命令执行处的位置。
方块名
指定新的方块。必须为一个block id (例如, minecraft:stone)。
数据值(可选)
Specifies additional data to further describe the new block. Must be between 0 and 15 (inclusive). If not specified, defaults to 0.
旧方块处理方式(可选)
指定任何处理方块变化。必须为其中之一:
  • destroy —旧方块掉落本身与其内容物(as if destroyed by a player). Plays the appropriate block breaking noise.
  • keep — Only air blocks will be changed (non-air blocks will be "kept").
  • replace — The old block drops neither itself nor any contents. Plays no sound.
If not specified, defaults to replace.
dataTag(可选)
Specifies the data tag for the new block. Must be a compound NBT tag (for example, {CustomName:Fred}).
Result
Fails if arguments are not specified properly, if tried to change a non-air block in keep mode, or tried to replace a block with an identical copy in keep or replace mode.
On success, changes the block at the specified position.
See also
  • /blockdata — modifies the data tags of a block
  • /clone — copies blocks from one region to another
  • /fill — fills a region with a block


setidletimeout

命令/infobox Sets the time before idle players are kicked from the server.

Syntax
setidletimeout <Minutes until kick>
Description
Set the idle kick timer. Any players idle for Minutes until kick will be kicked.
Success Conditions
Always succeeds.

setworldspawn

命令/infobox Sets the world spawn.

Syntax
setworldspawn
setworldspawn <x> <y> <z>
Arguments
x y z (optional)
Specifies the coordinates of the world spawn. x and z must be within the range -30,000,000 to 30,000,000 (inclusive). y must be between 0 and 256 (inclusive). May use tilde notation to specify coordinates relative to the command's execution. If not specified, defaults to the position of the command's execution. Not optional in command blocks.
If the server is not in adventure mode, players will always spawn on the topmost block near (x,z) — y is effectively ignored. If the server is in adventure mode, then the new spawnpoint will be the coordinates given exactly, including the y coordinate (even if undergound and even if there is no block there) -- if the y level given does not have space for the player then it will move up on the y axis until it does, at most y level 256.
Although spawn chunks are usually kept loaded at all times, new spawn chunks won't be loaded by this command until a player moves within range. Compasses (which in Minecraft point to the world spawn rather than north) will also not update to the change until the world is reloaded.
Result
Fails if arguments are not specified correctly.
On success, sets the world spawn to the specified coordinate.

spawnpoint

命令/infobox Sets the spawn point for a player.

Syntax
spawnpoint
spawnpoint <player>
spawnpoint <player> <x> <y> <z>
Arguments
player (optional)
Specifies the player whose spawn point should be set. Must be a player name or a target selector. If not specified, defaults to the command's user. Not optional in command blocks.
x y z (optional)
Specifies the coordinates of the player's new spawn point. x and z must be integers within the range -30,000,000 to 30,000,000 (inclusive). y must be an integer between 0 and 256 (inclusive). May use tilde notation to specify coordinates relative to the command's execution. If not specified, defaults to the position of the specified player(s).
Result
Fails if arguments are not specified correctly, or if player fails to resolve to one or more online players.
On success, sets the spawn point of the targeted player(s) to the specified coordinate.

spreadplayers

命令/infobox Teleports entities (players, mobs, items, etc.) to random surface locations within an area.

Syntax
spreadplayers <x> <z> <spreadDistance> <maxRange> <respectTeams> <player …>
Arguments
x z
Specifies the center of the region to spread targets to. x and z must be between -30,000,000 and 30,000,000 (exclusive). May use tilde notation to specify coordinates relative to the command's execution.
spreadDistance
Specifies the minimum distance between targets. Must be at least 0.0.
maxRange
Specifies the maximum distance on each horizontal axis from the center of the area to spread targets (thus, the area is square, not circular). Must be at least 1.0 greater than spreadDistance.
respectTeams
Specifies whether to keep teams together. Must be true or false. If true, targets on the same team will be teleported to the same location.
player
Specifies the targets to spread. Must be one or more player names and/or target selectors separated by spaces (@e is permitted to target entities other than players).
Result
Fails if arguments are not specified properly, if there are too many targets to satisfy the spreadDistance requirement within the specified area, or if a target is attempted to be spread to outside the world boundary.
On success, teleports targets to random surface locations within the specified area. Targets will always be placed on the top block at a location, and never on lava.
Examples
To teleport all players by team to random surface locations in a 1,000×1,000-block area centered on (0,0), with a minimum distance between teams of 200 blocks:
spreadplayers 0 0 200 500 true @a
To teleport one random player from each of three teams (Red, Blue, and Green), as well as Alice and Bob, to random surface locations in a 200×200-block area centered on (0,0), with a minimum distance between players of 50 blocks:
spreadplayers 0 0 50 100 false @r[team=Red] @r[team=Blue] @r[team=Green] Alice Bob
See also
/tp — teleports a single player or entity to a specific position (even underground).

stats

命令/infobox Manages the updating of scoreboard objectives with the results of other commands. Commands can be executed by blocks (specifically, command blocks and signs) or by entities (players can execute commands directly, and other entities can be the origin of commands indirectly with the /execute command). When a command is executed, the command returns one or more "command stats": the success count, number of blocks affected, number of entities affected, number of items affected, and/or a query result (such as from /time query daytime). The stats command allows "selectors" and "objectives" to be set (or cleared) for each of these command stats for specific blocks or entities. Selectors (for example, @e) are stored exactly as entered, and don't get evaluated immediately. When a command is later run by the block or entity, the stored selector is then used to target (other) entities and update their scoreboard objective with the value of the command stat. That value can then be displayed or operated on, just like any other scoreboard value. The success count from a command block can also be acquired with a redstone comparator, but that is capped at a maximum value of 15, while scoreboard objectives can hold any value from -2,147,483,648 to 2,147,483,647. Success counts and query results are also usually displayed in the chat.

参见:Tutorials/Command stats
Syntax
stats block <x> <y> <z> clear <stat>
stats block <x> <y> <z> set <stat> <selector> <objective>
stats entity <selector2> clear <stat>
stats entity <selector2> set <stat> <selector> <objective>
Arguments
x y z (block mode only)
Specifies the position of the block to post command stats from. x and z must be between -30,000,000 and 30,000,000 (inclusive, without the commas) and y must be between 0 and 256 (inclusive). May use tilde notation to specify a position relative to the command's execution.
selector2 (entity mode only)
Specifies the entity to post command stats from. Must be a player name or a target selector.
stat
Specifies the command stat whose selector and objective are to be cleared or set. Must be one of:
  • AffectedBlocks — returns the number of blocks affected by a command
  • AffectedEntities — returns the number of entities affected by a command
  • AffectedItems — returns the number of items affected by a command
  • QueryResult — returns the result of a command query
  • SuccessCount — returns a command's success count
selector (set mode only)
Specifies the selector to be evaluated when a command is run by the specified block or entity to determine which entity(ies) scoreboard objective is to be updated with the result returned by stat. May be anything because it won't be evaluated until a command is run by the specified block or entity, but only a player name or a target selector will produce useful results (though player names can be fake, so even real players don't need to be online).
objective (set mode only)
Specifies the name of the objective to be updated with the result returned by stat. May be anything because it won't be evaluated until a command is run by the specified block or entity, but only the name of a defined objective will produce useful results.
Result
Fails if arguments are not specified properly, if the specified block cannot track stats (in other words, it fails if the specified block is not a command block or sign), or if selector2 fails to evaluate to one or more valid entities (named players must be online).
On success, clears or sets the selector and objective to be updated with the result returned by stat.
Examples
To set the block at (0,64,0) to update scoreboard objective MyObj of the nearest player with the value of any query result returned by the block:
stats block 0 64 0 set QueryResult @p MyObj
To stop the block at (0,64,0) from updating any scoreboard obectives with the success count of commands it executes:
stats block 0 64 0 clear SuccessCount
To have the nearest wither skull update the scoreboard objective NumBlocks of fake player #FakePlayer with the number of blocks affected by commands executed by the wither skull:
stats entity @e[type=WitherSkull,c=1] set AffectedBlocks #FakePlayer NumBlocks
See also
/blockdata — can also change the selector and objectives of blocks by altering data tags directly
/entitydata — can also change the selector and objectives of entities by altering data tags directly

stop

命令/infobox Stops a server.

Syntax
stop
Description
Saves all changes to disk, then shuts down the server.
Success Conditions
Always succeeds.

summon

命令/infobox 召唤一个 实体 (生物, 弹射物, 物品, 车辆等.).

格式
summon <实体> [x] [y] [z] [数据标签]
参数
实体名称
指定召唤的实体。必须是一个实体ID (例如,Bat, EntityHorse, WitherSkull, XPOrb, PrimedTNT,等等。) or LightningBolt.
x y z (可选)
指定召唤的实体的坐标。x and z must be between -30,000,000 to 30,000,000 (inclusive), and y must be at least 0. May use tilde notation to specify a position relative to the command's execution. If not specified, defaults to the position of the command's execution.
数据标签 (可选)
指定实体的数据标签。必须是一个NBT格式组(例如,{CustomName:Fred}). Lightning has no additional data tags that can be specified.
结果
当参数未正确指定则失败。
成功,创建指定的实体在指定的位置。
例子:
召唤一个叫 "Powered Creeper" 的闪电爬行者在当前的位置:
summon Creeper ~ ~ ~ {powered:1,CustomName:Powered Creeper}
在当前位置往西面10格召唤出一个闪电:
summon LightningBolt ~-10 ~ ~
在当前位置召唤一个带有骷髅头和岩浆桶的盔甲架
/summon ArmorStand ~ ~ ~ {Equipment:[{id:lava_bucket},{},{},{},{id:skull}]}

tell

命令/infobox Sends a private message to one or more players.

Syntax
tell <player> <private message …>
msg <player> <private message …>
w <player> <private message …>
Arguments
player
Specifies the targeted player(s) to send the private message to. Must be a player name (or a target selector, but only if the user is an operator).
private message
Specifies the message to send. May include spaces (as well as target selectors, but only if run from the server console — in other words, from the computer running the server, or by remote access to it).
Result
Fails if any target selectors in either argument fail to resolve to at least one online player, or if a named player is not online.
On success, only the targeted player(s) see the private message in their chat.
Any target selectors in the private message will each resolve to one or more player names (as "name" for a single player, "name1 and name2" for two players, or "name1, name2, …, and nameN" for N players, without the quotes).
Examples
To privately tell Alice to start the mission: tell Alice Start the mission!

tellraw

命令/infobox Sends a JSON message to players.

Syntax
tellraw <player> <raw json message>
Arguments
player
Specifies the player(s) to send the message to. Must be a player name or target selector.
raw json message
Specifies the message to send. Must be valid raw JSON text (for example, {text:"Hi there!",bold:true}).
Result
Fails if arguments are not specified properly, or if player fails to evaluate to one or more online players.
On success, the targeted players receive the JSON message in their chat.
See also
/say — send a simple text message to all players
/tell — send a simple text message to specific players

testfor

命令/infobox Counts entities (players, mobs, items, etc.) matching specified conditions.

Syntax
testfor <player> [dataTag]
Arguments
player
Specifies the targets to count. Must be a player name or a target selector (@e is permitted to target entities other than players).
dataTag (optional)
Specifies the data tags the entities must have to match successfully. Must be a compound NBT tag (for example, {XpLevel:3}).
Result
Fails if arguments are not specified properly, or if player fails to resolve to one or more entities (named players must be online).
On success, produces a success count equal to the number of targets matching player, which can be measured by a redstone comparator facing away from the command block.
Examples
To test if Alice is online: testfor Alice
To count the number of players in survival mode within a 3-block radius of (0,64,0): testfor @a[0,64,0,3,m=0]
To count the number of players currently flying: testfor @a {abilities:{flying:1b}}
To count the number of zombies within a 20-block radius of (0,64,0): testfor @e[0,64,0,20,type=Zombie]

testforblock

命令/infobox Tests whether a certain block is in a specific location.

Syntax
testforblock <x> <y> <z> <TileName> [dataValue] [dataTag]
Arguments
x y z
Specifies the position of the block to test. x and z must be between -30,000,000 and 30,000,000 (inclusive, without the commas) and y must be between 0 and 255 (inclusive). May use tilde notation to specify a position relative to the command's execution.
TileName
Specifies the block to test for. Must be a valid block id (for example, minecraft:stone).
dataValue (optional)
Specifies the block data to test for. dataValue must be between -1 and 15 (inclusive). If not specified, or if -1, dataValue matches any block data value.
dataTag (optional)
Specifies the block data tags to test for. Must be a compound NBT tag (for example, {CustomName:Fred}). If not specified, dataTag matches any block data tag.
Result
Fails if arguments are not specified properly, if the block at the specified position does not match the specified block id or data, or if the specified data tag has different values than are defined in the block's data tag (dataTag does not need to match the block's entire data tag, and data tags in the argument which are undefined in the block will not cause the command to fail).
On success, returns a success count of 1.
Examples
To test if the block at (0,64,0) is any type of wool:
testforblock 0 64 0 minecraft:wool
testforblock 0 64 0 minecraft:wool -1
To test if the block at (0,64,0) is orange wool:
testforblock 0 64 0 minecraft:wool 1
To test if the block below is a jukebox with the "mall" record inside:
testforblock ~ ~-1 ~ minecraft:jukebox -1 {Record:2261}

testforblocks

命令/infobox Tests whether the blocks in two regions match.

Syntax
testforblocks <x1> <y1> <z1> <x2> <y2> <z2> <x> <y> <z> [mode]
Arguments
x1 y1 z1 and x2 y2 z2
Specifies two opposing corners of the region to use as the pattern to test for (the "source region"). x1, z1, x2, and z2 must all be between -30,000,000 and 30,000,000 (inclusive, without the commas), and y1 and y2 must be between 0 and 255 (inclusive). May use tilde notation to specify coordinates relative to the command's position. The number of blocks in the source region must not exceed 524,288.
x y z
Specifies the lower northwestern corner (the corner with the most-negative values) of the region to be checked (the "destination region"). x and z must both be between -30,000,000 and 30,000,000 (inclusive, without the commas), and y must be between 0 and 254 (inclusive). May use tilde notation to specify coordinates relative to the command's position. Source and destination regions may overlap.
mode (optional)
Specifies how to match blocks. Must be one of:
  • all — every block in the source and destination regions must match exactly.
  • maskedair blocks in the source region will match any block in the destination region.
If not specified, defaults to all.
Result
Fails if arguments are not specified properly, or if the source and destination regions do not match.
On success, returns the number of matching blocks (the total number of blocks in all mode, or the number of source region non-air blocks in masked mode).

time

命令/infobox Changes or queries the world's game time.

Syntax
time <add|query|set> <value>
Arguments
value
Specifies the time to add, query, or set:
  • add - Must be between 0 and 2,147,483,647 (inclusive, without the commas)
  • query - Must be daytime or gametime.
  • set - Must be between 0 and 2,147,483,647 (inclusive, without the commas), day, or night.
Result
Fails if arguments are not specified properly.
On success:
  • add - adds value to the world's game time
  • query - returns the day time (game ticks since midnight) or the game time (game ticks since world start)
  • set - sets the world game time to value (day = 1,000, night = 13,000).
Examples
To set the time to 1,000: time set 1000 or time set day
To add one day to the world time: time add 24000

title

命令/infobox Manages screen titles. Screen titles are displayed to players as a single line of large center-aligned text in the middle of their displays and can include a second line of text called a "subtitle". Both lines can include complicated formatting. Screen titles can be set to fade in and fade out, and the duration they are displayed can also be specified. Screen titles scale in size with the GUI Scale and screen titles which are too big to fit on the screen are not line-wrapped (they just overflow off the screen on both sides).

Syntax
The command has five variations, each with different arguments.
title <player> clear (removes a screen title from the screen)
title <player> reset (resets options to default values)
title <player> subtitle <raw json title> (specifies the subtitle text)
title <player> times <fadeIn> <stay> <fadeOut> (specifies fade-in, stay, and fade-out times)
title <player> title <raw json title> (displays the screen title)
Arguments
player
Specifies the player(s) to display a screen title to. Must be a player name or target selector.
raw json title (subtitle and title mode only)
Specifies the text to display as a title or subtitle. Must be valid raw JSON text (for example, {text:"Chapter I",bold:true}).
fadeIn, stay, and fadeOut (times mode only)
Specifies the time in game ticks (1/20ths of a second) for the screen title to fade in, stay, and fade out. All values must be between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas), but values below 0 will be treated as 0. If not specified (or if reset), default to 20 (1 second), 60 (3 seconds), and 20 (1 second).
Result
Title command

Example result of the title command.

Fails if arguments are not specified properly, or if player fails to evaluate to one or more online players.
On success:
  • clear — Clears the screen title from the screens of the specified player(s). If no screen title is currently being displayed, has no effect.
  • reset — Resets the subtitle text to blank text, the fade-in time to 20 (1 second fade-in), the stay time to 60 (3 seconds), and the fade-out time to 20 (1 second fade-out) for the specified player(s).
  • subtitle — If a screen title is currently being displayed to the specified player(s), changes the currently-displayed subtitle to the new specified text; otherwise, specifies the subtitle for the next screen title to be displayed to the specified player(s).
  • times — If a screen title is currently being displayed to the specified player(s), changes the fade-in, stay, and fade-out times of the current screen title (and of all future screen titles); otherwise, specifies the times for future screen titles to be displayed to the specified player(s).
  • title — Displays the specified text to the specified player(s), or changes the currently-displayed text to the new specified text. After fade-out, resets the subtitle back to blank text, but does not reset fade-in, stay, and fade-out times.
Examples
To display a bold screen title "Chapter I" with a gray italic subtitle "The story begins…" to all players:
  1. title @a subtitle {text:"The story begins…",color:gray,italic:true}
  2. title @a title {text:"Chapter I",bold:true}

toggledownfall

命令/infobox Toggles the weather.

Syntax
toggledownfall
Result
Always succeeds. If weather is currently clear, rain or snow will start. If weather is currently rain or snow, it will stop.

tp

命令/infobox Teleports entities (players, mobs, items, etc.).

Syntax
tp [target player] <destination player>
tp [target player] <x> <y> <z> [<y-rot> <x-rot>]
Arguments
target player (optional)
Specifies the targets to be teleported. Must be either a player name or a target selector (@e is permitted to target entities other than players). If not specified, defaults to the command's user. Not optional in command blocks.
destination player
Specifies the targets to teleport the target player to. Must be either a player name or a target selector (@e is permitted to target entities other than players).
x y z
Specifies the coordinates to teleport the targets to. x and z must fall within the range -30,000,000 to 30,000,000 (exclusive, without the commas), and y must be at least 0. May use tilde notation to specify a position relative to the target's current position.
y-rot (optional)
Specifies the horizontal rotation (-180.0 for due north, -90.0 for due east, 0.0 for due south, 90.0 for due west, to 179.9 for just west of north, before wrapping back around to -180.0). Tilde notation can be used to specify a rotation relative to the target's previous rotation.
x-rot (optional)
Specifies the vertical rotation (-90.0 for straight up to 90.0 for straight down). Tilde notation can be used to specify a rotation relative to the target's previous rotation.
Result
Fails if the arguments are not specified correctly, if target player fails to resolve to one or more entities (named players must be online), or if destination player fail to resolve to a single entity (a named player must be online).
On success, teleports the targets to the specified destination.
Examples
To teleport yourself to Alice: tp Alice
To teleport all players to yourself: tp @a @p
To teleport yourself to (x,z) = (100,100) but three blocks above your current position: tp 100 ~3 100
To rotate the nearest player 10 degrees to the right without changing their position: tp @p ~ ~ ~ ~10 ~

trigger

命令/infobox Sets a trigger to be activated.

Syntax
trigger <objective> <add|set> <value>
Description
Used together with /tellraw to let players activate systems made by operators or mapmakers. The objective must be an enabled scoreboard objective of the criteria "trigger". The given value is either added to its existing value, or becomes its new value, depending on whether the second argument is add or set. The value of the objective is only changed for the player who uses the command.
Success Conditions
objective must have the "trigger" criteria and the player who is running the command must be able to modify objective.

weather

命令/infobox Sets the weather.

Syntax
weather <clear|rain|thunder> [duration in seconds]
Arguments
clear
Specifies to set the weather to clear weather.
rain
Specifies to set the weather to rain (or snow in cold biomes).
thunder
Specifies to set the weather to a thunderstorm (or a thunder snowstorm in cold biomes).
duration in seconds
Specifies the time for the specified weather to last. Must be between 1 and 1,000,000 (inclusive, without the commas).
Result
Fails if arguments are not specified properly.
On success, changes the weather for the specified duration (in seconds).
Examples
To get clear weather for one Minecraft day: weather clear 1200
To make it rain, but let it end at its own pace: weather rain 1

whitelist

命令/infobox Manages the server whitelist. Server ops will always be able to connect when the whitelist is active, even if their names do not appear in the whitelist.

Syntax
The command has six variations.
whitelist add <player>
whitelist list
whitelist off
whitelist on
whitelist reload
whitelist remove <player>
Arguments
player (add and remove mode only)
Specifies the player(s) to add or remove from the whitelist.
Result
Fails if player doesn't exist
On success:
  • add — Adds the player name to the whitelist. The player does not need to be online.
  • list — Displays all player names in the whitelist.
  • off — Disables the server's use of a whitelist.
  • on — Enables the server's use of a whitelist.
  • reload — Reloads the list of player names in white-list.txt (1.7.5 or earlier) or whitelist.json (1.7.6 or later) from disk (used when white-list.txt or whitelist.json has been modified outside of Minecraft).
  • remove — Removes the player name from the whitelist. The player does not need to be online.

worldborder

命令/infobox These commands manage the world border.

Syntax
The command has eight variations, each with different arguments:
worldborder add <sizeInBlocks> [timeInSeconds] (increases the world border diameter)
worldborder center <x> <z> (recenters the world boundary)
worldborder damage amount <damagePerBlock> (specifies world border damage rate)
worldborder damage buffer <sizeInBlocks> (specifies world border damage buffer distance)
worldborder get (returns the world border diameter)
worldborder set <sizeInBlocks> [timeInSeconds] (sets the world border size and speed)
worldborder warning distance <blocks> (specifies the world border warning distance)
worldborder warning time <seconds> (specifies the world border warning time)
Arguments
sizeInBlocks (add, damage buffer, and set modes only)
Specifies a distance in blocks:
  • add — specifies the number of blocks to add to the world border diameter.
  • damage buffer — specifies the distance outside the world buffer before players start taking damage. Must be at least 0.0. Initially set to 5.0.
  • set — Specifies the new diameter for the world border. Must be between 1.0 and 60,000,000 (inclusive, without the commas).
timeInSeconds (add and set modes only)
Specifies the number of seconds it should take for the world border to move from its current diameter to the new diameter. Must be at least 0. If not specified, defaults to 0.
x z (center mode only)
Specifies the horizontal coordinates of the world border's center. Must be between -30,000,000 and 30,000,000 (inclusive, without the commas). May use tilde notation to specify coordinates relative to the command's execution.
damagePerBlock (damage amount mode only)
Specifies the damage a player takes per second per block past the world border buffer. For example, if damagePerBlock is 0.1, a player 5 blocks outside the world border buffer will take 0.5 damage per second (damage less than half a heart might not change the visual health display, but will still accumulate). Must be at least 0.0. Initially set to 0.2.
blocks (warning distance mode only)
Specifies the distance from the world border at which players will begin to see a visual warning of the world border's proximity. Must be at least 0. Initially set to 5.
seconds (warning time mode only)
Specifies the time in seconds before a moving world border overruns a player when they will begin to see a visual warning of the world border's proximity. For example, if seconds is 5, players will get a visual warning when the moving world border is 5 seconds or less away from passing their position. Must be at least 0. Initially set to 15.
Result
Fails if arguments are not specified properly, or if new world diameter will be less than 1.0 or greater than 60,000,000.
On success:
  • add — The world border begins changing its diameter. If sizeInBlocks is positive, the world border will turn green and start increasing; if negative, the world border will turn red and start decreasing. If timeInSeconds is 0 or unspecified, the change occurs immediately; otherwise the change proceeds at a rate of (sizeInBlocks/2)/timeInSeconds blocks per second.
  • center — The center of the world border immediate moves to the specified coordinates.
  • damage amount — Sets the world border damage amount to the specified value. Any player outside the world border buffer will take this amount of damage per second per block past the world border buffer distance.
  • damage buffer — Sets the world border buffer distance to the specified value. Players won't take damage until they move past this distance from the world border.
  • get — Shows the current world border diameter in the chat.
  • set — The world border begins changing its diameter. If sizeInBlocks is bigger than the current diameter, the world border will turn green and start increasing; if smaller, the world border will turn red and start decreasing. If timeInSeconds is 0 or unspecified, the change occurs immediately; otherwise the change proceeds at a rate of ((sizeInBlocks-<cirrent diameter>)/2)/timeInSeconds blocks per second.
  • warning distance — Sets the world border warning distance to this value.
  • warning time — Sets the world border warning time to this value.

xp

命令/infobox Adds experience to a player.

Syntax
xp <amount> [player]
xp <amount>L [player]
Arguments
amount
Specifies the amount of experience to give to the player. Must be between 0 and 2,147,483,647 (inclusive, without the commas).
If an L is added to the end, adds levels instead. Levels must be between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas) — negative values remove levels instead of adding them.
player (optional)
Specifies the target of the command. Must be a player name or a target selector. If not specified, defaults to the command's executor. Not optional in command blocks.
Result
Fails if arguments are not specified properly, or if player fails to resolve to one or more online players.
On success, adds experience or adds/removes levels. Total experience and levels will not be reduced below 0.
Examples
To give 7 experience to yourself: xp 7
To give 3 levels to Alice: xp 3L Alice
To remove all levels from all players: xp -2147483648L @a


历史

r
1.3.112w16a增加作弊模式
12w24a增加/publish命令
12w25a局域网连接可以选择是否允许作弊
12w27a增加/debug命令
1.4.212w32a增加/difficuty/gamerule/spawnpoint/weather命令
12w37a增加/clear命令
12w38a/clear命令可以指定移除特定的方块或物品
12w41a/xp的经验上限提高到2,147,483,647
1.4.41.4.4pre增加/enchant命令
1.513w03a增加命令方块独占的/testfor命令。
13w04a增加计分板/scoreboard系列命令。
1.7.213w36a增加/summon指令。
13w37a增加/setblock/testforblock/tellraw指令。
13w43a增加/setworldspawn指令。
1.814w02a增加/blockdata指令。
14w03a增加/fill/clone指令。
14w04a增加/particle指令。
14w06a增加/trigger指令。
14w07a增加/execute/testforblocks指令。
14w19a增加/worldborder指令。
14w20a增加/title指令。
14w26a增加/replaceitem指令。

引用


另见

Advertisement