scoreboard players set @s KyuDummy2 0
scoreboard players set @s KyuDummy3 0

execute positioned ~ ~3 ~ run summon minecraft:item ~ ~ ~ {Tags:["CheckWheat","SetSlot0Item"],Item:{id:"minecraft:structure_void",Count:2b},Age:1999s}
execute positioned ~ ~3 ~ run summon minecraft:item ~ ~ ~ {Tags:["CheckWheat","SetSlot1Item"],Item:{id:"minecraft:structure_void",Count:2b},Age:1999s}
execute positioned ~ ~3 ~ run summon minecraft:item ~ ~ ~ {Tags:["CheckWheat","SetSlot2Item"],Item:{id:"minecraft:structure_void",Count:2b},Age:1999s}
execute positioned ~ ~3 ~ run summon minecraft:item ~ ~ ~ {Tags:["CheckWheat","SetSlot3Item"],Item:{id:"minecraft:structure_void",Count:2b},Age:1999s}
execute positioned ~ ~3 ~ run summon minecraft:item ~ ~ ~ {Tags:["CheckWheat","SetSlot4Item"],Item:{id:"minecraft:structure_void",Count:2b},Age:1999s}

execute positioned ~ ~3 ~ run data modify entity @e[distance=..11,type=item,limit=1,sort=nearest,tag=SetSlot0Item] Item set from block ~ ~-3 ~ Items[{Slot:0b}]
execute positioned ~ ~3 ~ run data modify entity @e[distance=..11,type=item,limit=1,sort=nearest,tag=SetSlot1Item] Item set from block ~ ~-3 ~ Items[{Slot:1b}]
execute positioned ~ ~3 ~ run data modify entity @e[distance=..11,type=item,limit=1,sort=nearest,tag=SetSlot2Item] Item set from block ~ ~-3 ~ Items[{Slot:2b}]
execute positioned ~ ~3 ~ run data modify entity @e[distance=..11,type=item,limit=1,sort=nearest,tag=SetSlot3Item] Item set from block ~ ~-3 ~ Items[{Slot:3b}]
execute positioned ~ ~3 ~ run data modify entity @e[distance=..11,type=item,limit=1,sort=nearest,tag=SetSlot4Item] Item set from block ~ ~-3 ~ Items[{Slot:4b}]

data merge block ~ ~ ~ {Items:[]}



execute at @e[type=item,distance=..13,tag=CheckWheat,nbt={Item:{id:"minecraft:wheat",Count:64b}}] run scoreboard players add @s KyuDummy3 5


execute at @e[type=item,distance=..13,tag=CheckWheat,nbt={Item:{id:"minecraft:hay_block",Count:64b}}] run scoreboard players add @s KyuDummy3 45


kill @e[type=item,distance=..13,tag=CheckWheat,nbt={Item:{id:"minecraft:hay_block",Count:64b}}]
kill @e[type=item,distance=..13,tag=CheckWheat,nbt={Item:{id:"minecraft:wheat",Count:64b}}]


data modify block ~ ~ ~ Items[{Slot:0b}] merge from entity @e[distance=..11,type=item,limit=1,sort=nearest,tag=SetSlot0Item,nbt=!{Item:{id:"minecraft:structure_void",Count:2b}}] Item
data modify block ~ ~ ~ Items[{Slot:1b}] merge from entity @e[distance=..11,type=item,limit=1,sort=nearest,tag=SetSlot1Item,nbt=!{Item:{id:"minecraft:structure_void",Count:2b}}] Item
data modify block ~ ~ ~ Items[{Slot:2b}] merge from entity @e[distance=..11,type=item,limit=1,sort=nearest,tag=SetSlot2Item,nbt=!{Item:{id:"minecraft:structure_void",Count:2b}}] Item
data modify block ~ ~ ~ Items[{Slot:3b}] merge from entity @e[distance=..11,type=item,limit=1,sort=nearest,tag=SetSlot3Item,nbt=!{Item:{id:"minecraft:structure_void",Count:2b}}] Item
data modify block ~ ~ ~ Items[{Slot:4b}] merge from entity @e[distance=..11,type=item,limit=1,sort=nearest,tag=SetSlot4Item,nbt=!{Item:{id:"minecraft:structure_void",Count:2b}}] Item

