Skip to content

Commit

Permalink
Card Display: Only send every second to make actionbar messages visible
Browse files Browse the repository at this point in the history
With this, the card display is only send every second, so that vanilla
actionbar messages are at least somewhat visible.
  • Loading branch information
NeunEinser committed Apr 6, 2021
1 parent f0a532f commit a2e9260
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/bingo/functions/card_display/display_card.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Displays the bingo card for @s
#
# @internal
# @within bingo:card_display/display_card_schedule
# @context entity Player for displaying the card
# @reads score @s bingo.card_pos

Expand Down
16 changes: 16 additions & 0 deletions data/bingo/functions/card_display/display_card_schedule.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#> bingo:card_display/display_card_schedule
#
# Schedule responsible for showing the card display, to not run it every tick.
#
# @internal

#>
# @private
#declare score_holder $display_card

scoreboard players set $display_card bingo.debug_scdl 0

execute as @a run function bingo:card_display/display_card
schedule function bingo:card_display/display_card_schedule 1s

scoreboard players set $display_card bingo.debug_scdl 1
1 change: 1 addition & 0 deletions data/bingo/functions/init/init.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ gamerule doTraderSpawning false
gamerule disableElytraMovementCheck true
gamerule doPatrolSpawning false
difficulty easy
function bingo:card_display/display_card_schedule
schedule function bingo:tick/clean_up 300s

# setup default player configurations
Expand Down
5 changes: 4 additions & 1 deletion data/bingo/functions/item_detection/announce.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ execute store result score $item_detect/announce.has_bingo bingo.tmp run data ge

# detect goals
execute if score $item_detect/announce.has_bingo bingo.tmp matches 0 run function bingo:item_detection/goals/bingo/detect_bingo_and_20_no_bingo
execute if score $item_detect/announce.items bingo.tmp matches 25 run function bingo:item_detection/goals/announce_blackout
execute if score $item_detect/announce.items bingo.tmp matches 25 run function bingo:item_detection/goals/announce_blackout

# Update card immediately
function bingo:card_display/display_card_schedule
2 changes: 0 additions & 2 deletions data/bingo/functions/tick/tick.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
# @within tag/function minecraft:tick
# @handles #minecraft:tick

execute as @a run function bingo:card_display/display_card

# Assign each player a unique ID
execute as @a unless score @s bingo.id matches -2147483648.. run function bingo:tick/new_player

Expand Down

0 comments on commit a2e9260

Please sign in to comment.