Skip to content

Encoding any string (char array) to base64 in Minecraft 1.20.1

License

Notifications You must be signed in to change notification settings

Coppertine/base64-mc-encode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

base64-mc-encode

Encoding any string (char array) to base64 in Minecraft 1.20


A datapack library for Minecraft 1.20 that converts string (char array) into a base64 encoded string (char array) that can be compacted with a seperate library. This library does not decode the base64 code as that has been implemented before for player skull decoders (i.e. String-Parser).

How to Use

Once installed, you can set the string to be encoded into the b64:convert storage under the NBT string array tag input. Example:

data modify storage b64:convert input set value ["h","e","l","l","o"," ","w","o","r","l","d"]

To start encoding, the function is executed.

function b64:encode

The output will be found in b64:convert under the NBT string array tag result. You can concatenate the array using a library like ostrmc.

Example

data modify storage b64:convert input set value ["N","o","t","h","i","n","g"," ","t","o"," ","s","e","e"," ","h","e","r","e"," ","4","2"]
function b64:encode
data get storage b64:convert result

Output

Storage b64:convert has the following contents: ["T", "m", "9", "0", "a", "G", "l", "u", "Z", "y", "B", "0", "b", "y", "B", "z", "Z", "W", "U", "g", "a", "G", "V", "y", "Z", "S", "A", "0", "M", "g", "=", "="]

Allowed Characters

Below are the characters that this datapack can read from the input string becore encoding.

 !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\"\\]^_`abcdefghijklmnopqrstuvwxyz{|}~�

Building

Building this datapack uses beet, bolt, mecha and bolt-expressions. You can install them with the commands below.

$ pip install beet bolt mecha bolt-expressions

and you can build using

beet build

the built datapack will be found in the build folder.

Screenshot

image

Attributions

Minecraft Phi

Algorithm Wikibook

About

Encoding any string (char array) to base64 in Minecraft 1.20.1

Resources

License

Stars

Watchers

Forks

Packages

No packages published