tag @e[name=KyuPatch,type=armor_stand] add PatchOnePointFivePointThree
tellraw @a ["",{"text":"Patch 1.5.3 has been installed!","color":"gold"},{"text":"","color":"red"}]
execute as @e[tag=CurrentPatch] run data merge entity @s[tag=CurrentPatch] {CustomName:"\"Patch 1.5.3\"",Tags:["CurrentPatch"],NoGravity:1,Invisible:1b,Silent:1b,Invulnerable:1}



#execute as @e[type=armor_stand,name=DayQ] run function zzzzdonotuse:difficulty/normaldifficulty

setblock 999996 124 999977 chest{Items:[{Slot:0b,id:"minecraft:written_book",Count:1b,tag:{display:{Name:'{"text":"SUHC Info Book"}'},kyuonetickmainhand:1b,kyuprogbook:1b,title:"",author:"",pages:['','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','']}}]} replace

setblock 999976 124 999971 repeating_command_block[facing=up]{auto:0b,Command:"execute as @a[scores={ProgBookText=1..}] run function zzzzdonotuse:misc/progressionbook/progressionbooktext",TrackOutput:0} destroy

setblock 999978 127 999975 repeating_command_block[facing=up]{auto:0b,Command:"execute if entity @e[type=fireball] run data merge block ~ ~1 ~ {auto:1b}",TrackOutput:0} destroy
setblock 999978 128 999975 repeating_command_block[facing=up]{auto:0b,Command:"function zzzzdonotuse:fix/ghastfireball",TrackOutput:0} destroy


#main timer off
data merge block 999976 124 999978 {auto:0b}

#start text
fill 999977 127 999985 999977 157 999985 air
setblock 999976 125 999971 repeating_command_block[facing=up]{auto:0b,Command:"function zzzzdonotuse:misc/starttext",TrackOutput:0} destroy



#it is day X text
#setblock 999976 125 999979 chain_command_block[facing=up]{auto:1b,Command:"execute if entity @e[type=armor_stand,name=DayQ,scores={DayQ2=2..}] run tellraw @a[team=P] [\"\",{\"text\":\"You are on Day \",\"color\":\"green\"},{\"score\":{\"name\":\"@e[name=DayQ]\",\"objective\":\"DayQ2\"},\"color\":\"green\"},{\"text\":\".\",\"color\":\"green\"}]",TrackOutput:0} destroy


#new player adding put into functions
data modify block 999983 137 999985 Command set value "function zzzzdonotuse:misc/addplayers"
fill 999983 138 999985 999983 153 999985 air


#title timer put into functions
data modify block 999975 190 999985 Command set value "function zzzzdonotuse:misc/titletimer"
fill 999975 191 999985 999975 200 999985 air


#mushy house
setblock 999998 120 999971 repeating_command_block[facing=up]{auto:0b,Command:"scoreboard players add @e[tag=KyuPortMush,scores={MushyTimer=..101}] MushyTimer 1",TrackOutput:0} destroy
setblock 999998 121 999971 chain_command_block[facing=up]{auto:1b,Command:"execute if entity @e[tag=KyuPortMush,scores={MushyTimer=100}] run data merge block ~ ~2 ~ {auto:1b}",TrackOutput:0} destroy
setblock 999998 122 999971 chain_command_block[facing=up,conditional=true]{auto:1b,Command:"data merge block ~ ~-2 ~ {auto:0b}",TrackOutput:0} destroy 
setblock 999998 123 999971 command_block[facing=up]{auto:0b,Command:"function zzzzdonotuse:trinketeffect/mushy/mushycreate",TrackOutput:0} destroy



#blood imbue and blind rage page tweaks
execute positioned 999995.36 122.31 999974.75 run execute as @e[name=BookCopy,limit=1,sort=nearest] run data modify entity @s HandItems[0].tag.pages[42] set value "[{\"text\":\"A\",\"color\":\"dark_red\",\"strikethrough\":false,\"obfuscated\":true},{\"text\":\"Blood Imbue\",\"bold\":true,\"strikethrough\":false,\"obfuscated\":false},{\"text\":\"A\",\"color\":\"dark_red\",\"strikethrough\":false,\"obfuscated\":true},{\"text\":\"\\n-------------------\\n\",\"color\":\"black\",\"bold\":false,\"strikethrough\":false,\"obfuscated\":false},{\"text\":\"If the item in your offhand is a sword or axe - Imbue it with blood, making it lower health but increase damage when equipped. Can be stacked up to 9 times per item.\",\"color\":\"dark_red\",\"obfuscated\":false,\"bold\":false,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/trigger KyuSpells set 19\"}},{\"text\":\"\\n\\nCost to cast: 8 hearts of health\",\"color\":\"red\",\"obfuscated\":false,\"bold\":false,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/trigger KyuSpells set 19\"}},{\"text\":\"\",\"color\":\"black\"}]"
execute positioned 999995.36 122.31 999974.75 run execute as @e[name=BookCopy,limit=1,sort=nearest] run data modify entity @s HandItems[0].tag.pages[43] set value "[{\"text\":\"A\",\"color\":\"dark_red\",\"strikethrough\":false,\"obfuscated\":true},{\"text\":\"Blind Rage\",\"bold\":true,\"strikethrough\":false,\"obfuscated\":false},{\"text\":\"A\",\"color\":\"dark_red\",\"strikethrough\":false,\"obfuscated\":true},{\"text\":\"\\n-------------------\\n\",\"color\":\"black\",\"bold\":false,\"strikethrough\":false,\"obfuscated\":false},{\"text\":\"'Enter the void, and forget all but rage.'\\n\\n\",\"color\":\"dark_purple\",\"obfuscated\":false,\"bold\":false,\"italic\":true,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/trigger KyuSpells set 20\"}},{\"text\":\"Blinds you with rage, increasing damage and speed while lowering your vision. Nearby enemies will glow during this effect.\",\"color\":\"dark_red\",\"obfuscated\":false,\"bold\":false,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/trigger KyuSpells set 20\"}},{\"text\":\"\\n\\nCost to cast: 2 hearts of health\",\"color\":\"red\",\"obfuscated\":false,\"bold\":false,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/trigger KyuSpells set 20\"}},{\"text\":\"\",\"color\":\"black\"}]"

scoreboard objectives add KyuDummy6 dummy
scoreboard objectives add KyuDummy7 dummy
scoreboard objectives add KyuDummy8 dummy
scoreboard objectives add KyuDummy9 dummy
scoreboard objectives add KyuDummy10 dummy
scoreboard objectives add KyuRotDummy1 dummy
scoreboard objectives add KyuRotDummy2 dummy
scoreboard objectives add KyuRotDummy3 dummy
scoreboard objectives add KyuRotDummy4 dummy
scoreboard objectives add KyuPosDummy1 dummy
scoreboard objectives add KyuSoulLantern dummy
scoreboard objectives add ProgBookText dummy
scoreboard objectives add ProgBookDay dummy
scoreboard objectives add SlowfallUpgradeCharges dummy
scoreboard objectives add KyuMushyHouseCheck dummy
scoreboard objectives add StripMineDieTimer dummy

#scoreboard objectives add KyuSelfDestruct dummy


#command_block[facing=up]{auto:0b,Command:"aaa",TrackOutput:0} destroy
