PowerNBT 0.8.9.2

Powerful NBT editor, NBT API

  1. DPOH-VAR
    [PowerNBT]
    ppn.png
    Command-based in-game NBT editor

    Features:
    • Browsing and editing NBT tags
    • supports items, players, offline-players, entities, blocks, chunks, schematic files and all other nbt files
    • save tags to files
    • spawn entity with custom nbt tags
    • parse mojangson string
    • custom colors and unicode symbols
    • supports tab-completion
    • supports operations copy/paste/cut/swap
    • supports variables
    Examples:
    • /nbt me Inventory remove - clear inventory
    • /nbt me Inventory = *Bob EnderItems - get Bob's enderchest to yourself
    • /nbt @Eve remove - remove file Eve.dat (offline player)
    • /nbt block ExtraType = "Notch" - set skull owner
    • /nbt * Health = 1000 - set 1000 health to mob, which you select
    • /nbt item ench copy - copy item enchantments to buffer
    • /nbt item ench paste - paste enchantments to other item
    Permissions:
    • powernbt.use
    Use nbt command:
    /powernbt ...
    /pnbt ...
    /nbt ...


    Use nbt command in silent mode:
    /powernbt. ...
    /pnbt. ...
    /nbt. ...

    (command) (required param) (optional param)

    Browse tags

    You can browse nbt tree structure using this command:
    /nbt object query view-mode

    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:
    /nbt object query = value type
    /nbt value type > object query


    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 for nbt tag from other object:
    /nbt object1 query1 = object2 query2
    /nbt object1 query1 < object2 query2
    /nbt object2 query2 > object1 query1


    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):
    /nbt object1 query1 >> object2 query2
    /nbt object2 query2 << object1 query1

    Value will be removed from object1 and set to object2

    Swap values:
    /nbt object1 query1 <> object2 query2
    /nbt object1 query1 swap object2 query2

    Values of the objects will be swapped
    Example:
    /nbt block Items <> me Inventory - swap your inventory with targeted chest

    Add value:
    /nbt object1 query1 add value
    /nbt object1 query1 add object2 query2
    /nbt object1 query1 += value

    /nbt object1 query1 += object2 query2

    Add value to object1
    Behavior is different for the following cases:
    Object1 is number, value is number - increace number
    Object1 is string - concatenate
    Object1 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
    Examples:
    /nbt me HealF += 2 - Increace your hp by 2
    /nbt me HealF += -2 - Decreace your hp by 2
    /nbt item display.Name += "(tool)" - add text to item name

    Insert value to special position
    /nbt object1 query1 insert position value type
    /nbt object1 query1 ins position value type
    /nbt object1 query1 insert position object2 query2
    /nbt object1 query1 ins position object2 query2

    Insert value to object to special position Object1 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"]

    Bitwise operations
    /nbt object1 query1 &= object2 query2
    /nbt object1 query1 |= object2 query2
    /nbt object1 query1 ^= object2 query2
    /nbt object1 query1 &= value type
    /nbt object1 query1 |= value type
    /nbt object1 query1 ^= value type
    /nbt object1 query1 inverse
    /nbt object1 query1 inv
    /nbt object1 query1 ~

    &= - bitwise AND
    |= - bitwise OR
    |= - bitwise XOR
    ~ - 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
    /nbt object1 query1 *= object2 query2
    /nbt object1 query1 *= value type

    Multiply left value to right value.
    All values must be a numbers

    Rename tags

    Rename tag:
    /nbt object query1 rename newName
    /nbt object query1 ren newName

    Rename tag in compound to newName

    Remove tags

    Remove tag
    /nbt object query remove
    /nbt
    object query rem

    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

    Copy value to buffer
    /nbt object query copy
    /nbt
    value type copy


    Cut value to buffer
    /nbt object query cut


    Paste value from buffer
    /nbt object query paste


    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

    Set variable
    /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

    Spawn entity by NBT tag:
    /nbt object query spawn world
    /nbt mojangsonValue spawn world

    world - World where spawn entity. Required for executing from console.
    Required tags in left side to spawn entity:
    id - entity Savegame ID
    Pos - position of entity. List of doubles

    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
    /nbt debug 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 - 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 - chunk at position x:z in world.
    Example: chunk:5:7:MainWorld
    buffer, c - your clipboard
    *name - online player.
    Example: *Notch.
    Using in command blocks: *" @p "
    @nаme - offline player's .dat file.
    Example: @Notch
    . Using in command blocks: @" @p "
    %variable - defined variable. Example: %skeleton
    inventory, inv - your inventory. (alias for "me Inventory")
    hand, h - Selected slot in your inventory. (alias for "me Inventory[n]")
    hand:рlayer, h:рlayer - Selected slot in inventory of player.
    Example: h:Notch
    Using in command blocks: h:" @p "
    $name - file name.nbt in folder plugins/PowerNBT/nbt/
    $$name - compressed file name.nbtz in folder plugins/PowerNBT/nbt/
    file:filename - file in minecraft folder.
    Example: file:plugins\myplugin\file.dat
    filename can be enclosed in quotes: file:"plugins/myplugin/file.dat"
    gzip:filename - compressed file in minecraft folder.
    sch:schematicName, schematic:schematicName - Get schematic file in plugins/WorldEdit/schematics/
    /nbt sch:mySchematic TileEntities
    compound - create a new empty compound
    list - create a new empty 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

    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 color

    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 - 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
    and selected entity begins to burn

    Example, set variable:
    /nbt %var select - waiting for future object
    => select entity or block by right-click
    and selected object is stored in variable %var
    Javadoc: http://dpoh-var.github.io/PowerNBT/apidocs/


    NBTManager has methods to read and write NBT tags
    Code (Java):
    NBTManager manager = PowerNBT.getApi();
    simple useless example:
    Code (Java):
    NBTCompound playerData = manager.read(player);
    float health = (Float) playerData.get("HealF");
    if (health>15) playerData.put("HealF",(float)5);
    manager.write(player, playerData);
    NBTManager can:
    • read tags of entities, blocks, files, items,
    • read nbt from inputstream and datainput,
    • save nbt to outputstream and dataoutput,
    • compress nbt and save to outputstream or file
    • read compressed nbt
    • read forge data of entity and save
    • read offline player's .dat file and save
    • parse mojangson string to nbt

    this class represents net.minecraft.server.NBTTagCompound
    You can work with nbt as with lazy java.util.Map<String,Object>
    The changes are immediately applied to the original NBTTagCompound
    but NBTCompound has extra methods: getByte(), getShort(), getString(), etc..

    Difference from java.util.Map
    NBTCompound can contains only values of types:
    Byte, Short, Integer, Long, Float, Double, byte[], String, NBTList, NBTCompound, int[]
    But you can put to compound any value that can be converted to types above
    Boolean will be converted to Byte (0, 1),
    java.util.Collection and Object[] will be converted to NBTList,
    java.util.Map will be converted to NBTCompound
    Methods which add items into compound creates a copy of tag:
    See example:
    Code (Java):
    NBTCompound cmp = new NBTCompound(); // cmp = {}
    NBTCompound cmp2 = new NBTCompound(); // cmp2 = {}
    cmp.put("cmp2",cmp2);  // put to cmp a copy of cmp2
    cmp2.put("foo","bar"); // cmp2 = {foo:bar}
    cmp,get("cmp2"); // returns empty compound
    NBTCompound can not contain cross-references,
    Example:
    Code (Java):
    NBTCompound cmp = new NBTCompound(); // cmp = {}
    cmp.put("foo","bar"); // cmp = {foo:bar}
    cmp.put("cmp",cmp);  // put to cmp a copy of self
    System.out.println(cmp); // {foo:bar, cmp:{foo:bar}}
    NBTCompound can not contain empty keys or values:
    Example:
    Code (Java):
    NBTCompound cmp = new NBTCompound(); // cmp = {}
    cmp.put("foo","bar"); // add pair foo:bar
    System.out.println(cmp); // {foo:bar}
    cmp.put("foo",null);  // remove foo
    assert !cmp.containsKey("foo"); // now cmp is empty

    Convert NBTCompound to java.util.Map

    Code (Java):
    TreeMap<String,Object> treeMap = compound.toMap(new TreeMap<>());
    HashMap<String,Object> hashMap = compound.toHashMap();
    now treeMap and hashMap contains only java Values:
    Byte, Short, Integer, Long, Float, Double, byte[], String, List, Map, int[]

    Convert java.util.Map to NBTCompound
    Code (Java):
    NBTCompound compound = new NBTCompound(map); // it's easy, right?
    But be sure, that map does not contain cross-references!


    this class represents net.minecraft.server.NBTTagList
    you can work with nbt list as with lazy java.util.List<Object>

    Difference from java.util.List
    NBTList can contains only values of types:
    Byte, Short, Integer, Long, Float, Double, byte[], String, NBTList, NBTCompound, int[]
    But you can put to compound any value that can be converted to types above
    Boolean will be converted to Byte (0, 1),
    java.util.Collection and Object[] will be converted to NBTList,
    java.util.Map will be converted to NBTCompound
    Methods which add items into list creates a copy of tag:
    See example:
    Code (Java):
    NBTList list = new NBTList(); // []
    NBTList list2 = new NBTList(Arrays.asList(1,2,3)); // [1, 2, 3]
    list.add(list2);  // add a copy of list2 to list
    list2.clear(); // list2 = []
    System.out.print("list"); // [[1, 2, 3]]
    list2 = list.get(0); // Now list2 refers to a inner list
    list2.clear();
    System.out.print("list"); // [[]]
    NBTList can not contain cross-references:
    Example:
    Code (Java):
    NBTList list = new NBTList(); // list = []
    list.add(list); // list = [[]]
    list.add(list); // list = [[], [[]]]
    NBTList can not contain empty values:
    Example:
    Code (Java):
    NBTList list = new NBTList(Arrays.asList(1,2,3)); // [1, 2, 3]
    list.add(null); // do nothing
    System.out.println(list); // [1, 2, 3]
    list.set(1,null); // remove element in index 1
    System.out.println(list); // [1, 3]
    NBTList must contain elements of the same type.
    In most cases, it will try to convert your value.
    See Tag Type in NBT Format
    Example:
    Code (Java):
    NBTList list = new NBTList(); // list.getType() == 0
    // when type is 0 you can put to list any values
    list.add( (short) 10 ); // list.getType() == 2
    // type is 2. List can contain shorts only
    list.add( 76543 ); // convert 76543 to short and add to list
    System.out.println(list); // [10, 11007]
    list.clear(); // now list.getType() == 0 again
    list.add(new ArrayList); // now list.getType() == 9
    list.add("some String"); // NBTConvertException: can't convert String to NBT type 9
    Convert NBTList to java.util.Collection
    Code (Java):
    HashSet<Object> set = nbtList.toCollection(new HashSet<Object>());
    ArrayList<Object> list = nbtList.toArrayList();
    now set and list contains only java Values:
    Byte, Short, Integer, Long, Float, Double, byte[], String, List, Map, int[]

    Convert java.util.Collection to NBTList
    Code (Java):
    NBTList list = new NBTList(collection);
    But be sure, that collection does not contain cross-references!

    Maven

    Code (XML):
        <repositories>
            <!-- ... -->
            <repository>
                <id>varscript.ru-releases</id>
                <name>varscript.ru-releases</name>
                <url>https://repo.varscript.ru/release</url>
            </repository>
            <repository>
                <id>varscript.ru-snapshots</id>
                <name>varscript.ru-snapshots</name>
                <url>https://repo.varscript.ru/snapshots</url>
            </repository>
        </repositories>

        <dependencies>
            <!-- ... -->
            <dependency>
                <groupId>me.dpohvar.powernbt</groupId>
                <artifactId>PowerNBT</artifactId>
                <version>0.8.1</version>
            </dependency>
        </dependencies>
    If you have problems when downloading dependencies
    try to replace https to http in repository url

    NBT format:
    Sources:
    Repository:

