Skip to content

NBT Pretty Printing

Shane Bee edited this page May 30, 2024 · 2 revisions

Find NBT compounds really hard to read when you send to player and/or console?
For example, here is what printing the NBT of an item would look like:
Screenshot 2024-05-29 at 11 31 55 PM

EEEK... that is so hard to read.

So let's throw in some pretty printing.
Syntax:

pretty nbt (of|from) %nbtcompounds/strings%

Examples:

set {_p} to pretty nbt of {_nbt} 
send pretty nbt from {_nbt} to console
send "NBT: %pretty nbt from {_nbt}%" to player

How it looks:
Screenshot 2024-05-29 at 11 31 01 PM

ooOOoo that looks nicer.

Wanna take it another step further? Well, we can use pretty printing with a split. This splits the string into a format similar to JSON pretty printing.
Syntax:

pretty nbt (of|from) %nbtcompounds/strings% (with|using) split %string%

For the string part, simply choose what you want to split with. This can be 1 space, 2 spaces, a hyphen, whatever.
Examples:

set {_p} to pretty nbt of {_nbt} with split " "
send pretty nbt from {_nbt} with split "==" to console
send "NBT: %pretty nbt from {_nbt} with split "" ""%" to player

How it looks:
Screenshot 2024-05-29 at 11 29 34 PM
Oh.... now that's just fancy shmancy!!

Clone this wiki locally