NBT Data

OMGPI supports NBT format. This means you can use strings like {SomeData:"Value"} and get "Value" from it by key SomeData.

To parse NBT string in OMGPI, use NBTParser. Doing NBTParser nbt = new NBTParser("{SomeData:"Value"}") and then nbt.getString("SomeData") will give you the "Value". To set values use nbt.setString("Key", "Value") (does not have to be String, look in OMGPI JavaDocs for more info).

If you have a compound in a compound, like {tag:{display:{Name:"Item Name"}}}, you can use NBTParser like a config: getString("tag.display.Name"). If you want to get tags from existing item, use NBTParser.getTagCompound(item). However, this will only give you the "tag" compound, since all outside tags arent stored anywhere. To set item's "tag" compound, use nbt.setTagCompound(item) - this will give you a copy of the item with tag changed.

To turn NBT into an item use parser.toItem(). This will create item based on "id", "Count", "tag" and more tags.

To set NBT of a block, use setTagCompound(block). This will set block based on "id", "data", and TileEntity (Chest, Furnace, etc.) tags. Getting NBT of a block is simple too - getTagCompound(block) - gives Parser with "id", "data", TileEntity tags and coords "x", "y", "z". If you want to save some blocks based on some location, before saving NBT to some file or somewhere else set coords to your liking.