本站文本內容除另有聲明外,均在知識共享 署名-非商業性使用-相同方式共享 3.0 協議下提供。(詳情… 本站文本內容除另有聲明外,均在知識共享 署名-非商業性使用-相同方式共享 3.0 協議下提供。(詳情…中文Minecraft Wiki是完全公開的。歡迎持續參與翻譯工作中文Minecraft Wiki是完全公開的。歡迎持續參與翻譯工作Minecraft中文Wiki微博正在更新!或許有興趣去看看Minecraft中文Wiki微博正在更新!或許有興趣去看看翻譯或創建頁面之前,不妨看看譯名標準化Wiki條例頁面。翻譯或創建頁面之前,不妨看看譯名標準化Wiki條例頁面。想與其他用戶進行編輯上的溝通?社區專頁正是為此創建的。想與其他用戶進行編輯上的溝通?社區專頁正是為此創建的。需要管理員的協助?在管理員告示板留言也許可以幫到您。需要管理員的協助?在管理員告示板留言也許可以幫到您。

教程/命令方块

来自Minecraft Wiki
跳转至: 导航搜索
Ic translate.svg
此页面的(部分)内容需要被翻译。
你可以帮助我们来翻译此页面
Cleanup.svg
该文章需要整理以符合样式标准 讨论
如果您可以,请帮我们优化文章样式来让它符合样式要求。讨论页可能包含一些建议。

命令方块是一种帮助和支持冒险模式、SMP的自动化和自定义地图。如果你想了解更多细节,请参见命令方块页。如果你不知道在某些命令中如何设置x,y,z的值最好先看看坐标

一般的应用[编辑 | 编辑源代码]

命令方块可以使用在许多事情,改变难度,改变天气的状态,或者给你预先指定的物品。他们在这些领域特别有用:/weather/time set x 命令。他们只能在作弊模式之外。 /time set x 命令很有用,它允许你改变当前预定时间再按下一个开关。

命令方块也可以被用来使文本出现在人的聊天菜单。命令是 tell @p <信息>, 或者 tell <玩家名> <信息>。如果加上@p在tell的后面,那么只有最近的玩家会看到信息。 而如果制定了一个玩家名,那么对应的玩家会看到信息。 你也可以输入: /tell <玩家名> ,当有人走过时,它会跟你说:“@ 悄悄地 对 <玩家名> 说:”。

你可以用以下命令去改变难度:/difficulty x,0=和平,1=简单,2=普通,3=困难,或者在后面直接打上难度的名字,例如:/difficulty peaceful

另外一种使用命令方块的方法是使用代码/tp @p <目的地坐标>在两个不同的基地之间传送。

给予一个随机玩家一个物品并告诉所有人[编辑 | 编辑源代码]

曲奇给予器 5000X

这个装置会给予一个随机玩家五个曲奇,然后告诉所有人。

首先创建一个记分板(名字任意,注意除非在你测试时,不要显示它),比如说“cookie”(曲奇)

/scoreboard objectives add cookie dummy cookie

第一个命令方块的命令:

/scoreboard players set @r cookie 1

第二个和第三个命令(两者可颠倒,但要同时被激活)

/say @a[score_cookie_min=1] has been given 5 cookies.

/give @a[score_cookie_min=1] minecraft:cookie 5

第四个命令方块的命令

/scoreboard players set @a[score_cookie_min=1] cookie 0

"I" 代表输入红石信号端。(建议可使用循环红石电路)

也可以用

/give @r cookie 1

传送[编辑 | 编辑源代码]

你可以通过使用/tp x y z来传送。其中y表示上下方向的移动,x和z表示前后和左右方向的移动,玩家可以通过这个命令传送到(x y z)这一个坐标的位置。如果要以目前站的位置为标准进行传送的话就只要在x y z前面加上一个~即可,例如/tp ~x ~y ~z。如果当玩家位于(x y z)坐标为(-36 96 -12)的时候输入/tp @p ~3 ~4 ~5,这时他会被传送到(-33 100 -7)这个坐标,和玩家输入/tp @p -34 100 -8是一个效果。

玩家安全系统[编辑 | 编辑源代码]

命令方块同时也可以用来制作安全系统。 只要在你房子入口的铁门前放置一个压力板,输入命令:/tp @p[r=<半径>,name=!<你的名字>] <x> <y> <z>。对于怪物,简单的栅栏或熔岩护城河就能达到目的。

自动人行道[编辑 | 编辑源代码]

类似于电梯的概念,用于使生物沿x或z坐标移动。 这可以通过以下方式创建:

  • 使用/fill命令加上你的坐标。 (比如/fill x y z x2 y2 z2)
  • 对于填充的块,使用这个:command_block 1 replace{Command:/tp @p ~-1 ~ ~}
  • 编辑括号内的坐标,以改变您将移动的方向。
  • 将压力板放在所有命令块的顶部。
  • 在这一步,你可能想把命令块提示关闭…因为聊天会被提示疯狂刷屏。

永恒的白天[编辑 | 编辑源代码]

Time reseter .png
  • 在13w24a,可通过在聊天框设定/gamerule dodaylightcycle获得永恒的白天,可以输入/gamerule doDaylightCycle false,以及/time set 6000

通过使用蛛网和矿车,你可以使用 /time set 0跳过夜晚。一个矿车需要31秒穿过一个蛛网。因此,通过使用23个堆叠的蛛网和检测器轨道和几个动力轨将使太阳保持在天空中。

或者,你也可以在一个木制压力板上使用一个物品去实现。物品每5分钟就会释放出来,这时它会触发一个命令方块将时间重置为0,还会触发一个发射器(或投掷器)将一个新物品扔到木制压力板上。5分钟是一天的周期,并且会在怪物产生之前触发重置时间。然而,这个方法被限制在该区块被加载后的64×9=576个周期,即48个现实小时的游戏时间。在快照13w01a和更高版本中添加了漏斗,可以挑选物品并将它们存入箱子。在怪物磨床中,可以在发射器中填满火药或者腐肉。 另一种方法是使用命令方块创建(例如/summon Item ~1 ~0 ~1 {Item:brown_mushroom})。这样做的好处是它不像使用发射器那样有64×9的格子限制。

这两种方法都要求保持区块加载以使系统工作。


或者你可以将命令方块连接到一个重复的红石脉冲,例如一个5分时钟,某种类型的循环,或者如右图所示的阳光传感器。为了防止聊天框被刷屏,使用命令/gamerule commandBlockOutput false关闭命令方块在聊天框上的消息输出。注意:这个方法可以使用不同的命令来设置各种各样的东西。(比如,要使天气永远晴朗,在循环中添加另一个命令方块,并使用命令/weather clear。)

为了可以在不同功能之间切换,可以在命令方块前设置一个与门,在一边放置一个拉杆,在另一边设置一些电路。


使用阳光传感器是永恒之日的一种更直接的方法。

Automatic Time Resster view 1.png Automatic Time Reseter view 2.png

当没有足够的亮度阳光传感器在远处为红石火把供电时,传感器会停止充能并启动命令方块,将时间设置为8000。换句话说,当亮度太低时,命令方块会将时间设置为中午。当命令被激活时,亮度会随着红石线的距离而变化,它设置的时间随在命令方块中输入的时间而变化。

Automatic Time Reseter view 3.png

要做到这一点,首先,你要把阳光传感器放在一个开放的区域。然后你从它相邻的位置开始向远处设置一些红石线红石线的距离取决于你需要多少延迟的时间。你最多只能有15个红石线阳光传感器发送信号到它的另一端。接下来,在红石的另一端放一个方块。把红石火把放在这个方块的一侧,并在火把顶部设置一个命令方块。右键单击命令块输入命令,命令以/time set开始,以有效的时间值结束。这个值即为命令方块在触发时会将时间设置到的数值。晚上是14000,中午是8000。

Automatic Time Reseter.png

这种设计可以在地图上使用,使之保持在特定的时间。但这个简单的装置只能用在创造模式或者开启作弊时。

还有一种更紧凑的设计。如果你把一个阳光传感器作为一个红石比较器的第一个输入,一个强度为15的红石线(红石块红石火把)放入第二个输入,然后将比较器设置为减法模式,则比较器将会在中午之后立即启动。

轻松设置日/夜[编辑 | 编辑源代码]

命令方块上放置阳光传感器,然后按下使用键,将其设置为夜光传感器。 将命令/time set day添加到命令方块中。或者如果你希望永远是夜晚,你可以添加一个阳光传感器,不要右键单击它,然后将/time set night添加到命令方块中。

无线红石[编辑 | 编辑源代码]

可以使用命令方块计分板系统实现无线红石。该过程涉及使用计分板变量,该变量由附加到时钟电路输出的命令块进行搜索。然后在无线输出命令块上使用红石比较器,该命令块在发现变量为真时触发。

无线红石也可以通过使用对象而不是变量来实现。如果输出命令块设置为尝试删除一个不存在的对象,则可以通过通过命令块或聊天命令添加said objective来创建红石信号。这种方法对于变量法的优点是它不依赖于参与者。

为此,在在输入处放置一个命令块,并键入命令/scoreboard objectives add <对象名> dummy,在输出位置放置一个命令块,输入/scoreboard objectives remove <对象名>,将其连接到时钟电路上,然后在命令方块外面放一个红石比较器,然后放一个红石中继器。然后使用红石中继器作为输出。

你还可以通过使用/setblock而不是计分板系统来实现无线红石。你所要做的就是让命令方块将一个与空气方块或任何不输出信号的东西相邻的红石块的坐标设置为目标坐标,并且与一个连接到反向信号的命令方块一起设置为相同的坐标。

无线按钮[编辑 | 编辑源代码]

从技术上讲,这可以在任何方块上完成,但是按钮、杠杆和其他可以交互的方块可以增加有趣的效果。虽然在服务器上非常神秘,但它其实很简单。它使用了1.8的命令/testforblock。它只是一个命令方块、一个将命令转换为红石信号的红石比较器、一个要测试的方块和一个重复激活命令方块的时钟电路。这是一个无线按钮的示例:/testforblock 123 12 123 stone_button 10。输入要测试的特定方块的坐标和名称,在本例中是位于123 12 123石质按钮。这可以使用在任何可更改数据值的方块上。坐标之后的数字10对应于我们希望命令方块测试的按钮的数据值。在本例中,当按下面向西部的按钮时,我们希望命令方块激活,因此将该值设置为10

注意:这个值根据方块状态变化,没有按下的面向西部的按钮的数据值是2。当一个按钮被按下时,它会在初始状态中增加8的值,所以当按下时,一个面向西部的按钮的数据值是10。关于数据值,请参考按钮#数据值拉杆#数据值

入门套件[编辑 | 编辑源代码]

通过使用 m=, 你可以在(服务器)地图上制作一个只能获得一次的套件! 首先, 在地上挖 3个方格, 然后放置一行命令方块(工具包中的每个物品一个)。 在命令方块的界面中, 输入 /give[m=<初始游戏模式>] <物品ID> <数量>。这样他们会获得你所希望给予他们的物品。 在一个额外的命令方块里面输入 /gamemode <一个不是初始游戏模式的模式>, 然后用红石连接整个命令方块串 (这件事因通过潜行模式下放置方块变得更容易)。 把洞填起来然后放上压力板。 当玩家走过去,他们会得到他们应得的工具包,他们因为改变了他们的游戏模式所以他们不会获得更多的套件 (除非作弊) (注意:该方法也可以通过使用以下方法来完成 (首先命名你的套件, 输入 /scoreboard objectives add <kitName> dummy <kitName>) 这个计分板指令! /give @p[score_<kitName>=0] <item id> <amount> 为了这一串给予物品的命令方块,然后 /scoreboard players add @p <kitName> <任意大于0的数字> 让他只能使用一次。 同时你也可以重复这些步骤使用一个不同的计分板名称 <kitName>)。

作为压力板的替代品[编辑 | 编辑源代码]

是不是已经厌烦了压力板只有四种材质可用了呢(石质,木质,铁质和金质)?现在你可以不再为这个问题困扰了。你可以使用包含命令/testfor,区域大小的带有时钟电路的命令方块来代替压力板了。命令/testfor @p[r=2]会检测2格内(朝任意方向两个方块加上命令方块本身的区域内)是否有任意玩家。当命令方块在一层地板下面的时候,r=2刚好是希望达到的效果。记住玩家是在一个球形区域内(而不是方形区域)触发这个命令的,所以r=2的区域大约是5*5*5,r=1的区域大约是3*3*3(其实更像是一个+号上下各加一个方块)。你可以用dx,dy,dz这些参数来编辑命令。你也可以在代码里指定xyz坐标(比如/testfor @p[x=50,y=64,z=46,r=1]),但是注意不能把区域缩小到一个方块。因为在不包含坐标的命令中区域大小代表着命令方块本身加上周围r个方块厚的区域,对于命令方块来说比较合理(如果缩小到只有一个中心方块,那就只有你站在命令方块那个位置时才会触发命令了,所以并不合理)。至少来说一个r=1的触发区域(即+号上下各加一个方块)可以被埋在地层下,只露出上表面,前提是你知道玩家不可能在地表下两层的位置行走。如果实现这一效果且不使用xyz坐标则要求命令方块嵌在地表上,可以被玩家看到。

在单机非创造模式地图中使用命令方块[编辑 | 编辑源代码]

通过gamemode也可以使你在单机非创造性地图中使用命令方块,简单的切换游戏模式可以使用 gamemode 1 然后将命令方块的命令设置为您想要的任何内容, 最后使用gamemode 0切换回生存模式。 命令方块只是需要在创造模式下设置,但切换至生存模式仍然可以正常运作。

他也可以被用于传送(例如一个遥远的要塞,在地下挖矿,或者在一个浮空岛)。 如果他需要你花了很长时间才能到达那里,然后你不介意他是一种软作弊, 这样你可以建立起一个传送系统。请确保你在设置命令方块的时候是创造模式(请使用 gamemode 1。 如果你并没有开启作弊选项,打开局域网模式设置打开作弊),但你还是可以在生存模式中使用它。在打开的命令方块的界面中输入tp @p x y z 。 然后, 用红石 (包括按钮,拉杆,压力板)激活这个命令方块,然后你就会被送到远处的目的地。你可以建立多种不同的传送器。这也可以用于跨越大面积的大型项目,或者如果您将箱子从旧房子转移到新房子。

探险家地图绘制[编辑 | 编辑源代码]

如果一个人希望创造一个单人玩家的探险家地图,做 /publish命令来让其他的命令(见下方)被使用。

在多人中的应用 (SMP)[编辑 | 编辑源代码]

这个章节详细介绍了命令方块多人游戏中的应用。

  • 传送/运输

通过 /tp命令,可以制作一个所有人都可以使用的传送装置。可以在每个地方都使用。 例如,在整个世界里做一个庞大的传送系统,所有的传送点入口都汇集到传送大厅中,而传送大厅可以进入每个传送点入口处进而达到出口。这样就可以建造一个“快速交通中心”了。

  • "定格动画"

通过使用/tp,或者Minecraft地图编辑器,例如MC地图编辑器可以复制一张图片(利用方块做出来的绘画),然后粘贴到一处遥远的地方,并变动绘画的一些方块,利用一些压力板或者绊线钩,在玩家短时间欣赏绘画后,命令方块做出/tp命令,将玩家传送到下一张绘图点. 如果大量的复制粘贴这样的零件,让玩家按顺序的在这些之间传送并稍稍弄出一点点的延迟,那么玩家就会产生幻觉,认为这个绘画是在运动的(甚至认为是某MOD做出来),这就是利用命令方块来实现定格动画技术。

1.7+里可以使用/setblock来直接放置和删除方块,利用/setblock还可以免除传送时不必要的卡顿和一大堆的房间,而1.8+的/fill更是可以极其方便地放置大量的方块。

  • 抽奖

/give @r命令,可以创造一个抽奖。但是记住, /give命令是直接把物品放进他们的背包,而不是放在他们面前。

  • 监狱

通过连接高频红石到一个命令方块和用/tp命令,你可以强制玩家留在某个地方。如果你想让这个方法成为可行的,在你的聊天窗内使用命令/gamerule commandBlockOutput false。使用"Range"(最大范围)和"Minimum Range"(最小范围)两个参数,你可以在玩家离开一定距离后再将他们传送回来。

  • 只针对管理员

如果使用参数[m=1],那么只有创造模式的玩家才会受到这条命令的影响,当然输入m=0既只对生存模式的玩家有效。

  • 戏弄创造模式玩家

你可以放置一个命令方块,输入“/tp @p[m=1] <坐标>”或者一些整人命令。当创造模式的玩家激活这个命令方块就会被传送到某个地方或者变成生存模式,好无聊的恶作剧!

  • 公告

注:使用AutoMessage等服务端插件就可以达到自动公告的功能

通过在命令方块中使用 /me,可以创造一个无人自动广播(需要连接循环红石等不断发出激活信号的红石元件),不需要OP,用1.7+的新命令/tellraw {text:"<信息>"}可以免除开头的[@]并且可以做到悬浮事件和点击事件等。

  • 安全扫描

注:大部分服务器管理插件支持封禁危险物品。

使用 /clear命令, 你可以清除玩家背包中的某物品。具体步骤是这样的,使用 /clear @a(或者某玩家ID) <清除的物品名>。如果想实现自动清理危险品需要连接循环红石。

  • 比赛裁判

使用/say @p,命令方块就能报告最近的玩家。如果命令方块放在终点线后,他会很方便的说出赢家,但是/say会给所有玩家发送信息,为了防止刷屏,建议使用/tell或/tellraw。

  • 建立保护区域

注:Residence等服务器领地插件的拓展插件可以实现领地内游戏模式的变化。

你可以通过命令方块创造一个“创造/生存模式区域”,但是很繁琐。可以通过用命令方块的范围限制来制作一个“围栏”,通过围栏的玩家会变成生存或创造模式。在命令方块中输入命令 /gamemode 2 @a[x=<区域中心坐标> y=<区域中心坐标> z=<区域中心坐标> r=<最大的玩家搜索半径> rm=<最小的玩家搜索半径>] 这样放置两个搜索区域不重合的命令方块,就可以将规定半径内的玩家改变模式。

  • 无插件PVP

使用命令 /gamerule keepInventory true 来关闭玩家死亡后的物品掉落(同样在重生后会保留物品和经验等,所以需要在玩家重生后清空背包) 。使用 /give @p <物品ID>可以给予玩家武器(可以添加NBT标签),你可以设计一套完善的职业系统,玩家选择不同的职业会有不同的装备。使用 /spawnpoint [x y z坐标] 设置玩家重生地点,使用 /tp [x y z坐标]移动地图中的玩家到指定区域。

  • 新手工具包

你可以很简单的给新手工具包不用任何插件使用命令方块: "/give @p[r=2] 274"。 为了防止有人第二次按下按钮得到他们的工具包,您可以设置按钮激活两个命令方块:: 1. "/give @p[r=2,m=2] 274" 2."/gamemode 0 @p[r=2]"(玩家一开始是冒险模式,获得工具包后调成生存模式,然后再限定工具包仅限冒险模式能拿即可)

  • 特殊的彩字

虽然你不能够直接输入彩色/粗体/斜体文本到命令方块中,但是通过McEdit滤器可以编辑那些服务器内的文本。基岩版可以使用§来进行文字的变色、甚至是乱码(§k)。 SethBling's McEdit Filter: ColourCommandBlockText

同时/tellraw可以直接利用color等参数来弄出彩色字体

  • 警报系统

当玩家走上踏板时,他能触发命令方块 /say @p <警告内容>

  • 奖励屋

如果某个玩家在服务器有着过人的贡献或者有元老资历,但却不足给他管理,你可以奖励他一组钻石或者一些奇怪的东西.... 创建一个只有通过传送命令才能进入的房间,将有卓越贡献的玩家传送进去,玩家会激活房间中的命令方块从而获得奖励,而后他又会被另一个命令方块传送回原地,如果服务器允许/back的话,连续2次传送到原点,这样/back就无效了。(可以避免玩家二次领取奖励)

  • 天气机

使用/toggledownfall/weather thunder来开始或者结束降雨(雷雨。)合理安排这个命令的权限会十分有用, 你可以顺随自己的意愿开始或停止降雨。这个技术可以用于村民和一些由降水控制的红石机械,不用输入任何命令就可以控制天气(需要管理员激活命令方块自动执行), 合理利用将会十分有效,比如在森林火灾时或者在雨天刷怪

  • 有奖竞赛

使用/tp @p 和 /give @p,你可以制作一个障碍赛跑或者奖励迷宫,游戏结束后就将玩家传送汇出生点或其他地方。

  • 时间机器

在地图上模拟两个十分相似的环境,通过命令方块将玩家从一个传送到另一个,并且时间也会被设置为开始的时刻,这就好像是时间倒退。 注:可以广泛用于剧情RPG地图。

  • 地雷

使用命令/testfor @p[r=<检测范围>,name=<玩家名(如果没有限制可不写)>] 使用红石中继器连接命令方块和TNT,当命令方块检测到有玩家经过就会激活TNT!Boom! 注:命令方块的/testfor命令为一次性命令,命令方块检测到一次就会一直输出信号,如果需要多次性的话,你可以直接使用/summon召唤出TNT。

  • 安全门

通过使用 /testfor @p[r=5,name=<房主>],命令方块会在一定范围内检测房主并且为他开门,也只会为他开门。 注:命令方块的/testfor命令为一次性命令,命令方块检测到一次就会一直输出信号。

在自定义地图中的应用[编辑 | 编辑源代码]

这一节详细介绍了命令方块在自定义地图的应用。

Minecraft中使用大量命令方块的地图有很多优势。 比如:SethBling's TF2 Map

https://www.youtube.com/watch?v=_f2brU8hBWc&feature=plcp

另一个优秀的应用例子是 Hypixel's Gladiator Arena,这个地图中的战斗职业系统完全依赖于命令方块。

https://www.youtube.com/watch?v=jryJkWcqmzM

  • “沉默的”命令方块

在地图中控制命令方块不输出提示信息很重要,这可以保持玩家对地图的未知性和剧情的隐蔽性,如果玩家看到了各种命令的提示信息,地图将会索然无味。 关闭命令方块输出信息(除非是/say这类的命令)使用/gamerule commandBlockOutput false就可以实现。

  • 庇护所/角斗场

使用压力板或者绊线 (以安全城堡为例)设置进入城堡内的玩家为和平模式(对于不同区域视情况而定)。城堡大门可以有连接命令方块的绊线,玩家一旦走过绊线,激活命令方块,就会变为和平模式,这样就可以创造一个“避难所”。反之,你可以用同样的方法创造一个“困难模式区域”,所有玩家进入会变为困难模式。

  • 对于不同游戏模式玩家的控制

使用值[m=1]你就可以设置命令只对创造模式的玩家有效,生存模式就是[m=0]。 例:传送所有创造模式的玩家到254,47,-874,使用的命令为 /tp @a[m=1] 254 47 -874

  • “联合”住宅

在房间的入口或者出口设置一个 /tp 命令的命令方块,你不必将你的建筑都在同一个地方建设,它们可以在任何地方,只需要入口的命令方块传送过去,玩家会忽然觉得外面感觉很小的建筑内部空间竟如此之大。用这种方法联合多个建筑,可用作与服务器或单人地图中的场景瞬移。

  • 出生地

使用 /spawnpoint 可以设定玩家出生地点。(应用十分广泛,PVP地图,RPG地图等等)

  • 熔岩跑酷

之前的内容提到过,/gamerule keepInventory true可以在玩家死后保存背包物品。 在跑酷地图的出发点设置一个这样的命令方块,就可以使掉落熔岩死亡的玩家不会丢失物品,同时记录点可以用/spawnpoint来做。

  • 我要睡觉!

使用 /spawnpoint 可以直接设置出生点,但是要跳过白天就需要 /time set <时间> 命令,18000为夜晚(并非绝对,可以按喜好设置,不要少于12500),这样就可以模拟出睡觉的效果了。(可用/time set 700 直接转为白天,/spawnpoint命令和/time set 700配合不就行了么?)

  • 时间和天气下的场景

比方说,你的地图开始在一个寒冷的暴风雨之夜,你可以设置突然天晴了,外面有灿烂的阳光(光影mod么?)!或者,如果你想开始一个光明的一天,想让雨突然下起来又没办法?不要怕,有/weather命令。只需使用/weather,输入就行了!你也可以使用/time set输入:0是凌晨,6000是中午,12000是黄昏,18000是午夜(月亮还挂在头上呐!)。

  • 检测玩家是否切换到了和平模式

创建一个攻击型生物,把它放在压力板上。(请确保它会保持始终按下状态,所以一定要确保它不能跳或走开)。做一个红石电路,让压力板在没有接收到红石信号的时候激活命令方块。命令方块里设置一个消息,通知玩家的地图由于和平模式了已经损坏,需要的怪物已经消失,必须重新下载这个地图。你甚至可以做一个隐形传输命令方块,把那些故意切换到和平模式的玩家换成冒险模式后传送到一间基岩屋内,并让他不能使用/kill或/tp命令,并把他的重生点设在那个房子里,让他永生见不得光明!(单人的话,可以点“对局域网开放”,或用修改器)

  • 会说话的冒险地图(有一个任务系统!)

/say命令非常有用因为它可以直接给玩家发送消息. 用命令方块将会更好,这样你就不需要放很多的告示牌和编页码长到不行的书来告诉玩家游戏规则. 你只需要把命令方块放成一条线然后在中间铺中继器来弄各个语段之间的延迟(so the player isn't spammed)接着你就可以把那堆告示牌和放着书的箱子移走。

有一些是和NPC配合使用的。 想象一下你进了铁匠铺并且你想要让里面的铁匠说些什么。在命令方块出现之前, 你需要一些书和告示牌来充当对话的效果, 然后在铁匠铺里造些房间并放些杂物,这样会让这个铁匠铺看起来变得非常乱,但是现在,你只需要使用/say命令来制造铁匠说话的效果。 也许柜台后面的猪甚至会求饶!让我们再举另外一个例子:你在一家工厂里,一个报警铃的声音告诉你要爆炸了。用这个在聊天框中告诉你,特别是如果文字很长,以便保持一个紧张的气氛;这同样的可以用在炸弹倒数装置。如果玩家看到了 '10...' '9...' '8...' 显示在聊天框中,他将可以更好的把情绪带进地图。

最后但并非最不重要,他可以更容易的建立一个任务系统。来让我们的玩家开始进行厮杀。 他通过压力板激活了RS NOR锁存器 (所以他不能被再次激活) 然后一个有 /say命令的命令方块去满足屠夫对玩家的要求。他需要去杀一只猪 (他真可耻)。 玩家到达站在石制压板上的猪,当猪死了时就会关闭. 所以, when the player gets back to the butchery, he activates another circuit containing yet another RS NOR Latch and two command blocks with two commands. First, the /say command in which the butcher thanks the player, and other one, the /give command, so the player gets the reward. Along with that, don't forget to use the @p command so the butcher says the player's name. For example, if the command block is set to do this: /say Thanks, @p. You helped me a lot killing that pig., the channel will say: "@]: Thanks, <name of the player>. You helped me a lot killing that pig." This makes the map way cooler and looks like it's made for the player as it says his/her name!

  • 创建商店

使用/give @p[lm=(等级)] (物品) (数量)/xp -(等级)l @p[lm=(等级)] ,你可以创建一个使用经验交易物品的商店系统。例如,如果你创建了一个使用/give @p[lm=5] minecraft:grass 64的命令方块以及一个使用/xp -5l @p[lm=5]的命令方块,并把它们连接到同一个红石电路,那么激活时就会从最近的玩家身上扣除5级经验并给他64个草方块。

  • * Subtracting xp CAN work as a currency, by using the command /xp -3l @p[lm=3] where l (L for level) is subtracted. The minimum xp for the command to work can be listed inside the brackets, where lm is short for minimum level necessary.

    • You can make a Store using xp as a currency. Just place a command block before all the others with the following instructions: /testfor @p[lm=5] with a Comparator in front of the command block. That way you can only do the trade if you're at least at level 5 (in this case, but you can choose what level you want).

*

  • *The last two "updates" are pointless, as the [lm=(level)] in the first post will keep players from getting the item or losing their xp unless they are that level or higher. so if the command says [lm=5], they will NOT be able to use the "store" if they are level 4 or below, but WILL be able to if they are level 5 or above.
  • The blocks must be in order for this to work. If the blocks are powered at the same time, the cost block will subtract as per normal, but the block giving the item will not function unless your level is double or higher what the cost of the block is. (example: item costs 5, you have 7 levels, you will lose the 5 levels, but will not gain the item. You would only receive the item if your starting level is 10 or higher) The fix for this is to power the blocks linearly, give block first followed by xp block.


1.7命令的用法[编辑 | 编辑源代码]

Minecarts over floating rails created with the setblock command.

在1.7版本中, the command block gained an expanded potential. 也就是 /summon and /setblock 命令的添加, and can be used to automatically build structures, 填充箱子, 以及生成以前不能生成的实体。 下面是这些命令的语法: setblock的使用方法:/setblock <x> <y> <z> <方块名> [数据值] [旧方块处理方式] [数据标签] summon的使用方法:/summon <实体名> [x] [y] [z] [数据标签] setblock命令也可以用于做突然消失的地板或突然出现的墙。

setblock命令的例子:

* MobSpawners pt 1: The Basics This code will create a zombie spawner 2 blocks from you in the x direction. Note that the name given for mob spawners in this code ("minecraft:mob_spawner") is the long version and you can leave out the "minecraft:" part.

/setblock ~2 ~0 ~0 minecraft:mob_spawner 0 replace {EntityId:Zombie}

This next code is also pretty basic but it includes the 6 basic parameters that can be set.

/setblock ~0 ~-1 ~-3 mob_spawner 0 replace {EntityId:Skeleton,SpawnRange:4,RequiredPlayerRange:16,SpawnCount:4,MaxNearbyEntities:6,MinSpawnDelay:200,MaxSpawnDelay:800}

A few things to note:
A) All times are in game ticks (20ths of a second). 200-800 is 10-40 seconds.
B) Keep in mind that they are in groups of 2 and won't work if their partner is missing. SpawnRange requires RequiredPlayerRange (and vice-versa), MinSpawnDelay requires MaxSpawnDelay, and I assume SpawnCount needs MaxNearbyEntities (although I haven't actually heard confirmation on that last one).
C) There is also a parameter called "Delay" which contains the amount of time before next spawn (20 ticks for the first time, whatever random number it picks between MaxSpawnDelay and MinSpawnDelay every other time).
D) the coordinates given are ~0 ~-1 ~-3 (so 3 blocks in the negative Z direction from the commandblock's current position and 1 block down). This presumably will imbed it in the surface of the floor. Keep in mind that a spawners "SpawnRange" setting only applies horizontally not vertically. Vertically it will only spawn at the same height or 1 lower or higher, so imbedding it in the surface of the floor cuts the available spawn area by 2/3rds (but can help hide it). Naturally occuring spawners have their height cut by 1/3rd due to appearing 1 block above the floor instead of 2.
E) All the values used here are the defaults.

