Skip to content

Commit

Permalink
fix: auto handled output only if there is count
Browse files Browse the repository at this point in the history
  • Loading branch information
edayot committed Aug 13, 2023
1 parent 8aababb commit d71f184
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ data modify storage simpledrawer:main temp.dropped_item.tag.display set from sto


scoreboard players set #model simpledrawer.math 1430000
execute unless data entity @s item.tag.simpledrawer{globalCount:0} run function simpledrawer:impl/new_drawer/compacting/destroy_filled
scoreboard players set #temp_filled simpledrawer.math 0
execute unless data entity @s item.tag.simpledrawer{globalCount:0} run scoreboard players set #temp_filled simpledrawer.math 1
execute unless data entity @s item.tag.simpledrawer{current_material:"none"} run scoreboard players set #temp_filled simpledrawer.math 1

execute if score #temp_filled simpledrawer.math matches 1 run function simpledrawer:impl/new_drawer/compacting/destroy_filled


execute store result storage simpledrawer:main temp.dropped_item.tag.CustomModelData int 1 run scoreboard players get #model simpledrawer.math

data modify storage simpledrawer:main temp.dropped_item.tag.Trim.material set from entity @s item.tag.simpledrawer.wood_type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@

execute store result score #count_aho simpledrawer.math run data get storage simpledrawer:main temp.Items_aho[0].Count

execute if score #count_aho simpledrawer.math matches 1..
run function ./auto_handled_output_loop_output:
data modify storage itemio:io Item_auto_output set from storage simpledrawer:main temp.Items_aho[0]
#tellraw @a {"nbt":"Item_auto_output","storage":"itemio:io"}
function #itemio:calls/auto_handled_output
#tellraw @a {"score":{"name":"#remove_count","objective":"itemio.math.output"}}

data modify storage itemio:io Item_auto_output set from storage simpledrawer:main temp.Items_aho[0]
#tellraw @a {"nbt":"Item_auto_output","storage":"itemio:io"}
function #itemio:calls/auto_handled_output
#tellraw @a {"score":{"name":"#remove_count","objective":"itemio.math.output"}}

scoreboard players operation #count simpledrawer.io = #remove_count itemio.math.output
execute store result score #slot simpledrawer.io run data get storage simpledrawer:main temp.Items_aho[0].Slot
execute if score #success_output itemio.io matches 1 run function simpledrawer:impl/new_drawer/working/io/output
scoreboard players operation #count simpledrawer.io = #remove_count itemio.math.output
execute store result score #slot simpledrawer.io run data get storage simpledrawer:main temp.Items_aho[0].Slot
execute if score #success_output itemio.io matches 1 run function simpledrawer:impl/new_drawer/working/io/output


execute unless score #success_output itemio.io matches 1 run data remove storage simpledrawer:main temp.Items_aho[0]
Expand Down

0 comments on commit d71f184

Please sign in to comment.