From c8635d8234a96e5050fb677855667d2c25826c83 Mon Sep 17 00:00:00 2001 From: NeunEinser Date: Sat, 6 Mar 2021 16:45:03 +0100 Subject: [PATCH] Timer: Move internal scores to new objective and document them This moves internal scores used by the timer from 91.timer.main to 91.timer.intern. The sole constant (value 60) was also moved from 91.timer.const to the new objective, and the const objective was removed. All internal score holders are also properly documented now (Work towards #5) --- .../functions/internal/init.mcfunction | 21 ++++++++++++++++--- .../functions/read.mcfunction | 8 +++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/data/neun_einser.timer/functions/internal/init.mcfunction b/data/neun_einser.timer/functions/internal/init.mcfunction index a99b1e00..2fd8e79c 100644 --- a/data/neun_einser.timer/functions/internal/init.mcfunction +++ b/data/neun_einser.timer/functions/internal/init.mcfunction @@ -93,14 +93,29 @@ scoreboard objectives add 91.timer.main dummy #declare score_holder $hours #> -# This scoreboard is used to store constant values. +# Internal scoreboard for non-temporary memory # # @internal -scoreboard objectives add 91.timer.const dummy +scoreboard objectives add 91.timer.intern dummy #> # @internal #declare score_holder 60 -scoreboard players set 60 91.timer.const 60 +scoreboard players set 60 91.timer.intern 60 + +#> +# Raw time the world border was started at. The world border is reset once it +# reaches a certain threshold to prevent it running out of blocks. +# @internal +#declare score_holder $start +#> +# Blocks the world border travels per second. Used for some internal +# calculations. +# +# For example, if this was started with neun_einser.timer:start/millis, this +# will be 1000. +# +# @internal +#declare score_holder $blocks_per_second data merge storage neun_einser.timer:display {"hh:mm:ss.s": '[{"storage": "neun_einser.timer:display", "nbt": "internal.hours", "interpret": true}, {"storage": "neun_einser.timer:display", "nbt": "internal.minutes", "interpret": true}, {"storage": "neun_einser.timer:display", "nbt": "internal.seconds", "interpret": true}, {"storage": "neun_einser.timer:display", "nbt": "internal.millis", "interpret": true}]', "hh:mm:ss": '[{"storage": "neun_einser.timer:display", "nbt": "internal.hours", "interpret": true}, {"storage": "neun_einser.timer:display", "nbt": "internal.minutes", "interpret": true}, {"storage": "neun_einser.timer:display", "nbt": "internal.seconds", "interpret": true}]', "hh:mm": '[{"storage": "neun_einser.timer:display", "nbt": "internal.hours", "interpret": true}, {"storage": "neun_einser.timer:display", "nbt": "internal.minutes", "interpret": true}]'} \ No newline at end of file diff --git a/data/neun_einser.timer/functions/read.mcfunction b/data/neun_einser.timer/functions/read.mcfunction index 5760a917..653f05cc 100644 --- a/data/neun_einser.timer/functions/read.mcfunction +++ b/data/neun_einser.timer/functions/read.mcfunction @@ -4,10 +4,10 @@ scoreboard players operation $millis 91.timer.main = $raw 91.timer.main scoreboard players operation $seconds 91.timer.main = $millis 91.timer.main scoreboard players operation $seconds 91.timer.main /= $blocks_per_second 91.timer.main scoreboard players operation $minutes 91.timer.main = $seconds 91.timer.main -scoreboard players operation $minutes 91.timer.main /= 60 91.timer.const +scoreboard players operation $minutes 91.timer.main /= 60 91.timer.intern scoreboard players operation $hours 91.timer.main = $minutes 91.timer.main -scoreboard players operation $hours 91.timer.main /= 60 91.timer.const +scoreboard players operation $hours 91.timer.main /= 60 91.timer.intern scoreboard players operation $millis 91.timer.main %= $blocks_per_second 91.timer.main -scoreboard players operation $seconds 91.timer.main %= 60 91.timer.const -scoreboard players operation $minutes 91.timer.main %= 60 91.timer.const \ No newline at end of file +scoreboard players operation $seconds 91.timer.main %= 60 91.timer.intern +scoreboard players operation $minutes 91.timer.main %= 60 91.timer.intern \ No newline at end of file