From 028e29d66887f1794c58b81d9e0f7e78d1040ce7 Mon Sep 17 00:00:00 2001 From: Coppertine <37494321+Coppertine@users.noreply.github.com> Date: Thu, 6 Jul 2023 01:26:47 +1000 Subject: [PATCH] clean up files --- beet.json | 23 +++++++++++----------- data/b64/functions/encode.mcfunction | 17 +++++----------- data/b64/functions/test_bitwise.mcfunction | 5 ----- 3 files changed, 17 insertions(+), 28 deletions(-) delete mode 100644 data/b64/functions/test_bitwise.mcfunction diff --git a/beet.json b/beet.json index e95a283..e803082 100644 --- a/beet.json +++ b/beet.json @@ -1,15 +1,16 @@ { - "name": "Base64 Encode", - "author": "Coppertine", - "description": "Test for encoding text to b64", - "require": ["bolt","bolt_expressions"], - "data_pack": { - "load": ["."] - }, - "pipeline": ["mecha"], + "name": "Base64 Encode", + "author": "Coppertine", + "description": "Base64 Encoder", + "require": ["bolt", "bolt_expressions"], + "data_pack": { + "load": ["."] + }, + "version": "0.1", + "pipeline": ["mecha"], "meta": { - "bolt": {"entrypoint": "b64:main"} + "bolt": { "entrypoint": "b64:encode" } }, - "output": "build" -} \ No newline at end of file + "output": "build" +} diff --git a/data/b64/functions/encode.mcfunction b/data/b64/functions/encode.mcfunction index cf62ef1..25f03f8 100644 --- a/data/b64/functions/encode.mcfunction +++ b/data/b64/functions/encode.mcfunction @@ -1,9 +1,8 @@ from bolt_expressions import Scoreboard, Data -from ./math/bitwise/ops import lshift +from b64:ops import lshift storage = Data.storage(b64:convert) -score = Scoreboard("b64.tmp") -math_score = Scoreboard("b64.math") - +score = Scoreboard("b64.tmp", "dummy") +math_score = Scoreboard("b64.math", "dummy") def rshift(a,b): math_score["$a"] = a @@ -24,9 +23,6 @@ storage.padding = [] storage.tmp = [] storage.tmp_single = "" - -# storage.input = ["h","e","l","l","o"," ","w","o","r","l","d"] -tellraw @a storage.input storage.string = [] storage.tmp_section = [] storage.section = [] @@ -54,9 +50,6 @@ if score var score["$chunk"] matches 1.. run function b64:add_padding: storage.string.append('') score["$iterator"] += 1 if score var score["$iterator"] matches ..3 run function b64:loop -# Debug to see if the padding is added... -tellraw @a "added padding" -tellraw @a storage.padding score["$chunk"] = 0 if score var score["$chunk"] < var score["$length"] run function b64:string_increment: @@ -102,7 +95,7 @@ if score var score["$chunk"] < var score["$length"] run function b64:string_incr score["$n3"] = bitwise_and(score["$n3"],63) score["$n0"] = bitwise_and(rshift(score["$n0"], 18), 63) score["$n1"] = bitwise_and(rshift(score["$n1"], 12), 63) - score["$n2"] = bitwise_and(rshift(score["$n2"], 6),63) + score["$n2"] = bitwise_and(rshift(score["$n2"], 6), 63) # tellraw @a [score['$n0'], ",", score['$n1'],",",score['$n2'],",",score['$n3']] for x in [score["$n0"], score["$n1"], score["$n2"], score["$n3"]]: @@ -128,4 +121,4 @@ if score var score["$i"] < var score["$paddinglen"] run function b64:padding_app score["$i"] = score["$i"] + 1 if score var score["$i"] < var score["$paddinglen"] run function b64:padding_append -tellraw @a [storage.result.component(interpret=true)] \ No newline at end of file +# tellraw @a [storage.result.component(interpret=true)] \ No newline at end of file diff --git a/data/b64/functions/test_bitwise.mcfunction b/data/b64/functions/test_bitwise.mcfunction deleted file mode 100644 index 5be054f..0000000 --- a/data/b64/functions/test_bitwise.mcfunction +++ /dev/null @@ -1,5 +0,0 @@ -from bolt_expressions import Scoreboard, Data -score = Scoreboard("b64.tmp") - -score["$foo"] = 1 -# score["$foo"] << 2 \ No newline at end of file