* MobSpawners pt 2: Custom monsters Now we get into the SpawnData. That's the stuff that tells the spawner you want a non-standard version of a monster, like a Zombie with a Diamond Sword and a Chainmail Helmet.

/setblock ~ ~1 ~ mob_spawner 0 replace {EntityId:Zombie,SpawnData:{Equipment:[{id:276,Count:1},{},{},{},{id:302,Count:1}]}}

Using ~ without any number after it in the coordinates counts as zero. Since none of those 6 parameters from last example are used they will all be defaults.
Note that the 5 equipment slots are: Hand, Boots, Legs, Chest, Helmet. You must even specify empty slots (the { }, parts) unless they're after the last non-empty slot. So if you want him to have a helmet you have to specify all 5 slots, but if it's just a weapon you can leave off the other 4. Or if you want him to have leg armor you have to specify weapon and boot slots but not chest and helmet slots.
By the way, creatures that burn in sunlight are safe if they have a helmet on, although it damages the helmet instead.
About the Count tag: most codes can get away with leaving it out, however it is important. An item without a count tag is a stack of zero, better known in the community as a "Ghost Item". A player trying to use a ghost item will have it disappear out of his hands with it's first use (which is a failure). While monsters can use ghost items without problem (hence why codes get away with leaving it out sometimes) if they drop the items the player who picks it up won't be able to use it, SO INCLUDE COUNT!

