我的世界命令方塊怎么一個指令實現多個目的?不少的玩家看過命令方塊有如此強大的功能,肯定忍不住要問,那怎么用了一條指令實現同時執行多條命令的效果呢?那就要用到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指令實現的。一般存在于一鍵生成某個大型的物件會用到。游戲狗我的世界專區中有很多的大神命令方塊一鍵生成的作品,代碼中就用了這種思路來實現的,一條指令實現了多個包含的指令。