execute as @s run execute store result score @s KyuDummy3 run data get entity @s Item.Count
tag @s[scores={KyuDummy3=1}] add SingleItem



execute at @s[tag=ItemSaveEgg] run execute at @e[type=marker,tag=ECChestMarker,limit=1,sort=nearest] run summon chicken ~ ~1 ~


execute at @s[tag=ItemSaveGA] positioned ~ 10 ~ run tag @e[tag=GA2,tag=ECChestMarker,limit=1,distance=..10] add GA3
execute at @s[tag=ItemSaveGA] positioned ~ 10 ~ run tag @e[tag=GA1,tag=ECChestMarker,limit=1,distance=..10] add GA2
execute at @s[tag=ItemSaveGA] positioned ~ 10 ~ run tag @e[tag=!GA1,tag=ECChestMarker,limit=1,distance=..10] add GA1
execute at @s[tag=ItemSaveGA] positioned ~ 10 ~ run execute at @e[tag=ECChestMarker,limit=1,distance=..30,tag=!GA2] run tellraw @a[distance=..200] ["",{"text":"The cavern chest has gained part of the ","color":"gold"},{"text":"effect","color":"gold","underlined":true,"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Consumed item: Golden Apple.\nEffect: Has a chance to heal players near it at the start of every day.","color":"green"}]}}},{"text":" of an item it has consumed!","color":"gold","underlined":false}]
execute at @e[type=marker,tag=ECChestMarker,tag=!GA3] positioned ~ 0 ~ run execute at @s[tag=ItemSaveGA] positioned ~ 10 ~ run execute at @e[tag=ECChestMarker,limit=1,distance=..30,tag=GA2] run tellraw @a[distance=..200] ["",{"text":"The cavern chest has gained part of the ","color":"gold"},{"text":"effect","color":"gold","underlined":true,"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Consumed item: Golden Apple.\nEffect #2: Has a higher chance to heal players near it at the start of every day.","color":"green"}]}}},{"text":" of an item it has consumed!","color":"gold","underlined":false}]
execute at @e[type=marker,tag=ECChestMarker,tag=GA3] positioned ~ 0 ~ run execute at @s[tag=ItemSaveGA] positioned ~ 10 ~ run execute at @e[tag=ECChestMarker,limit=1,distance=..30,tag=GA3] run tellraw @a[distance=..200] ["",{"text":"The cavern chest has gained part of the ","color":"gold"},{"text":"effect","color":"gold","underlined":true,"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Consumed item: Golden Apple.\nEffect #3: Will always heal players near it at the start of every day.","color":"green"}]}}},{"text":" of an item it has consumed!","color":"gold","underlined":false}]
execute at @e[type=marker,tag=ECChestMarker,tag=GA3] run effect give @a[distance=..100] regeneration 5 0
execute if predicate suhc:50percent run execute at @e[tag=ECChestMarker,tag=GA2] run effect give @a[distance=..100] regeneration 5 0
execute if predicate suhc:25percent run execute at @e[tag=ECChestMarker,tag=GA1] run effect give @a[distance=..100] regeneration 5 0


execute at @s[tag=ItemSaveEGA] positioned ~ 10 ~ run tag @e[tag=ECChestMarker,limit=1,distance=..30] add EGA1
execute at @s[tag=ItemSaveEGA] positioned ~ 10 ~ run execute at @e[tag=ECChestMarker,limit=1,distance=..30,tag=EGA1] run tellraw @a[distance=..200] ["",{"text":"The cavern chest has gained an ","color":"gold"},{"text":"effect","color":"gold","underlined":true,"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Consumed item: Notch Apple.\nEffect: None currently. Sucks, eh?","color":"green"}]}}},{"text":"!","color":"gold","underlined":false}]



execute at @s[tag=ItemSaveEmBlock] positioned ~ 12 ~ run execute at @e[tag=ECChestMarker,distance=..40] run tag @a[distance=..100] add KyuEmeraldLuck
execute at @s[tag=ItemSaveEmBlock,tag=SingleItem] positioned ~ 12 ~ run execute at @e[tag=ECChestMarker,distance=..50,limit=1] run tellraw @a[distance=..100] ["",{"text":"The chest demolishes the emerald block, scattering the effects of luck around the area!","color":"dark_green"}]
execute at @s[tag=ItemSaveEmBlock,tag=!SingleItem] positioned ~ 12 ~ run execute at @e[tag=ECChestMarker,distance=..50,limit=1] run tellraw @a[distance=..100] ["",{"text":"The chest demolishes one of the emerald blocks, scattering the effects of luck around the area!","color":"dark_green"}]
scoreboard players add @a[tag=KyuEmeraldLuck] KyuLuck 1
scoreboard players add @a[tag=KyuEmeraldLuck] KyuLuck20min 20
tag @a remove KyuEmeraldLuck


