• Hey! Register here to create your account, engage with the community, and talk about what is new!

Unlocking DF

stinkey

Forum adept
Joined
Sep 8, 2020
Messages
225
Reaction score
74
lol what is this name

Now, have you ever wondered about how DF's values and variables (text, number, potion effect, dynamic, etc.) store their values? Clearly they don't store it in the name or lore; doing /item name [something] doesn't work. Now, with the new release of item tags, we can do /item tag list. Doing this while holding a text value, dynamic variable, or code template shows you the real values behind the item.

Value and variable items have an item tag called varitem. A text value with the value Hello! has the following item tags:
unknown.png


Code templates also store data in their item tags. It's in an item tag called codetemplatedata.
unknown.png


This also has some values, such as author or name. What's interesting is code. It has some text, seemingly gibberish. However, it's actually compressed text, using gzip compression (thanks to otte for telling me it was gzip and base64 not base64 by itself... if you decode with only base64 its just emojis and brackets). Decoded, it says: {"blocks":[{"id":"block","block":"func","args":{"items":[{"item":{"id":"bl_tag","data":{"option":"False","tag":"Is Hidden","action":"dynamic","block":"func"}},"slot":26}]},"data":"hello"}]}. This code template was just a function called hello. You can see that there is func and tag (the option to make the function hidden or not), and data, which contains hello, the function's name. In theory, you could make a code template with some code just by setting the item tags, though the tag is pretty long and wouldn't fit in your chat bar. However, you could bypass the char limit by using set var code blocks.

I'm not sure why the devs made it all in one item tag. I'm not a dev, nor am I super good at coding, so I wouldn't know anyways.

TL;DR DF values are stored in item tags.
 
Last edited:

stinkey

Forum adept
Joined
Sep 8, 2020
Messages
225
Reaction score
74
correction: it is base64, its just base64 and gzip
what does that mean lol ????
which part of the text are you talking about
code templates are clearly not base64 because they have a-z, A-Z, 0-9, +, /, and =. thats 65 chars, and its not base65
elaborate.
 

RolandMC123

Forum adept
Joined
Sep 9, 2020
Messages
186
Reaction score
50
The text is first encrypted with base64, and afterwards gzipped. So to decode it you would first need to ungzip it and then convert it from base64.

(Also, the data is stored into only one item tag since it's just encrypted JSON, and the internal code afaik doesn't parse item tags or anything, just the JSON that it receives)
 
Last edited:

stinkey

Forum adept
Joined
Sep 8, 2020
Messages
225
Reaction score
74
The text is first encrypted with base64, and afterwards gzipped. So to decode it you would first need to ungzip it and then convert it from base64.
i just straight up ungzipped it without decrypting with base64 and got that
 

RolandMC123

Forum adept
Joined
Sep 9, 2020
Messages
186
Reaction score
50
welp, I guess encrypting it with base64 then gzip also works since that's what my Python -> DF script prototype used. /shrug
 

K_Sasha

Active member
Joined
Aug 16, 2020
Messages
40
Reaction score
45
The = character is a padding character Java adds automatically. It does not serve any purpose in this situation. The code data is compressed, and then encoded in base 64 to avoid any unwanted characters that might cause issues.
 
Top Bottom