大家好。今天无聊时做了一个小作品:全自动的生存合作伙伴。这个“伙伴”会自动挖矿,自动钓鱼和自动帮玩家打怪什么。
这个东西灵感来自国外的装备架挖矿机,主要是一个手拿钻石镐的装备架,自己自动往地下挖。截图:

(@Xhand )

-----------分割线--------------
这个机器首先需要几个积分版。指令:
- /scoreboard objectives add Mine dummy
- /scoreboard objectives add State dummy
- /scoreboard objectives add InWater dummy
- /scoreboard objectives add SpawnEgg stat.useItem.minecraft.spawn_egg
(以下指令都用脉冲激活。速度越快越好)
大家看见Mine积分版,这个积分版主要是用来控制掉在地上的物品。因为工作原理是,如果给伙伴一个钻石块,那他就会进入挖矿模式。绿宝石块就会进入钓鱼模式,然后金块就会进入攻击/防御模式。所以,这里使用Mine积分版来控制和探测落地的宝石块,然后给他们加分。指令:
- /scoreboard players reset * Mine
- /scoreboard players set @e[type=Item] Mine 1
- {OnGround:1b,Item:{id:"minecraft:diamond_block"}}
给落地的钻石块加分(1)。钻石块控制挖矿。
- /scoreboard players set @e[type=Item] Mine 2
- {OnGround:1b,Item:{id:"minecraft:gold_block"}}
- /scoreboard players set @e[type=Item] Mine 3
- {OnGround:1b,Item:{id:"minecraft:emerald_block"}}
之后就是InWater积分版的控制。这个积分版主要是控制钓鱼模式,探测伙伴有没有在水里。如果伙伴在水里,那么积分会变成1,不在水里重新变回0。运行方法和刚才一样:
- /scoreboard players reset * InWater
- /execute @e[type=ArmorStand,name=Friend] ~ ~ ~ detect ~ ~ ~ minecraft:water 0
- /scoreboard players set @e[type=ArmorStand,name=Friend] InWater 1
-----------分割线--------------
这里积分版就完成了。之后来控制的是:防御模式。这个就是默认模式,伙伴刚刷出来的时候就是这个模式。在这个模式下,伙伴手里会拿着一把钻石剑。防御模式的控制:(以下指令按照顺序在脉冲下运行)
- /execute @e[type=Item,score_Mine_min=2,score_Mine=2] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1] ~ ~ ~
- /scoreboard players set @e[type=ArmorStand,name=Friend,r=1] State 1
- /execute @e[type=Item,score_Mine_min=2,score_Mine=2] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1] ~ ~ ~
- /entitydata @e[type=ArmorStand,name=Friend,r=1]
- {Equipment:[{id:"minecraft:diamond_sword",Count:1b,Damage:0s,tag:{ench:[],Unbreakable:1b}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:skull",Damage:3s,Count:1b,tag:{SkullOwner:"RookieXhand",ench:[]}}]}
- /execute @e[type=Item,score_Mine_min=2,score_Mine=2] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1] ~ ~ ~
- /summon Wolf ~ ~1 ~
- {Silent:1b,ActiveEffects:[{Id:14,Duration:9999,ShowParticles:0b}],
- Invulnerable:1b,CustomName:"FriendWolf",Owner:"PotatoMaster101"}
- /execute @e[type=Item,score_Mine_min=2,score_Mine=2] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1] ~ ~ ~
- /tp @e[type=Item,score_Mine_min=1,r=1] ~ ~-9999 ~
-----------分割线--------------
之后就是挖矿模式。但是首先我们要给伙伴一个移动系统。因为默认模式下伙伴是跟着主人走的,只有在挖矿或者钓鱼模式下才会停止。所以主要就是伙伴(装备架)一直TP到主人的狗那里,这样走哪里跟哪里。指令:
- /tp @e[type=ArmorStand,name=Friend] @e[type=Wolf,name=FriendWolf,c=1]
- /execute @e[type=Item,score_Mine_min=1,score_Mine=1] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1] ~ ~ ~
- /scoreboard players set @e[type=ArmorStand,name=Friend,r=1] State 2
- /execute @e[type=Item,score_Mine_min=1,score_Mine=1] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1] ~ ~ ~
- /entitydata @e[type=ArmorStand,name=Friend,r=1] {Equipment:[{id:"minecraft:diamond_pickaxe",Count:1b,Damage:0s,tag:{ench:[],Unbreakable:1b}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:skull",Damage:3s,Count:1b,tag:{SkullOwner:"RookieXhand",ench:[]}}]}
- /execute @e[type=Item,score_Mine_min=1,score_Mine=1] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1] ~ ~ ~
- /kill @e[type=Wolf,name=FriendWolf,r=1]
- /execute @e[type=Item,score_Mine_min=1,score_Mine=1] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1] ~ ~ ~
- /kill @e[type=Item,score_Mine_min=1,r=1]
- /execute @e[type=ArmorStand,name=Friend,score_State_min=2,score_State=2] ~ ~ ~ detect ~ ~-2 ~ minecraft:bedrock 0
- /setblock -475 57 -438 minecraft:redstone_block 0 replace
(大家看见以上指令方块没有任何挖矿的指令,这是因为以上指令方块都在高速脉冲下面,挖矿的指令方块在一个比较慢的脉冲下面,后期会说到)。
-----------分割线--------------
之后是钓鱼模式。
- /execute @e[type=Item,score_Mine_min=3,score_Mine=3] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1,score_InWater_min=1,score_InWater=1] ~ ~ ~
- /scoreboard players set @e[type=ArmorStand,name=Friend,r=1] State 3
- /execute @e[type=Item,score_Mine_min=3,score_Mine=3] ~ ~ ~
- /execute @e[score_InWater_min=1,type=ArmorStand,name=Friend,r=1] ~ ~ ~
- /entitydata @e[type=ArmorStand,name=Friend,r=1] {Equipment:[{id:"minecraft:fishing_rod",Count:1b,Damage:0s,tag:{ench:[],Unbreakable:1b}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:skull",Damage:3s,Count:1b,tag:{SkullOwner:"RookieXhand",ench:[]}}]}
- /execute @e[type=Item,score_Mine_min=3,score_Mine=3] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1,score_InWater_min=1] ~ ~ ~
- /kill @e[type=Wolf,name=FriendWolf,r=1]
- /execute @e[type=Item,score_Mine_min=3,score_Mine=3] ~ ~ ~
- /execute @e[type=ArmorStand,name=Friend,r=1,score_InWater_min=1] ~ ~ ~
- /kill @e[type=Item,score_Mine_min=1,r=1]
之后就是钓鱼系统了。因为钓鱼系统不包括在高速脉冲内,是一个随机器控制:
- /setblock ~ ~1 ~ minecraft:mob_spawner 0 replace
- {MinSpawnDelay:125,MaxSpawnDelay:125,SpawnCount:1,Delay:1,RequiredPlayerRange:100,MaxNearbyEntities:1,SpawnRange:1,EntityId:FallingSand,SpawnPotentials:[{Type:FallingSand,Properties:{Pos:[-463.5,56.5,-435.5],Time:50,DropItem:0,Block:"minecraft:redstone_block"},Weight:5},{Type:FallingSand,Properties:{Pos:[-463.5,56.5,-434.5],Time:50,DropItem:0,Block:"minecraft:redstone_block"},Weight:4},{Type:FallingSand,Properties:{Pos:[-463.5,56.5,-433.5],Time:50,DropItem:0,Block:"minecraft:redstone_block"},Weight:3},{Type:FallingSand,Properties:{Pos:[-463.5,56.5,-432.5],Time:50,DropItem:0,Block:"minecraft:redstone_block"},Weight:3},{Type:FallingSand,Properties:{Pos:[-463.5,56.5,-431.5],Time:50,DropItem:0,Block:"minecraft:redstone_block"},Weight:6}]}
-----------分割线--------------
之后就是一些其他的系统了,比如:输入,挖矿机设置,防止熊孩子什么。
首先是挖矿的延迟。挖矿没有加到高速脉冲上面,因为如果加上的话,那挖矿速度几秒就能到达地壳,所以本人另外造了一个速度慢点的脉冲来设置挖矿:
- /execute @e[type=ArmorStand,name=Friend,score_State=2,score_State_min=2] ~ ~ ~
- /fill ~-1 ~-1 ~-1 ~1 ~ ~1 minecraft:air 0 destroy
- /blockdata ~ ~ ~-2 {TransferCooldown:12}
之后就是输入系统。这里本人使用刷怪蛋,每次玩家扔一个水下护卫刷怪蛋就会刷出伙伴,扔一个鸡刷怪蛋就会杀死伙伴:
- /execute @e[name=SummonBuddy,type=Guardian] ~ ~ ~
- /setblock -472 56 -436 minecraft:redstone_block 0 replace
- /execute @e[name=KillBuddy,type=Chicken] ~ ~ ~
- /setblock -457 57 -458 minecraft:redstone_block 0 replace
刷出伙伴的指令:
- /execute @e[name=SummonBuddy,type=Guardian] ~ ~ ~
- /execute @p[score_SpawnEgg_min=1] ~ ~ ~
- /summon ArmorStand ~ ~1 ~
- {CustomName:"Friend",Invisible:1b,Equipment:[{id:"minecraft:diamond_sword",Damage:0s,Count:1b,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:chainmail_boots",Count:1b,Damage:0s,tag:{Unbreakable:1b,ench:[]}},
- {id:"minecraft:skull",Damage:3s,Count:1b,tag:{SkullOwner:"RookieXhand",ench:[]}}],
- NoGravity:0b,NoBasePlate:1b,DisabledSlots:2069869,ShowArms:0b,Small:0b}
刷出狗:
- /execute @e[name=SummonBuddy,type=Guardian] ~ ~ ~
- /execute @p[score_SpawnEgg_min=1] ~ ~ ~
- /summon Wolf ~ ~ ~
- {Silent:1b,ActiveEffects:[{Id:14,Duration:9999,ShowParticles:0b}],
- Invulnerable:1b,CustomName:"FriendWolf",Owner:"PotatoMaster101"}
然后其他的指令包括开启随机器,杀掉水下护卫,重置积分版什么本人这里就不一一列出了,相信大家都会。
但是这个机器不支持一个地图内有2个伙伴,可能会有冲突。所以有一个系统就是限制只能刷出一个:
- /testfor @e[type=ArmorStand,name=Friend]
地图其他部位就没什么好说的了,都是比较基础。
http://v.youku.com/v_show/id_XNzkxOTk1Nzky.html
百度云下载地址 (进入存档后,在指令方块上有海绵的指令方块里改动自己的名字。那些都是刷出狗的指令方块,大家把Owner:"PotatoMaster101"的名字改成自己的名字就可以了。进入存档后按绿色按钮拿到所有的刷怪蛋和宝石块。红色按钮是重置机器。之后玩家自行开启脉冲,2个开关)
============END=============
[groupid=546]Command Block Logic[/groupid]