我的世界方块学院CanPlaceOn和怎么设定只能放在有别的数据值的方块上

我的世界怎么进冒险模式_百度知道
我的世界怎么进冒险模式
输入/gamemode 2或/gamemode a进入冒险模式gamemode 0(s)为生存模式,1(c)创造模式,3(sp)为旁观者模式(1.8可用)在高于1.8的版本里,玩家不能放置或破坏任何方块,只能通过命令方块刷出的物品进行破坏或放置如/give @p minecraft:dirt 1 0 {CanPlaceOn:[&minecraft:log&,&minecraft:diamond_block&]} 就是刷出一个只能放在钻石块和原木上的泥土。/give @p minecraft:stick 1 0 {CanDestroy:[&minecraft:glass&,&minecraft:dirt]} 就是给你一个只能破坏泥土和玻璃的木棍
为您推荐:
想以冒险模式创建一个世界是不可能的!百度minecraft TMI,传说中的属性修改器。那家伙,生存、极限、创造、冒险模式一键切换。但有了TMI,minecraft会慢慢变得无趣!建议去Minecra畅礌扳啡殖独帮扫爆激ft中文下载站 | 我的世界 下载站
要进冒险模式的话要在作弊下使用/gamemode 2才能进行冒险模式。但是在显示存档的地方并不会显示冒险模式。
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁警告:根據CC BY-NC-SA 3.0協議,所有從wiki搬運的資料都必須寫上來源出處(中文Minecraft Wiki),否則將被視為侵權行為!()
致繁體用戶:本wiki現已更新簡繁更換系統,各位用戶可以通過簡繁切換來查看正確的繁體譯名
警告:您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您或一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
因存在冲突的中间编辑,本编辑不能撤销。
反垃圾检查。
不要加入这个!
{{Translation|needed}}
{{cleanup}}
[[命令方块]]是一种帮助支持[[冒险模式]],SMP的自动化,和自定义地图。了解更多细节,请参见[[命令方块]]页。如果你不知道在某些命令中如何设置x,y,z的值最好先看看[[坐标]]。
== Video ==
{{/video}}
== 一般的应用 ==
[[命令方块]]可以使用在许多事情,改变[[难度]],改变[[天气]]的状态,或者给你预先指定的[[物品]]。他们在这些领域特别有用:&code>/weather&/code> 和 &code>/time set x&/code> 命令。他们只能在作弊模式之外。 &code>/time set x&/code> 命令很有用,它允许你改变当前预定时间再按下一个开关。
命令方块也可以被用来使文本出现在人的聊天菜单。命令是 &code>tell @p &message>&/code>, 或者 &code>tell &username> &message>&/code>.如果加上@p在tell的后面,那么只有最近的玩家会看到信息 If a username was specified, the username will be sent the message. 你也可以输入: &code>/tell &your username> @p&/code> and whenever someone walks over it is will say: "@ whispers to you: &username>''.
你可以用已下命令去改变难度 &code>/difficulty x&/code> 0=和平,1=简单,2=普通,3=困难,或者在后面直接打上难度的名字。(例如:&code>/difficulty peaceful)&/code>
Another way to use Command Blocks is to use &code>/tp @p &coordinates>&code> to teleport between different bases in your world
Don't you hate how there's only 4 materials that pressure plates blend in with? (stone, oak wood planks, iron and gold)
Now you don't have to put up with that. Pressure plates can be replaced with a command block by using the command {{cmd|testfor}} with a range and a clock circuit. The command &code>/testfor @p[r=2]&/code> will test to see if any players are within a range of 2 (the command block itself plus 2 more blocks in every direction). Range 2 is the range you want for a command block under a floor. Keep in mind that it will produce a globe shaped trigger area (rather than a cube), so a range of 2 makes an approximately 5x5x5 area and a range of 1 makes a 3x3x3 area (more like a + pattern with an extra block above and below the center). You can get around this by using the dx, dy and dz arguments. Alternately you can specify xyz coordinates in the code (e.g. &code>/testfor @p[x=50,y=64,z=46,r=1]&/code> but be warned that you cannot shrink the range to the 1-block point. As with the non-xyz version range means center block plus range number of blocks around it, which makes sense from a command block (where "just the center block" would mean you have to be standing IN the command block) but doesn't make sense here. At any rate a range 1 sphere (+ pattern with an extra block on top and bottom) can be buried underground with just the top sticking out, provided you know no one will be walking through the bottom 2 layers of the globe. Trying this with the non-xyz version of the code would require the command block itself to be embedded in the surface of the floor where it can be seen.
==Using Command Blocks in Single Player Non-Creative Maps==
By swapping gamemode it is possible to use command blocks in single player outside of creative mode. Simply swap to creative mode with the /gamemode 1 command, set the command block command to whatever you want, then swap back to /gamemode 0. The command block only needs to be set in creative, but will still function once back in normal.
It can also be used to teleport to certain areas (for ex. a far-away Stronghold, a deep mining operation, or a floating island). If it took you a very long time to get there, and if you don't mind sort-of cheating, then you can set up a teleport system. Make sure that you are on Creative mode while setting it (use the command /gamemode 1. If you don't have cheats enabled, open the LAN and set the cheats on), but you can still activate it in Survival mode. Type this command in when having the Command Block GUI open
/tp @p x y z
. Then, activate the command block with redstone (including buttons, levers, and pressure plates), and you will be sent to your far-away destination. You can set up multiple different teleports. This can also be used when doing a big project that spans over a very large area or if you are transferring chests to from an old house to a newer house.
== 探险地图绘制 ==
如果一个人希望创造一个单人玩家的探险地图,做 &code>/publish&/code>命令来让其他的命令(见下方)被使用。
== 在多人中的应用 (SMP) ==
这个章节详细介绍了[[命令方块]]在多人游戏中的应用。
*'''传送/运输'''
通过 &code>/tp&/code>指令,可以制作一个所有人都可以使用的传送装置。可以在每个地方都使用。 例如,在整个世界里做一个庞大的传送系统,所有的传送点入口都汇集到传送大厅中,而传送大厅可以进入每个传送点入口处进而达到出口。这样就可以建造一个“快速交通中心”了。
*'''"定格动画"'''
通过使用/tp,或者Minecraft地图编辑器,例如MC地图编辑器可以复制一张图片(利用方块做出来的绘画),然后粘贴到一处遥远的地方,并变动绘画的一些方块,利用一些压力板或者绊线钩,在玩家短时间欣赏绘画后,命令方块做出/tp指令,将玩家传送到下一张绘图点. 如果大量的复制粘贴这样的零件,让玩家按顺序的在这些之间传送并稍稍弄出一点点的延迟,那么玩家就会产生幻觉,认为这个绘画是在运动的(甚至认为是某MOD做出来),这就是利用命令方块来实现定格动画技术。
1.7+里可以使用/setblock来直接放置和删除方块,利用/setblock还可以免除传送时不必要的卡顿和一大堆的房间,而1.8+的/fill更是可以极其方便地放置大量的方块。
*'''抽奖'''
用&code>/give @r&/code>命令,可以创造一个抽奖。但是记住, &code>/give&/code>命令是直接把物品放进他们的背包,而不是放在他们面前。
*'''监狱'''
通过连接高频红石到一个命令方块和用&code>/tp&/code>命令,你可以强制玩家留在某个地方。如果你想让这个方法成为可行的,在你的聊天窗内使用指令&code>/gamerule commandBlockOutput false&/code>.。使用"Range"(最大范围)和"Minimum Range"(最小范围)两个参数,你可以在玩家离开一定距离后再将他们传送回来。
*'''只针对管理员'''
如果使用参数&code>[m=1]&/code>,那么只有创造模式的玩家才会受到这条命令的影响,当然输入m=0既只对生存模式的玩家有效。
*'''戏弄创造模式玩家'''
你可以放置一个命令方块,输入“/tp @p[m=1] &坐标>”或者一些整人命令。当创造模式的玩家激活这个命令方块就会被传送到某个地方或者变成生存模式,好无聊的恶作剧!
*'''公告'''
注:使用AutoMessage等服务端插件就可以达到自动公告的功能
通过在命令方块中使用 &code>/me&/code>,可以创造一个无人自动广播(需要连接循环红石等不断发出激活信号的红石元件),不需要OP,用1.7+的新指令/tellraw {text:"&信息>"}可以免除开头的[@]并且可以做到悬浮事件和点击事件等。
*'''安全扫描'''
注:大部分服务器管理插件支持封禁危险物品。
使用 &code>/clear&/code>指令, 你可以清除玩家背包中的某物品。具体步骤是这样的,使用 &code>/clear @a(或者某玩家ID) &清除的物品名>&/code>。如果想实现自动清理危险品需要连接循环红石。
*'''比赛裁判'''
使用&code>/say @p&/code>,命令方块就能报告最近的玩家。如果命令方块放在终点线后,他会很方便的说出赢家,但是/say会给所有玩家发送信息,为了防止刷屏,建议使用/tell或/tellraw。
*'''建立保护区域'''
注:Residence等服务器领地插件的拓展插件可以实现领地内游戏模式的变化。
你可以通过命令方块创造一个“创造/生存模式区域”,但是很繁琐。可以通过用命令方块的范围限制来制作一个“围栏”,通过围栏的玩家会变成生存或创造模式。在命令方块中输入指令 &code> /gamemode 2 @a[x=&区域中心坐标> y=&区域中心坐标> z=&区域中心坐标> r=&最大的玩家搜索半径> rm=&最小的玩家搜索半径>]&code> 这样放置两个搜索区域不重合的命令方块,就可以将规定半径内的玩家改变模式。
*'''无插件PVP'''
使用指令 /gamerule keepInventory true 来关闭玩家死亡后的物品掉落(同样在重生后会保留物品和经验等,所以需要在玩家重生后清空背包) 。使用 /give @p &物品ID>可以给予玩家武器(可以添加NBT标签),你可以设计一套完善的职业系统,玩家选择不同的职业会有不同的装备。使用 /spawnpoint [x y z坐标] 设置玩家重生地点,使用 /tp [x y z坐标]移动地图中的玩家到指定区域。
*'''新手工具包'''
你可以很简单的给新手工具包不用任何插件使用命令方块: &code>"/give @p[r=2] 274"&/code>.
为了防止有人第二次按下按钮得到他们的工具包,您可以设置按钮激活两个命令方块:: 1. &code>"/give @p[r=2,m=2] 274"&/code> &code>2."/gamemode 0 @p[r=2]"&/code>(玩家一开始是冒险模式,获得工具包后调成生存模式,然后再限定工具包仅限冒险模式能拿即可)
*'''特殊的彩字'''
虽然你不能够直接输入彩色/粗体/斜体文本到命令方块中,但是通过McEdit滤器可以编辑那些服务器内的文本。
[/colorcommandblocktext/ SethBling's McEdit Filter: ColourCommandBlockText]
同时/tellraw可以直接利用color等参数来弄出彩色字体
*'''警报系统'''
当玩家走上踏板时,他能触发命令方块 /say @p &警告内容>
*'''奖励屋'''
如果某个玩家在服务器有着过人的贡献或者有元老资历,但却不足给他管理,你可以奖励他一组钻石或者一些奇怪的东西....
创建一个只有通过传送指令才能进入的房间,将有卓越贡献的玩家传送进去,玩家会激活房间中的命令方块从而获得奖励,而后他又会被另一个命令方块传送回原地,如果服务器允许/back的话,连续2次传送到原点,这样/back就无效了。(可以避免玩家二次领取奖励)
*'''天气机'''
使用&code>/toggledownfall&/code>和&code>/weather thunder&/code>来开始或者结束降雨(雷雨。)合理安排这个指令的权限会十分有用, 你可以顺随自己的意愿开始或停止降雨。这个技术可以用于村民和一些由降水控制的红石机械,不用输入任何指令就可以控制天气(需要管理员激活命令方块自动执行), 合理利用将会十分有效,比如在森林火灾时或者在雨天刷怪
*'''有奖竞赛'''
使用/tp @p 和 /give @p,你可以制作一个障碍赛跑或者奖励迷宫,游戏结束后就将玩家传送汇出生点或其他地方。
*'''时间机器'''
在地图上模拟两个十分相似的环境,通过命令方块将玩家从一个传送到另一个,并且时间也会被设置为开始的时刻,这就好像是时间倒退。
注:可以广泛用于剧情RPG地图。
*'''地雷'''
使用指令&code>/testfor @p[r=&检测范围>,name=&玩家名(如果没有限制可不写)>]&/code> 使用红石中继器连接命令方块和TNT,当命令方块检测到有玩家经过就会激活TNT!Boom!
注:命令方块的/testfor指令为一次性指令,命令方块检测到一次就会一直输出信号,如果需要多次性的话,你可以直接使用/summon召唤出TNT。
*'''安全门'''
通过使用 &code>/testfor @p[r=5,name=&房主>]&/code>,命令方块会在一定范围内检测房主并且为他开门,也只会为他开门。
注:命令方块的/testfor指令为一次性指令,命令方块检测到一次就会一直输出信号。
== 在自定义地图中的应用 ==
这一节详细介绍了命令方块在自定义地图的应用。
Minecraft中使用大量命令方块的地图有很多优势。
比如:SethBling's TF2 Map
/watch?v=_f2brU8hBWc&feature=plcp
另一个优秀的应用例子是 Hypixel's Gladiator Arena,这个地图中的战斗职业系统完全依赖于命令方块。
/watch?v=jryJkWcqmzM
*'''“沉默的”命令方块'''
在地图中控制命令方块不输出提示信息很重要,这可以保持玩家对地图的未知性和剧情的隐蔽性,如果玩家看到了各种指令的提示信息,地图将会索然无味。 关闭命令方块输出信息(除非是/say这类的指令)使用&code>/gamerule commandBlockOutput false&/code>就可以实现。
*'''庇护所/角斗场'''
使用压力板或者绊线 (以安全城堡为例)设置进入城堡内的玩家为和平模式(对于不同区域视情况而定)。城堡大门可以有连接命令方块的绊线,玩家一旦走过绊线,激活命令方块,就会变为和平模式,这样就可以创造一个“避难所”。反之,你可以用同样的方法创造一个“困难模式区域”,所有玩家进入会变为困难模式。
*'''对于不同游戏模式玩家的控制'''
使用值&code>[m=1]&/code>你就可以设置指令只对创造模式的玩家有效,生存模式就是&code>[m=0]&/code>。
例:传送所有创造模式的玩家到254,47,-874,使用的指令为 /tp @a[m=1] 254 47 -874
*'''“联合”住宅'''
在房间的入口或者出口设置一个 /tp 指令的命令方块,你不必将你的建筑都在同一个地方建设,它们可以在任何地方,只需要入口的命令方块传送过去,玩家会忽然觉得外面感觉很小的建筑内部空间竟如此之大。用这种方法联合多个建筑,可用作与服务器或单人地图中的场景瞬移。
*'''出生地'''
使用 &code>/spawnpoint&/code> 可以设定玩家出生地点。(应用十分广泛,PVP地图,RPG地图等等)
*'''岩浆跑酷'''
之前的内容提到过,&code>/gamerule keepInventory true&/code>可以在玩家死后保存背包物品。 在跑酷地图的出发点设置一个这样的命令方块,就可以使掉落岩浆死亡的玩家不会丢失物品,同时记录点可以用&code>/spawnpoint&/code>来做。
*'''我要睡觉!'''
使用 &code>/spawnpoint&/code> 可以直接设置出生点,但是要跳过白天就需要 &code>/time set &时间>&/code> 指令,18000为夜晚(并非绝对,可以按喜好设置,不要少于12500),这样就可以模拟出睡觉的效果了。(可用/time set 700 直接转为白天,/spawnpoint指令和/time set 700配合不就行了么?)
*'''时间和天气下的场景'''
比方说,你的地图开始在一个寒冷的暴风雨之夜,你可以设置突然天晴了,外面有灿烂的阳光(光影mod么?)!或者,如果你想开始一个光明的一天,想让雨突然下起来又没办法?不要怕,有/weather指令。只需使用/weather,输入就行了!你也可以使用/time set输入:0是凌晨,6000是中午,12000是黄昏,18000是午夜(月亮还挂在头上呐!)。
*'''检测玩家是否切换到了和平模式'''
创建一个攻击型生物,把它放在压力板上。(请确保它会保持始终按下状态,所以一定要确保它不能跳或走开)。做一个红石电路,让压力板在没有接收到红石信号的时候激活命令方块。命令方块里设置一个消息,通知玩家的地图由于和平模式了已经损坏,需要的怪物已经消失,必须重新下载这个地图。你甚至可以做一个隐形传输命令方块,把那些故意切换到和平模式的玩家换成冒险模式后传送到一间基岩屋内,并让他不能使用/kill或/tp指令,并把他的重生点设在那个房子里,让他永生见不得光明!(单人的话,可以点“对局域网开放”,或用修改器)
*'''Talking Adventure Map(featuring an easy Quest System!)'''
&code> /say&/code>指令非常有用因为它可以直接给玩家发送消息. 用[[命令方块]]将会更好,这样你就不需要放很多的牌子和编页码长到不行的书来告诉玩家游戏规则. 你只需要把命令方块放成一条线然后在中间铺中继器来弄各个语段之间的延迟(so the player isn't spammed)接着你就可以把那堆牌子和放着书的箱子移走。
有一些是和NPC配合使用的. 想象一下你进了铁匠铺并且你想要让里面的铁匠说些什么。在命令方块出现之前, 你需要一些书和牌子来充当对话的效果, 然后在铁匠铺里造些房间并放些杂物,这样会让这个铁匠铺看起来变得非常乱,但是现在,你只需要使用&code>/say&/code>命令来制造铁匠说话的效果. Maybe a pig behind the counter will even beg for mercy! Let's take another example: you are in a factory and an alarm suddenly rings and says that it's going to explode. Having it in the chat, especially if the text is long, keeps the same thing works for bomb timers. The player will get more into the map's mood if the chat displays '10...' '9...' '8...' also.
Last but not least, it makes it easier to create a Quest System. Let's say the player gets in a butchery. He activates through a pressure plate connected to a RS NOR Latch (so it can't be activated twice) and a command block with the &code>/say&/code> command in which the butcher asks for the player's help: he needs to kill a pig (shame on him). The player gets to the pig that is standing on a stone pressure plate, that turns off when the pig is dead. So, 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 &code>/say&/code> command in which the butcher thanks the player, and other one, the &code>/give&/code> 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: &code>/say Thanks, @p. You helped me a lot killing that pig.&/code>, 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!
*'''创建商店'''
使用&code>/give @p[lm=(等级)] (物品) (数量)&code>和&code>/xp -(等级)l @p[lm=(等级)]&code> ,你可以创建一个使用经验交易物品的商店系统。例如,如果你创建了一个使用&code>/give @p[lm=5] 2 64&code>的命令方块以及一个使用&code>/xp -5l @p[lm=5]&code>的命令方块,并把它们连接到同一个红石电路,那么激活时就会从最近的玩家身上扣除5级经验并给他64个草方块。
*&code>&/code>
*&code>* 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.
**&code> You can make a Store using xp as a currency. Just place a command block before all the others with the following instructions: &code> /testfor @p[lm=5]&code> 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).
&code>&code>*&code>&code>&/code>
*&code>&code>*The last two "updates" are pointless, as the &code>[lm=(level)]&code> 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 &code>[lm=5]&code>, 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.&/code>
==1.7命令的用法==
[[File:Legit Rails.png|thumb|Minecarts over floating rails created with the ''setblock'' command.]]
在1.7版本中, the command block gained an expanded potential. 也就是 &code> /summon &/code> and &code> /setblock &/code> 命令的添加, and can be used to automatically build structures, fill chests, 以及生成以前不能生成的实体。 下面是这些命令的语法:
''setblock''的使用方法:&code>/setblock &x> &y> &z> &方块名> [数据值] [旧方块处理方式] [数据标签] &/code>
''summon''的使用方法:&code>/summon &实体名> [x] [y] [z] [数据标签]&/code>
''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.&br>
&code>/setblock ~2 ~0 ~0 minecraft:mob_spawner 0 replace {EntityId:Zombie}&/code>&br>
This next code is also pretty basic but it includes the 6 basic parameters that can be set.&br>
&code>/setblock ~0 ~-1 ~-3 mob_spawner 0 replace {EntityId:Skeleton,SpawnRange:4,RequiredPlayerRange:16,SpawnCount:4,MaxNearbyEntities:6,MinSpawnDelay:200,MaxSpawnDelay:800}&/code>&br>
A few things to note:&br>
A) All times are in game ticks (20ths of a second). 200-800 is 10-40 seconds.&br>
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).&br>
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).&br>
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.&br>
E) All the values used here are the defaults.&br>
'''* 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.&br>
&code> /setblock ~ ~1 ~ mob_spawner 0 replace {EntityId:Zombie,SpawnData:{Equipment:[{id:276,Count:1},{},{},{},{id:302,Count:1}]}} &/code>&br>
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.&br>
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.&br>
By the way, creatures that burn in sunlight are safe if they have a helmet on, although it damages the helmet instead.&br />
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!&br>
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.&br>
&code> /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}}}} &/code>&br>
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.&br>
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.&br>
'''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&br>
&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:&br>
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.&br>
1) Same random dood, only this time his wooden sword is 2 hits away from breaking.&br>
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.&br>
3) Stone Sword and Chain Armor guy. Protection II on his mobhead.&br>
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.&br>
5) Iron Sword and Armor guy. Sharpness II on his Sword, Protection II on his mobhead.&br>
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).&br>
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!)&br>
'''* MobSpawners pt 4: Rideable Monsters'''
Mobs can be ridden by using Minecarts or Boats on their heads. The command is fairly simple &br>
&code>/setblock ~ ~1 ~ mob_spawner {EntityId:MinecartRideable(or Boat), SpawnData:{Riding:{id:&Entity>}}}&/code>&br>
Tips: &br>
*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 ( 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.
==New 1.8 uses==
'''New commands'''
There are several new commands and tags added in 1.8. One of the most useful being @e. It allows the player to target entities.
You can now teleport creepers, or kill a minecart. Others include &code>/fill, /clone, /execute, /worldborder (set|health, etc}, /trigger, /title, /blockdata, /testforblocks,&/code> and &code>/stats.&/code>. Check out the commands page to see how they work
==Commanding Passwords==
You can now create passwords with command blocks, using &code>/testforblock&/code>. Place a command block. This will be the one you put input in. Place another command block, and type in the command &code>/testforblock (x,y,z of first command block) command_block 0 {Command:(input)}&/code>. Here's an example: &code>/testforblock ~2 ~ ~ command_block 0 {Command:That's Numberwang!}&/code>. Place a comparator connected to the second command block, and place a button on or next to it to power the block. Now type "That's Numberwang!" (without quotes). If the second command block properly finds the first, the comparator will activate whatever it's wired to. If you want the first command block to reset so the password isn't used by someone else, also place a command block with &code>/setblock&/code> that activates after the &code>/testforblock&/code>.
==The Destroyer==
This allows you to destroy a cube of materials around you as you walk, using &code>/execute&/code>. Here's the command: &code>/execute @p ~ ~ ~ fill ~1 ~2 ~1 ~-1 ~-1 ~-1 air&/code>. Attach a clock or some sort of repeating device to it, and the cube of air will follow you wherever you go. Confused? The @p specifies the player (you), and you can change it to all players, or mobs. Imagine enderman blowing holes randomly. "~" is shorthand for the place you are, and adding numbers to them adds that to the area. &code>fill&/code> takes out a specified amount of space, similar to setblock, but it uses two xyz's and fills the space in between them with the material you choose. In this case it's air. Now, every time you move, it will fill a 3x3 cube of air around you. Great for enemy bases, or simply being a crazy griefer.
Tips: &br />
*This also deletes water, so you basically become a moving sponge.
*This works in any game mode, even spectator. This means even more advantage for griefers.
==Landscaper==
This is a version of Destroyer. &code>/execute @p ~ ~ ~ fill ~1 ~-1 ~1 ~-1 ~-1 ~-1 grass&/code>. 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: {{cmd|1=gamemode ? @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 {{cmd|say|Hello, @p}}, {{cmd|tell|@p|Hello, @p}}, and {{cmd|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: {{cmd|clear|?|...}}
== Spawners ==
Command Blocks can create spawners using the setblock command, eg.: {{cmd|long=1|setblock ~1 ~-1 ~0 mob_spawner 0 replace &nowiki>{EntityId:Zombie,SpawnData:{Equipment:[{id:276,Count:1}]}}&/nowiki>}} 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.: {{cmd|long=1|setblock ~1 ~-1 ~0 mob_spawner 0 replace &nowiki>{EntityId:Chicken,MaxNearbyEntities:10,RequiredPlayerRange:16,SpawnCount:6,SpawnRange:2,MinSpawnDelay:50,MaxSpawnDelay:200,SpawnData:{Riding:{id:"Pig"}}}&/nowiki>}} 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 &code>@a&/code>, &code>@p&/code>, or &code>@r&/code> instead of &code>&''player''>&/code>. 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 {{cmd|1=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 use the {{cmd|testfor}} command as an invisible pressure plate. Hook a clock circuit up to a command block programmed with {{cmd|1=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: {{cmd|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 {{cmd|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 &code>~&/code> in front of a Coordinate (e.g. code: {{cmd|tp @p ~0 ~8 ~0}} This would teleport the player 8 blocks into the air).
Commands that use coordinates (e.g. {{cmd|tp}} or {{cmd|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. &br />
With the 1.8 update, you can now also teleport minecarts or boats, with you in them. The command is &code>/tp @e[type=Boat] (coordinates)&/code>.
== Further Resources ==
&span class="plainlinks">[http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2225178-tutorial-command-blocks-for-dummies-adventure-map/ Feare's Command Block Tutorials]&/span>&br />
&span class="plainlinks">[/playlist?list=PLsroTGcv_SFPM7PJ2JsZm9VWY0XpHMDwJ Dragnoz' youtube tutorials to a lot of possibilities using data tags]&/span>&br />
&span class="plainlinks">[http://www.minecraftforum.net/topic/-using-summon-give-datatags-in-map-making-tutorials/ a text tutorial to data tags]&/span>&br />
== 另见 ==
* [[命令]]
* [[命令方块]]
* [[多人游戏]]
* [[游戏模式]]
{{tutorials}}
[[Category:Mechanics]]
[[Category:Guides]]
[[de:Redstone-Schaltkreise/Wettersensor]]
[[en:Tutorials/Command block]]
*&code>&code>*The last two "updates" are pointless, as the &code>[lm=(level)]&code> 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 &code>[lm=5]&code>, 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.&/code>&/code>
==1.7命令的用法==
[[File:Legit Rails.png|thumb|Minecarts over floating rails created with the ''setblock'' command.]]
在1.7版本中, the command block gained an expanded potential. 也就是 &code> /summon &/code> and &code> /setblock &/code> 命令的添加, and can be used to automatically build structures, fill chests, 以及生成以前不能生成的实体。 下面是这些命令的语法:
''setblock''的使用方法:&code>/setblock &x> &y> &z> &方块名> [数据值] [旧方块处理方式] [数据标签] &/code>
''summon''的使用方法:&code>/summon &实体名> [x] [y] [z] [数据标签]&/code>
''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.&br>
&code>/setblock ~2 ~0 ~0 minecraft:mob_spawner 0 replace {EntityId:Zombie}&/code>&br>
This next code is also pretty basic but it includes the 6 basic parameters that can be set.&br>
&code>/setblock ~0 ~-1 ~-3 mob_spawner 0 replace {EntityId:Skeleton,SpawnRange:4,RequiredPlayerRange:16,SpawnCount:4,MaxNearbyEntities:6,MinSpawnDelay:200,MaxSpawnDelay:800}&/code>&br>
A few things to note:&br>
A) All times are in game ticks (20ths of a second). 200-800 is 10-40 seconds.&br>
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).&br>
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).&br>
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.&br>
E) All the values used here are the defaults.&br>
'''* 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.&br>
&code> /setblock ~ ~1 ~ mob_spawner 0 replace {EntityId:Zombie,SpawnData:{Equipment:[{id:276,Count:1},{},{},{},{id:302,Count:1}]}} &/code>&br>
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.&br>
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.&br>
By the way, creatures that burn in sunlight are safe if they have a helmet on, although it damages the helmet instead.&br />
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!&br>
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.&br>
&code> /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}}}} &/code>&br>
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.&br>
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.&br>
'''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&br>
&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:&br>
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.&br>
1) Same random dood, only this time his wooden sword is 2 hits away from breaking.&br>
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.&br>
3) Stone Sword and Chain Armor guy. Protection II on his mobhead.&br>
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.&br>
5) Iron Sword and Armor guy. Sharpness II on his Sword, Protection II on his mobhead.&br>
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).&br>
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!)&br>
'''* MobSpawners pt 4: Rideable Monsters'''
Mobs can be ridden by using Minecarts or Boats on their heads. The command is fairly simple &br>
&code>/setblock ~ ~1 ~ mob_spawner {EntityId:MinecartRideable(or Boat), SpawnData:{Riding:{id:&Entity>}}}&/code>&br>
Tips: &br>
*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 ( 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.
==New 1.8 uses==
'''New commands'''
There are several new commands and tags added in 1.8. One of the most useful being @e. It allows the player to target entities.
You can now teleport creepers, or kill a minecart. Others include &code>/fill, /clone, /execute, /worldborder (set|health, etc}, /trigger, /title, /blockdata, /testforblocks,&/code> and &code>/stats.&/code>. Check out the commands page to see how they work
==Commanding Passwords==
You can now create passwords with command blocks, using &code>/testforblock&/code>. Place a command block. This will be the one you put input in. Place another command block, and type in the command &code>/testforblock (x,y,z of first command block) command_block 0 {Command:(input)}&/code>. Here's an example: &code>/testforblock ~2 ~ ~ command_block 0 {Command:That's Numberwang!}&/code>. Place a comparator connected to the second command block, and place a button on or next to it to power the block. Now type "That's Numberwang!" (without quotes). If the second command block properly finds the first, the comparator will activate whatever it's wired to. If you want the first command block to reset so the password isn't used by someone else, also place a command block with &code>/setblock&/code> that activates after the &code>/testforblock&/code>.
==The Destroyer==
This allows you to destroy a cube of materials around you as you walk, using &code>/execute&/code>. Here's the command: &code>/execute @p ~ ~ ~ fill ~1 ~2 ~1 ~-1 ~-1 ~-1 air&/code>. Attach a clock or some sort of repeating device to it, and the cube of air will follow you wherever you go. Confused? The @p specifies the player (you), and you can change it to all players, or mobs. Imagine enderman blowing holes randomly. "~" is shorthand for the place you are, and adding numbers to them adds that to the area. &code>fill&/code> takes out a specified amount of space, similar to setblock, but it uses two xyz's and fills the space in between them with the material you choose. In this case it's air. Now, every time you move, it will fill a 3x3 cube of air around you. Great for enemy bases, or simply being a crazy griefer.
Tips: &br />
*This also deletes water, so you basically become a moving sponge.
*This works in any game mode, even spectator. This means even more advantage for griefers.
==Landscaper==
This is a version of Destroyer. &code>/execute @p ~ ~ ~ fill ~1 ~-1 ~1 ~-1 ~-1 ~-1 grass&/code>. 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: {{cmd|1=gamemode ? @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 {{cmd|say|Hello, @p}}, {{cmd|tell|@p|Hello, @p}}, and {{cmd|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: {{cmd|clear|?|...}}
== Spawners ==
Command Blocks can create spawners using the setblock command, eg.: {{cmd|long=1|setblock ~1 ~-1 ~0 mob_spawner 0 replace &nowiki>{EntityId:Zombie,SpawnData:{Equipment:[{id:276,Count:1}]}}&/nowiki>}} 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.: {{cmd|long=1|setblock ~1 ~-1 ~0 mob_spawner 0 replace &nowiki>{EntityId:Chicken,MaxNearbyEntities:10,RequiredPlayerRange:16,SpawnCount:6,SpawnRange:2,MinSpawnDelay:50,MaxSpawnDelay:200,SpawnData:{Riding:{id:"Pig"}}}&/nowiki>}} 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 &code>@a&/code>, &code>@p&/code>, or &code>@r&/code> instead of &code>&''player''>&/code>. 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 {{cmd|1=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 use the {{cmd|testfor}} command as an invisible pressure plate. Hook a clock circuit up to a command block programmed with {{cmd|1=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: {{cmd|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 {{cmd|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 &code>~&/code> in front of a Coordinate (e.g. code: {{cmd|tp @p ~0 ~8 ~0}} This would teleport the player 8 blocks into the air).
Commands that use coordinates (e.g. {{cmd|tp}} or {{cmd|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. &br />
With the 1.8 update, you can now also teleport minecarts or boats, with you in them. The command is &code>/tp @e[type=Boat] (coordinates)&/code>.
== Further Resources ==
&span class="plainlinks">[http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2225178-tutorial-command-blocks-for-dummies-adventure-map/ Feare's Command Block Tutorials]&/span>&br />
&span class="plainlinks">[/playlist?list=PLsroTGcv_SFPM7PJ2JsZm9VWY0XpHMDwJ Dragnoz' youtube tutorials to a lot of possibilities using data tags]&/span>&br />
&span class="plainlinks">[http://www.minecraftforum.net/topic/-using-summon-give-datatags-in-map-making-tutorials/ a text tutorial to data tags]&/span>&br />
== 另见 ==
* [[命令]]
* [[命令方块]]
* [[多人游戏]]
* [[游戏模式]]
{{tutorials}}
[[Category:Mechanics]]
[[Category:Guides]]
[[de:Redstone-Schaltkreise/Wettersensor]]
[[en:Tutorials/Command block]]
请注意您对Minecraft Wiki的所有贡献都被认为是在CC BY-NC-SA 3.0下发布,请查看在的细节。
如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源。
不要在未获授权的情况下发表!
(在新窗口中打开)
该页面使用的模板:
()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(受半保护)}

我要回帖

更多关于 我的世界幸运方块 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信