Other [NBTSk] How to use NBTSk!

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Aidanete

Active Member
Apr 11, 2017
139
10
0
NBTSk for dummies
As I've recently uploaded NBTSk, I think is a moment to make a tutorial. When I'm writing this, the script is pending approval.

All you know what NBT Tags are, and we know that skript don't provide enough support for this stuff, so NBTSk works well for your server, because can store items in variables, and then you can call them in your codes.

For example, a custom head. Simply take it on your hand and put this command /ns save (id). This will save the ID (id) with that item

To call it, you can use this variable:
code_language.skript:
{ns::%id%}
For example
code_language.skript:
set the player's helmet to {ns::burger}
This will make the item saved in ID burger to be placed on the player's head.
If you use TuSKe GUI, you can also use them:
code_language.skript:
command /ns-example2:
    trigger:
        open virtual chest inventory with size 3 named "Example of NBTs" to the player
        format gui slot 0 of player with {ns::lion} to close
        format gui slot 1 of player with {ns::burger} to close
This will place the items saved with ids "lion" and "burger"

To delete an item, just command /ns delete (id)

You can test as well if the item is saved correctly with /ns give (id)
If you feel lost with the saved item, to know their ids put /ns list

Another function is to detect items in the player's inventory, I tested with it but this feature isn't very clean and may have errors, anyway, it is still usable:
code_language.skript:
on rightclick:
    player is holding {ns::gigajump}:
        cancel event
        push the player upwards with force 4
Note: I used the id "gigajump" for a head with an ! in the center and the name &6&lGiga jump! However, the game, in this case, will detect any head with that name, but probably this can be fixed with other methods or extra detection but is still usable, that the reason why I said this feature can have errors

As you know, you can't save variables in a script directly, so when you pass the script the saved items will not work, simply use it for personal use, your servers or other's servers that you can control.

Enjoy NBTSk!
 
Last edited:
Hey, excited to check out your upcoming resource.
Just wanted to throw out there that Skript doesn't support NBT because it requires net.minecraft.server reflection (aka NMS), which has a habit of changing with every major minecraft release and on top of it is obfuscated. They're taking a pass on that stuff because it makes mantaining Skript more difficult.

I know the guy that develops the plugin MythicMobs and he does in fact include NMS stuff in his code for a plethra of MC versions. I've also seen the source code and ... it's not pretty. So i fully empathize with the Skript team on this
 
Good to know it, hope you enjoy this script, I don't know if someone will need it but at least I were searching for something like this like a month, so I decided to publish it because may be very helpful
 
Good to know it, hope you enjoy this script, I don't know if someone will need it but at least I were searching for something like this like a month, so I decided to publish it because may be very helpful
I believe publishing is never wrong. There's always somebody who might find it useful
 
I'm not the best to judge, but i think the resource moderation team would've automatically classified it as API if it were to be