NBTParse Documentation Release 0.2.0.dev0 Kevin Norris February 11, 2015 Contents 1 API Reference 1.1 nbtparse Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 exceptions Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Subpackages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 4 4 2 Indices and tables 53 Python Module Index 55 i ii NBTParse Documentation, Release 0.2.0.dev0 NBTParse is a set of tools for working with Named Binary Tags, the data format used by Minecraft. The project is still under active development and many things don’t quite work right. Watch this space! Contents: Contents 1 NBTParse Documentation, Release 0.2.0.dev0 2 Contents CHAPTER 1 API Reference Contents • nbtparse Package • exceptions Module • Subpackages 1.1 nbtparse Package Named Binary Tag manipulation tools. This package contains various utilities for manipulating NBT-formatted data. NBT is used by Minecraft to store a variety of data and metadata. • syntax contains modules relating to low-level NBT syntax. • semantics contains modules relating to intermediate-level constructs. • minecraft contains modules directly relating to Minecraft’s file and data structures. NBTParse logs to loggers with the same names as its modules and packages. You can therefore control logging for the entire package via the NBTParse root logger: nbtparse_root_logger = logging.getLogger('nbtparse') By default (as of Python 3.4), the logging package will emit warnings and more severe logged events on sys.stderr, while dropping less severe events. Consult the logging documentation if you wish to override this behavior. nbtparse.__version__ = ‘0.3.0.dev0’ The version number string for NBTParse, or None if version information is not available. The numbering scheme is strictly compatible with PEP 440 and loosely compatible with Semantic Versioning, allowing some deviations from the latter to satisfy the former. Strictly speaking, NBTParse does not comply with SemVer at all, and the above link is at best misleading. This results from SemVer’s heavy use of the MUST keyword. Note: As a matter of policy, this value ends in .dev0 on the trunk. Since the version number is not changed from one commit to the next, trunk snapshots may appear to have the same version number even if they are materially different. Such snapshots are not official releases. 3 NBTParse Documentation, Release 0.2.0.dev0 1.2 exceptions Module exception nbtparse.exceptions.ClassWarning Bases: builtins.UserWarning Warning issued when a class definition is dubious. exception nbtparse.exceptions.ConcurrentError Bases: builtins.Exception Exception raised when concurrent operations conflict. NBTParse is generally not thread-safe. These exceptions are usually only raised in response to process-level concurrency (e.g. while interacting with the filesystem). Thread safety violations may cause this exception to be raised, but you should not depend on this behavior. exception nbtparse.exceptions.IncompleteSequenceError Bases: nbtparse.exceptions.MalformedNBTError Raised if a sequence is incomplete (i.e. we hit EOF too early). exception nbtparse.exceptions.MalformedNBTError Bases: builtins.Exception Base class of all exceptions caused by malformed or invalid NBT. NBT does not provide any easy method to recover from this sort of error. The source file’s offset pointer is not reset, because it might not be possible to do so. If you want to seek back to the beginning, do so manually. exception nbtparse.exceptions.NoSuchTagTypeError Bases: nbtparse.exceptions.MalformedNBTError Raised if an unrecognized tag type is used. exception nbtparse.exceptions.ParserError Bases: builtins.Exception Exception raised by minecraft.ids.read_config(). Raised if the config file is ill-formed. exception nbtparse.exceptions.SliceWarning Bases: builtins.UserWarning Warning issued when using dubious slicing syntax. exception nbtparse.exceptions.ValueWarning Bases: builtins.UserWarning Warning issued when passing dubious values. 1.3 Subpackages 1.3.1 minecraft Package 4 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 Contents • • • • • • • • • minecraft Package entity Module entityfactory Module ids Module item Module level Module mobs Module projectile Module Subpackages minecraft Package Minecraft-related NBTParse modules. The modules in this package all relate to high-level files and data structures. For instance, nbtparse.minecraft.level contains the LevelFile class, which can read and write the level.dat file in a standard Minecraft save. entity Module Classes for Minecraft entities. nbtparse.minecraft.entity.CoordinateField Field for a TAG_List of coordinates. Pythonic equivalent is a tuple with two or three elements depending on whether or not Y is included. Elements may be ints or floats depending on the underlying datatype. class nbtparse.minecraft.entity.Entity(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject A Minecraft entity. Subclasses of Entity may be declared with an extra parameter like this: class Foo(Entity, id='Foo'): pass Such subclasses have an ID field attached to them automatically, with an appropriate default value. Entities are hashable and compare equal if they have the same UUID (and the same type()). air_ticks How much longer until this entity begins to drown. Starts at 300 when above water and goes down when underwater. At zero, lose 1 health per second. dimension Which dimension we’re in. Note: This information is stored elsewhere; it is not known why Minecraft stores it here as well. fall_distance Distance this entity has fallen. 1.3. Subpackages 5 NBTParse Documentation, Release 0.2.0.dev0 Farther distances will result in greater fall damage on landing. fire_ticks How much longer this entity will be aflame. Equal to -1 if not on fire. Larger negative values make it temporarily fireproof. id What kind of entity this is. entityfactory can use this to create subclasses of Entity automatically. invulnerable Whether entity is immune to all damage. Also applies to nonliving entities. motion Velocity at which this entity is moving. Stored as an (x, y, z) tuple. mount NBTObject field called Riding on_ground Whether this entity is touching the ground. portal_cooldown Number of ticks until this entity passes through a portal. Starts at 900 and counts down when in a portal. Switch dimensions at zero. pos Position of this entity, in (x, y, z) form. Values may be fractional. rotation Rotation of this entity. Stored as (yaw, pitch). Roll is not supported. uuid Universally unique identifier for this entity. Should be unique across every Minecraft world. Cannot be changed once the entity is constructed. Creating a new entity will set this to a new UUID. If it is necessary to initialize this field, you may modify _uuid instead. This field is a wrapper for that value. As the name suggests, it must not be modified outside __init__(). Since the UUID is used in calculating the hash(), violating this rule is a Bad Idea. class nbtparse.minecraft.entity.EntityMeta(name, bases, dct, *args, id=None, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTMeta Metaclass for entities. The ID of the entity should be passed as a class keyword argument called id, as follows: class FooEntity(Entity, id='foo'): pass This will create a top-level field with the given string as its default value, for the entity’s ID. If no ID is specified this way, you are responsible for creating the field yourself. If the class neither creates an ID field nor passes an 6 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 ID keyword argument, it cannot be instantiated. This may be done deliberately, typically on abstract classes that aren’t meant to be instantiated. Although ID fields are subject to inheritance like any other, inheriting them doesn’t count for the purposes of this rule. entityfactory Module Module for producing entity.Entity instances. nbtparse.minecraft.entityfactory.from_nbt(nbt: nbtparse.syntax.tags.CompoundTag, *, default_class: nbtparse.semantics.nbtobject.NBTMeta=<class ‘nbtparse.minecraft.entity.Entity’>) → nbtparse.semantics.nbtobject.NBTObject Factory function for making entities and tile entities from raw NBT. Uses appropriate subclasses (usually of Entity and TileEntity) where necessary. The choice of subclass is made via the ids module, and may be altered by registering a custom namespace or re-registering a custom version of the standard namespace. Tries to defend against invalid input. If there is no ID or the ID is unrecognized, a warning will be logged on the module’s logger, and a plain instance of default_class is returned instead. ids Module Module for looking up blocks, items, entities, etc. by name or number. Lookups are performed via all_ids; the rest of the section documents the objects returned by it and how to manage the available namespaces. nbtparse.minecraft.ids.ALLOWED_TYPES = frozenset({‘item’, ‘entity’, ‘block’}) The different types of identifiers allowed class nbtparse.minecraft.ids.BlockID(*, name: str=None, block_number: int=None, item_id: nbtparse.minecraft.ids.ItemID, light: int=0, transparent: bool=False, opacity: int=None, physics: bool=False) Bases: nbtparse.minecraft.ids.Named Information about a block ID. block_number The number used internally when storing this block in terrain. item_id The ItemID for the item version of this block. light The amount of light this block emits. opacity The amount of light this block impedes. None if transparent is False. physics True if this block falls by itself. renumber(new_id: str) → ‘BlockID’ Duplicate this block ID with a different number 1.3. Subpackages 7 NBTParse Documentation, Release 0.2.0.dev0 transparent Whether this block is transparent. type Always equal to ‘block’. class nbtparse.minecraft.ids.ClassID(*args, name=None, **kwargs) Bases: nbtparse.minecraft.ids.Named Abstract class for IDs which identify NBT objects. resolve_class() → nbtparse.semantics.nbtobject.NBTMeta Returns a subclass of NBTObject. The subclass is suitable for objects with this ID. This may involve importing the class from another module if it is not already imported. class nbtparse.minecraft.ids.EntityID(class_name: str) Bases: nbtparse.minecraft.ids.ClassID Information about a (tile) entity ID. class_name The fully-qualified name of this (tile) entity’s class. Formatted as follows: some.module.name:SomeClassName resolve_class() → nbtparse.semantics.nbtobject.NBTMeta Returns the class used to create instances of this (tile) entity. This may involve importing the class. type Always equal to ‘entity’. class nbtparse.minecraft.ids.ItemID(*, name: str=None, max_stack: int=64) Bases: nbtparse.minecraft.ids.ClassID Information about an item ID. max_stack How large stacks of this item may get. resolve_class() → nbtparse.semantics.nbtobject.NBTMeta Return Item. type Always equal to ‘item’. class nbtparse.minecraft.ids.Named(*args, name=None, **kwargs) Bases: builtins.object Root of the ID hierarchy; all IDs have names. name The name of this ID, or None if no name was specified. Named objects are renamed when placed into a namespace. rename(new_name: str) → ‘Named’ Duplicate this named object with a different name. 8 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 class nbtparse.minecraft.ids.Namespace(contents: {<class ‘str’>: <class ‘nbtparse.minecraft.ids.Named’>}, numericals: {<class ‘int’>: <class ‘str’>}) Bases: collections.abc.Mapping A Minecraft namespace. Namespaces associate block names and numbers with each other, and store additional information about blocks, items, and entities. A namespace maps names and numbers to instances of the various FooID classes defined in the ids module. Iterating over a namespace will only produce the names, since every numbered block also has a name. nbtparse.minecraft.ids.STANDARD_NAMESPACE_NAME = ‘minecraft’ The name of the “standard” namespace, containing ID’s used by vanilla Minecraft nbtparse.minecraft.ids.all_ids = <all_ids: mapping from strings to identifiers> Mapping from ‘namespace:identifier’ strings to Named objects. The primary interface to the ids module. Use like a dictionary: all_ids['minecraft:stone'] Indexing with a number produces the corresponding block: all_ids['minecraft:1'] Indexing without a namespace will search every registered namespace in reverse order of registration (i.e. most recently registered first): all_ids['stone'] Bare integers may also be looked up: all_ids[1] nbtparse.minecraft.ids.get_namespace(name: str) → nbtparse.minecraft.ids.Namespace Produce the block namespace with the given name. Namespaces are immutable, so you should not use this mechanism to alter a namespace in-place. Instead, re-register the modified version of the namespace with register_namespace(). Raises a KeyError if no such namespace exists. nbtparse.minecraft.ids.main() Run this module as a script. nbtparse.minecraft.ids.read_config(infile: io.TextIOBase) parse.minecraft.ids.Namespace Read a configuration file and produce a namespace dictionary. → nbt- Return a suitable argument to register_namespace(). Config file format is simple JSON, encoded in UTF-8: { "stone": { "id": 1, "item_identifier": { "id": 1, "item_identifier": null, "max_stack": 64, "type": "item" } 1.3. Subpackages 9 NBTParse Documentation, Release 0.2.0.dev0 "light": 0, "opacity": null, "transparent": false, "type": "block" } } Null values may be omitted, except that id and type are mandatory and must not be null. If the above format is not followed or the file is invalid JSON, a ParserError is raised. nbtparse.minecraft.ids.register_namespace(name: str, namespace: parse.minecraft.ids.Namespace) Register a new namespace of ID’s. nbt- You may register a new version of the standard namespace (’minecraft’). Doing so will “hide” the official version. You can always unregister your custom version later, and the official version will be automatically re-registered. nbtparse.minecraft.ids.unregister_namespace(name: str) Remove the given namespace, preventing lookups. Attempting to unregister the standard namespace (i.e. ’minecraft’) will automatically re-register the “default” version of the standard namespace. nbtparse.minecraft.ids.write_config(outfile: io.TextIOBase, namespace: parse.minecraft.ids.Namespace, *, pprint=False) Write a configuration file. nbt- Use a format suitable for read_config(). Nulls are omitted. item Module Classes for items and XP orbs. class nbtparse.minecraft.item.DroppedItem(*args, **kwargs) Bases: nbtparse.minecraft.item.ItemEntity An item dropped on the ground. id Usually equal to ‘Item’ item NBTObject field called Item class nbtparse.minecraft.item.Item(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject An inventory item. Not an entity; only stores item-related information. count byte field called Count damage short integer field called Damage id string (unicode) field called id 10 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 slot byte field called Slot class nbtparse.minecraft.item.ItemEntity(*args, **kwargs) Bases: nbtparse.minecraft.entity.Entity Superclass of dropped item and XP orbs. age short integer field called Age health short integer field called Health class nbtparse.minecraft.item.XPOrb(*args, **kwargs) Bases: nbtparse.minecraft.item.ItemEntity An experience orb. id Usually equal to ‘XPOrb’ value short integer field called Value level Module class nbtparse.minecraft.level.LevelFile(*args, **kwargs) Bases: nbtparse.semantics.filetype.GzippedNBTFile Represents a level.dat file. cheats Whether cheats are enabled. features Whether or not structures are generated. game_type The game mode. generator The name of the generator used to create the level. Note: This is not a vanity field. Minecraft uses it to decide how to populate empty chunks. Putting an arbitrary string here may cause problems generator_options Custom superflat settings. Empty for other generators. generator_version Version number of the generator. hardcore Whether hardcore mode is enabled. initialized Whether world has undergone “running initial simulation...” 1.3. Subpackages 11 NBTParse Documentation, Release 0.2.0.dev0 last_played Time (in UTC) when level was last loaded. name The name of the level. player The player. May not exist in multiplayer. static prepare_load(nbt: nbtparse.syntax.tags.CompoundTag) parse.syntax.tags.CompoundTag Unwrap the argument. → nbt- static prepare_save(nbt: nbtparse.syntax.tags.CompoundTag) parse.syntax.tags.CompoundTag Wrap the argument in a singleton CompoundTag. → nbt- rain_time Number of ticks until raining changes. raining Whether rain and snow are falling on the level. rules Level custom rules. seed Seed for the world generator. size Estimated size of the level on disk. Currently ignored by Minecraft. spawn Coordinates of the level’s spawn. thunder_time Number of ticks until thundering changes. thundering Whether a lightning storm is happening. ticks Age of the level in ticks. time_of_day Age in the level in thousandths of in-game hours. version The NBT version of this level; should be 19133. class nbtparse.minecraft.level.Rules(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject Class representing a collection of game rules. Part of a typical level. command_block_output Field called commandBlockOutput 12 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 do_fire_tick Field called doFireTick do_mob_loot Field called doMobLoot do_mob_spawning Field called doMobSpawning do_tile_drops Field called doTileDrops keep_inventory Field called keepInventory mob_griefing Field called mobGriefing nbtparse.minecraft.level.StringBooleanField Represents a boolean stored in a TAG_String (‘true’ or ‘false’). mobs Module All the mobs in vanilla minecraft. class nbtparse.minecraft.mobs.Abilities(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject A set of abilities for a player. fly_speed floating point field called flySpeed flying boolean field called flying instabuild boolean field called instabuild invulnerable boolean field called invulnerable may_build boolean field called mayBuild may_fly boolean field called mayfly walk_speed floating point field called walkSpeed class nbtparse.minecraft.mobs.Attribute(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject An attribute, usually attached to a mob. base floating point (high precision) field called Base modifiers list field called Modifiers 1.3. Subpackages 13 NBTParse Documentation, Release 0.2.0.dev0 name string (unicode) field called Name class nbtparse.minecraft.mobs.Bat(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A bat. A small flying mob. Drops nothing. hanging boolean field called BatFlags id Usually equal to ‘Bat’ class nbtparse.minecraft.mobs.Blaze(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A blaze. Flying ranged mob that shoots fire. id Usually equal to ‘Blaze’ class nbtparse.minecraft.mobs.Breedable(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A mob which can be bred. age integer field called Age in_love integer field called InLove class nbtparse.minecraft.mobs.CaveSpider(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A cave spider. A small poisonous spider. id Usually equal to ‘CaveSpider’ class nbtparse.minecraft.mobs.Chicken(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Breedable A chicken. Small mob. Lays eggs and drops feathers. id Usually equal to ‘Chicken’ class nbtparse.minecraft.mobs.Cow(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Breedable A cow. Large mob. Produces milk. Drops leather and beef. id Usually equal to ‘Cow’ 14 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 class nbtparse.minecraft.mobs.Creeper(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob The infamous creeper. A 2-block tall hostile mob with an explosive attack that destroys blocks. explosion_radius byte field called ExplosionRadius fuse short integer field called Fuse id Usually equal to ‘Creeper’ powered boolean field called powered class nbtparse.minecraft.mobs.EnderDragon(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob The Ender Dragon. The final boss. id Usually equal to ‘EnderDragon’ class nbtparse.minecraft.mobs.Enderman(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob An enderman. Endermen are 3-block tall neutral mobs that can carry blocks around. carried short integer field called carried carried_data short integer field called carriedData id Usually equal to ‘Enderman’ class nbtparse.minecraft.mobs.Ghast(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A ghast. A large floating mob that shoots fireballs and breaks blocks. id Usually equal to ‘Ghast’ class nbtparse.minecraft.mobs.Giant(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A giant. A very large zombie. Doesn’t spawn naturally. id Usually equal to ‘Giant’ 1.3. Subpackages 15 NBTParse Documentation, Release 0.2.0.dev0 nbtparse.minecraft.mobs.HealthField A field for a mob’s health. class nbtparse.minecraft.mobs.Horse(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Breedable A horse. A tall rideable mob. armor NBTObject field called ArmorItem bred boolean field called Bred chested boolean field called ChestedHorse eating boolean field called EatingHaystack has_reproduced boolean field called HasReproduced id Usually equal to ‘EntityHorse’ items list field called Items owner_name string (unicode) field called OwnerName saddle NBTObject field called SaddleItem tame boolean field called Tame temper integer field called Temper type Field called Type variant integer field called Variant class nbtparse.minecraft.mobs.HorseType Bases: enum.Enum The valid values for Horse.type. donkey = None Indicates a donkey. horse = None Indicates a regular horse. mule = None Indicates a mule. skeleton = None Indicates a skeleton horse; not naturally spawned. 16 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 zombie = None Indicates a zombie horse; not naturally spawned. class nbtparse.minecraft.mobs.IronGolem(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob An iron golem. A large defensive mob that also spawns naturally to protect villages. id Usually equal to ‘VillagerGolem’ player_created boolean field called PlayerCreated class nbtparse.minecraft.mobs.Leash(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject A leash for a mob. Only represents one “end” of the leash Exactly one of uuid and coords should exist. coords Multi-field combining (‘X’, ‘Y’, ‘Z’) uuid Universally unique identifier field split between UUIDMost and UUIDLeast class nbtparse.minecraft.mobs.MagmaCube(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Slime A magma cube. A slime from The Nether. id Usually equal to ‘LavaSlime’ class nbtparse.minecraft.mobs.Mob(*args, **kwargs) Bases: nbtparse.minecraft.entity.Entity A mob, in minecraft terms. Do not instantiate directly, instead use a subclass. absorption floating point field called AbsorptionAmount active_effects list field called ActiveEffects attack_ticks short integer field called AttackTime attributes list field called Attributes can_pickup_loot boolean field called CanPickUpLoot death_ticks short integer field called DeathTime 1.3. Subpackages 17 NBTParse Documentation, Release 0.2.0.dev0 drop_chances tuple field called DropChances equipment tuple field called Equipment health Multi-field combining (‘Health’, ‘HealthF’) hurt_ticks short integer field called HurtTime leash NBTObject field called Leash leashed boolean field called Leashed name string (unicode) field called CustomName name_visible boolean field called CustomNameVisible persistent boolean field called PersistenceRequired class nbtparse.minecraft.mobs.Modifier(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject An attribute modifier. amount floating point (high precision) field called Amount name string (unicode) field called Name operation integer field called Operation uuid Universally unique identifier field split between UUIDMost and UUIDLeast class nbtparse.minecraft.mobs.Mooshroom(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Breedable A Mooshroom (mushroom-cow) Like the cow, but produces mushroom stew instead of milk. Can be shorn into a regular cow, dropping mushrooms. id Usually equal to ‘MushroomCow’ class nbtparse.minecraft.mobs.Ocelot(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Tameable, nbtparse.minecraft.mobs.Breedable An ocelot. A tameable mob. cat_type integer field called CatType 18 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 id Usually equal to ‘Ozelot’ class nbtparse.minecraft.mobs.Offer(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject An individual villager offer. buy NBTObject field called buy buy_secondary NBTObject field called buyB max_uses integer field called maxUses sell NBTObject field called sell uses integer field called uses class nbtparse.minecraft.mobs.OfferList(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject, collections.abc.MutableSequence List of offers a villager has. For convenience, sequence-related functionality is redirected to self.recipes. insert(index, value) recipes list field called Recipes class nbtparse.minecraft.mobs.OfferListMeta(name, bases, dct) Bases: nbtparse.semantics.nbtobject.NBTMeta, abc.ABCMeta Metaclass for OfferList. class nbtparse.minecraft.mobs.Pig(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Breedable A pig. A short mob that drops porkchops. id Usually equal to ‘Pig’ saddle boolean field called Saddle class nbtparse.minecraft.mobs.Player(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob, nbtparse.semantics.filetype.GzippedNBTFile A player, and the accompanying player.dat file. abilities NBTObject field called abilities dimension integer field called Dimension ender_items list field called EnderItems 1.3. Subpackages 19 NBTParse Documentation, Release 0.2.0.dev0 food_exhaustion integer field called foodExhaustionLevel food_level integer field called foodLevel food_saturation integer field called foodSaturationLevel food_timer integer field called foodTickTimer inventory list field called Inventory mode integer field called playerGameType score integer field called Score selected_item_slot integer field called SelectedItemSlot sleep_timer short integer field called SleepTimer sleeping boolean field called Sleeping spawn Multi-field combining (‘SpawnX’, ‘SpawnY’, ‘SpawnZ’) spawn_forced boolean field called SpawnForced xp_level integer field called XpLevel xp_progress integer field called XpP xp_total integer field called XpTotal class nbtparse.minecraft.mobs.PotionEffect(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject A potion effect, usually attached to a mob. ambient boolean field called Ambient amplifier byte field called Amplifier duration integer field called Duration id byte field called id class nbtparse.minecraft.mobs.Sheep(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Breedable 20 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 A sheep. A mob that can be shorn for wool. color byte field called Color id Usually equal to ‘Sheep’ sheared boolean field called Sheared class nbtparse.minecraft.mobs.Silverfish(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A silverfish. Small swarming mob that hides in tile entities. id Usually equal to ‘Silverfish’ class nbtparse.minecraft.mobs.Skeleton(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A skeleton. A ranged mob with a bow and arrows. id Usually equal to ‘Skeleton’ wither boolean field called SkeletonType class nbtparse.minecraft.mobs.Slime(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A slime. A variable-sized mob which divides on death. id Usually equal to ‘Slime’ size integer field called Size class nbtparse.minecraft.mobs.SnowGolem(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A snow golem (snowman). A mob that throws snowballs at hostile mobs. id Usually equal to ‘SnowMan’ class nbtparse.minecraft.mobs.Spider(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A spider. A large short mob that can climb walls. 1.3. Subpackages 21 NBTParse Documentation, Release 0.2.0.dev0 id Usually equal to ‘Spider’ class nbtparse.minecraft.mobs.Squid(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A squid. An underwater mob that drops ink sacs. id Usually equal to ‘Squid’ class nbtparse.minecraft.mobs.Tameable(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A mob which can be tamed. Horses are not tamed conventionally and are not Tameable. owner string (unicode) field called Owner sitting boolean field called Sitting class nbtparse.minecraft.mobs.Villager(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Breedable A villager. A passive mob that players can trade with. id Usually equal to ‘Villager’ offers NBTObject field called Offers profession Field called Profession riches integer field called Riches class nbtparse.minecraft.mobs.VillagerProfession Bases: enum.Enum The valid values for Villager.profession. butcher = None A butcher, with a white apron. farmer = None A farmer, with a brown robe. generic = None A “generic” villager, with a green robe. Not spawned naturally. librarian = None A librarian, with a white robe. priest = None A priest, with a purple robe. 22 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 smith = None A blacksmith, with a black apron. class nbtparse.minecraft.mobs.Witch(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A witch. A ranged mob that throws potions. id Usually equal to ‘Witch’ class nbtparse.minecraft.mobs.Wither(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A wither. A boss mob the player has to construct from wither skeletons. id Usually equal to ‘WitherBoss’ invulnerable integer field called Invul class nbtparse.minecraft.mobs.Wolf(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Breedable, nbtparse.minecraft.mobs.Tameable angry boolean field called Angry collar_color byte field called CollarColor id Usually equal to ‘Wolf’ class nbtparse.minecraft.mobs.Zombie(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Mob A zombie. A mob that can convert villagers into more zombies. conversion_time integer field called ConversionTime id Usually equal to ‘Zombie’ is_baby boolean field called IsBaby is_villager boolean field called IsVillager class nbtparse.minecraft.mobs.ZombiePigman(*args, **kwargs) Bases: nbtparse.minecraft.mobs.Zombie anger short integer field called Anger id Usually equal to ‘PigZombie’ 1.3. Subpackages 23 NBTParse Documentation, Release 0.2.0.dev0 projectile Module Classes for projectiles, such as snowballs and arrows. class nbtparse.minecraft.projectile.AbstractFireball(*args, **kwargs) Bases: nbtparse.minecraft.projectile.Projectile Any fireball-like thing. direction tuple field called direction class nbtparse.minecraft.projectile.Arrow(*args, **kwargs) Bases: nbtparse.minecraft.projectile.Projectile An arrow. Fired by a player or a skeleton. damage floating point (high precision) field called damage id Usually equal to ‘Arrow’ in_data byte field called inData pickup integer field called pickup player boolean field called player class nbtparse.minecraft.projectile.Egg(*args, **kwargs) Bases: nbtparse.minecraft.projectile.Projectile A thrown egg. id Usually equal to ‘Egg’ class nbtparse.minecraft.projectile.Fireball(*args, **kwargs) Bases: nbtparse.minecraft.projectile.AbstractFireball A regular fireball. id Usually equal to ‘Fireball’ class nbtparse.minecraft.projectile.Projectile(*args, **kwargs) Bases: nbtparse.minecraft.entity.Entity A projectile. A fast-moving entity like an arrow or snowball. coords Multi-field combining (‘xTile’, ‘yTile’, ‘zTile’) in_ground boolean field called inGround in_tile byte field called inTile 24 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 shake byte field called shake class nbtparse.minecraft.projectile.SmallFireball(*args, **kwargs) Bases: nbtparse.minecraft.projectile.AbstractFireball A small fireball. id Usually equal to ‘SmallFireball’ class nbtparse.minecraft.projectile.Thrown(*args, **kwargs) Bases: nbtparse.minecraft.projectile.Projectile Anything thrown by players (and only players). owner_name string (unicode) field called ownerName class nbtparse.minecraft.projectile.ThrownEnderpearl(*args, **kwargs) Bases: nbtparse.minecraft.projectile.Thrown A thrown enderpearl. Teleports the player on landing. id Usually equal to ‘ThrownEnderpearl’ class nbtparse.minecraft.projectile.ThrownExpBottle(*args, **kwargs) Bases: nbtparse.minecraft.projectile.Thrown A thrown Bottle o’ Enchanting. id Usually equal to ‘ThrownExpBottle’ class nbtparse.minecraft.projectile.ThrownPotion(*args, **kwargs) Bases: nbtparse.minecraft.projectile.Thrown A thrown splash potion. id Usually equal to ‘ThrownPotion’ potion NBTObject field called Potion potion_value integer field called potionValue class nbtparse.minecraft.projectile.ThrownSnowball(*args, **kwargs) Bases: nbtparse.minecraft.projectile.Thrown A thrown snowball. id Usually equal to ‘Snowball’ class nbtparse.minecraft.projectile.WitherSkull(*args, **kwargs) Bases: nbtparse.minecraft.projectile.AbstractFireball A wither skull. id Usually equal to ‘WitherSkull’ 1.3. Subpackages 25 NBTParse Documentation, Release 0.2.0.dev0 Subpackages terrain Package Contents • • • • • terrain Package dimension Module region Module chunk Module voxel Module – Performance of the voxel module • filters Module • tile Module terrain Package Terrain-related NBTParse modules. This package consists of modules relating to Minecraft terrain. The basic unit of terrain manipulation is voxel.VoxelBuffer, which is used to store blocks of terrain and tile entity data compactly. dimension Module class nbtparse.minecraft.terrain.dimension.Dimension(path: str, *, max_cache: int=5, fill_value: nbtparse.minecraft.terrain._voxel.Block=None) Bases: builtins.object A dimension, in Minecraft terms. A collection of (usually) contiguous regions. May be indexed and sliced using block coordinates. Indexing is similar to that of voxel.VoxelBuffer, except that X and Z coordinates are absolute, and X and Z slices must have both a start and an end. Dimensions are not thread-safe. atomic Make the following operations atomic. Either every change made within the block will be saved to disk, or none of those changes are saved to disk. This should not be confused with the other three ACID guarantees (particularly isolation). The transaction is aborted if and only if an exception is raised (but see below). Can be used as a context manager or decorator: @dim.atomic def atomic_function(): # Things in here will happen atomically. with dim.atomic: # Things in here will happen atomically In some circumstances, you may need to call recover_atomic(). This is generally only necessary if the system crashed or lost power while actually saving regions to disk. The method may roll back a partially-committed transaction to ensure atomicity, or it may complete the transaction. 26 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 It is legal to call save_all() while in this context. Doing so creates a sort of “checkpoint”; if an exception is raised, the context rolls back to the last checkpoint. There is an implicit checkpoint at the beginning of the context. Nested invocations are legal but have no effect. This consumes memory more aggressively than normal operations. It ignores the max_cache attribute for the sake of correctness. Warning: This is not the same as thread safety. If you require thread safety, use explicit locking. Multiple threads attempting to enter or exit the atomic context at the same time can cause data corruption, and the rest of the class is similarly unsafe for concurrent access. Note: Atomicity is only guaranteed on systems where os.replace() is atomic and os.fsync() can be used on a directory. Most POSIX-compliant systems should satisfy these requirements. Windows most likely fails the second and perhaps the first as well. cache_size Number of regions currently cached. Should always be <= max_cache, except inside a Dimension.atomic invocation. entities Sliceable collection of entities. Provides a similar slicing API to the dimension itself, except that extended slicing and ordinary indexing are unsupported. Slicing the object returns a set of entities. Slices may also be assigned to and deleted. As with dimensions, all slices must be fully-qualified, except for Y-dimension slices. Unlike with dimensions, slice indices may be fractional. Other collection-related operations are not currently supported. Note: The slices are sets, not lists. Duplicate entities with the same UUID and type are not supported and will be silently coalesced. max_cache The maximum number of regions to keep cached at once. If zero, no regions will be cached; every lookup will hit the disk. Note: Even if this is zero, some regions will be cached for short periods of time during slicing operations. This is because slice assignment may need to hit multiple regions at once. The cache size will also be unrestricted by this parameter while inside a Dimension.atomic invocation. If -1, the cache size is unlimited; once a region has been loaded, it will not be unloaded. recover_atomic() → bool Recover from a failure during atomic or save_all(). Call this method if a system crash or other severe problem occurs while exiting an atomic block. It is not necessary to call this method if the crash occurred while control was still inside the block. The method should also be called if save_all() raised an exception, even if it did so inside an atomic block. Return True if the changes were saved, False if the changes were rolled back. Also return True if the Dimension is already in a “clean” state and recovery is unnecessary. 1.3. Subpackages 27 NBTParse Documentation, Release 0.2.0.dev0 Warning: Do not call this method while a save is in progress. Doing so will likely cause severe data corruption. This rule applies regardless of which process is performing the save. save_all() raises a ConcurrentError to indicate that it believes a save cannot be safely made at the current time. Calling this method will override that safety check. save_all() Save every region currently cached. Regions which are no longer cached have already been saved. Prefer correctness over speed; provide the same guarantees as Dimension.atomic. A ConcurrentError is raised if another save appears to have been in progress when this method was called. Under no circumstances are two or more save_all() calls allowed to run concurrently on the same directory; all but one will always fail with an exception. If an exception is raised under other circumstances, it is recommended to call recover_atomic(). save_fast() Save every region currently cached (like save_all()). Prefer speed over correctness; do not provide any guarantees beyond those of the basic region caching system. region Module class nbtparse.minecraft.terrain.region.Region(region_x: int, region_z: int) Bases: collections.abc.MutableMapping A Minecraft region file. region_x and region_z should be the region coordinates (as they appear in the filename). Standard constructor creates an empty region. load() loads a region from a file. For both loading and saving, files generally need to be seekable. This may pose a problem if you want to send a region over the network or through a pipe. Depending on your memory and disk resources, you may be able to use io.BytesIO or tempfile as temporary buffers. Contains individual chunks. Access chunk (1, 2), in chunk coordinates, as follows: r = Region.load(...) chunk = r[1, 2] No slicing. A KeyError is raised if the chunk does not exist. You may use absolute or relative coordinates as you please; they will be translated into positive relative coordinates via modulus. You may also replace one chunk with another. clear() Mark this region as empty. Equivalent to deleting every chunk from the region, but quite a bit faster. classmethod load(region_x: int, region_z: int, src: _io.BufferedReader) Load a region from disk (or another I/O-like object). src must support seeking in both directions. save(dest: _io.BufferedWriter) Save the state of this region. dest must support seeking in both directions. 28 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 chunk Module nbtparse.minecraft.terrain.chunk.BlockField Exposes the blocks in a section. If default is None, a new empty buffer will be created as the default. class nbtparse.minecraft.terrain.chunk.Chunk(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject entities List of Entity objects. height_map The height map for this chunk. Note: It is planned that a lighting engine will manage this attribute automatically. This is not yet implemented. static prepare_load(nbt: nbtparse.syntax.tags.CompoundTag) parse.syntax.tags.CompoundTag Unwrap nbt from a singleton CompoundTag. → nbt- static prepare_save(nbt: nbtparse.syntax.tags.CompoundTag) parse.syntax.tags.CompoundTag Wrap nbt in a singleton CompoundTag. → nbt- sections Mutable mapping from Y-indices to Sections. Y-indices which are not present in the underlying NBT will be automagically created as empty sections upon attempting to retrieve them. The key in this mapping will override the y_index attribute if they disagree. Note: It is acceptable to replace this mapping with an entirely different mapping. If you do so, the magic creation of missing sections will very likely not work. If you prefer creating sections explicitly, code like the following will disable the magic: c = Chunk.from_nbt(...) c.sections = dict(c.sections) tiles List of TileEntity objects. Note: This attribute is generally managed by the Region which created this chunk. Manually changing it is usually unnecessary. class nbtparse.minecraft.terrain.chunk.HeightMap(intlist: [<class ‘int’>]) Bases: collections.abc.MutableMapping The height map of a chunk. Maps coordinates to heights: hm[3, 4] = 5 Keys may not be inserted or deleted, and must be pairs of integers. Intlist should be the raw list of integers as saved by Minecraft. to_raw() → [<class ‘int’>] Returns the raw list used by Minecraft. 1.3. Subpackages 29 NBTParse Documentation, Release 0.2.0.dev0 nbtparse.minecraft.terrain.chunk.HeightMapField Field for HeightMap. class nbtparse.minecraft.terrain.chunk.Section(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject blocks VoxelBuffer of this section. y_index The Y-index of this section. From 0 to 15 inclusive. nbtparse.minecraft.terrain.chunk.SectionDictField Field for the sections of a chunk. Keys are y_index, values are sections. voxel Module Terrain editing at the level of individual blocks. Note: This is the pure Python version of the module. Pass --cython to setup.py to install the Cython version. class nbtparse.minecraft.terrain.voxel.Block(id: int, data: int=0) Bases: builtins.object A basic block, not including tile entity data. Blocks are not NBTObjects because Minecraft does not store them that way. They cannot be serialized directly to NBT. Instead, Minecraft stores blocks in groups called chunks. id is the block id, a nonnegative integer. data is the damage value, also a nonnegative integer. Blocks compare equal if they have the same id and data. Blocks are immutable and hashable. data The block damage value. id The block ID. class nbtparse.minecraft.terrain.voxel.VoxelBuffer(length: int, height: int, width: int) Bases: builtins.object A 3D buffer of blocks. Stores block IDs and damage values in much the same way as Minecraft: a “packed” format involving 8-bit strings (i.e. bytearray). Basic constructor will create a buffer full of air (block ID 0). Blocks may be retrieved or changed with standard subscription. Slicing is also acceptable, and assigning a block to a slice is interpreted as filling the slice with the block. However, it is not possible to resize a buffer once created. Replacing a single block with subscription will erase the accompanying tile entity. Slicing is a shallow copy, and will only duplicate references to tile entities. Slicing a VoxelBuffer is a potentially expensive operation. It is linear in the total volume sliced, which sounds fine until we realize that the volume of a cube is (logically enough) cubic in the edge length. Slices covering an entire VoxelBuffer are very fast, as they are optimized into a single memory copy. This currently does not apply to any other slices. Manipulating individual blocks is relatively fast, however. VoxelBuffers can be iterated. This is done in the rather esoteric YZX order rather than the conventional XYZ order because the former is more natural in practice. The VoxelBuffer.enumerate() method may be 30 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 used to prepend (x, y, z) coordinates in much the same way as the builtin enumerate() does. Standard iteration is marginally faster than the following code, because it skips some unnecessary sanity checks: for y in range(vb.height): for z in range(vb.width): for x in range(vb.length): yield vb[x, y, z] If you want to iterate in the XYZ ordering instead, use xyz(). Note: Do not write this, as it does not work: vb = VoxelBuffer(length, height, width) block = vb[x][y][z] Instead, write this: vb = VoxelBuffer(length, height, width) block = vb[x, y, z] enumerate() Iterate over the blocks in the buffer, with coordinates. Produces the (x, y, z) coordinates of each block in addition to the block itself: for (x, y, z), block in vb.enumerate(): # block is equivalent to vb[x, y, z] classmethod from_raw(ids: bytes, addids: bytes, damages: bytes, length: int, height: int, width: int) Create a new VoxelBuffer from the provided buffers. These buffers should be bytes objects (or acceptable to bytes()). Each byte or nybble should correspond to a block, in the same format as minecraft stores terrain data. No tile entities will be attached to the terrain. You must do this manually. Do not use this to duplicate a VoxelBuffer. Instead, take a slice of the entire buffer. height The height (Y-axis) of the buffer. length The length (X-axis) of the buffer. Note: This should not be confused with the len() of the buffer, which is the product of the length, width, and height (i.e. the volume), for consistency with iteration. tilemap Mutable mapping from coordinates to tile entities. Overwriting a single block with subscription will delete the corresponding entry from this mapping, even if the block is otherwise unchanged. Overwriting a slice of blocks will replace the entries with the equivalent entries from the other buffer. Example code: vb.tilemap[(x, y, z)] = tile.TileEntity(...) The following is exactly equivalent and, in the opinion of the author, more readable: 1.3. Subpackages 31 NBTParse Documentation, Release 0.2.0.dev0 vb.tilemap[x, y, z] = tile.TileEntity(...) Note: This is a mapping, not a 3D array or similar. It cannot be sliced and negative indices will not be converted into positive indices. Note: Coordinates are always relative to the origin of the VoxelBuffer, as with subscription. This means they do not correspond to the TileEntity.coords attribute. Furthermore, said attribute will be ignored and overwritten with the coordinates provided to this mapping when the chunk is placed into a region. to_raw() -> (<class ‘bytes’>, <class ‘bytes’>, <class ‘bytes’>) Return the raw buffers as used by Minecraft. unwatch(observer: <built-in function callable>) Unregister a previously-registered observer. Undoes a previous call to watch(). KeyError is raised if the observer was never registered. Observers are not automatically unregistered, so it is important to call this method manually if you intend the VoxelBuffer to outlive the observers. watch(observer: <built-in function callable>) Register an observer. The observer will be called with three arguments every time the buffer is modified. The arguments will be one of the following: •The (x, y, z) coordinates of the single block which has changed. •Three range objects, describing the set of blocks which have changed (the range of X coordinates, Y coordinates, and Z coordinates). The observer must be hashable. If this is a problem, wrap it in a lambda expression. Changes to tilemap will not trigger notifications. width The width (Z-axis) of the buffer. xyz() Iterate over the blocks in the buffer, in XYZ order. Produces coordinates, just like VoxelBuffer.enumerate(). Performance of the voxel module The voxel module is implemented both in pure Python and in Cython. When you import it, you will receive the most performant version available. When running setup.py on a system with a compatible version of Cython, pass the --cython flag to request the inclusion of the Cython version. Otherwise, it is excluded by default. The Cython version is, generally speaking, far more performant than the Python version, unless you happen to be a PyPy user. Both versions are optimized under the assumption that tile entities are relatively rare and most blocks are ordinary blocks. This assumption allows the Cython version to release the GIL when copying memory. It should be possible, in principle, to realize considerable gains from parallelism here. However, the current implementation does not do so. The Cython version of the module implements the buffer protocol, as described in PEP 3118. This allows C code fast access to the underlying memory backing a VoxelBuffer. VoxelBuffers provide buffers compatible with the flag value PyBUF_RECORDS. Each element is an unsigned short with native byte order (i.e. the format string is H). 32 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 The block ID is stored in the 12 least significant bits, and the data value is stored in the next 4 bits. On those arcane architectures where unsigned short is not 16 bits, the remaining high bits are ignored. Note: As an implementation detail, buffers are contiguous in the YZX order (that is, with the second index changing least often and the first index changing most often). This behavior is not contractual, but it may help you maximize CPU cache hits. Warning: Modifications made through the buffer protocol will not trigger notifications to any observers which may be registered. filters Module class nbtparse.minecraft.terrain.filters.Filter(vb: nbtparse.minecraft.terrain._voxel.VoxelBuffer) Bases: collections.abc.Mapping Filter for rapidly finding all blocks of a given type. Keys are Block objects or integers. Values are sets of (x, y, z) 3-tuples. Filters maintain the following invariants: vb = VoxelBuffer(...) # with arbitrary contents block = Block(number, data) filter = Filter(vb) ((x, y, z) in filter[block]) == (vb[x, y, z] == block) ((x, y, z) in filter[number]) == (vb[x, y, z].id == number) The filter updates automatically when the VoxelBuffer changes. Initially constructing a filter is expensive, but keeping it up-to-date is relatively cheap. You may realize performance gains by constructing a single filter and reusing it many times. Integer keys will not appear in iteration, because the same information is already available via block keys. close() Close this filter so it can no longer be used. Filters slow down the VoxelBuffers they are attached to. Closing them is good practice. Using a filter as a context manager will close it automatically when the context is exited: with Filter(vb) as filt: pass Closing a filter twice is legal and has no effect. Doing anything else with a closed filter will raise a RuntimeError. copy_vb() → nbtparse.minecraft.terrain._voxel.VoxelBuffer Return a copy of the VoxelBuffer and attach to it. This will detach the filter from the original VoxelBuffer, so it will track the copy instead. This is equivalent to the following code, but significantly faster: filter.close() copy = vb[...] filter = Filter(copy) tile Module 1.3. Subpackages 33 NBTParse Documentation, Release 0.2.0.dev0 class nbtparse.minecraft.terrain.tile.AbstractDispenser(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.Container A dropper or dispenser. items Things to dispense or drop. class nbtparse.minecraft.terrain.tile.Beacon(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity A beacon. id Usually equal to ‘Beacon’ levels How tall the pyramid is primary The primary power selected (as a potion ID) secondary The secondary power selected (as a potion ID) class nbtparse.minecraft.terrain.tile.Cauldron(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.Container A brewing stand (not actually a cauldron). brew_time How long the brewing stand has been brewing. Measured in ticks. id Usually equal to ‘Cauldron’ items The items in the brewing stand. Slots numbered from 0 to 3 inclusive. class nbtparse.minecraft.terrain.tile.Chest(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.Container A single chest. Double chests are two of these next to each other. id Usually equal to ‘Chest’ items List of items in the chest. Slots go from 0 to 26. 0 is the top left corner. class nbtparse.minecraft.terrain.tile.Comparator(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity A comparator. id Usually equal to ‘Comparator’ output Strength of the output signal. 34 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 Will very likely be overwritten on the next block update. class nbtparse.minecraft.terrain.tile.Container(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity One of several different kinds of containers. Consult the id to determine which kind. custom_name The custom name of this container. Rename using an anvil. lock Optional string specifying a “lock item.” Players not carrying the lock item will be unable to open the container. class nbtparse.minecraft.terrain.tile.Control(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.Container A control block. command The command to send on activation. id Usually equal to ‘Control’ last_output Output from most-recently executed command. success_count Strength of the redstone output. Used for commands like /testfor. Only updates on activation. track_output Unknown. class nbtparse.minecraft.terrain.tile.DaylightSensor(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity A daylight sensor. id Usually equal to ‘DLDetector’ class nbtparse.minecraft.terrain.tile.Dispenser(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.AbstractDispenser A dispenser. id Usually equal to ‘Trap’ class nbtparse.minecraft.terrain.tile.Dropper(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.AbstractDispenser A dropper. id Usually equal to ‘Dropper’ 1.3. Subpackages 35 NBTParse Documentation, Release 0.2.0.dev0 class nbtparse.minecraft.terrain.tile.EndPortal(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity An end portal. id Usually equal to ‘Airportal’ class nbtparse.minecraft.terrain.tile.FlowerPot(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity A flower pot. flower_type Data value of the contents of the pot. id Usually equal to ‘FlowerPot’ item Block ID of the contents of the pot. Most block ID’s will not work; generally only plants are allowed. class nbtparse.minecraft.terrain.tile.Furnace(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.Container A furnace. burn_time Number of ticks of fuel remaining. cook_time Number of ticks current item has been cooking for When this reaches 300, item is done. id Usually equal to ‘Furnace’ items List of items, with slot field. Slot 0 is the cooking item, slot 1 is the fuel, and slot 2 is the output. class nbtparse.minecraft.terrain.tile.Hopper(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.Container A hopper. cooldown Time until the next transfer. Zero if no transfer is imminent. id Usually equal to ‘Hopper’ items Items in the hopper class nbtparse.minecraft.terrain.tile.Music(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity A music block. 36 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 id Usually equal to ‘Music’ note Pitch of the block. Every right click increases this by 1. In music theory terms, this measures the number of semitones above F# (octave 3). Values may range from 0 to 24 inclusive, or two full octaves. class nbtparse.minecraft.terrain.tile.Piston(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity A piston. block_data Data (damage) value of the moving block. block_id Block ID of the moving block. extending Whether we are extending. facing Direction the piston is facing. id Usually equal to ‘Piston’ progress How far the block has moved. class nbtparse.minecraft.terrain.tile.RecordPlayer(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity A jukebox. id Usually equal to ‘RecordPlayer’ record_id Item ID of the record being played. Zero if the jukebox is empty. record_item The record in the jukebox. Can place other items here as well. class nbtparse.minecraft.terrain.tile.Sign(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity A sign. id Usually equal to ‘Sign’ line1 First line of text. If longer than 16 characters, excess is discarded. line2 Second line of text. 1.3. Subpackages 37 NBTParse Documentation, Release 0.2.0.dev0 line3 Third line of text. line4 Fourth (last) line of text. class nbtparse.minecraft.terrain.tile.Skull(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity A skull on the ground. id Usually equal to ‘Skull’ rotation Rotation (same as sign data values). skull_id Data value of the skull. skull_name Name of player whose skull it is. class nbtparse.minecraft.terrain.tile.SpawnPotential(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject One possible spawn from a spawner. properties Tags to copy to the entity to spawn. type ID of the entity to spawn weight Relative likelihood that this spawn will be used. Must be positive. class nbtparse.minecraft.terrain.tile.Spawner(*args, **kwargs) Bases: nbtparse.minecraft.terrain.tile.TileEntity A mob spawner. delay Time until next spawn in ticks. If set to -1 (the default for newly-created Spawners), randomize this value, entity_id, and spawn_data when a player comes in range. entity_id The ID of the next entity spawned. id Usually equal to ‘MobSpawner’ max_delay Maximum allowed delay, when Minecraft generates it. max_entities Maximum entities to spawn. If this is exceeded, stop spawning until some of the entities go out of range. 38 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 min_delay Minimum allowed delay, when Minecraft generates it. player_range Maximum distance from a player. If no player is within this range, the spawner will shut down. spawn_count Number of mobs to spawn at once. spawn_data Tags to copy to the next entity spawned. spawn_potentials List of SpawnPotentials. Used to fill in some of the fields of this object after each spawn. spawn_range How far away from the spawner to spawn. X and Y are both indepently constrained by this radius, so the target area is square rather than circular. class nbtparse.minecraft.terrain.tile.TileEntity(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject A tile entity. Stores additional data about a block. coords The coordinates of this tile entity. Note: region.Region will usually overwrite this attribute with the appropriate value; you do not need to work with it directly. id A string identifying the type of tile entity. 1.3.2 semantics Package Contents • • • • semantics Package fields Module filetype Module nbtobject Module semantics Package Modules relating to NBT semantics The modules in this package provide intermediate constructs to simplify working with NBT. Their primary purpose is making nbtparse.minecraft modules less repetitive and easier to understand. Nothing in this package directly relates to Minecraft itself, however, so you may find uses for it in other contexts. 1.3. Subpackages 39 NBTParse Documentation, Release 0.2.0.dev0 fields Module A field is part of a TAG_Compound that corresponds to a top-level tag. It knows how to translate a tag or group of tags into a Pythonic value and back again, and uses the descriptor protocol to make this translation seamless. Typical usage would be something like this: class FooFile(NBTFile): bar = LongField(u'Bar') Thereafter, when saving or loading a FooFile, the top-level TAG_Long called Bar will be accessible under the attribute bar. The NBT version is still accessible under the FooFile.data attribute (or by calling the to_nbt() method, which is usually more correct). Fields are a thin abstraction over the data dict in an NBTObject; modifying the dict may cause Fields to misbehave. Idea shamelessly stolen from Django, but massively simplified. nbtparse.semantics.fields.AbstractField Root of the Field class hierarchy. nbtparse.semantics.fields.BooleanField Field for a TAG_Byte acting as a boolean. nbtparse.semantics.fields.ByteArrayField Field for a TAG_Byte_Array. nbtparse.semantics.fields.ByteField Field for a TAG_Byte acting as an integer. nbtparse.semantics.fields.DoubleField Field for a TAG_Double. nbtparse.semantics.fields.EnumField Field for an enumerated type. See enum. nbtparse.semantics.fields.FloatField Field for a TAG_Float. nbtparse.semantics.fields.IntArrayField Field for a TAG_Int_Array. nbtparse.semantics.fields.IntField Field for a TAG_Int. nbtparse.semantics.fields.ListField Field for a TAG_List. The ListTag will be given an id of content_id for the elements. nbtparse.semantics.fields.LongField Field for a TAG_Long. nbtparse.semantics.fields.MultiField Field combining multiple top-level tags into one object. Controls a series of one or more top-level tags which should be combined into a single Pythonic object. If the tags are enclosed in a TAG_Compound, consider using an NBTObjectField instead. 40 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 This is an abstract class. to_python() will be called with the same number of arguments as nbt_names has elements, in the same order specified, and should return a value acceptable to from_python(), which should produce a sequence of the same values passed as arguments to to_python(). If a tag does not exist, to_python() will be passed None instead of the corresponding tag. from_python() produces a None value, the corresponding tag will be skipped. If default should be a value acceptable to from_python(), which will be called when setting the field to its default value. nbtparse.semantics.fields.MutableField Mutable variant of a field. Caches the Pythonic value and holds a reference to it. Such a value can be safely mutated in-place. Needed for mutable types like lists, as well as immutable types whose contents may be mutable, such as tuples. The cache_key must be unique within the object. By convention, it is the nbt_name or nbt_names attribute. It must be hashable but has no other restrictions. This class must precede any class which overrides __get__(), __set__(), and/or __delete__() in the method resolution order. In particular, it must precede MultiField or SingleField. If you do not understand what that means, just make sure your code looks like this: class FooField(MutableField, SingleField): pass ...rather than like this: class FooField(SingleField, MutableField): pass Combining with ReadOnly is inadvisable and will generate a warning. nbtparse.semantics.fields.NBTObjectField Field for an NBTObject. Usually a TAG_Compound but exact contents will vary. In other words, a brand-new instance of the object will be created, with all its fields set to their default values. nbtparse.semantics.fields.ObjectListField Field for a TAG_List of NBTObjects. nbtparse.semantics.fields.ObjectTupleField Field for a TAG_List of NBTObjects, as a tuple. class nbtparse.semantics.fields.ReadOnly(wrapped: nbtparse.semantics.fields.AbstractField) Bases: builtins.object Field wrapper which disallows modification. __set__() and __delete__() raise an AttributeError. __get__() is silently forwarded to the wrapped field. Other field operations are not implemented at all. Because __get__() forwards all accesses, including class-level access, it will cause the docstring and repr() of the wrapped field to appear instead of the docstring and repr() of the wrapper. Wrappers of this type are suitable for computing __hash__(), and for other scenarios in which a value must not change after construction. This wrapper does not inherit from AbstractField, because it behaves rather differently from real fields and would otherwise confuse some of the NBTObject machinery. As a consequence, it will not be set to its default value by the standard NBTObject __init__(). If you want this functionality included, expose wrapped as an underscore-prefixed field. 1.3. Subpackages 41 NBTParse Documentation, Release 0.2.0.dev0 Note: If the wrapped field is a MutableField, the read-only restriction may not be observed if client code modifies the return value of __get__() in-place. Because this combination makes little sense anyway, a warning is raised when it occurs. wrapped The wrapped field, which may be modified directly. It is recommended to expose this as an underscore-prefixed field on the class, as an escape-hatch for __init__() and the like. Such an underscore-prefixed field will also receive a set_default() if __init__() has not been overridden, and will appear in field-by-field introspection (while the immutable wrapper will not). nbtparse.semantics.fields.ShortField Field for a TAG_Short. nbtparse.semantics.fields.SingleField Field for a single top-level tag. This is an abstract class. to_python() is passed an NBT tag (see nbtparse.syntax.tags) and should return some object. That object should be acceptable to from_python(), which should return the equivalent NBT tag. nbtparse.semantics.fields.TupleListField Field for a TAG_List; converts to a tuple. This should not be confused with TupleMultiField, which takes several top-level tags and wraps them together into a single field. This takes a single TAG_List and converts it into a tuple. ListField takes a single TAG_List and converts it into a list. nbtparse.semantics.fields.TupleMultiField Field which combines several tags into a tuple. to_pythons and from_pythons should be sequences of functions which translate each item listed in nbt_names into its corresponding Python value. nbtparse.semantics.fields.UTCField Field for a TAG_Long holding a Unix timestamp. Note that this is always in UTC. See datetime for documentation. nbtparse.semantics.fields.UUIDField Field which combines two TAG_Long‘s into a UUID. A default of None will generate a new UUID every time. Assigning None in the ordinary fashion is equivalent to deleting the field. nbtparse.semantics.fields.UnicodeField Field for a TAG_String. nbtparse.semantics.fields.self_reference(field_name: str, nbt_name: str) → function Class decorator to allow a class’s fields to refer to the class itself. Typical usage: @self_reference('parent', u'ParentFoo') class Foo(NBTObject): pass Now Foo.parent is an NBTObjectField for a Foo. 42 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 filetype Module Provides classes for working with NBT files as objects. These classes extend nbtparse.semantics.nbtobject and provide save and load methods so the file can be easily (de)serialized. class nbtparse.semantics.filetype.GzippedNBTFile(*args, **kwargs) Bases: nbtparse.semantics.filetype.NBTFile Gzipped variant of NBTFile. classmethod load(input: io.BufferedIOBase) Creates a new NBTFile from the gzipped input file-like. save(output: io.BufferedIOBase, rootname: str=’‘) Writes this file to output as gzipped NBT. class nbtparse.semantics.filetype.NBTFile(*args, **kwargs) Bases: nbtparse.semantics.nbtobject.NBTObject Simple class for handling NBT encoded files holistically. An entire NBT file is read and decoded via tags.decode_named, and then converted into a Pythonic object. classmethod load(input: io.BufferedIOBase) Creates a new NBTFile from the input file-like. Returns (rootname, NBTFile), where rootname is the name of the root tag. Conventional NBTObjects do not make use of their external names, so if you intend to use it somewhere, you need to capture it here. save(output: io.BufferedIOBase, rootname: str=’‘) Writes this file to output as NBT. The root tag will be called rootname. nbtobject Module NBT high-level object-oriented class NBTObject is an object-oriented wrapper for CompoundTag, designed to expose its fields in a standard and welldocumented fashion. class nbtparse.semantics.nbtobject.NBTMeta(name, bases, dct) Bases: builtins.type Metaclass for NBTObjects. Allows NBTObjects to track their fields upon creation. all_fields() → collections.abc.Set Return a set of all fields attached to this class. Includes fields whose names begin with underscores. attach_field(field: nbtparse.semantics.fields.AbstractField, field_name: str) Attaches the given field with the given name to the class. Changing a class after it’s created is usually a Bad Idea; this method is meant to be used in class decorators and other contexts where you can be reasonably sure the class has not yet been instantiated. 1.3. Subpackages 43 NBTParse Documentation, Release 0.2.0.dev0 detach_field(field_name: str) Detaches the field with the given name from the class. Changing a class after it’s created is usually a Bad Idea; this method is meant to be used in class decorators and other contexts where you can be reasonably sure the class has not yet been instantiated. fields() → collections.abc.Set Return a set of the public fields attached to this class. The elements of the set are strings whose names correspond to those of the fields. They are suitable arguments for getattr() and setattr(). Does not include fields whose names begin with underscores. class nbtparse.semantics.nbtobject.NBTObject(*args, **kwargs) Bases: builtins.object Thin wrapper over a TAG_Compound. Typically houses one or more fields. Calling the constructor directly will create an empty object with all fields set to their default values, except for any specifically initialized as keyword arguments. Calling from_nbt() will populate fields from the provided NBT. Note: If the default of a field is None, that field will be set to None, which is equivalent to leaving it empty. Such fields will not be present in the generated NBT unless their values are changed by hand. In some cases, this means newly created objects will require modification before they can be meaningfully saved. Some fields don’t observe the above semantics and will do something different when the default is None. This is noted in the fields documentation where applicable. Such fields will still erase their contents if explicitly set to None. classmethod all_fields() → collections.abc.Set Forwards to NBTMeta.all_fields(), which see. data = None The underlying CompoundTag for this NBTObject. Fields store and retrieve instance data in this attribute. It is largely used as-is when calling to_nbt(), but some fields may customize this process in their save() methods. Some NBTObjects will also alter the output by overriding to_nbt(). For these reasons, direct manipulation of this attribute is discouraged. It may still prove useful for debugging or for cases where a key is not controlled by any field. classmethod fields() → collections.abc.Set Forwards to NBTMeta.fields(), which see. classmethod from_bytes(raw: bytes) Deserialize a new NBTObject from a bytes object. The name of the root tag is discarded. classmethod from_nbt(nbt: nbtparse.syntax.tags.CompoundTag) Creates a new NBTObject from the given NBT representation. Stores the given NBT in the data attribute of the newly-created object. Also calls the load() methods of all the fields. classmethod prepare_load(nbt: nbtparse.syntax.tags.CompoundTag) parse.syntax.tags.CompoundTag Hook called during from_nbt() with the loaded NBT. 44 → nbt- Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 Should return a CompoundTag after (for instance) unwrapping data inside a singleton CompoundTag or performing other transformations. Unless overridden, return argument unchanged. This hook runs before any fields’ load() methods are called. It is the first hook after the NBT has been loaded. Note: Unlike prepare_save(), this method must be callable as a class method. In practice, both methods can often be implemented as static methods anyway. prepare_save(nbt: nbtparse.syntax.tags.CompoundTag) → nbtparse.syntax.tags.CompoundTag Hook called during to_nbt() with the to-be-saved NBT. Should return a CompoundTag after (for instance) wrapping data inside a singleton CompoundTag or performing other transformations. Unless overridden, return argument unchanged. This hook runs after all fields’ save() methods are called. It is the last hook before the NBT is saved. to_bytes() → bytes Serialize this NBTObject directly to a bytes object. The root tag will have no name. to_nbt() → nbtparse.syntax.tags.CompoundTag Returns an NBT representation of this object. By default, return self.data, which is sufficient if all data is kept in fields. Also calls the save() methods of all the fields. 1.3.3 syntax Package Contents • syntax Package • tags Module syntax Package Utilities relating to low-level NBT syntax. The package currently consists of a single module, plus a class that used to be a module: • tags provides object-oriented NBT encoding and decoding. • ids provides tag ID’s (e.g. ids.TAG_Byte is 1). class nbtparse.syntax.ids Bases: enum.IntEnum Defines various tag ID’s. Formerly a module, now implemented as a class. This provides various benefits while retaining compatibility and a straightforward interface. 1.3. Subpackages 45 NBTParse Documentation, Release 0.2.0.dev0 TAG_Byte = None ID of a TAG_Byte TAG_Byte_Array = None ID of a TAG_Byte_Array TAG_Compound = None ID of a TAG_Compound TAG_Double = None ID of a TAG_Double TAG_End = None ID of a TAG_End TAG_Float = None ID of a TAG_Float TAG_Int = None ID of a TAG_Int TAG_Int_Array = None ID of a TAG_Int_Array TAG_List = None ID of a TAG_List TAG_Long = None ID of a TAG_Long TAG_Short = None ID of a TAG_Short TAG_String = None ID of a TAG_String tags Module Types for the various NBT tags. Every tag type has a corresponding Pythonic class. Most of these are subclasses of various built-in classes with additional NBT encoding and decoding functionality. Generally speaking, TAG_Foo‘s counterpart will be called FooTag. Most tags are immutable and hashable, and use a values-based definition of equality; this is usually inherited from the corresponding built-in class. The tags all inherit from TagMixin, an abstract mixin class. TagMixin provides some method implementations and a great deal of high-level documentation; if a particular tag’s documentation is unclear, consult TagMixin as well. TagMixin.decode_named() is also exposed at the module level for convenience. This module will also log the encoding and decoding process via logging; the logger has the same name as the module. Since encoding and decoding are generally very low-level processes, nearly everything is logged at the DEBUG level; some irregularities when decoding are logged at WARNING, and irregularities while encoding will instead generate ordinary warnings (i.e. warnings.warn()). See the logging documentation for instructions on how to access this data or ignore it. class nbtparse.syntax.tags.ByteArrayTag Bases: nbtparse.syntax.tags.TagMixin, builtins.bytes Represents a TAG_Byte_Array. 46 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 Derives from bytes, and can be used anywhere that bytes would be valid. Note that this is generally not used to represent text because it lacks encoding information; see StringTag for that. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) Read a TAG_Byte_Array payload into a new ByteArrayTag. encode_payload(output: io.BufferedIOBase, errors: str=’strict’) → int Writes this tag as a sequence of raw bytes to output. Returns the total number of bytes written, including the length. tag_id Equal to ids.TAG_Byte_Array. class nbtparse.syntax.tags.ByteTag Bases: nbtparse.syntax.tags.TagMixin, builtins.int Represents a TAG_Byte. Derives from int, and can be used anywhere an int is valid. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) → int Decode a fixed-width value from input. Value is 1 bytes wide. encode_payload(output: io.BufferedIOBase, errors=’strict’) Encode a fixed-width value to output. If the value is too large to fit into the appropriate representation, an OverflowError will result. tag_id Equal to ids.TAG_Byte. class nbtparse.syntax.tags.CompoundTag Bases: nbtparse.syntax.tags.TagMixin, builtins.dict Represents a TAG_Compound. Unlike most other tags, this tag is mutable and unhashable. Derives from dict and may be used in place of one. Keys are names, values are tags. The terminating TAG_End is handled automatically; you do not need to worry about it. This implementation does not preserve the order of the tags; this is explicitly permitted under the NBT standard. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) Decodes a series of named tags into a new CompoundTag. encode_payload(output: io.BufferedIOBase, errors: str=’strict’) → int Encodes contents as a series of named tags. Tags are fully formed, including ids and names. Errors is passed to the Unicode encoder for encoding names, and to the individual tag encoders. tag_id Equal to ids.TAG_Compound. 1.3. Subpackages 47 NBTParse Documentation, Release 0.2.0.dev0 class nbtparse.syntax.tags.DoubleTag Bases: nbtparse.syntax.tags.TagMixin, builtins.float Represents a TAG_Double. Derives from float, and can be used anywhere a float is valid. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) → int Decode a fixed-width value from input. Value is 8 bytes wide. encode_payload(output: io.BufferedIOBase, errors=’strict’) Encode a fixed-width value to output. If the value is too large to fit into the appropriate representation, an OverflowError will result. tag_id Equal to ids.TAG_Double. class nbtparse.syntax.tags.EndTag Bases: nbtparse.syntax.tags.TagMixin Represents a TAG_End. EndTags always compare equal to one another, are immutable and hashable, and are considered False by bool(). Subclassing it is probably not a great idea. For all practical purposes, you can think of EndTag() as the tag equivalent of None. You probably won’t need this very often; TAG_End mostly only shows up as the terminating sentinel value for TAG_Compound, and CompoundTag handles that automatically. It’s here if you need it, though. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) Returns an EndTag Does not interact with input at all. encode_named(name: str, output: io.BufferedIOBase, errors: str=’strict’) → int Writes a single null byte to output. encode_payload(output: io.BufferedIOBase, errors: str=’strict’) → int Does nothing, since TAG_End has no payload. tag_id Equal to ids.TAG_End. class nbtparse.syntax.tags.FloatTag Bases: nbtparse.syntax.tags.TagMixin, builtins.float Represents a TAG_Float. Derives from float, and can be used anywhere a float is valid. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) → int Decode a fixed-width value from input. Value is 4 bytes wide. encode_payload(output: io.BufferedIOBase, errors=’strict’) Encode a fixed-width value to output. If the value is too large to fit into the appropriate representation, an OverflowError will result. tag_id Equal to ids.TAG_Float. 48 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 class nbtparse.syntax.tags.IntArrayTag Bases: nbtparse.syntax.tags.TagMixin, builtins.list Represents a TAG_Int_Array. Unlike most other tags, this tag is mutable and unhashable. Derives from list and may be used in place of one. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) Decodes a series of integers into a new IntArrayTag. encode_payload(output, errors=’strict’) Encodes contents as a series of integers. tag_id Equal to ids.TAG_Int_Array. class nbtparse.syntax.tags.IntTag Bases: nbtparse.syntax.tags.TagMixin, builtins.int Represents a TAG_Int. Derives from int, and can be used anywhere an int is valid. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) → int Decode a fixed-width value from input. Value is 4 bytes wide. encode_payload(output: io.BufferedIOBase, errors=’strict’) Encode a fixed-width value to output. If the value is too large to fit into the appropriate representation, an OverflowError will result. tag_id Equal to ids.TAG_Int. class nbtparse.syntax.tags.ListTag(iterable=None, content_id=None) Bases: nbtparse.syntax.tags.TagMixin, builtins.list Represents a TAG_List. Unlike most other tags, this tag is mutable and unhashable. instance.content_id identifies the type of the tags listed in this tag. During initialization, ListTag will attempt to guess content_id if it is not provided. If the list is empty, it defaults to None and the list will not be encodable. content_id Identifies the tag id of the tags listed in this TAG_List. Starts at None if the list was initially empty and a content_id was not provided. While this is None, the tag cannot be encoded. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) Decode a list of tags. encode_payload(output: io.BufferedIOBase, errors: str=’strict’) → int Encodes a series of tag payloads to output. Returns the total number of bytes written, including metadata. tag_id Equal to ids.TAG_List. 1.3. Subpackages 49 NBTParse Documentation, Release 0.2.0.dev0 class nbtparse.syntax.tags.LongTag Bases: nbtparse.syntax.tags.TagMixin, builtins.int Represents a TAG_Long. Derives from long, and can be used anywhere a long is valid. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) → int Decode a fixed-width value from input. Value is 8 bytes wide. encode_payload(output: io.BufferedIOBase, errors=’strict’) Encode a fixed-width value to output. If the value is too large to fit into the appropriate representation, an OverflowError will result. tag_id Equal to ids.TAG_Long. class nbtparse.syntax.tags.ShortTag Bases: nbtparse.syntax.tags.TagMixin, builtins.int Represents a TAG_Short. Derives from int, and can be used anywhere an int is valid. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) → int Decode a fixed-width value from input. Value is 2 bytes wide. encode_payload(output: io.BufferedIOBase, errors=’strict’) Encode a fixed-width value to output. If the value is too large to fit into the appropriate representation, an OverflowError will result. tag_id Equal to ids.TAG_Short. class nbtparse.syntax.tags.StringTag Bases: nbtparse.syntax.tags.TagMixin, builtins.str Represents a TAG_String. Derives from str and can be used anywhere that str is valid. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) Reads a TAG_String payload into a new StringTag. TAG_String is always in UTF-8. Errors is passed to the Unicode encoder. The default value of ‘strict’ will cause any problems (e.g. invalid UTF-8) to raise a UnicodeError. encode_payload(output: io.BufferedIOBase, errors: str=’strict’) → int Writes this tag as UTF-8 to output. Returns total bytes written, including length. Errors is passed to the Unicode encoder. The default value of ’strict’ will cause any problems (e.g. invalid surrogates) to raise a UnicodeError. tag_id Equal to ids.TAG_String. 50 Chapter 1. API Reference NBTParse Documentation, Release 0.2.0.dev0 class nbtparse.syntax.tags.TagMixin Bases: builtins.object Abstract mixin class for tags. All NBT tags inherit from TagMixin. classmethod decode_named(input: io.BufferedIOBase, errors: str=’strict’) Decode a named tag from input and returns (name, tag). Reads from input; see decode_payload() for some caveats related to this. Errors will be passed to the Unicode decoder when decoding the name and payload. classmethod decode_payload(input: io.BufferedIOBase, errors: str=’strict’) Decode a payload from input. Reads from input and returns an instance of this tag. input should provide a read() method but is otherwise unconstrained in type. If a string needs to be decoded, pass errors to the Unicode decoder; ignored on tags which don’t need to encode strings. Note: input.read() must perform any buffering that may be necessary to the underlying I/O; if it returns less data than was requested, that will be interpreted as EOF. io.BufferedIOBase and its subclasses satisfy this requirement when in non-interactive mode, but may raise BlockingIOError if in non-blocking mode. If you want to use non-blocking I/O here, look into event-driven frameworks; many provide non-blocking file and socket implementations with buffer-like behavior. encode_named(name: str, output: io.BufferedIOBase, errors: str=’strict’) → int Encode this tag with a name (e.g. in a TAG_Compound). Writes to output and returns bytes written; see encode_payload() for some caveats related to this. Name should be a unicode object, not a string. errors will be used in encoding the name and payload of this tag. encode_payload(output: io.BufferedIOBase, errors: str=’strict’) → int Encode the payload of this tag. Writes to output and returns number of bytes written. Output should provide a write() method but is otherwise unconstrained in type. If a string needs to be encoded, pass errors to the Unicode encoder; ignored on tags which don’t need to encode strings. If a value is out of range, an OverflowError may result. Note: output.write() must perform any buffering that may be necessary to the underlying I/O; it should write its entire argument, unless something has gone wrong. io.BufferedIOBase and its subclasses satisfy this requirement when in non-interactive mode, but may raise BlockingIOError if in non-blocking mode. If you want to use non-blocking I/O here, look into event-driven frameworks; many provide non-blocking file and socket implementations with buffer-like behavior. tag_id The ID of this tag (e.g. 1 for a TAG_Byte). nbtparse.syntax.tags.decode_named = <bound method ABCMeta.decode_named of <class ‘nbtparse.syntax.tags.TagM Same as TagMixin.decode_named() 1.3. Subpackages 51 NBTParse Documentation, Release 0.2.0.dev0 nbtparse.syntax.tags.decode_payload(input, tag_id: int, errors: parse.syntax.tags.TagMixin Decode a payload with tag ID tag_id. str=’strict’) → nbt- Helper function to look up the appropriate class and call its decode_payload() method. 52 Chapter 1. API Reference CHAPTER 2 Indices and tables • genindex • modindex • search 53 NBTParse Documentation, Release 0.2.0.dev0 54 Chapter 2. Indices and tables Python Module Index n nbtparse, 3 nbtparse.exceptions, 4 nbtparse.minecraft, 5 nbtparse.minecraft.entity, 5 nbtparse.minecraft.entityfactory, 7 nbtparse.minecraft.ids, 7 nbtparse.minecraft.item, 10 nbtparse.minecraft.level, 11 nbtparse.minecraft.mobs, 13 nbtparse.minecraft.projectile, 24 nbtparse.minecraft.terrain, 26 nbtparse.minecraft.terrain.chunk, 29 nbtparse.minecraft.terrain.dimension, 26 nbtparse.minecraft.terrain.filters, 33 nbtparse.minecraft.terrain.region, 28 nbtparse.minecraft.terrain.tile, 33 nbtparse.minecraft.terrain.voxel, 30 nbtparse.semantics, 39 nbtparse.semantics.fields, 40 nbtparse.semantics.filetype, 43 nbtparse.semantics.nbtobject, 43 nbtparse.syntax, 45 nbtparse.syntax.tags, 46 55 NBTParse Documentation, Release 0.2.0.dev0 56 Python Module Index Index Symbols attributes (nbtparse.minecraft.mobs.Mob attribute), 17 __version__ (in module nbtparse), 3 B A base (nbtparse.minecraft.mobs.Attribute attribute), 13 Bat (class in nbtparse.minecraft.mobs), 14 Beacon (class in nbtparse.minecraft.terrain.tile), 34 Blaze (class in nbtparse.minecraft.mobs), 14 Block (class in nbtparse.minecraft.terrain.voxel), 30 block_data (nbtparse.minecraft.terrain.tile.Piston attribute), 37 block_id (nbtparse.minecraft.terrain.tile.Piston attribute), 37 block_number (nbtparse.minecraft.ids.BlockID attribute), 7 BlockField (in module nbtparse.minecraft.terrain.chunk), 29 BlockID (class in nbtparse.minecraft.ids), 7 blocks (nbtparse.minecraft.terrain.chunk.Section attribute), 30 BooleanField (in module nbtparse.semantics.fields), 40 bred (nbtparse.minecraft.mobs.Horse attribute), 16 Breedable (class in nbtparse.minecraft.mobs), 14 brew_time (nbtparse.minecraft.terrain.tile.Cauldron attribute), 34 burn_time (nbtparse.minecraft.terrain.tile.Furnace attribute), 36 butcher (nbtparse.minecraft.mobs.VillagerProfession attribute), 22 buy (nbtparse.minecraft.mobs.Offer attribute), 19 buy_secondary (nbtparse.minecraft.mobs.Offer attribute), 19 ByteArrayField (in module nbtparse.semantics.fields), 40 ByteArrayTag (class in nbtparse.syntax.tags), 46 ByteField (in module nbtparse.semantics.fields), 40 ByteTag (class in nbtparse.syntax.tags), 47 Abilities (class in nbtparse.minecraft.mobs), 13 abilities (nbtparse.minecraft.mobs.Player attribute), 19 absorption (nbtparse.minecraft.mobs.Mob attribute), 17 AbstractDispenser (class in nbtparse.minecraft.terrain.tile), 33 AbstractField (in module nbtparse.semantics.fields), 40 AbstractFireball (class in nbtparse.minecraft.projectile), 24 active_effects (nbtparse.minecraft.mobs.Mob attribute), 17 age (nbtparse.minecraft.item.ItemEntity attribute), 11 age (nbtparse.minecraft.mobs.Breedable attribute), 14 air_ticks (nbtparse.minecraft.entity.Entity attribute), 5 all_fields() (nbtparse.semantics.nbtobject.NBTMeta method), 43 all_fields() (nbtparse.semantics.nbtobject.NBTObject class method), 44 all_ids (in module nbtparse.minecraft.ids), 9 ALLOWED_TYPES (in module nbtparse.minecraft.ids), 7 ambient (nbtparse.minecraft.mobs.PotionEffect attribute), 20 amount (nbtparse.minecraft.mobs.Modifier attribute), 18 amplifier (nbtparse.minecraft.mobs.PotionEffect attribute), 20 anger (nbtparse.minecraft.mobs.ZombiePigman attribute), 23 angry (nbtparse.minecraft.mobs.Wolf attribute), 23 armor (nbtparse.minecraft.mobs.Horse attribute), 16 Arrow (class in nbtparse.minecraft.projectile), 24 atomic (nbtparse.minecraft.terrain.dimension.Dimension attribute), 26 C attach_field() (nbtparse.semantics.nbtobject.NBTMeta cache_size (nbtparse.minecraft.terrain.dimension.Dimension method), 43 attribute), 27 attack_ticks (nbtparse.minecraft.mobs.Mob attribute), 17 can_pickup_loot (nbtparse.minecraft.mobs.Mob atAttribute (class in nbtparse.minecraft.mobs), 13 tribute), 17 57 NBTParse Documentation, Release 0.2.0.dev0 carried (nbtparse.minecraft.mobs.Enderman attribute), 15 carried_data (nbtparse.minecraft.mobs.Enderman attribute), 15 cat_type (nbtparse.minecraft.mobs.Ocelot attribute), 18 Cauldron (class in nbtparse.minecraft.terrain.tile), 34 CaveSpider (class in nbtparse.minecraft.mobs), 14 cheats (nbtparse.minecraft.level.LevelFile attribute), 11 Chest (class in nbtparse.minecraft.terrain.tile), 34 chested (nbtparse.minecraft.mobs.Horse attribute), 16 Chicken (class in nbtparse.minecraft.mobs), 14 Chunk (class in nbtparse.minecraft.terrain.chunk), 29 class_name (nbtparse.minecraft.ids.EntityID attribute), 8 ClassID (class in nbtparse.minecraft.ids), 8 ClassWarning, 4 clear() (nbtparse.minecraft.terrain.region.Region method), 28 close() (nbtparse.minecraft.terrain.filters.Filter method), 33 collar_color (nbtparse.minecraft.mobs.Wolf attribute), 23 color (nbtparse.minecraft.mobs.Sheep attribute), 21 command (nbtparse.minecraft.terrain.tile.Control attribute), 35 command_block_output (nbtparse.minecraft.level.Rules attribute), 12 Comparator (class in nbtparse.minecraft.terrain.tile), 34 CompoundTag (class in nbtparse.syntax.tags), 47 ConcurrentError, 4 Container (class in nbtparse.minecraft.terrain.tile), 35 content_id (nbtparse.syntax.tags.ListTag attribute), 49 Control (class in nbtparse.minecraft.terrain.tile), 35 conversion_time (nbtparse.minecraft.mobs.Zombie attribute), 23 cook_time (nbtparse.minecraft.terrain.tile.Furnace attribute), 36 cooldown (nbtparse.minecraft.terrain.tile.Hopper attribute), 36 CoordinateField (in module nbtparse.minecraft.entity), 5 coords (nbtparse.minecraft.mobs.Leash attribute), 17 coords (nbtparse.minecraft.projectile.Projectile attribute), 24 coords (nbtparse.minecraft.terrain.tile.TileEntity attribute), 39 copy_vb() (nbtparse.minecraft.terrain.filters.Filter method), 33 count (nbtparse.minecraft.item.Item attribute), 10 Cow (class in nbtparse.minecraft.mobs), 14 Creeper (class in nbtparse.minecraft.mobs), 14 custom_name (nbtparse.minecraft.terrain.tile.Container attribute), 35 data (nbtparse.minecraft.terrain.voxel.Block attribute), 30 data (nbtparse.semantics.nbtobject.NBTObject attribute), 44 DaylightSensor (class in nbtparse.minecraft.terrain.tile), 35 death_ticks (nbtparse.minecraft.mobs.Mob attribute), 17 decode_named (in module nbtparse.syntax.tags), 51 decode_named() (nbtparse.syntax.tags.TagMixin class method), 51 decode_payload() (in module nbtparse.syntax.tags), 51 decode_payload() (nbtparse.syntax.tags.ByteArrayTag class method), 47 decode_payload() (nbtparse.syntax.tags.ByteTag class method), 47 decode_payload() (nbtparse.syntax.tags.CompoundTag class method), 47 decode_payload() (nbtparse.syntax.tags.DoubleTag class method), 48 decode_payload() (nbtparse.syntax.tags.EndTag class method), 48 decode_payload() (nbtparse.syntax.tags.FloatTag class method), 48 decode_payload() (nbtparse.syntax.tags.IntArrayTag class method), 49 decode_payload() (nbtparse.syntax.tags.IntTag class method), 49 decode_payload() (nbtparse.syntax.tags.ListTag class method), 49 decode_payload() (nbtparse.syntax.tags.LongTag class method), 50 decode_payload() (nbtparse.syntax.tags.ShortTag class method), 50 decode_payload() (nbtparse.syntax.tags.StringTag class method), 50 decode_payload() (nbtparse.syntax.tags.TagMixin class method), 51 delay (nbtparse.minecraft.terrain.tile.Spawner attribute), 38 detach_field() (nbtparse.semantics.nbtobject.NBTMeta method), 43 Dimension (class in nbtparse.minecraft.terrain.dimension), 26 dimension (nbtparse.minecraft.entity.Entity attribute), 5 dimension (nbtparse.minecraft.mobs.Player attribute), 19 direction (nbtparse.minecraft.projectile.AbstractFireball attribute), 24 Dispenser (class in nbtparse.minecraft.terrain.tile), 35 do_fire_tick (nbtparse.minecraft.level.Rules attribute), 12 do_mob_loot (nbtparse.minecraft.level.Rules attribute), 13 D do_mob_spawning (nbtparse.minecraft.level.Rules attribute), 13 damage (nbtparse.minecraft.item.Item attribute), 10 damage (nbtparse.minecraft.projectile.Arrow attribute), do_tile_drops (nbtparse.minecraft.level.Rules attribute), 13 24 58 Index NBTParse Documentation, Release 0.2.0.dev0 donkey (nbtparse.minecraft.mobs.HorseType attribute), 16 DoubleField (in module nbtparse.semantics.fields), 40 DoubleTag (class in nbtparse.syntax.tags), 47 drop_chances (nbtparse.minecraft.mobs.Mob attribute), 17 DroppedItem (class in nbtparse.minecraft.item), 10 Dropper (class in nbtparse.minecraft.terrain.tile), 35 duration (nbtparse.minecraft.mobs.PotionEffect attribute), 20 E eating (nbtparse.minecraft.mobs.Horse attribute), 16 Egg (class in nbtparse.minecraft.projectile), 24 encode_named() (nbtparse.syntax.tags.EndTag method), 48 encode_named() (nbtparse.syntax.tags.TagMixin method), 51 encode_payload() (nbtparse.syntax.tags.ByteArrayTag method), 47 encode_payload() (nbtparse.syntax.tags.ByteTag method), 47 encode_payload() (nbtparse.syntax.tags.CompoundTag method), 47 encode_payload() (nbtparse.syntax.tags.DoubleTag method), 48 encode_payload() (nbtparse.syntax.tags.EndTag method), 48 encode_payload() (nbtparse.syntax.tags.FloatTag method), 48 encode_payload() (nbtparse.syntax.tags.IntArrayTag method), 49 encode_payload() (nbtparse.syntax.tags.IntTag method), 49 encode_payload() (nbtparse.syntax.tags.ListTag method), 49 encode_payload() (nbtparse.syntax.tags.LongTag method), 50 encode_payload() (nbtparse.syntax.tags.ShortTag method), 50 encode_payload() (nbtparse.syntax.tags.StringTag method), 50 encode_payload() (nbtparse.syntax.tags.TagMixin method), 51 ender_items (nbtparse.minecraft.mobs.Player attribute), 19 EnderDragon (class in nbtparse.minecraft.mobs), 15 Enderman (class in nbtparse.minecraft.mobs), 15 EndPortal (class in nbtparse.minecraft.terrain.tile), 35 EndTag (class in nbtparse.syntax.tags), 48 entities (nbtparse.minecraft.terrain.chunk.Chunk attribute), 29 entities (nbtparse.minecraft.terrain.dimension.Dimension attribute), 27 Index Entity (class in nbtparse.minecraft.entity), 5 entity_id (nbtparse.minecraft.terrain.tile.Spawner attribute), 38 EntityID (class in nbtparse.minecraft.ids), 8 EntityMeta (class in nbtparse.minecraft.entity), 6 enumerate() (nbtparse.minecraft.terrain.voxel.VoxelBuffer method), 31 EnumField (in module nbtparse.semantics.fields), 40 equipment (nbtparse.minecraft.mobs.Mob attribute), 18 explosion_radius (nbtparse.minecraft.mobs.Creeper attribute), 15 extending (nbtparse.minecraft.terrain.tile.Piston attribute), 37 F facing (nbtparse.minecraft.terrain.tile.Piston attribute), 37 fall_distance (nbtparse.minecraft.entity.Entity attribute), 5 farmer (nbtparse.minecraft.mobs.VillagerProfession attribute), 22 features (nbtparse.minecraft.level.LevelFile attribute), 11 fields() (nbtparse.semantics.nbtobject.NBTMeta method), 44 fields() (nbtparse.semantics.nbtobject.NBTObject class method), 44 Filter (class in nbtparse.minecraft.terrain.filters), 33 fire_ticks (nbtparse.minecraft.entity.Entity attribute), 6 Fireball (class in nbtparse.minecraft.projectile), 24 FloatField (in module nbtparse.semantics.fields), 40 FloatTag (class in nbtparse.syntax.tags), 48 flower_type (nbtparse.minecraft.terrain.tile.FlowerPot attribute), 36 FlowerPot (class in nbtparse.minecraft.terrain.tile), 36 fly_speed (nbtparse.minecraft.mobs.Abilities attribute), 13 flying (nbtparse.minecraft.mobs.Abilities attribute), 13 food_exhaustion (nbtparse.minecraft.mobs.Player attribute), 19 food_level (nbtparse.minecraft.mobs.Player attribute), 20 food_saturation (nbtparse.minecraft.mobs.Player attribute), 20 food_timer (nbtparse.minecraft.mobs.Player attribute), 20 from_bytes() (nbtparse.semantics.nbtobject.NBTObject class method), 44 from_nbt() (in module nbtparse.minecraft.entityfactory), 7 from_nbt() (nbtparse.semantics.nbtobject.NBTObject class method), 44 from_raw() (nbtparse.minecraft.terrain.voxel.VoxelBuffer class method), 31 Furnace (class in nbtparse.minecraft.terrain.tile), 36 fuse (nbtparse.minecraft.mobs.Creeper attribute), 15 59 NBTParse Documentation, Release 0.2.0.dev0 G game_type (nbtparse.minecraft.level.LevelFile attribute), 11 generator (nbtparse.minecraft.level.LevelFile attribute), 11 generator_options (nbtparse.minecraft.level.LevelFile attribute), 11 generator_version (nbtparse.minecraft.level.LevelFile attribute), 11 generic (nbtparse.minecraft.mobs.VillagerProfession attribute), 22 get_namespace() (in module nbtparse.minecraft.ids), 9 Ghast (class in nbtparse.minecraft.mobs), 15 Giant (class in nbtparse.minecraft.mobs), 15 GzippedNBTFile (class in nbtparse.semantics.filetype), 43 H hanging (nbtparse.minecraft.mobs.Bat attribute), 14 hardcore (nbtparse.minecraft.level.LevelFile attribute), 11 has_reproduced (nbtparse.minecraft.mobs.Horse attribute), 16 health (nbtparse.minecraft.item.ItemEntity attribute), 11 health (nbtparse.minecraft.mobs.Mob attribute), 18 HealthField (in module nbtparse.minecraft.mobs), 15 height (nbtparse.minecraft.terrain.voxel.VoxelBuffer attribute), 31 height_map (nbtparse.minecraft.terrain.chunk.Chunk attribute), 29 HeightMap (class in nbtparse.minecraft.terrain.chunk), 29 HeightMapField (in module nbtparse.minecraft.terrain.chunk), 29 Hopper (class in nbtparse.minecraft.terrain.tile), 36 Horse (class in nbtparse.minecraft.mobs), 16 horse (nbtparse.minecraft.mobs.HorseType attribute), 16 HorseType (class in nbtparse.minecraft.mobs), 16 hurt_ticks (nbtparse.minecraft.mobs.Mob attribute), 18 I id (nbtparse.minecraft.entity.Entity attribute), 6 id (nbtparse.minecraft.item.DroppedItem attribute), 10 id (nbtparse.minecraft.item.Item attribute), 10 id (nbtparse.minecraft.item.XPOrb attribute), 11 id (nbtparse.minecraft.mobs.Bat attribute), 14 id (nbtparse.minecraft.mobs.Blaze attribute), 14 id (nbtparse.minecraft.mobs.CaveSpider attribute), 14 id (nbtparse.minecraft.mobs.Chicken attribute), 14 id (nbtparse.minecraft.mobs.Cow attribute), 14 id (nbtparse.minecraft.mobs.Creeper attribute), 15 id (nbtparse.minecraft.mobs.EnderDragon attribute), 15 id (nbtparse.minecraft.mobs.Enderman attribute), 15 id (nbtparse.minecraft.mobs.Ghast attribute), 15 id (nbtparse.minecraft.mobs.Giant attribute), 15 60 id (nbtparse.minecraft.mobs.Horse attribute), 16 id (nbtparse.minecraft.mobs.IronGolem attribute), 17 id (nbtparse.minecraft.mobs.MagmaCube attribute), 17 id (nbtparse.minecraft.mobs.Mooshroom attribute), 18 id (nbtparse.minecraft.mobs.Ocelot attribute), 18 id (nbtparse.minecraft.mobs.Pig attribute), 19 id (nbtparse.minecraft.mobs.PotionEffect attribute), 20 id (nbtparse.minecraft.mobs.Sheep attribute), 21 id (nbtparse.minecraft.mobs.Silverfish attribute), 21 id (nbtparse.minecraft.mobs.Skeleton attribute), 21 id (nbtparse.minecraft.mobs.Slime attribute), 21 id (nbtparse.minecraft.mobs.SnowGolem attribute), 21 id (nbtparse.minecraft.mobs.Spider attribute), 21 id (nbtparse.minecraft.mobs.Squid attribute), 22 id (nbtparse.minecraft.mobs.Villager attribute), 22 id (nbtparse.minecraft.mobs.Witch attribute), 23 id (nbtparse.minecraft.mobs.Wither attribute), 23 id (nbtparse.minecraft.mobs.Wolf attribute), 23 id (nbtparse.minecraft.mobs.Zombie attribute), 23 id (nbtparse.minecraft.mobs.ZombiePigman attribute), 23 id (nbtparse.minecraft.projectile.Arrow attribute), 24 id (nbtparse.minecraft.projectile.Egg attribute), 24 id (nbtparse.minecraft.projectile.Fireball attribute), 24 id (nbtparse.minecraft.projectile.SmallFireball attribute), 25 id (nbtparse.minecraft.projectile.ThrownEnderpearl attribute), 25 id (nbtparse.minecraft.projectile.ThrownExpBottle attribute), 25 id (nbtparse.minecraft.projectile.ThrownPotion attribute), 25 id (nbtparse.minecraft.projectile.ThrownSnowball attribute), 25 id (nbtparse.minecraft.projectile.WitherSkull attribute), 25 id (nbtparse.minecraft.terrain.tile.Beacon attribute), 34 id (nbtparse.minecraft.terrain.tile.Cauldron attribute), 34 id (nbtparse.minecraft.terrain.tile.Chest attribute), 34 id (nbtparse.minecraft.terrain.tile.Comparator attribute), 34 id (nbtparse.minecraft.terrain.tile.Control attribute), 35 id (nbtparse.minecraft.terrain.tile.DaylightSensor attribute), 35 id (nbtparse.minecraft.terrain.tile.Dispenser attribute), 35 id (nbtparse.minecraft.terrain.tile.Dropper attribute), 35 id (nbtparse.minecraft.terrain.tile.EndPortal attribute), 36 id (nbtparse.minecraft.terrain.tile.FlowerPot attribute), 36 id (nbtparse.minecraft.terrain.tile.Furnace attribute), 36 id (nbtparse.minecraft.terrain.tile.Hopper attribute), 36 id (nbtparse.minecraft.terrain.tile.Music attribute), 36 id (nbtparse.minecraft.terrain.tile.Piston attribute), 37 id (nbtparse.minecraft.terrain.tile.RecordPlayer attribute), 37 id (nbtparse.minecraft.terrain.tile.Sign attribute), 37 Index NBTParse Documentation, Release 0.2.0.dev0 id (nbtparse.minecraft.terrain.tile.Skull attribute), 38 id (nbtparse.minecraft.terrain.tile.Spawner attribute), 38 id (nbtparse.minecraft.terrain.tile.TileEntity attribute), 39 id (nbtparse.minecraft.terrain.voxel.Block attribute), 30 ids (class in nbtparse.syntax), 45 in_data (nbtparse.minecraft.projectile.Arrow attribute), 24 in_ground (nbtparse.minecraft.projectile.Projectile attribute), 24 in_love (nbtparse.minecraft.mobs.Breedable attribute), 14 in_tile (nbtparse.minecraft.projectile.Projectile attribute), 24 IncompleteSequenceError, 4 initialized (nbtparse.minecraft.level.LevelFile attribute), 11 insert() (nbtparse.minecraft.mobs.OfferList method), 19 instabuild (nbtparse.minecraft.mobs.Abilities attribute), 13 IntArrayField (in module nbtparse.semantics.fields), 40 IntArrayTag (class in nbtparse.syntax.tags), 48 IntField (in module nbtparse.semantics.fields), 40 IntTag (class in nbtparse.syntax.tags), 49 inventory (nbtparse.minecraft.mobs.Player attribute), 20 invulnerable (nbtparse.minecraft.entity.Entity attribute), 6 invulnerable (nbtparse.minecraft.mobs.Abilities attribute), 13 invulnerable (nbtparse.minecraft.mobs.Wither attribute), 23 IronGolem (class in nbtparse.minecraft.mobs), 17 is_baby (nbtparse.minecraft.mobs.Zombie attribute), 23 is_villager (nbtparse.minecraft.mobs.Zombie attribute), 23 Item (class in nbtparse.minecraft.item), 10 item (nbtparse.minecraft.item.DroppedItem attribute), 10 item (nbtparse.minecraft.terrain.tile.FlowerPot attribute), 36 item_id (nbtparse.minecraft.ids.BlockID attribute), 7 ItemEntity (class in nbtparse.minecraft.item), 11 ItemID (class in nbtparse.minecraft.ids), 8 items (nbtparse.minecraft.mobs.Horse attribute), 16 items (nbtparse.minecraft.terrain.tile.AbstractDispenser attribute), 34 items (nbtparse.minecraft.terrain.tile.Cauldron attribute), 34 items (nbtparse.minecraft.terrain.tile.Chest attribute), 34 items (nbtparse.minecraft.terrain.tile.Furnace attribute), 36 items (nbtparse.minecraft.terrain.tile.Hopper attribute), 36 L last_output (nbtparse.minecraft.terrain.tile.Control attribute), 35 last_played (nbtparse.minecraft.level.LevelFile attribute), 11 Leash (class in nbtparse.minecraft.mobs), 17 leash (nbtparse.minecraft.mobs.Mob attribute), 18 leashed (nbtparse.minecraft.mobs.Mob attribute), 18 length (nbtparse.minecraft.terrain.voxel.VoxelBuffer attribute), 31 LevelFile (class in nbtparse.minecraft.level), 11 levels (nbtparse.minecraft.terrain.tile.Beacon attribute), 34 librarian (nbtparse.minecraft.mobs.VillagerProfession attribute), 22 light (nbtparse.minecraft.ids.BlockID attribute), 7 line1 (nbtparse.minecraft.terrain.tile.Sign attribute), 37 line2 (nbtparse.minecraft.terrain.tile.Sign attribute), 37 line3 (nbtparse.minecraft.terrain.tile.Sign attribute), 37 line4 (nbtparse.minecraft.terrain.tile.Sign attribute), 38 ListField (in module nbtparse.semantics.fields), 40 ListTag (class in nbtparse.syntax.tags), 49 load() (nbtparse.minecraft.terrain.region.Region class method), 28 load() (nbtparse.semantics.filetype.GzippedNBTFile class method), 43 load() (nbtparse.semantics.filetype.NBTFile class method), 43 lock (nbtparse.minecraft.terrain.tile.Container attribute), 35 LongField (in module nbtparse.semantics.fields), 40 LongTag (class in nbtparse.syntax.tags), 49 M MagmaCube (class in nbtparse.minecraft.mobs), 17 main() (in module nbtparse.minecraft.ids), 9 MalformedNBTError, 4 max_cache (nbtparse.minecraft.terrain.dimension.Dimension attribute), 27 max_delay (nbtparse.minecraft.terrain.tile.Spawner attribute), 38 max_entities (nbtparse.minecraft.terrain.tile.Spawner attribute), 38 max_stack (nbtparse.minecraft.ids.ItemID attribute), 8 max_uses (nbtparse.minecraft.mobs.Offer attribute), 19 may_build (nbtparse.minecraft.mobs.Abilities attribute), 13 may_fly (nbtparse.minecraft.mobs.Abilities attribute), 13 min_delay (nbtparse.minecraft.terrain.tile.Spawner attribute), 38 K Mob (class in nbtparse.minecraft.mobs), 17 keep_inventory (nbtparse.minecraft.level.Rules attribute), mob_griefing (nbtparse.minecraft.level.Rules attribute), 13 13 mode (nbtparse.minecraft.mobs.Player attribute), 20 Index 61 NBTParse Documentation, Release 0.2.0.dev0 Modifier (class in nbtparse.minecraft.mobs), 18 modifiers (nbtparse.minecraft.mobs.Attribute attribute), 13 Mooshroom (class in nbtparse.minecraft.mobs), 18 motion (nbtparse.minecraft.entity.Entity attribute), 6 mount (nbtparse.minecraft.entity.Entity attribute), 6 mule (nbtparse.minecraft.mobs.HorseType attribute), 16 MultiField (in module nbtparse.semantics.fields), 40 Music (class in nbtparse.minecraft.terrain.tile), 36 MutableField (in module nbtparse.semantics.fields), 41 ObjectTupleField (in module nbtparse.semantics.fields), 41 Ocelot (class in nbtparse.minecraft.mobs), 18 Offer (class in nbtparse.minecraft.mobs), 19 OfferList (class in nbtparse.minecraft.mobs), 19 OfferListMeta (class in nbtparse.minecraft.mobs), 19 offers (nbtparse.minecraft.mobs.Villager attribute), 22 on_ground (nbtparse.minecraft.entity.Entity attribute), 6 opacity (nbtparse.minecraft.ids.BlockID attribute), 7 operation (nbtparse.minecraft.mobs.Modifier attribute), 18 N output (nbtparse.minecraft.terrain.tile.Comparator attribute), 34 name (nbtparse.minecraft.ids.Named attribute), 8 owner (nbtparse.minecraft.mobs.Tameable attribute), 22 name (nbtparse.minecraft.level.LevelFile attribute), 12 owner_name (nbtparse.minecraft.mobs.Horse attribute), name (nbtparse.minecraft.mobs.Attribute attribute), 13 16 name (nbtparse.minecraft.mobs.Mob attribute), 18 owner_name (nbtparse.minecraft.projectile.Thrown atname (nbtparse.minecraft.mobs.Modifier attribute), 18 tribute), 25 name_visible (nbtparse.minecraft.mobs.Mob attribute), 18 P Named (class in nbtparse.minecraft.ids), 8 ParserError, 4 Namespace (class in nbtparse.minecraft.ids), 8 persistent (nbtparse.minecraft.mobs.Mob attribute), 18 NBTFile (class in nbtparse.semantics.filetype), 43 physics (nbtparse.minecraft.ids.BlockID attribute), 7 NBTMeta (class in nbtparse.semantics.nbtobject), 43 pickup (nbtparse.minecraft.projectile.Arrow attribute), 24 NBTObject (class in nbtparse.semantics.nbtobject), 44 NBTObjectField (in module nbtparse.semantics.fields), Pig (class in nbtparse.minecraft.mobs), 19 Piston (class in nbtparse.minecraft.terrain.tile), 37 41 Player (class in nbtparse.minecraft.mobs), 19 nbtparse (module), 3 player (nbtparse.minecraft.level.LevelFile attribute), 12 nbtparse.exceptions (module), 4 player (nbtparse.minecraft.projectile.Arrow attribute), 24 nbtparse.minecraft (module), 5 player_created (nbtparse.minecraft.mobs.IronGolem atnbtparse.minecraft.entity (module), 5 tribute), 17 nbtparse.minecraft.entityfactory (module), 7 player_range (nbtparse.minecraft.terrain.tile.Spawner atnbtparse.minecraft.ids (module), 7 tribute), 39 nbtparse.minecraft.item (module), 10 portal_cooldown (nbtparse.minecraft.entity.Entity atnbtparse.minecraft.level (module), 11 tribute), 6 nbtparse.minecraft.mobs (module), 13 pos (nbtparse.minecraft.entity.Entity attribute), 6 nbtparse.minecraft.projectile (module), 24 potion (nbtparse.minecraft.projectile.ThrownPotion atnbtparse.minecraft.terrain (module), 26 tribute), 25 nbtparse.minecraft.terrain.chunk (module), 29 potion_value (nbtparse.minecraft.projectile.ThrownPotion nbtparse.minecraft.terrain.dimension (module), 26 attribute), 25 nbtparse.minecraft.terrain.filters (module), 33 PotionEffect (class in nbtparse.minecraft.mobs), 20 nbtparse.minecraft.terrain.region (module), 28 powered (nbtparse.minecraft.mobs.Creeper attribute), 15 nbtparse.minecraft.terrain.tile (module), 33 prepare_load() (nbtparse.minecraft.level.LevelFile static nbtparse.minecraft.terrain.voxel (module), 30 method), 12 nbtparse.semantics (module), 39 prepare_load() (nbtparse.minecraft.terrain.chunk.Chunk nbtparse.semantics.fields (module), 40 static method), 29 nbtparse.semantics.filetype (module), 43 prepare_load() (nbtparse.semantics.nbtobject.NBTObject nbtparse.semantics.nbtobject (module), 43 class method), 44 nbtparse.syntax (module), 45 prepare_save() (nbtparse.minecraft.level.LevelFile static nbtparse.syntax.tags (module), 46 method), 12 NoSuchTagTypeError, 4 prepare_save() (nbtparse.minecraft.terrain.chunk.Chunk note (nbtparse.minecraft.terrain.tile.Music attribute), 37 static method), 29 O prepare_save() (nbtparse.semantics.nbtobject.NBTObject method), 45 ObjectListField (in module nbtparse.semantics.fields), 41 62 Index NBTParse Documentation, Release 0.2.0.dev0 priest (nbtparse.minecraft.mobs.VillagerProfession attribute), 22 primary (nbtparse.minecraft.terrain.tile.Beacon attribute), 34 profession (nbtparse.minecraft.mobs.Villager attribute), 22 progress (nbtparse.minecraft.terrain.tile.Piston attribute), 37 Projectile (class in nbtparse.minecraft.projectile), 24 properties (nbtparse.minecraft.terrain.tile.SpawnPotential attribute), 38 save_fast() (nbtparse.minecraft.terrain.dimension.Dimension method), 28 score (nbtparse.minecraft.mobs.Player attribute), 20 secondary (nbtparse.minecraft.terrain.tile.Beacon attribute), 34 Section (class in nbtparse.minecraft.terrain.chunk), 30 SectionDictField (in module nbtparse.minecraft.terrain.chunk), 30 sections (nbtparse.minecraft.terrain.chunk.Chunk attribute), 29 seed (nbtparse.minecraft.level.LevelFile attribute), 12 selected_item_slot (nbtparse.minecraft.mobs.Player atR tribute), 20 rain_time (nbtparse.minecraft.level.LevelFile attribute), self_reference() (in module nbtparse.semantics.fields), 42 sell (nbtparse.minecraft.mobs.Offer attribute), 19 12 shake (nbtparse.minecraft.projectile.Projectile attribute), raining (nbtparse.minecraft.level.LevelFile attribute), 12 24 read_config() (in module nbtparse.minecraft.ids), 9 sheared (nbtparse.minecraft.mobs.Sheep attribute), 21 ReadOnly (class in nbtparse.semantics.fields), 41 recipes (nbtparse.minecraft.mobs.OfferList attribute), 19 Sheep (class in nbtparse.minecraft.mobs), 20 record_id (nbtparse.minecraft.terrain.tile.RecordPlayer ShortField (in module nbtparse.semantics.fields), 42 ShortTag (class in nbtparse.syntax.tags), 50 attribute), 37 record_item (nbtparse.minecraft.terrain.tile.RecordPlayer Sign (class in nbtparse.minecraft.terrain.tile), 37 Silverfish (class in nbtparse.minecraft.mobs), 21 attribute), 37 RecordPlayer (class in nbtparse.minecraft.terrain.tile), 37 SingleField (in module nbtparse.semantics.fields), 42 sitting (nbtparse.minecraft.mobs.Tameable attribute), 22 recover_atomic() (nbtparse.minecraft.terrain.dimension.Dimension size (nbtparse.minecraft.level.LevelFile attribute), 12 method), 27 size (nbtparse.minecraft.mobs.Slime attribute), 21 Region (class in nbtparse.minecraft.terrain.region), 28 register_namespace() (in module nbtparse.minecraft.ids), Skeleton (class in nbtparse.minecraft.mobs), 21 skeleton (nbtparse.minecraft.mobs.HorseType attribute), 10 16 rename() (nbtparse.minecraft.ids.Named method), 8 Skull (class in nbtparse.minecraft.terrain.tile), 38 renumber() (nbtparse.minecraft.ids.BlockID method), 7 resolve_class() (nbtparse.minecraft.ids.ClassID method), skull_id (nbtparse.minecraft.terrain.tile.Skull attribute), 38 8 resolve_class() (nbtparse.minecraft.ids.EntityID method), skull_name (nbtparse.minecraft.terrain.tile.Skull attribute), 38 8 resolve_class() (nbtparse.minecraft.ids.ItemID method), sleep_timer (nbtparse.minecraft.mobs.Player attribute), 20 8 sleeping (nbtparse.minecraft.mobs.Player attribute), 20 riches (nbtparse.minecraft.mobs.Villager attribute), 22 SliceWarning, 4 rotation (nbtparse.minecraft.entity.Entity attribute), 6 rotation (nbtparse.minecraft.terrain.tile.Skull attribute), Slime (class in nbtparse.minecraft.mobs), 21 slot (nbtparse.minecraft.item.Item attribute), 10 38 SmallFireball (class in nbtparse.minecraft.projectile), 25 Rules (class in nbtparse.minecraft.level), 12 smith (nbtparse.minecraft.mobs.VillagerProfession atrules (nbtparse.minecraft.level.LevelFile attribute), 12 tribute), 22 SnowGolem (class in nbtparse.minecraft.mobs), 21 S spawn (nbtparse.minecraft.level.LevelFile attribute), 12 saddle (nbtparse.minecraft.mobs.Horse attribute), 16 spawn (nbtparse.minecraft.mobs.Player attribute), 20 saddle (nbtparse.minecraft.mobs.Pig attribute), 19 save() (nbtparse.minecraft.terrain.region.Region method), spawn_count (nbtparse.minecraft.terrain.tile.Spawner attribute), 39 28 spawn_data (nbtparse.minecraft.terrain.tile.Spawner atsave() (nbtparse.semantics.filetype.GzippedNBTFile tribute), 39 method), 43 spawn_forced (nbtparse.minecraft.mobs.Player attribute), save() (nbtparse.semantics.filetype.NBTFile method), 43 20 save_all() (nbtparse.minecraft.terrain.dimension.Dimension method), 28 Index 63 NBTParse Documentation, Release 0.2.0.dev0 spawn_potentials (nbtparse.minecraft.terrain.tile.Spawner attribute), 39 spawn_range (nbtparse.minecraft.terrain.tile.Spawner attribute), 39 Spawner (class in nbtparse.minecraft.terrain.tile), 38 SpawnPotential (class in nbtparse.minecraft.terrain.tile), 38 Spider (class in nbtparse.minecraft.mobs), 21 Squid (class in nbtparse.minecraft.mobs), 22 STANDARD_NAMESPACE_NAME (in module nbtparse.minecraft.ids), 9 StringBooleanField (in module nbtparse.minecraft.level), 13 StringTag (class in nbtparse.syntax.tags), 50 success_count (nbtparse.minecraft.terrain.tile.Control attribute), 35 T TAG_Byte (nbtparse.syntax.ids attribute), 45 TAG_Byte_Array (nbtparse.syntax.ids attribute), 46 TAG_Compound (nbtparse.syntax.ids attribute), 46 TAG_Double (nbtparse.syntax.ids attribute), 46 TAG_End (nbtparse.syntax.ids attribute), 46 TAG_Float (nbtparse.syntax.ids attribute), 46 tag_id (nbtparse.syntax.tags.ByteArrayTag attribute), 47 tag_id (nbtparse.syntax.tags.ByteTag attribute), 47 tag_id (nbtparse.syntax.tags.CompoundTag attribute), 47 tag_id (nbtparse.syntax.tags.DoubleTag attribute), 48 tag_id (nbtparse.syntax.tags.EndTag attribute), 48 tag_id (nbtparse.syntax.tags.FloatTag attribute), 48 tag_id (nbtparse.syntax.tags.IntArrayTag attribute), 49 tag_id (nbtparse.syntax.tags.IntTag attribute), 49 tag_id (nbtparse.syntax.tags.ListTag attribute), 49 tag_id (nbtparse.syntax.tags.LongTag attribute), 50 tag_id (nbtparse.syntax.tags.ShortTag attribute), 50 tag_id (nbtparse.syntax.tags.StringTag attribute), 50 tag_id (nbtparse.syntax.tags.TagMixin attribute), 51 TAG_Int (nbtparse.syntax.ids attribute), 46 TAG_Int_Array (nbtparse.syntax.ids attribute), 46 TAG_List (nbtparse.syntax.ids attribute), 46 TAG_Long (nbtparse.syntax.ids attribute), 46 TAG_Short (nbtparse.syntax.ids attribute), 46 TAG_String (nbtparse.syntax.ids attribute), 46 TagMixin (class in nbtparse.syntax.tags), 50 tame (nbtparse.minecraft.mobs.Horse attribute), 16 Tameable (class in nbtparse.minecraft.mobs), 22 temper (nbtparse.minecraft.mobs.Horse attribute), 16 Thrown (class in nbtparse.minecraft.projectile), 25 ThrownEnderpearl (class in nbtparse.minecraft.projectile), 25 ThrownExpBottle (class in nbtparse.minecraft.projectile), 25 ThrownPotion (class in nbtparse.minecraft.projectile), 25 64 ThrownSnowball (class in nbtparse.minecraft.projectile), 25 thunder_time (nbtparse.minecraft.level.LevelFile attribute), 12 thundering (nbtparse.minecraft.level.LevelFile attribute), 12 ticks (nbtparse.minecraft.level.LevelFile attribute), 12 TileEntity (class in nbtparse.minecraft.terrain.tile), 39 tilemap (nbtparse.minecraft.terrain.voxel.VoxelBuffer attribute), 31 tiles (nbtparse.minecraft.terrain.chunk.Chunk attribute), 29 time_of_day (nbtparse.minecraft.level.LevelFile attribute), 12 to_bytes() (nbtparse.semantics.nbtobject.NBTObject method), 45 to_nbt() (nbtparse.semantics.nbtobject.NBTObject method), 45 to_raw() (nbtparse.minecraft.terrain.chunk.HeightMap method), 29 to_raw() (nbtparse.minecraft.terrain.voxel.VoxelBuffer method), 32 track_output (nbtparse.minecraft.terrain.tile.Control attribute), 35 transparent (nbtparse.minecraft.ids.BlockID attribute), 7 TupleListField (in module nbtparse.semantics.fields), 42 TupleMultiField (in module nbtparse.semantics.fields), 42 type (nbtparse.minecraft.ids.BlockID attribute), 8 type (nbtparse.minecraft.ids.EntityID attribute), 8 type (nbtparse.minecraft.ids.ItemID attribute), 8 type (nbtparse.minecraft.mobs.Horse attribute), 16 type (nbtparse.minecraft.terrain.tile.SpawnPotential attribute), 38 U UnicodeField (in module nbtparse.semantics.fields), 42 unregister_namespace() (in module nbtparse.minecraft.ids), 10 unwatch() (nbtparse.minecraft.terrain.voxel.VoxelBuffer method), 32 uses (nbtparse.minecraft.mobs.Offer attribute), 19 UTCField (in module nbtparse.semantics.fields), 42 uuid (nbtparse.minecraft.entity.Entity attribute), 6 uuid (nbtparse.minecraft.mobs.Leash attribute), 17 uuid (nbtparse.minecraft.mobs.Modifier attribute), 18 UUIDField (in module nbtparse.semantics.fields), 42 V value (nbtparse.minecraft.item.XPOrb attribute), 11 ValueWarning, 4 variant (nbtparse.minecraft.mobs.Horse attribute), 16 version (nbtparse.minecraft.level.LevelFile attribute), 12 Villager (class in nbtparse.minecraft.mobs), 22 Index NBTParse Documentation, Release 0.2.0.dev0 VillagerProfession (class in nbtparse.minecraft.mobs), 22 VoxelBuffer (class in nbtparse.minecraft.terrain.voxel), 30 W walk_speed (nbtparse.minecraft.mobs.Abilities attribute), 13 watch() (nbtparse.minecraft.terrain.voxel.VoxelBuffer method), 32 weight (nbtparse.minecraft.terrain.tile.SpawnPotential attribute), 38 width (nbtparse.minecraft.terrain.voxel.VoxelBuffer attribute), 32 Witch (class in nbtparse.minecraft.mobs), 23 Wither (class in nbtparse.minecraft.mobs), 23 wither (nbtparse.minecraft.mobs.Skeleton attribute), 21 WitherSkull (class in nbtparse.minecraft.projectile), 25 Wolf (class in nbtparse.minecraft.mobs), 23 wrapped (nbtparse.semantics.fields.ReadOnly attribute), 42 write_config() (in module nbtparse.minecraft.ids), 10 X xp_level (nbtparse.minecraft.mobs.Player attribute), 20 xp_progress (nbtparse.minecraft.mobs.Player attribute), 20 xp_total (nbtparse.minecraft.mobs.Player attribute), 20 XPOrb (class in nbtparse.minecraft.item), 11 xyz() (nbtparse.minecraft.terrain.voxel.VoxelBuffer method), 32 Y y_index (nbtparse.minecraft.terrain.chunk.Section attribute), 30 Z Zombie (class in nbtparse.minecraft.mobs), 23 zombie (nbtparse.minecraft.mobs.HorseType attribute), 16 ZombiePigman (class in nbtparse.minecraft.mobs), 23 Index 65
© Copyright 2024