commands
Commands
Use nbt command:
- /
powernbt ...
- /
pnbt ...
- /
nbt ...
Use nbt command in silent mode (without displaying a messages):
- /
powernbt. ...
- /
pnbt. ...
- /
nbt. ...
(command) (required param) (optional param)
Browse tags
You can browse nbt tree structure using this command:
object
- Object that contains NBT tag.
Examples:
/nbt inventory
- show items in your inventory as nbt list
/nbt block
- show nbt of target block
/nbt item
- show nbt tag of item in hand
query
(optional) - Query to view nested tags.
Examples:
/nbt block .
- empty query for block. Command is similar to /nbt block
/nbt me HealF
- show your health
/nbt *admin EnderItems[0].id
- show id of first item in admin's enderchest
view-mode
(optional) - View mode of tag
Edit tags
Set new value for nbt tag:
value
- New value of nbt tag
Value can be: number, string, hexadecimal value, color, array of numbers
Example:
/nbt me foodLevel = 20
- set your food level to full (20)
type
(optional in some cases) - Type of value
Type can be: any of nbt tag type
Type is required for numeric values. In other cases type is optional.
Example:
/nbt buffer foo = 12 float
- set new value (12 of type float) to tag "foo" in buffer compound
Set new value from other object:
object1
- Object to be changed
query1
(optional) - Value in object be changed (query)
object2
- Object whose value will be read
query2
(optional) - Query to get the specific value of object2
Examples:
/nbt $playerFile = *playerName
- save all tags of playerName to file playerFile.nbt
/nbt me HealF = $playerFile HealF
- set value of your health to stored in playerFile.nbt in tag "HealF"
Move value (cut and paste):
Value will be removed from object1 and set to object2
Swap values:
Values of the objects will be swapped
Example:
/nbt block Items <> me Inventory
- swap your inventory with targeted chest
Add value:
Add value to object1
Behavior is different for the following cases:
Object is number, value is number - increace number
Object is string - concatenate
Object is list or array, value is list or array - add all items from value to object
Object is compound and value is compound - add all entries from value to object
Example:
/nbt me HealF += 2
- Increace your hp by 2
/nbt me HealF += -2
- Decreace your hp by 2
Same as above, but value is read from object2
Insert value to special position
Insert value to object to special position
Object in left side must be an list or array.
Example:
before: item display.Lore = ["Lore1","Lore2","Lore3","Lore4"]
/nbt item display.Lore insert 2 "New Lore"
- insert "New lore" to position 2 in list
after: item display.Lore = ["Lore1","Lore2","New Lore","Lore3","Lore4"]
Same as above, but value is read from object2
Bitwise operations v0.8.2+
/nbt object1 query1 &= object2 query2
/nbt object1 query1 |= object2 query2
/nbt object1 query1 ^= object2 query2
/nbt object1 query1 inverse
/nbt object1 query1 inv
&= - bitwise AND
|= - bitwise OR
|= - bitwise XOR
inverse, inv - bitwise NOT
Examples:
/nbt item HideFlags |= b0000100
- hide "Unbreakable" display property in item
/nbt item HideFlags &= b1111110
- show "ench" display property in item
/nbt item HideFlags ^= b0000010
- toggle "AttributeModifiers" display property in item
Multiplication v0.8.2+
Multiply left value to right value.
All values must be a numbers
Rename tags
Rename tag:
Rename tag in compound to newName
Examples:
/nbt item a.b.c rename d
- same as /nbt item a.b.c >> item a.b.d
/nbt item display.Loer rename Lore
- example of typo
Remove tags
Remove tag
If query is not present, it will attempt to remove object
Examples:
/nbt item display remove
- remove all display attributes of item
/nbt $filename remove
- remove file filename.nbt
Buffer
Each player has his buffer (clipboard)
Copy value to buffer
Cut value to buffer
Paste value from buffer
Example:
/nbt me Inventory copy
- copy your inventory to buffer (clipboard)
/nbt buffer [0].tag.display.Name = "new Name of item"
- change value in buffer
/nbt me Inventory paste
- paste buffer back to your inventory
Variables
Each player has his set of variables (aliases)
/nbt %variable set object query
/nbt %variable set value type
/nbt object query as %variable
/nbt value type as %variable
After this command you can use a variable as if using the object
%variable
- Name of variable
Example:
//nbt %b set block
- set block as variable %b
//nbt block as %b
- set block as variable %b
//nbt %b Items
- Now you can use a variable %b as if you using a block
Spawn entities
v0.8.2+
Spawn entity by NBT tag:
/nbt object query spawn world
/nbt mojangson-value spawn world
world
- World where spawn entity
This parameter is optional for players and command blocks.
Required tags in left side to spawn entity:
id - entity Savegame ID
Pos - position of entity. List of double values
Examples:
/nbt {id:Pig,Pos:[1d,100d,2d],Riding:{id:MinecartRideable}} spawn world1
- spawn pig in minecart at position 1:100:2 in world world1
/nbt id123(Creeper) copy
- copy entity value to buffer
/nbt buffer Pos = me Pos
- change position stored in buffer to your position
/nbt buffer spawn
- spawn entity at your position
Debug mode
Enable or disable debug mode:
/nbt debug on|off
Object
Object is special container that can contains nbt tag.
Plugin can read tags from it, save, and remove container.
You can use these objects:
- me
you =) as player
- item, i
item in hand (only tagged items)
- block, b
block at the line of sight
- chunk v0.8.1+
chunk in player's position
- id<?>
entity with specified id. Example: id102
- x:y:z:world
block at position x:y:z in world
- chunk:x:z:world v0.8.1+
chunk at position x:z in world. Example: chunk:5:7:MainWorld
- buffer, c
your clipboard
*name
online player. Example: *Notch
- @name
offline player's .dat file. Example: @Notch
- %variable
variable. Example: %skeleton
- inventory, inv
your inventory. (alias for "me Inventory")
- hand, h v0.8.2+
Selected slot in your inventory. (alias for "me Inventory[n]")
- $name
file name.nbt in folder plugins/PowerNBT/nbt/
- $$name
compressed file name.nbtz in folder plugins/PowerNBT/nbt/ (inner Data tag)
- file:filename
file in minecraft folder.
Example: file:plugins\myplugin\file.dat
filename can be enclosed in quotes: file:"file:plugins/myplugin/file.dat
"
- gzip:filename
compressed file in minecraft folder.
- sch:schematicName, schematic:schematicName v0.8.2+
Get schematic file in folder plugins/WorldEdit/schematics/
/nbt sch:mySchematic TileEntities
- compound
create a new compound
- list
create a new list
- self, this
get object from left fide (or right side in some cases)
Examples:
/nbt item display.Lore[2] = this display.Name
/nbt me Inventory = this EnderItems
*
future object.
after this command you must select any block or entity or input new value to chat
Query
Query allows you to browse and select special tag in object.
Query is string containing tags, sepatated by "."
Examples:
Inventory[1].id
- id of second item in player inventory
display.Name
- item's name.
pages[0]
- first page of book
.
- root
Tag name can contains spaces and unicode characters.
In this case, enter the tag name in quotes:
forgeData."foo bar"[0]
forgeData."unicode\u2600".tag
forgeData.example."multi\nline"
View mode
View mode of nbt tag
- limit
Limit of display lines or chars
Examples:
/nbt me Inventory 10
- show first 10 items in inventory
/nbt item display.Name 100
- show first 100 characters of item name
- range
Show results from start range to end
Example:
/nbt me Inventory 10-20
- show items in inventory from 10 to 19
- full
Show all lines or full result
Example:
/nbt me . full
- hex
Show number or string in hex mode
Example:
/nbt item display.color hex
- show color of item in hex mode
You can combine hex mode with anyone else:
/nbt item display.Name 5-10,hex
- show 5-10 characters of item name in hex mode
Default view mode: Show only first 20 values, numbers as decimal
Value
In some commands you can specify new value for tag. But in some cases you also must specify a type.
Value can be
"string"
string must be enclosed in quotes.
supported java-like escaping by char "\"
escaping features:
"\c" - Translate to COLOR_CHAR §
"&" - Translate to COLOR_CHAR §
"\&" - Translate to &
type is not required (type is string by default)
Example: /nbt item display.Name = "\cbItem name"
- numeric value
if the previous object already contains a value - type is optional
available types: byte, short, int, long, float, double
Examples:
/nbt me Health = 100500
/nbt buffer NewValue = 18 int
- #hexadecimal
default type is int, but you can specify other type
available types: byte, short, int, long, float, double
Example: /nbt item display.color = #FF0000 (red)
- binary
Binary value, starting by "b"
default type is int, but you can specify other type
available types: byte, short, int, long, float, double
Example: /nbt item HideFlags = b101 - hide display properties for "ench" and "Unbreakable"
- color
color contains an integer value
colors: black red green brown blue purple cyan lightgray gray pink lime lightgreen yellow lightblue magenta orange white
Example: /nbt item display.color = red
- on, true
aliases for "1 byte"
- off, false
aliases for "0 byte"
- int[], byte[]
new empty array
- [list of values]
values separated by ","
if the previous object already contains a value - type is not required
available types: byte[], int[]
Example: /nbt buffer myByteArray = [1,2,3,10] byte[]
- mojangson v0.8.2+
Create nbt object from string in mojangson format
Spaces in tag names are not allowed
Example: /nbt item = {display:{Name:"New item name"}}
See http://minecraft.gamepedia.com/Tutorials/Command_NBT_Tags
Type
Available nbt types:
byte, short, int, long, float, double, byte[], int[], string
Future object
Future object - is object that you can specify later
Example, set fire ticks:
/nbt * Fire = 1000
- waiting for future object
~ select entity by right-click
~ selected entity begins to burn
Example, set variable:
/nbt %var select
- waiting for future object
~ select entity or block by right-click
~ selected object is stored in variable %var
The example: /nbt {id:Pig,Pos:[1d,100d,2d],Riding:{id:MinecartRideable}} spawn world1
doesn't work. It gives a "no nbt object {id:Pig,Pos:[1d,100d,2d],Riding:{id:MinecartRideable}}" error. Is there another way to do it properly?
@rubenvde json data is available since v0.8.2
update to latest version: https://www.spigotmc.org/resources/powernbt.9098/