瀏覽代碼

测试bossbar

HerobrineXia 6 年之前
父節點
當前提交
d0c7b776ed

+ 21 - 0
data/lib/functions/bossbar/init.mcfunction

@@ -0,0 +1,21 @@
+# 初始化bossbar
+# 玩家的bossbar_color: 1红 2黄 3绿 4蓝
+# mem的$bossbar_type: 0关闭 1countdown_fast 2count_down
+bossbar remove mini:red
+bossbar remove mini:yellow
+bossbar remove mini:blue
+bossbar remove mini:green
+
+bossbar add mini:red "红"
+bossbar add mini:yellow "黄"
+bossbar add mini:blue "绿"
+bossbar add mini:green "蓝"
+
+bossbar set mini:red color red
+bossbar set mini:yellow color yellow
+bossbar set mini:blue color blue
+bossbar set mini:green color green
+
+# 重置计分板
+scoreboard objectives remove bossbar_color
+scoreboard objectives add bossbar_color dummy "bossbar颜色"

+ 0 - 0
data/lib/functions/bossbar/init_bossbar.mcfunction


+ 4 - 0
data/lib/functions/bossbar/show_none.mcfunction

@@ -0,0 +1,4 @@
+bossbar set mini:red players
+bossbar set mini:yellow players
+bossbar set mini:green players
+bossbar set mini:blue players

+ 0 - 0
data/lib/functions/bossbar/show_yellow.mcfunction


+ 6 - 0
data/lib/functions/bossbar/tick2.mcfunction

@@ -0,0 +1,6 @@
+# 显示bossbar
+execute if score $bossbar_type mem matches 0 as @a run function lib:bossbar/show_none
+bossbar set mini:red players @a[scores={bossbar_color=1}]
+bossbar set mini:yellow players @a[scores={bossbar_color=2}]
+bossbar set mini:green players @a[scores={bossbar_color=3}]
+bossbar set mini:blue players @a[scores={bossbar_color=4}]

+ 1 - 0
data/ltw/functions/clock/tick2.mcfunction

@@ -14,6 +14,7 @@ execute if score $tempo_enable mem matches 1 run function lib:tempo_block/tick2
 
 
 # 调用物品模块(必须最后调用
 # 调用物品模块(必须最后调用
 function item:tick2
 function item:tick2
+function lib:bossbar/tick2
 
 
 # 全局倒计时
 # 全局倒计时
 execute if score $countdown_fast mem matches 1.. run scoreboard players remove $countdown_fast mem 1
 execute if score $countdown_fast mem matches 1.. run scoreboard players remove $countdown_fast mem 1

+ 1 - 0
data/ltw/functions/init.mcfunction

@@ -107,6 +107,7 @@ schedule function ltw:clock/tick20 20t replace
 # 其他模块
 # 其他模块
 function mini:main/init
 function mini:main/init
 function item:init
 function item:init
+function lib:bossbar/init
 
 
 # 状态
 # 状态
 function ltw:state/0/state_enter
 function ltw:state/0/state_enter