Next up we have a Skeleton with an enchanted bow (Flame), a custom mobhead (Spider, internet connection required or it's just steve) with Protection 2, and riding a Skeletal Horse.

/setblock ~2 ~1 ~2 mob_spawner 0 replace {EntityId:Skeleton,SpawnData:{Equipment:[{id:261,Count:1,tag:{ench:[{id:50,lvl:1}]}},{},{},{},{id:397,Count:1,Damage:3,tag:{ench:[{id:0,lvl:2}],SkullOwner:MHF_Spider}}],Riding:{id:"EntityHorse",Type:4,Tame:1,SaddleItem:{id:329,Count:1,Damage:0}}}}

Well actually sitting on a Skeletal Horse, since the lower creature controls the movement and the horse isn't hostile. Don't try zombies on horseback, they just sit there ineffectually while the horse eats grass and snorts. Luckily this is a skeleton and can shoot you from wherever the horse decides to wander.
As for the horse itself, it's type 4 (skeletal horse), Tame is set to 1 (yes), and it's got a saddle (and the fact that they make us specify which saddle hints that they may eventually have more than one type). Technically you can have multiple levels of riders, although this gets silly quickly.

MobSpawners pt 3: SpawnPotentials Using the SpawnPotentials tag lets us create a mobspawner with multiple mobs in it. It will randomly pick one each time it resets the timer (a second after spawning the previous mobs). Since these codes contain multiple mobs they tend to be quite long codes. Thanks to some youtuber whose name escapes me (Dragnoz) the fact that you can "break up" your code is known (command blocks ignore line breaks, so you can start a new line to clarify where one section ends and another begins and it won't ruin your code). Here's a more easy on the eye version of a SpawnPotentials code

/setblock ~0 ~1 ~1 mob_spawner 0 replace {EntityId:Zombie,SpawnRange:6,RequiredPlayerRange:12,SpawnCount:1,MaxNearbyEntities:6,MinSpawnDelay:100,MaxSpawnDelay:600,SpawnData:{Equipment:[{id:268,Count:1},{id:301,Count:1},{id:300,Count:1,tag:{display:{color:5013401}}},{id:299,Count:1,tag:{display:{color:6717235}}},{id:397,Count:1,Damage:3,tag:{SkullOwner:Reimac}}]},SpawnPotentials:[

{Type:Zombie,Weight:4,Properties:{Equipment:[{id:268,Count:1,Damage:58},{id:301,Count:1},{id:300,Count:1,tag:{display:{color:5013401}}},{id:299,Count:1,tag:{display:{color:6717235}}},{id:397,Count:1,Damage:3,tag:{SkullOwner:Reimac}}]}},

{Type:Skeleton,Weight:2,Properties:{Equipment:[{id:267},{id:301,Count:1,tag:{display:{color:1644825}}},{id:300,Count:1,tag:{display:{color:1644825}}},{id:299,Count:1,tag:{display:{color:1644825}}},{id:397,Count:1,Damage:3,tag:{SkullOwner:2insanepeople}}]}},

{Type:Zombie,Weight:4,Properties:{Equipment:[{id:272,Count:1},{id:305,Count:1},{id:304,Count:1},{id:303,Count:1},{id:397,Count:1,Damage:3,tag:{ench:[{id:0,lvl:2}],SkullOwner:Flixnore}}]}},

{Type:Zombie,Weight:4,Properties:{Fire:2400,Equipment:[{id:283,Count:1,tag:{ench:[{id:20,lvl:1}]}},{id:317,Count:1},{id:316,Count:1},{id:315,Count:1},{id:86,Count:1,tag:{ench:[{id:0,lvl:2},{id:1,lvl:10}]}}]}},

{Type:Zombie,Weight:4,Properties:{Equipment:[{id:267,Count:1,tag:{ench:[{id:16,lvl:2}]}},{id:309,Count:1},{id:308,Count:1},{id:307,Count:1},{id:397,Count:1,Damage:3,tag:{ench:[{id:0,lvl:2}],SkullOwner:2zqa}}]}},

{Type:Zombie,Weight:1,Properties:{Equipment:[{id:278,Count:1,tag:{ench:[{id:16,lvl:4},{id:17,lvl:4},{id:18,lvl:4},{id:21,lvl:3},{id:34,lvl:3}]}},{id:313,Count:1,tag:{ench:[{id:1,lvl:4},{id:2,lvl:4}]}},{id:312,Count:1,tag:{ench:[{id:3,lvl:4}]}},{id:311,Count:1,tag:{ench:[{id:0,lvl:4}]}},{id:397,Count:1,Damage:3,tag:{SkullOwner:MHF_Herobrine,ench:[{id:0,lvl:4},{id:1,lvl:4},{id:3,lvl:4},{id:5,lvl:3},{id:6,lvl:1}]}}],CustomNameVisible:1,CustomName:Herobrine,PersistenceRequired:1}},

]}

Wow that's a mouthful! But then it is 6 separate mobs. In order we have:
0) Before the "SpawnPotentials" tag: The starter, which will never pop up again after the first time. If we want to see him again we have to include him a second time under SpawnPotentials. He is just some random dude in bluejeans (blue dyed leather leg armor) and a cactus green shirt (green dyed leather tunic) with a wooden sword. He's a zombie under that random-dood-mobhead of his of course. They all are.
1) Same random dood, only this time his wooden sword is 2 hits away from breaking.
2) Hey who let a ninja into the game?!? This one is a skeleton under his mask, but he's been given an iron sword. All his leather armor is dyed ninja-black. Skeletons with swords close the gap quicker than zombies so watch out.
3) Stone Sword and Chain Armor guy. Protection II on his mobhead.
4) One of my favorites. Gold Sword, Golden Armor, Pumpkin Helmet, and ON FIRE!!! Originally I wanted to give him a flaming pumpkin helmet but I realized the Fire tag only applies to entities not armor. The pumpkin is enchanted with Protection II and Fire Resistance X (10!) in a desperate attempt to keep him on his feet and threatening the player for more than 5 seconds. It works but if the player plays keepaway then Mr Pumpkinhead does tend to burn to death. Oh his sword has fire aspect too.
5) Iron Sword and Armor guy. Sharpness II on his Sword, Protection II on his mobhead.
6) Diamond Weapons and Armor guy. Wait who is that. Is...is that...Oh Em Gee it is! Run!...No of course it's not really him. Because he doesn't exist. FakeHB here has highly enchanted Diamond Armor (Boots with Fire Protection IV and Feather Falling IV, Leggings with Blast Protection IV, Chestplate with Protection IV, Mobhead with Protection IV, Fire Protection IV, Blast Protection IV, Respiration III) and a Diamond Pickaxe enchanted with Sharpness IV, Smite IV, Bane of Arthropods IV, Looting III and Unbreaking III. He's also got the previously unseen CustomNameVisible (set to 1 for yes), a CustomName, and PersistenceRequired (set to 1 for yes). That last one will prevent him from ever despawning, although he can be killed normally. If you can get through that Diamond Armor. And level 4 resistances. Luckily he's rarer (see below).

