D
Deleted member 26
Guest
In this tutorial, I will go over how to be able to edit code templates and manipulate using NBT Editor.
Recommended Programs:
NBT Explorer (For inserting the new code template into a toolbar item)
Text Editor (Copying code/Editing Code)
Accessing the NBT Data
To edit a template, we must first get access to the code templates NBT data. There are multiple ways to do this, so choose whichever one you think is best.
The code you are looking for is stored under "code" in the item's NBT data.
1. /itemdata and manually copy the code. (I wouldn't do this, as there is room for human error.)
2. /itemdata and accessing your log files in minecraft. (%appdata%\.minecraft\logs\latest.log)
3. Use NBT Explorer to copy the code (save the template in your saved toolbars) (RECOMMENDED)
If you are not going to use NBT Explorer to get the code, please still follow this tutorial as you will need to use it for editing a template.
Please make sure that you saved the template to a saved toolbar.
Open your .minecraft folder (%appdata%\.minecraft) and select hotbar.nbt.
You then should see something like this...
0-8 represents the number of toolbars, 0 being the first and 8th being the last.
In this example, my code template is stored inside of my first toolbar so I will access 0.
After that, each "box" looking icon contains an item. Locate the one that contains your code template.
After that, open up the "tag" section. You should then see display and PublicBukkitValues, after that expand PublicBukkitValues.
Now you see "hypercube:codetemplatedata", if you have gotten to this point great job! Now, all you have to do is double click, locate "code" and copy that.
Decompressing
DiamondFire compresses the code template data so that it doesn't use as much space in the items NBT. We need to decompress it so that we can edit the data.
Here's how DiamondFire compresses the data...
As you can see, the data starts as JSON and gets gzipped, then base64 encoded.
Using http://www.txtwizard.net/compression, your text will be decoded and decompressed to display the JSON data.
Once you put your compressed data, you need to click decompress.
Then, copy and paste the JSON data that you get inside the result box.
It should look like this, as you can see it is clearly in the JSON format. Because of this, you can use any JSON editor you want as well.
For this example, we are going to add an action that really doesn't exist currently.
(I think it should exist)
Okay so, now what?
Exporting our new code template
So now, we want to insert this new code into our item... but how?
Well using the tutorial up above you simply are going to set the code instead of just copying.
(MAKE SURE YOU HAVE A TEMPLATE SAVED IN YOUR TOOLBAR)
Now, we need to compress our JSON back to the format DF uses. So, head back to http://www.txtwizard.net/compression.
Put your JSON in the top box and click compress.
After you have your string, you need to edit your items NBT again.
Replace the string inside of code with the new string.
Result
After you have saved and rejoined the game, when you try to place down your code you should see that your changes were made!
Thanks for following my tutorial, have a great rest of your day/night. Feel free to leave any feedback that you may have. This is my first tutorial, so please correct me if needed.
Make sure to leave a like if you enjoyed it!
Extra Information:
I have a neat program that allows you to interact with templates in very interesting ways. It's called DFVisual, and it's been a project of mine for a while. Please note that it is pretty buggy, and isn't updated that much anymore.
Basically, it allows you to create new codeblocks and import them with ease.
If you are interested, please join the discord for more information. https://discord.gg/XMw7vSq
Recommended Programs:
NBT Explorer (For inserting the new code template into a toolbar item)
Text Editor (Copying code/Editing Code)
If you are going to be following this tutorial, please do not use this with malicious intentions. If you are attempting to bypass filters or certain restrictions that are currently in place you may have the chance of being punished.
Accessing the NBT Data
To edit a template, we must first get access to the code templates NBT data. There are multiple ways to do this, so choose whichever one you think is best.
The code you are looking for is stored under "code" in the item's NBT data.
1. /itemdata and manually copy the code. (I wouldn't do this, as there is room for human error.)
2. /itemdata and accessing your log files in minecraft. (%appdata%\.minecraft\logs\latest.log)
3. Use NBT Explorer to copy the code (save the template in your saved toolbars) (RECOMMENDED)
If you are not going to use NBT Explorer to get the code, please still follow this tutorial as you will need to use it for editing a template.
There is a chance that when you are editing toolbar NBT data, you can corrupt it causing ALL ITEMS to be lost. If you do not want this happening, save your items somewhere else, or please click off this tutorial.
I am not responsible for any lost items... including lost heads.
Please make sure that you saved the template to a saved toolbar.
Open your .minecraft folder (%appdata%\.minecraft) and select hotbar.nbt.
You then should see something like this...
0-8 represents the number of toolbars, 0 being the first and 8th being the last.
In this example, my code template is stored inside of my first toolbar so I will access 0.
After that, each "box" looking icon contains an item. Locate the one that contains your code template.
After that, open up the "tag" section. You should then see display and PublicBukkitValues, after that expand PublicBukkitValues.
Now you see "hypercube:codetemplatedata", if you have gotten to this point great job! Now, all you have to do is double click, locate "code" and copy that.
Decompressing
DiamondFire compresses the code template data so that it doesn't use as much space in the items NBT. We need to decompress it so that we can edit the data.
Here's how DiamondFire compresses the data...
As you can see, the data starts as JSON and gets gzipped, then base64 encoded.
Using http://www.txtwizard.net/compression, your text will be decoded and decompressed to display the JSON data.
Once you put your compressed data, you need to click decompress.
Then, copy and paste the JSON data that you get inside the result box.
It should look like this, as you can see it is clearly in the JSON format. Because of this, you can use any JSON editor you want as well.
For this example, we are going to add an action that really doesn't exist currently.
Okay so, now what?
Exporting our new code template
So now, we want to insert this new code into our item... but how?
Well using the tutorial up above you simply are going to set the code instead of just copying.
(MAKE SURE YOU HAVE A TEMPLATE SAVED IN YOUR TOOLBAR)
Now, we need to compress our JSON back to the format DF uses. So, head back to http://www.txtwizard.net/compression.
Put your JSON in the top box and click compress.
After you have your string, you need to edit your items NBT again.
Replace the string inside of code with the new string.
Result
After you have saved and rejoined the game, when you try to place down your code you should see that your changes were made!
Thanks for following my tutorial, have a great rest of your day/night. Feel free to leave any feedback that you may have. This is my first tutorial, so please correct me if needed.
Make sure to leave a like if you enjoyed it!
Extra Information:
I have a neat program that allows you to interact with templates in very interesting ways. It's called DFVisual, and it's been a project of mine for a while. Please note that it is pretty buggy, and isn't updated that much anymore.
Basically, it allows you to create new codeblocks and import them with ease.
If you are interested, please join the discord for more information. https://discord.gg/XMw7vSq
Last edited by a moderator: