# Mcfunction-Debugger is a debugger for Minecraft's *.mcfunction files that does not require any
# Minecraft mods.
#
# © Copyright (C) 2021-2024 Adrodoc <adrodoc55@googlemail.com> & Skagaros <skagaros@gmail.com>
#
# This file is part of Mcfunction-Debugger.
#
# Mcfunction-Debugger is free software: you can redistribute it and/or modify it under the terms of
# the GNU General Public License as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# Mcfunction-Debugger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with Mcfunction-Debugger.
# If not, see <http://www.gnu.org/licenses/>.
execute if score -fn_score_holder- -ns-_valid matches 1 run summon area_effect_cloud ~ ~ ~ {Duration: 2147483647, Tags: [-ns-_new, -ns-, -ns-_function_call, -ns-+-orig_ns-+-orig+fn-+-line_number-, -ns-_active], CustomName: '{"text":"-orig_ns-:-orig/fn-:-line_number-"}'}
execute if score -fn_score_holder- -ns-_valid matches 1 run scoreboard players operation @e[type=area_effect_cloud,tag=-ns-_new] -ns-_anchor = current -ns-_anchor
execute if score -fn_score_holder- -ns-_valid matches 1 run scoreboard players operation @e[type=area_effect_cloud,tag=-ns-_new] -ns-_depth = current -ns-_depth
execute if score -fn_score_holder- -ns-_valid matches 1 run tag @e[type=area_effect_cloud,tag=-ns-_new] remove -ns-_new
execute if score -fn_score_holder- -ns-_valid matches 1 run scoreboard players add current -ns-_depth 1
# -debug_anchor-
execute if score -fn_score_holder- -ns-_valid matches 1 run execute run function -ns-:select_entity
execute if score -fn_score_holder- -ns-_valid matches 1 run function -ns-:-call_ns-/-call/fn-/next_iteration_or_return
# -minect_log_conditional-
execute unless score -fn_score_holder- -ns-_valid matches 0.. run summon area_effect_cloud ~ ~ ~ {CustomName: '{"text":"console+Skipping call to missing function -call_ns-:-call/fn-"}'}
# -minect_log_conditional-
execute if score -fn_score_holder- -ns-_valid matches 0 run summon area_effect_cloud ~ ~ ~ {CustomName: '{"text":"console+Skipping call to function -call_ns-:-call/fn-, because it contains an invalid command."}'}
execute unless score -fn_score_holder- -ns-_valid matches 1 run function -ns-:-orig_ns-/-orig/fn-/continue_current_iteration_at_-line_number-_function