我的世界命令方块怎么一个指令实现多个目的?不少的玩家看过命令方块有如此强大的功能,肯定忍不住要问,那怎么用了一条指令实现同时执行多条命令的效果呢?那就要用到1.8版本中的tellraw指令了。
一个指令实现多个目的:
首先,大家可以试一下:放一个指令方块,然后输入这条指令:
/summon MinecartCommandBlock ~ ~4 ~-0.1
{Command:"/fill ~ ~-1 ~ ~ ~-1 ~minecraft:air 0 replace",Riding:
{id:"MinecartCommandBlock",Command:"/kill @e[type=Item,r=7]",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 15",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 14",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 13",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 12",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 11",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 10",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 8",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 7",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 7",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 6",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 5",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 4",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 3",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 2",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 1",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/kill @e[type=Item,r=7]",Riding:
{id:"MinecartCommandBlock",Command:"/setblock ~ ~ ~-1 minecraft:lava 7 replace",Riding:
{id:"FallingSand",Time:1,Block:"minecraft:activator_rail",Riding:
{id:"FallingSand",Block:"minecraft:redstone_block",Time:1,Riding:
{id:"Item",Motion:[0.0,0.0,-0.1],Age:5996}}}}}}}}}}}}}}}}}}}}}}
这条指令会使用/tellraw,在玩家屏幕里数到15。
指令的核心是使用MinecartCommandBlock。这个就是指令方块矿车的意思。之后大家看下面的
{id:"MinecartCommandBlock",Command:"/setblock ~ ~ ~-1 minecraft:lava 7 replace",Riding:
{id:"FallingSand",Time:1,Block:"minecraft:activator_rail",Riding:
{id:"FallingSand",Block:"minecraft:redstone_block",Time:1,Riding:
{id:"Item",Motion:[0.0,0.0,-0.1],Age:5996}}}}}}}}}}}}}}}}}}}}}}
这个意思就是,先刷出一个寿命很短的掉落物品,之后上面骑着红石块掉落沙,再在上面又骑着激活铁轨掉落沙。之后在斜面刷出岩浆方块。岩浆的原因是因为,刷出的是指令方块矿车。但是指令方块矿车在激活铁轨上面会形成脉冲,所以要岩浆把矿车烧掉。大家看见这整条指令都是在指令方块的上方实现,所以需要一个物品。因为有红石块掉落沙,所以如果掉到指令方块上面的话会导致指令方块再次激活,于是这里是用掉落物品来防止指令方块再次激活。
之后有暴多的MinecartCommandBlock骑来骑去,这些就是指令执行的地方:
“{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 15",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 14",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 13",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 12",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 11",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 10",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 8",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 7",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 7",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 6",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 5",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 4",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 3",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 2",color:aqua}",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action 1",color:aqua}",Riding:”。
之后大家看最上面的
“{Command:"/fill ~ ~-1 ~ ~ ~-1 ~ minecraft:air 0 replace",Riding:
{id:"MinecartCommandBlock",Command:"/kill @e[type=Item,r=7]",Riding:”
这个就是清空系统。意思是,等指令方块全部都激活完毕后,那么指令方块会自毁自己。这样子就不会留下任何指令方块/红石的痕迹。但是有时还是会有一些矿车掉落品落下来,到时玩家捡起来就行了。
以上就是指令的基本部位。之后玩家可以只激活一条指令:
/summon MinecartCommandBlock ~ ~4 ~-0.1
{Command:"",Riding:
{id:"MinecartCommandBlock",Command:"/kill @e[type=Item,r=7]",Riding:
{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action",color:red}",Riding:
{id:"MinecartCommandBlock",Command:"/setblock ~ ~ ~-1 minecraft:lava 7 replace",Riding:
{id:"FallingSand",Time:1,Block:"minecraft:activator_rail",Riding:
{id:"FallingSand",Block:"minecraft:redstone_block",Time:1,Riding:
{id:"Item",Motion:[0.0,0.0,-0.1],Age:5996}}}}}}}
大家看见原理还是和上面的一样,但是内容少了一点。大家在看中间一行:
“{id:"MinecartCommandBlock",Command:"/tellraw @a {text:"Action",color:red}",Riding:”
这里就是激活的指令。所以,激活这整条指令后会有/tellraw指令告诉玩家“Action”。
但是上面没有加入“{Command:"/fill ~ ~-1 ~ ~ ~-1 ~ minecraft:air 0 replace",Riding:”,这是因为上面的指令方块矿车碟的比较少,所以会导致错乱,清空系统先激活。这样子整个机器就坏了。所以大家如果要使用这种方法激活多条指令的话,最起码也要10+条。
这些就是指令的核心部位。之后玩家可以自行自定义。
以上这条指令都是用的/fill和/setblock,最难的部位是确保坐标的正确。
小编点评:一条指令实现多个指令,这种利用方式利用/tellraw指令实现的。一般存在于一键生成某个大型的物件会用到。游戏狗我的世界专区中有很多的大神命令方块一键生成的作品,代码中就用了这种思路来实现的,一条指令实现了多个包含的指令。