Skip to content

Commit

Permalink
Fix #6
Browse files Browse the repository at this point in the history
  • Loading branch information
hampfh committed Aug 1, 2020
1 parent 95d75e9 commit 1daaf33
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 23 deletions.
16 changes: 10 additions & 6 deletions data/biometunes/functions/core.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ stopsound @a music minecraft:music.game
stopsound @a music minecraft:music.nether
stopsound @a music minecraft:music.under_water

# Restart music for reconnected clients
execute as @a[scores={hasLeft=1..}] run scoreboard players set @s musicTimer 0
execute as @a[scores={hasLeft=1..}] run scoreboard players set @s ambientTimer 0
execute as @a[scores={hasLeft=1..}] run scoreboard players set @s ticksSinceLogin 0
execute as @a[scores={hasLeft=1..}] run scoreboard players set @s bossfight 0
execute as @a[scores={hasLeft=1..}] run scoreboard players set @s hasLeft 0

# Check for bosses for players that have enabled it
execute as @a[tag=!noBossBattleMusic] run function biometunes:triggers/updatebosses

Expand Down Expand Up @@ -42,17 +49,14 @@ execute at @a as @a[scores={ambientTimer=10.., biomeAmbient=16},tag=!playingAmbi
execute as @a[tag=!playing] run tag @s add playing
execute as @a[tag=!playingAmbient] run tag @s add playingAmbient

# Restart music for reconnected clients
execute as @a[scores={hasLeft=1..}] run scoreboard players set @s musicTimer 0
execute as @a[scores={hasLeft=1..}] run scoreboard players set @s ambientTimer 0

execute as @a[scores={hasLeft=1..}] run scoreboard players set @s hasLeft 0

# Decrease soundtrack timer
execute as @a[tag=playing, scores={musicTimer=1..}] run scoreboard players remove @s musicTimer 1
# Decrease ambient timer
execute as @a[tag=playingAmbient, scores={ambientTimer=1..}] run scoreboard players remove @s ambientTimer 1

# Increase login timer
execute as @a run scoreboard players add @s ticksSinceLogin 1

# Resetting music
execute as @a[tag=playing, scores={musicTimer=0}] run stopsound @s music
execute as @a[tag=playing, scores={musicTimer=0}] run tag @s remove playing
Expand Down
4 changes: 2 additions & 2 deletions data/biometunes/functions/options.mcfunction

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tag @s remove playing
# Enable intro track
execute unless score @s biome matches 9 run tellraw @s[tag=receiveBiomeMsg, scores={soundtrackState=1}] ["",{"text":"You entered the end","color":"gray","italic":true}]

# Set biome variable to plains
# Set biome variable to the end
scoreboard players set @s biome 9
scoreboard players set @s biomeAmbient 9

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

tag @s remove playing

# Always hard reset transition
execute as @s run stopsound @s music

# Executes ones (when player engages in battle)
execute as @s unless score @s bossfight matches 1.. run scoreboard players set @s musicTimer 0
execute as @s[tag=receiveBossMsg] unless score @s bossfight matches 1 run tellraw @s ["",{"text":"You entered a boss battle with an ender dragon","color":"gray","italic":true}]

scoreboard players set @s bossfight 1
Expand Down
3 changes: 2 additions & 1 deletion data/biometunes/functions/triggers/bosses/wither.mcfunction
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

tag @s remove playing

# Always hard reset transition
execute as @s run stopsound @s music

# Executes ones (when player engages in battle)
execute as @s unless score @s bossfight matches 1.. run scoreboard players set @s musicTimer 0
execute as @s[tag=receiveBossMsg] unless score @s bossfight matches 2 run tellraw @s ["",{"text":"You entered a boss battle with a wither","color":"gray","italic":true}]

scoreboard players set @s bossfight 2
Expand Down
12 changes: 7 additions & 5 deletions data/biometunes/functions/triggers/init.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
scoreboard objectives add hasLeft minecraft.custom:minecraft.leave_game
scoreboard objectives add bt_pack_vars dummy "Biometunes datapack variables"
scoreboard objectives add posY dummy "Y Position of each player"
scoreboard objectives add ticksSinceLogin dummy "Ticks since player login"

# Set version number
scoreboard players set #bt_version_main bt_pack_vars 0
scoreboard players set #bt_version_second bt_pack_vars 2
scoreboard players set #bt_version_major bt_pack_vars 0
scoreboard players set #bt_version_minor bt_pack_vars 2
scoreboard players set #bt_version_patch bt_pack_vars 1

# Sound track variables
scoreboard objectives add biome dummy "Current biome"
Expand Down Expand Up @@ -37,11 +39,11 @@ scoreboard players reset * hasLeft
# Reset all advancements and music
function biometunes:triggers/reset

scoreboard players add #bt_instantiated bt_pack_vars 1
scoreboard players set #bt_instantiated bt_pack_vars 1

tellraw @a ["",{"text":"### Biometunes","color":"dark_green"},{"text":" ### \n","color":"dark_green"},{"text":"Developed by: ","color":"dark_green","bold":true},{"text":"Hampfh ","color":"gold","bold":false},{"text":"[twitter]","color":"dark_green","clickEvent":{"action":"open_url","value":"https://twitter.com/hampfh"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Visit site","color":"green"}]}}},{"text":"\nMusic by:\n","color":"dark_green","bold":true},{"text":"Reklawer ","color":"gold","bold":false},{"text":"[instagram]\n","color":"dark_green","clickEvent":{"action":"open_url","value":"https://www.instagram.com/abefrato/"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Visit site","color":"green"}]}}},{"text":"mar01 ","color":"gold"},{"text":"[site]","color":"dark_green","bold":true,"clickEvent":{"action":"open_url","value":"https://www.martinryberglaude.com/"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Open site","color":"green"}]}}},{"text":"\nDatapack successfully installed!\n","color":"green","italic":true,"bold":false},{"text":"Current version: #","color":"green","italic":false},{"score":{"name":"#bt_version_main","objective":"bt_pack_vars"},"color":"green","bold":true},{"text":".","color":"green","bold":true},{"score":{"name":"#bt_version_second","objective":"bt_pack_vars"},"color":"green","bold":true},{"text":"\nTo open the control panel type ","color":"green","bold":false},{"text":"/trigger biomeTunes","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/trigger biomeTunes"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Open control panel","color":"green"}]}}}]
tellraw @a ["",{"text":"Biometunes","bold":true,"color":"dark_green"},{"text":"\n"},{"text":"Visit our github page: ","bold":true,"color":"dark_green"},{"text":"https://github.com/biometunes/data-pack","italic":true,"underlined":true,"color":"gold","clickEvent":{"action":"open_url","value":"https://github.com/biometunes/data-pack"},"hoverEvent":{"action":"show_text","value":["",{"text":"Go to site","color":"green"}]}},{"text":"\n"},{"text":"Datapack successfully installed!","color":"green"},{"text":"\n"},{"text":"Current version: ","color":"green"},{"text":"v.","bold":true,"color":"green"},{"score":{"name":"#bt_version_major","objective":"bt_pack_vars"},"bold":true,"color":"green"},{"text":".","bold":true,"color":"green"},{"score":{"name":"#bt_version_minor","objective":"bt_pack_vars"},"bold":true,"color":"green"},{"text":".","bold":true,"color":"green"},{"score":{"name":"#bt_version_patch","objective":"bt_pack_vars"},"bold":true,"color":"green"},{"text":"\n"},{"text":"To open your own control panel type ","color":"green"},{"text":"/trigger biomeTunes","bold":true,"color":"green","clickEvent":{"action":"run_command","value":"/trigger biomeTunes"},"hoverEvent":{"action":"show_text","value":["",{"text":"Open control panel","color":"green"}]}},{"text":"\n"},{"text":"Note: If your music setting was set to 0% then a relog is required in order to start the music","color":"light_purple"}]

# {"command":"/tellraw @p %s","jobject":[{"text":"### Biometunes","color":"dark_green"},{"text":" ### \\n","color":"dark_green"},{"text":"Developed by: ","color":"dark_green","bold":true},{"text":"Hampfh ","color":"gold"},{"text":"[twitter]","color":"dark_green","clickEvent":{"action":"open_url","value":"https://twitter.com/hampfh"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Visit site","color":"green"}]}}},{"text":"\\nMusic by:\\n","color":"dark_green","bold":true},{"text":"Reklawer ","color":"gold"},{"text":"[instagram]\\n","color":"dark_green","clickEvent":{"action":"open_url","value":"https://www.instagram.com/abefrato/"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Visit site","color":"green"}]}}},{"text":"mar01 ","color":"gold"},{"text":"[site]","color":"dark_green","bold":true,"clickEvent":{"action":"open_url","value":"https://www.martinryberglaude.com/"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Open site","color":"green"}]}}},{"text":"\\nDatapack successfully installed!\\n","color":"green","italic":true},{"text":"Current version: #","color":"green"},{"score":{"name":"#bt_version_main","objective":"bt_pack_vars"},"color":"green","bold":true},{"text":".","color":"green","bold":true},{"score":{"name":"#bt_version_second","objective":"bt_pack_vars"},"color":"green","bold":true},{"text":"\\nTo open the control panel type ","color":"green"},{"text":"/trigger biomeTunes","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/trigger biomeTunes"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Open control panel","color":"green"}]}}}],"jtemplate":"tellraw"}
# {"jformat":6,"jobject":[{"bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"a46acf17-3fc7-4e68-9725-9ac2eb780555","text":"Biometunes"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"dc6e0928-35e0-4458-93b6-aa7f714d0128","text":"\n"},{"bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"dark_green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"c3c0e818-7323-4fce-88af-bdbd17350a65","text":"Visit our github page: "},{"bold":false,"italic":true,"underlined":true,"strikethrough":false,"obfuscated":false,"font":null,"color":"gold","insertion":"","click_event_type":"1","click_event_value":"https://github.com/biometunes/data-pack","hover_event_type":"1","hover_event_value":"","hover_event_object":{},"hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"8bc3db1c-a5f7-46b3-b7ae-3e53b9f7b72a","text":"Go to site"}],"id":"cbe3b491-aa26-4e2a-814a-77296f46ba2c","text":"https://github.com/biometunes/data-pack"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"0dbb8624-2e0f-4ec1-861e-72b4a6cd09a7","text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"c49bf55f-b5b4-40be-938f-19ae049e143a","text":"Datapack successfully installed!"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"d151db32-78fc-4d79-a14e-f586154f541b","text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"614692e4-754d-4122-a1ce-6855ed087e76","text":"Current version: "},{"bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"064e63fe-5863-4d23-bab2-61d81a6627e4","text":"v."},{"bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"8272934e-a818-42ee-b458-4eef72fcc8d4","score_name":"#bt_version_major","score_objective":"bt_pack_vars","score_value":null},{"bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"5efa7a51-e4d3-4040-b742-60051afa6eff","text":"."},{"bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"d6f37fe4-2f5e-40a3-8b3c-6a1c3376a8cf","score_name":"#bt_version_minor","score_objective":"bt_pack_vars","score_value":null},{"bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"468a421b-6b92-4342-b32b-4499bc1a1775","text":"."},{"bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"4b8a8ef3-908c-4c37-b2be-f8721551b5d1","score_name":"#bt_version_patch","score_objective":"bt_pack_vars","score_value":null},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"1c5677d5-faba-48f6-b481-24d6e8cbf6ce","text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"208288da-009e-487c-99f6-7a4e8a263e6a","text":"To open your own control panel type "},{"bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":"2","click_event_value":"/trigger biomeTunes","hover_event_type":"1","hover_event_value":"","hover_event_object":{},"hover_event_children":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"green","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"76e18e50-f7af-4128-af60-5f7db6737ff6","text":"Open control panel"}],"id":"cb468282-7ae1-4e46-aad5-739977c77f79","text":"/trigger biomeTunes"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"16dfcbb6-c2ec-4e30-be26-420cd68e732d","text":"\n"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"light_purple","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"e12dd4f5-7aea-4fca-afbb-ba5835e67ccb","text":"Note: If your music setting was set to 0% then a relog is required in order to start the music"}],"command":"/tellraw @s %s","jtemplate":"tellraw"}

# Boss fights
# 0 No boss
Expand Down
Loading

0 comments on commit 1daaf33

Please sign in to comment.