execute at @s[tag=ItemSaveGT] run execute at @e[tag=ECChestMarker,distance=..40] run effect give @a[distance=..100] instant_health 1 1
execute if predicate suhc:50percent run execute at @s[tag=ItemSaveGT] positioned ~ 12 ~ run execute at @e[tag=ECChestMarker,distance=..40] run effect give @a[distance=..100] regeneration 10 0
execute if predicate suhc:25percent run execute at @s[tag=ItemSaveGT] positioned ~ 12 ~ run execute at @e[tag=ECChestMarker,distance=..40] run effect give @a[distance=..100] regeneration 20 0
execute at @s[tag=ItemSaveGT,tag=SingleItem] positioned ~ 12 ~ run execute at @e[tag=ECChestMarker,distance=..50,limit=1] run tellraw @a[distance=..100] ["",{"text":"The chest crushes the ghast tear, spreading some of its effects in the process!","color":"light_purple"}]
execute at @s[tag=ItemSaveGT,tag=!SingleItem] positioned ~ 12 ~ run execute at @e[tag=ECChestMarker,distance=..50,limit=1] run tellraw @a[distance=..100] ["",{"text":"The chest crushes one of the ghast tears, spreading some of its effects in the process!","color":"light_purple"}]
execute at @s[tag=ItemSaveGT] run summon item ~ ~ ~ {Item:{id:"minecraft:experience_bottle",Count:5b}}
execute if predicate suhc:50percent run execute at @s[tag=ItemSaveGT] run summon item ~ ~ ~ {Item:{id:"minecraft:experience_bottle",Count:5b}}

execute at @s[tag=ItemSaveBP] positioned ~ 12 ~ run execute at @e[tag=ECChestMarker,distance=..70,limit=1] run effect give @a[distance=..100] fire_resistance 2700 0
execute at @s[tag=ItemSaveBP,tag=SingleItem] positioned ~ 12 ~ run execute at @e[tag=ECChestMarker,distance=..50,limit=1] run tellraw @a[distance=..100] ["",{"text":"The chest destroys the blaze powder, spreading an aura of fire resistance within the area!","color":"gold"}]
execute at @s[tag=ItemSaveBP,tag=!SingleItem] positioned ~ 12 ~ run execute at @e[tag=ECChestMarker,distance=..50,limit=1] run tellraw @a[distance=..100] ["",{"text":"The chest destroys one of the blaze powders, spreading an aura of fire resistance within the area!","color":"gold"}]
execute at @s[tag=ItemSaveBP] run summon item ~ ~ ~ {Item:{id:"minecraft:experience_bottle",Count:8b}}
execute if predicate suhc:50percent run execute at @s[tag=ItemSaveBP] run summon item ~ ~ ~ {Item:{id:"minecraft:experience_bottle",Count:8b}}



execute if predicate suhc:25percent run execute at @s[tag=ItemSaveDiaBlock] positioned ~ ~ ~ run summon item ~ ~ ~ {Item:{id:"minecraft:shield",Count:1b,tag:{Enchantments:[{id:"minecraft:unbreaking",lvl:10s}],AttributeModifiers:[{AttributeName:"generic.knockback_resistance",Name:"generic.knockback_resistance",Amount:1,Operation:0,UUID:[I;6969,6969,6969,1124],Slot:"mainhand"},{AttributeName:"generic.attack_damage",Name:"generic.attack_damage",Amount:7,Operation:0,UUID:[I;6969,6969,6969,1125],Slot:"mainhand"},{AttributeName:"generic.armor",Name:"generic.armor",Amount:2,Operation:0,UUID:[I;6969,6969,6969,1126],Slot:"mainhand"},{AttributeName:"generic.armor_toughness",Name:"generic.armor_toughness",Amount:2,Operation:0,UUID:[I;6969,6969,6969,1127],Slot:"mainhand"}],display:{Name:"Sturdy Shield",Lore:["Tank? TAAAAAAAAAAAAAAANK!"]},Enchantments:[{id:"minecraft:protection",lvl:1},{id:"minecraft:knockback",lvl:3}]}}}





scoreboard players remove @s KyuDummy3 1
execute as @s run execute store result entity @s Item.Count byte 1 run scoreboard players get @s KyuDummy3



tag @s remove ItemSave