Skip to content

Commit

Permalink
clean up files
Browse files Browse the repository at this point in the history
  • Loading branch information
Coppertine committed Jul 5, 2023
1 parent 86cfc7b commit 028e29d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 28 deletions.
23 changes: 12 additions & 11 deletions beet.json
Original file line number Diff line number Diff line change
@@ -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"
}
"output": "build"
}
17 changes: 5 additions & 12 deletions data/b64/functions/encode.mcfunction
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 = []
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"]]:
Expand All @@ -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)]
# tellraw @a [storage.result.component(interpret=true)]
5 changes: 0 additions & 5 deletions data/b64/functions/test_bitwise.mcfunction

This file was deleted.

0 comments on commit 028e29d

Please sign in to comment.