kill @e[type=item,distance=..13,tag=CheckWheat]

#get the attack damage, multiplied by 1000
execute store result score @s KyuDummy4 run data get entity @e[type=item_frame,limit=1,sort=nearest] Item.tag.AttributeModifiers[0].Amount 100

#set dummy to 1000, then multiply the attack damage by dummy(1000)
scoreboard players set @s KyuDummy5 100
scoreboard players operation @s KyuDummy4 *= @s KyuDummy5

#set dummy to 10000, then multiply the wheat counter by dummy(10000)
scoreboard players set @s KyuDummy5 100
scoreboard players operation @s KyuDummy3 *= @s KyuDummy5
#scoreboard players operation @s KyuDummy4 *= @s KyuDummy5

#add the wheat counter to the attack damage
scoreboard players operation @s KyuDummy4 += @s KyuDummy3

#LOL need this because the game has floating-point rounding errors
##welcome back to the pentium days folks, thank you java very cool
scoreboard players add @s KyuDummy4 3

execute as @s[scores={KyuDummy3=5..}] run execute store result entity @e[type=item_frame,limit=1,sort=nearest] Item.tag.AttributeModifiers[0].Amount float .0001 run scoreboard players get @s KyuDummy4







execute store result score @s KyuDummy4 run data get entity @e[type=item_frame,limit=1,sort=nearest] Item.tag.AttributeModifiers[0].Amount
scoreboard players set @s KyuDummy5 1
scoreboard players operation @s KyuDummy4 *= @s KyuDummy5

execute store result score @s KyuDummy5 run data get entity @e[type=item_frame,limit=1,sort=nearest] Item.tag.AttributeModifiers[0].Amount 100
scoreboard players set @s KyuDummy6 100
scoreboard players operation @s KyuDummy5 %= @s KyuDummy6

setblock ~ ~18 ~ air
execute as @s[scores={KyuDummy3=5..}] run execute as @s[scores={KyuDummy5=..9}] run setblock ~ ~18 ~ oak_sign{Text1:'[{"text":" ","color":"#14A82D","italic":false},{"score":{"name":"@e[type=marker,tag=WheatstoneMarker,limit=1,sort=nearest]","objective":"KyuDummy4"}},{"text":".0"},{"score":{"name":"@e[type=marker,tag=WheatstoneMarker,limit=1,sort=nearest]","objective":"KyuDummy5"}},{"text":" Attack Damage"}]'} replace
execute as @s[scores={KyuDummy3=5..}] run execute as @s[scores={KyuDummy5=10..}] run setblock ~ ~18 ~ oak_sign{Text1:'[{"text":" ","color":"#14A82D","italic":false},{"score":{"name":"@e[type=marker,tag=WheatstoneMarker,limit=1,sort=nearest]","objective":"KyuDummy4"}},{"text":"."},{"score":{"name":"@e[type=marker,tag=WheatstoneMarker,limit=1,sort=nearest]","objective":"KyuDummy5"}},{"text":" Attack Damage"}]'} replace

execute as @s[scores={KyuDummy3=1..}] run data modify entity @e[type=item_frame,limit=1,sort=nearest] Item.tag.display.Lore[4] set from block ~ ~18 ~ Text1

execute as @s[scores={KyuDummy3=1..}] run execute positioned ~ ~-1.25 ~ run particle minecraft:wax_on ~ ~ ~ 0 0.1 0 15 20 force
stopsound @a[distance=..15] * minecraft:entity.item_frame.add_item
execute as @s[scores={KyuDummy3=1..}] run playsound minecraft:item.axe.scrape ambient @a[distance=..10] ~ ~ ~ 3 0.75




#setblock ~ ~2 ~ oak_sign{Text1:'[{"score":{"name":"@e[type=marker,tag=WheatstoneMarker,limit=1,sort=nearest]","objective":"KyuDummy"}},{"text":" Attack Damage"}]'} replace
#/setblock ~ ~ ~ oak_sign{Text1:'[{"nbt":"health","entity":"@p","interpret":true},{"text":"Attack Damage"}]'} replace


#execute as @e[distance=..2,type=marker,tag=WheatstoneMarker] run function zzzzdonotuse:structures/windmill/wheatstonetimer

