大家好。今天无聊是本人做了一个冰冻之箭小作品。这个作品十分简单,弓箭射生物后会冰冻起来。
截图:
------------原理/运行------------
这个机器十分的简单。主要还是有积分版来完成。首先需要创建积分版:
- /scoreboard objectives add UseBow stat.useItem.minecraft.bow
- /scoreboard objectives add IsFrozArrow dummy
- /scoreboard objectives add SelecBow dummy
- /scoreboard objectives add ArrowInG dummy
- /scoreboard objectives add RightMob dummy
之后还要一个指令方块拿到弓箭。指令:
- /give @p minecraft:bow 1 0
- {display:{Name:"Frozen",Lore:["PotatoMaster101's Secret Weapon"]},ench:[{id:51,lvl:999}],Unbreakable:1b,HideFlags:63}
之后就是运行原理了。(以下机械都是有高速脉冲激活的)
第一步:探测玩家手上是否拿着正确的弓(Frozen)。如果拿着,那么把该玩家的SelecBow积分版设为1。指令:
- /scoreboard players set @a SelecBow 0
- /scoreboard players set @a SelecBow 1
- {Inventory:[{id:"minecraft:bow",Damage:0s,tag:{display:{Name:"Frozen"}},Slot:0b}],SelectedItemSlot:0}
- /scoreboard players set @a SelecBow 1
- {Inventory:[{id:"minecraft:bow",Damage:0s,tag:{display:{Name:"Frozen"}},Slot:4b}],SelectedItemSlot:4}
- /scoreboard players set @a SelecBow 1
- {Inventory:[{id:"minecraft:bow",Damage:0s,tag:{display:{Name:"Frozen"}},Slot:7b}],SelectedItemSlot:7}
- /scoreboard players set @a SelecBow 1
- {Inventory:[{id:"minecraft:bow",Damage:0s,tag:{display:{Name:"Frozen"}},Slot:2b}],SelectedItemSlot:2}
- /scoreboard players set @a SelecBow 1
- {Inventory:[{id:"minecraft:bow",Damage:0s,tag:{display:{Name:"Frozen"}},Slot:3b}],SelectedItemSlot:3}
- /scoreboard players set @a SelecBow 1
- {Inventory:[{id:"minecraft:bow",Damage:0s,tag:{display:{Name:"Frozen"}},Slot:8b}],SelectedItemSlot:8}
- /scoreboard players set @a SelecBow 1
- {Inventory:[{id:"minecraft:bow",Damage:0s,tag:{display:{Name:"Frozen"}},Slot:1b}],SelectedItemSlot:1}
- /scoreboard players set @a SelecBow 1
- {Inventory:[{id:"minecraft:bow",Damage:0s,tag:{display:{Name:"Frozen"}},Slot:5b}],SelectedItemSlot:5}
- /scoreboard players set @a SelecBow 1
- {Inventory:[{id:"minecraft:bow",Damage:0s,tag:{display:{Name:"Frozen"}},Slot:6b}],SelectedItemSlot:6}
所以,如果玩家没拿,那他的积分始终是0,如果拿了,那就是1。
第二步:探测弓箭是在天上还是在地上。指令:
- /scoreboard players set @e[type=Arrow] ArrowInG 0
- {inGround:0b}
- /scoreboard players set @e[type=Arrow] ArrowInG 1
- {inGround:1b}
第三步:主要的机械运行。这一步主要就是探测正确的弓箭,和弓箭对生物的影响。指令:
- /execute @a[score_SelecBow_min=1,score_UseBow_min=1] ~ ~ ~
- /execute @e[type=Arrow,r=3,score_ArrowInG=0] ~ ~ ~
- /scoreboard players set @e[type=Arrow,r=0] IsFrozArrow 1
之后就是探测正确的生物:
- /execute @e[type=Arrow,score_ArrowInG_min=1,score_IsFrozArrow_min=1] ~ ~ ~
- /execute @e[type=!Arrow,r=2] ~ ~ ~
- /scoreboard players set @e[r=0] RightMob 1
最后就是对RightMob积分为1的生物输出:
- /execute @e[score_RightMob_min=1,type=!Player] ~ ~ ~
- /setblock ~ ~ ~ minecraft:ice
- /entitydata @e[score_RightMob_min=1]
- {NoAI:1b}
第四步:清空机器,指令:
- /kill @e[type=Arrow,score_ArrowInG_min=1,score_IsFrozArrow_min=1]
- /scoreboard players reset * RightMob
这就是整个机器,箭打到生物旁边后那个生物会冰起来。对玩家无效。之后,刚才说过,如果箭打到生物上,那就会没用,因为指令方块只能探测落得的箭,而无法探测打在生物上面的箭。但是有一个解决方法,就是使用/execute detect功能探测马上要落地的箭,然后冰冻下面的生物,但是本机器不会加入此装置。
(视频敬请期待)
(所有图片图床上传)
---百度云盘存档下载---(进去后先按绿色按钮开始机器。红色关闭机器,黄色杀掉生物)
(这个作品本人没加入清空UseBow,可能联机模式会出现BUG。玩家可以自行加入一个速度慢点的脉冲,清空UseBow积分版)
======END======