Recent Updates

  1. 0.8.9.2 fix for older spigot versions
  2. 0.8.9
  3. update to spigot 1.12

Recent Reviews

  1. FunnyGameNS
  2. CoolJWB
    CoolJWB
    5/5,
    Version: 0.8.9.2
    Really awesome plugin!
    It features a large variety of different NBT modification ways, while also being simplistic and helpful.

    Too bad it seems to be discontinued :(
  3. mr_coffee
    mr_coffee
    5/5,
    Version: 0.8.9.2
    This is a superb plugin really hope it updates for 1.13 soon! Very fast and easy to use.
  4. BrunoAvixdubSB
    BrunoAvixdubSB
    1/5,
    Version: 0.8.9.2
    dont work support 1.13.2 .
  5. symvizan
    symvizan
    5/5,
    Version: 0.8.9.2
    This is really the best NBT Editor plugin. If there was such a thing as a NotCrapware award, it would defenetly win it!
  6. DrOreo002
    DrOreo002
    5/5,
    Version: 0.8.9
    This is the best plugin for developers :D.
    Easy to use and easy to understand!, thanks for making this plugin!
  7. Perzan
    Perzan
    5/5,
    Version: 0.8.9
    Really flexible plugin and is worth learning. You can do almost anything with this plugin.
  8. Vert3x
    Vert3x
    5/5,
    Version: 0.8.9
    Awesome, lightweight (at least for me), free and well designed plugin. Can't avoid using it.
  9. Blutkrone
    Blutkrone
    5/5,
    Version: 0.8.8
    Its a super useful thing, probably the best NBT API out there. Would've been even more awesome if you included the javadocs internally, some IDE's (IDEA for example) allow you to simply go to the method declaration with a click on the mousewheel - making reading the docs a lot less of a hassle.

    Anyway, a hint for everyone: Dont try to store information on something that didnt have the meta set - itll throw a NPE.
  10. Remixful
    Remixful
    5/5,
    Version: 0.8.7
    This is an amazing plugin and API. My project heavily depends on this and it has made NBT editing much easier. So far I have had no issues. Thank you so much for this beautiful plugin.