Other than the ninja it's a straight tour of the 5 tiers of swords and armor. Note the Weight tag, used right after the mob name in each SpawnPotential. That determines how rarely it's picked. Specific numbers don't mean anything, just the ratios between the numbers. For example if you want all the potentials to have an equal chance just set all the weights to 1. Changing them all to 8 wouldn't do anything different (they're still all the same size as each other), however changing all but one to 8 would make that one 1/8th as likely as the rest. In this code 4 is the default. The ninja only has a weight of 2 (making him half as likely to be picked) and FakeHB has a weight of 1 (making him 1/4th as likely to be picked, and thank god!)
* MobSpawners pt 4: Rideable Monsters Mobs can be ridden by using Minecarts or Boats on their heads. The command is fairly simple
/setblock ~ ~1 ~ mob_spawner {EntityId:MinecartRideable(or Boat), SpawnData:{Riding:{id:<Entity>}}}
Tips:

  • Some mobs simply can't be spawned with a spawner, sad to say, like bosses and Iron Golems. Adding a Minecart isn't going to change that.
  • Hostile Mobs with shooting abilities can and will use them against survival players. Watch out.
  • Ghasts cannot be ridden. The minecart becomes stuck in their head, no use to anyone.
  • Endermen cannot be walked around, but they can be forced to teleport by shooting a projectile at them (eg; snowball).
  • Ocelots (Ozelots in the game format) are some of the fastest mobs to ride, seeing they're trying to get away from you. They can also be partially controlled, by pointing away from the place you want to go.
  • Spiders are the only mobs that slow down when ridden.
  • Slimes and their cousins, Magma Cubes (game format LavaSlime) cannot have their sizes changed.

1.8 的使用[编辑 | 编辑源代码]

新指令 在1.8有一些新增的指令和标签。其中最有用的就是@e。它允许玩家去标记实体。 你现在可以清除矿车传送Creeper. 其他的包括/fill, /clone, /execute, /worldborder (set|health, etc}, /trigger, /title, /blockdata, /testforblocks/stats的指令被新增了。查看 command页面,以便你知道他们是怎么运作的。

指令密码[编辑 | 编辑源代码]

你现在可以用一个被设置为/testforblock的命令方块来设置密码。放置一个命令方块这将会是你要输入的命令方块.再放置另一个命令方块,然后在里面输入/testforblock x y z(这里的x,y,z是你第一个命令方块) command_block 0 {Command:(input)}。 这里是一个例子: /testforblock ~2 ~ ~ command_block 0 {Command:这是密码!}. 放置一个比较器去连接第一个命令方块,然后再放置一个按钮在旁边以便充能这个命令方块.现在输入"这是密码!" (不要引号).如果第二个命令方块正确的找到了第一个命令方块, 这个比较器会被激活无论他是否被连线.如果你想重置密码以免被其他人利用,也可以放置一个被设置这 /setblock的命令方块在 /testforblock命令方块之后.

如果你不想让其他人编辑命令方块,你可以试着用 sign代替,但这意味着你必须去分别检测4排文字. To add a touch,你可以用空气去替换sign,但记得用/give @p sign去退还一个sign


破坏者[编辑 | 编辑源代码]

他可以让你破坏你所走过的立方体,~ 使用/execute。这是这个功能的指令: /execute @p ~ ~ ~ fill ~1 ~2 ~1 ~-1 ~0 ~-1 air。附上一个红石钟或者重复触发装置,~这个立方空气会跟随你到任何地方。很困惑?fill 带走了特定数量的空间,~ 很像是 setblock,~但是他需要两组xyz而且填充你指定的两点之间的区域。 在这种情况他是空气。 现在,~ 每次你移动,~他会填充一个3*3的空气正方体。这很好的用于消灭基地,~ 或者你只是想变成一个疯狂的熊孩子。

  • 这也可以用于清除水,~ 所以你变成了一个可以动的人型海绵。
  • 这在任何模式下都可以运作,甚至包括旁观者。

Landscaper[编辑 | 编辑源代码]

This is a reversed version of Destroyer. /execute @p ~ ~ ~ fill ~1 ~-1 ~1 ~-1 ~-1 ~-1 grass. This puts a 3x3 grass square under your feet. Only problem: Don't jump. It becomes a mountain of a problem.

Examples[编辑 | 编辑源代码]

  • The player can make a kind of world guard using the command block. (e.g. code: /gamemode <模式:[0|1|2|3]> @a[r=<radius>])
  • Using the radius argument with a teleporter hooked up to a clock circuit can be used to create an exclusion zone ("forcefield") around an x y z coordinate (which should not be centered on the command block itself, otherwise it will be difficult to edit or disable it later). Simply program it to teleport any player within a certain range to a further away point, or just back 10 meters using relative coordinates. Note that such a forcefield wouldn't know which direction you were approaching from, and may result in pulling a player in before pushing them back out the other side.
  • The commands /say Hello, @p, /tell @p Hello, @p, and /me Hello, @p will cause the command block to say user name of the nearest player in the message.
  • You can also clear players inventories, to prevent griefing and/or cheating: /clear <玩家> <物品> <数据> <最大量> <数据标签>

Spawners[编辑 | 编辑源代码]

Command Blocks can create spawners using the setblock command, e.g.: /setblock ~1 ~-1 ~0 mob_spawner 0 replace {EntityId:Zombie,SpawnData:{Equipment:[{id:276,Count:1}]}} Anything that counts as an entity can be spawned (except a player), which includes all hostile, neutral and passive mobs, as well as animals, minecarts, fireballs, arrows, snowballs, ender pearls, custom thrown potions, fireworks, primed TNT, falling sand, red sand, or gravel, paintings and item frames, experience orbs, and even dropped items of any type.

Pig/Cow/Chicken spawners can be placed in the butcher's backyard in a village to create a constant meat supply. E.g.: /setblock ~1 ~-1 ~0 mob_spawner 0 replace {EntityId:Chicken,MaxNearbyEntities:10,RequiredPlayerRange:16,SpawnCount:6,SpawnRange:2,MinSpawnDelay:50,MaxSpawnDelay:200,SpawnData:{Riding:{id:"Pig"}}} Note that the spawner in the last code example will spawn a chicken riding a pig. There doesn't seem to be a limit to how many levels of riders you can use (e.g.: a chicken riding a pig riding a cow riding a horse riding a silverfish riding a villager ("Say, that's a mighty odd hat you have on, Farmer Brown")).

Please note that if you want to use the RequiredPlayerRange tag you have to use the MaxNearbyEntities tag as well. Same deal with MinSpawnDelay and MaxSpawnDelay. Lastly, note that the y value used in both of those spawner example codes was ~-1, which (assuming you're not flying) will put the spawner in the surface level of the ground at your feet.

If you don't want to target a specific player, you can use @a, @p, or @r instead of <player>. Keep in mind that you can use @p (which means "closest player") in player issued commands as an easy to type 2 character replacement for your own name as the closest player to you will always be you.

Booby traps[编辑 | 编辑源代码]

The most lethal booby trap would be a command block set to teleport someone into the void.

As of 1.8 you can do /kill @e[r=2] in a command block below a block with a pressure plate to make a multi-use landmine that kills all nearby entities upon stepping on it (including players, item frames, and paintings)

Note that booby traps that use @p can be dangerous due to the fact that non-player entities could trigger them (if something like a pressure plate is used), resulting in the teleportation of the nearest player, no matter how far away they are and regardless of the fact that they haven't actually stepped on the plate. To get around this, you can either use the /testfor command as an invisible pressure plate, or you can do /tp @p[r=radius] x y z. Hook a clock circuit up to a command block programmed with /testfor @p[x=1, y=2, z=3, r=radius], with the coordinates changed as appropriate. Note that as of 1.8 a range of zero can now be specified.

Teleporters[编辑 | 编辑源代码]

It is possible to make teleporters using the command block. (e.g. code: /tp @p x y z) Taking it one step further, a teleporting station can be made, with multiple button-activated teleporters that each teleport to different locations. Scouting and testing teleportation destinations first is advisable, to make sure players don't end up stuck inside blocks or in other unintended places. If you appear in ground while testing coordinates, use /tp @p ~0 ~8 ~0 to get out (may require multiple uses).

If you use the teleport command with the command block, you can use relative coordinates in the destination coordinates by placing an ~ in front of a Coordinate (e.g. code: /tp @p ~0 ~8 ~0 This would teleport the player 8 blocks into the air).

Commands that use coordinates (e.g. /tp or /spawnpoint) add 0.5 to whole numbers when no decimal follows. This is so you appear centered over the block you appear on instead of at the edge or corner of it. For example, the number -33 would execute as -32.5, and 187 as 187.5. To prevent this behavior, add .0 (25.3, 90.0) after them, as these values are executed left as-is.
With the 1.8 update, you can now also teleport minecarts or boats, with you in them. The command is /tp @e[type=Boat] (coordinates).

More commands in fewer blocks[编辑 | 编辑源代码]

There are several ways to combine groups of commands into just one command.

  • /execute will run its command as many times as the number of targets it selects. If it doesn't matter what entity runs a particular command, you can use @e[c=10] to ensure the code always runs 10 times (as long as there are always at least 10 entities in the loaded world).
  • To run multiple commands, /summon a command-block minecart riding another command-block minecart riding another, with the commands in reverse order, on an activator rail. There are also commands called one-command mods that use this tactic. Mr. Garretto makes one-commands and maps here.

Exp Shop[编辑 | 编辑源代码]

This will allow server owners to sell effects, items, and more to any player using level ups and exp. All they have to do is press one button

Building The Structure[编辑 | 编辑源代码]


Setting The Commands[编辑 | 编辑源代码]

Using a map item as a scroll[编辑 | 编辑源代码]

In his recent videos, Sethbling uses a map as a scroll to perform commands (summon creatures, teleport). He has an empty map in his inventory and when he uses it, it becomes a filled map which immediately disappears and a redstone task is done. In this tutorial I will show you how to build a redstone mechanism to detect the use of a map as a scroll and perform a task (give an effect, open a door,...).

Pros

  • Fast redstone interaction.
  • Compact system.
  • At-will triggered system, just right-click to activate it.
  • Single use : the map disappears during the inventory check, but you can give it back through a /give command

Cons

  • There can only be one purpose for the scroll. I.E. you cannot do a scroll of teleporting and a scroll of strength without using complicated data values.
  • You may see the map animation when activating the map before it gets deleted.
  • You cannot use the map item during your playthrough (showing a text message, a path, a drawing,...).

Building the mechanism

You can change the display name of an item to give the player a better understanding of the object and use the tooltip display. Use the following command to give the player a custom named map :

/give <player> map 1 0 {display:{Name:"<displayName>",Lore:["<tooltip>"]}}
  • player : the player you want to reach (@p, @a[arguments],...).
  • displayName : the name displayed when you scroll in the hotbar or when you hover the item with your mouse.
  • tooltip : the text below the item name when you hover it.

Detecting the activation of the map

Minecraftscroll.jpg

  • The two hoppers form a redstone clock. You can use other clocks shown here.
  • The Command block 1 contains the /give command described in the section above. It can be dismissed if you don't want the scroll to come back after being activated.
  • The Command block 2 contains the inventory check command :
/clear <player> filled_map
  • The Command block 3 is the output in case of success. You can do whatever you want : give an effect to the player, teleport him somewhere,... You can also wire this output to a door, a piston,...


Going further The /clear command can check for other interactive items :

  • check for a glass_bottle if the player just drank a potion.
  • Sethbling also uses a fishing rod which works when the line is reeled in. The /clear syntax involves another argument, the damage value, after the item name:
/clear <player> fishing_rod 2

Note that spamming the reel, or hooking a mob, may damage it more than 2, so make another one of these every 2.

Command-Piston-Repeater Fun[编辑 | 编辑源代码]

  • Command block: /setblock x y z minecraft:sand
  • 1st Piston Front: Showing to set /setblock x y z to that position

Fast Pusher[编辑 | 编辑源代码]

  • Repeaters are risen by 1 block from 1-3 so you can see them

  • 1(Repeater): Set to 1
  • 2(Repeater): Set to 3
  • 3(2 Repeaters): Set to 4 and 2
  • 4(Repeater): Set to 2(Default)
  • 5(2 Repeaters): Set to 4 and 1
  • 6(2 Repeaters): Set to 4 and 4
  • 7(Repeater): Set to 2
  • 8 and 9(Repeaters): Set to 4 and 4
FastPusher.gif










Slow Pusher[编辑 | 编辑源代码]

  • 1(Repeater): Set to 4
  • 2(Repeater): Set to 4
  • 3(Repeater): Set to 4
  • 4(Repeater): Set to 1(Default)
  • 5(Repeater): Set to 1
  • 6(Repeater): Set to 1
  • 8(Repeater): Set to 4
  • 9(Repeater): Set to 2
  • 10(Repeater): Set to 2
SlowPusher.gif










更多资源[编辑 | 编辑源代码]

Feare's Command Block Tutorials
Dragnoz' youtube tutorials to a lot of possibilities using data tags
a text tutorial to data tags

另见[编辑 | 编辑源代码]