我的世界可點擊的浮空字怎么做?可點擊的浮空字在游戲中可以說是非常好玩的一件事,玩家可以通過右鍵或左鍵來對浮空字進行點擊,接下來西西就給大家?guī)淼氖强牲c擊的浮空字制作方法詳解!
我的世界可點擊的浮空字制作方法介紹
在服務器里也不需要玩家具有權(quán)限,是不是要右鍵比告示牌炫酷多了呢?代碼適用版本為1.11.2 (點擊圖片查看動圖)
圖片就介紹到這里,下面是思路以及代碼部分~
整體思路:
初步思路是利用玩家右鍵村民這個準則實現(xiàn)檢測右鍵點擊,用實體受到傷害和玩家是否造成傷害來檢測玩家是否左鍵點擊。
在村民的nbt上,普通村民右鍵是會出現(xiàn)交易框的,這里為其加上Offers:{Recipes:[]}這個nbt即可消除顯示。(村民無任何交易選項,無法交易,故不顯示)。對于受傷害實體的nbt,你需要使它不會輕易被玩家攻擊致死。這里我使用生命提升和生命恢復,因為如果用抗性提升后無法檢測到實體被攻擊。
代碼:
創(chuàng)建變量:
/scoreboard objectives add villager stat.talkedToVillager 右鍵村民 /scoreboard objectives add ifhit stat.damageDealt 造成傷害 /scoreboard objectives add hit dummy 受到傷害
右鍵浮空字:
召喚實體:
/summon armor_stand ~ ~ ~ {CustomName:"領取甘蔗(右鍵)",CustomNameVisible:1b,NoBasePlate:1,NoGravity:1,Invisible:1}
/summon villager ~ ~ ~ {NoAI:1b,Silent:1b,Offers:{Recipes:[]},ActiveEffects:
[{Id:14,Duration:9999999,Amplifier:0,Ambient:1,ShowParticles:0b}],Tags:["lqgz"]}
右鍵觸發(fā):[高頻循環(huán)]
/execute @e[type=villager,tag=lqgz] ~ ~ ~ give @a[score_villager_min=1,r=6] reeds 1 0 {display:{Name:www.Ganxiaozhe.com}}
/scoreboard players set @a[score_villager_min=1] villager 0
左鍵浮空字:
召喚實體:
/summon armor_stand ~ ~ ~ {CustomName:"回復血量(左鍵)",CustomNameVisible:1b,NoBasePlate:1,NoGravity:1,Invisible:1}
/summon Sheep ~ ~0.5 ~ {CustomName:"hit",NoAI:1,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:500000,ShowParticles:0b},{Id:21,Amplifier:100,Duration:500000,ShowParticles:0b},{Id:10,Amplifier:100,Duration:500000,ShowParticles:0b}]}
左鍵觸發(fā):[高頻循環(huán)]
/scoreboard players add @e[type=Sheep,name=hit] hit 1 {HurtTime:10s}
/execute @e[type=Sheep,name=hit,score_hit_min=1] ~ ~ ~ effect @a[score_ifhit_min=1,r=6] 10 1 10 true
/execute @e[type=Sheep,name=hit,score_hit_min=1] ~ ~ ~ tellraw @a[score_ifhit_min=1,r=6] [{"text":"你的血量已回復","color":"red","bold":"true"}]
/scoreboard players set @e[type=Sheep,name=hit,score_hit_min=1] hit 0
/scoreboard players set @a[score_ifhit_min=1] ifhit 0
保證實體正常運行:
使村民保持隱形:[高頻循環(huán)]
/effect @e[type=villager,tag=lqgz] invisibility 100000 0 true
使羊保持隱形、抗性并回復血量:[高頻循環(huán)]
/effect @e[type=Sheep,name=hit] invisibility 100000 0 true
/effect @e[type=Sheep,name=hit] health_boost 100000 100 true
/effect @e[type=Sheep,name=hit] regeneration 100000 100 true