Data Types#

class minecraft.datatypes.Advancement(parent_id: String | None = None, display_data: DataProxy | None = None, criteria: dict[minecraft.datatypes.Identifier, None] | None = None, requirements: list[list[minecraft.datatypes.String]] | None = None)#

Bases: DataType

Represents an advancement.

Variables:
  • parent_id (String | None) – The advancement’s parent ID.

  • display_data (DataProxy | None) – The advancement’s display data.

  • criteria (dict[Identifier, None]) – The advancement’s criteria.

  • requirements (list[list[String]]) – The advancement’s requirements.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.AdvancementDisplay(title: Chat, description: Chat, icon: Identifier, frame_type: frame, flags: Int, background_texture: Identifier | None, x: Float, y: Float)#

Bases: DataType

Represents an advancement display.

Variables:
  • title (Chat) – The advancement’s title.

  • description (Chat) – The advancement’s description.

  • icon (Identifier) – The advancement’s icon.

  • frame_type (FrameType) – The advancement’s frame type.

  • flags (Int) – The advancement’s flags.

  • background_texture (Identifier | None) – The advancement’s background texture.

  • x (float) – The advancement’s X position.

  • y (float) – The advancement’s Y position.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.AdvancementProgress(criterion: dict[minecraft.datatypes.Identifier, minecraft.datatypes.CriterionProgress])#

Bases: DataType

Represents progress towards an advancement.

Variables:
classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Angle(value: UnsignedByte)#

Bases: DataType

Represents an angle.

Variables:

value (UnsignedByte) – The angle.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.BitSet(longs: list[minecraft.datatypes.Long])#

Bases: DataType

Represents a bit set.

Variables:

longs (list[Long]) – The longs of this bit set.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.BlockEntity(xz: Byte, y: Short, type: Varint, data: NBT)#

Bases: DataType

Represents a block entity.

Variables:
  • xz (Byte) – The x and z coordinates of this block entity.

  • y (Short) – The y coordinate of this block entity.

  • type (Varint) – The type of this block entity.

  • data (NBT) – The data of this block entity.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

property x#

The x coordinate of this block entity. (int)

property z#

The z coordinate of this block entity. (int)

class minecraft.datatypes.Boolean(value: bool)#

Bases: DataType

Represents a boolean value.

Variables:

value (bool) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Byte(value: int)#

Bases: DataType

Represents a byte.

Variables:

value (int) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.ByteArray(data: bytes)#

Bases: DataType

Represents a byte array.

Variables:

data (bytes) – The data in this byte array.

classmethod from_bytes(data: BytesIO, *, length: int = None) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Chat(value: str)#

Bases: String

Represents chat data.

Variables:

value (str) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

property json#

The parsed JSON data of this chat data. (dict))

class minecraft.datatypes.CommandNode(flags: Byte, children: list[Varint], redirect: Varint | None = None, name: String | None = None, parser: CommandParser | None = None, properties: bytes | None = None, suggestions_type: Identifier | None = None)#

Bases: DataType

Represents a command node.

Variables:
  • flags (Byte) – The flags of this command node.

  • children (list[Varint]) – The children of this command node.

  • redirect (Varint | None) – The redirect of this command node.

  • name (String | None) – The name of this command node.

  • parser (CommandParser | None) – The parser of this command node.

  • properties (bytes | None) – The properties of this command node.

  • suggestions_type (Identifier | None) – The suggestions type of this command node.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.CommandSuggestionMatch(match: String, tooltip: Chat | None = None)#

Bases: DataType

Represents a command suggestion match.

Variables:
  • match (String) – The match.

  • tooltip (Chat | None) – The tooltip.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.CriterionProgress(achieved: Boolean, date: Long | None = None)#

Bases: DataType

Represents progress for a criterion.

Variables:
  • achieved (Boolean) – Whether the criterion has been achieved.

  • date (Long | None) – The date the criterion was achieved.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.DataProxy(**attrs)#

Bases: object

A proxy class for data types that do not have their own class.

All attributes on this class are dynamic.

class minecraft.datatypes.DataType#

Bases: object

The base class for all data types.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Double(value: float)#

Bases: DataType

Represents a double.

Variables:

value (int) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.EntityMetadata(entries: list[minecraft.datatypes.EntityMetadataEntry])#

Bases: DataType

Represents an entity’s metadata.

Variables:

entries (list[EntityMetadataEntry]) – The entries in this entity’s metadata.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.EntityMetadataEntry(index: UnsignedByte, type: Varint, value: DataType)#

Bases: object

Represents entity metadata.

Variables:
  • index (UnsignedByte) – The index key for this entry.

  • type (Varint) – The type of index.

  • value (DataType) – The value of this entry.

classmethod from_bytes(data: BytesIO, index: UnsignedByte) Self#
class minecraft.datatypes.Float(value: float)#

Bases: DataType

Represents a float.

Variables:

value (int) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Identifier(value: str)#

Bases: String

Represents an identifier.

Variables:

value (str) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Int(value: int)#

Bases: DataType

Represents an integer.

Variables:

value (int) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Long(value: int)#

Bases: DataType

Represents a long.

Variables:

value (int) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.MapIcon(type: MapIconType, x: Byte, y: Byte, direction: Byte, display_name: Chat | None)#

Bases: DataType

Represents a map icon.

Variables:
  • type (MapIconType) – The type of this map icon.

  • x (Byte) – The x coordinate of this map icon.

  • y (Byte) – The y coordinate of this map icon.

  • direction (Byte) – The direction this icon is pointing.

  • display_name (Chat) – The display name of this map icon.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.NBT(data: BytesIO, tag_id: int)#

Bases: NBTFile

Represents NBT data. This inherits from nbt.NBTFile.

classmethod from_bytes(data: BytesIO) Self#
parse_file()#

Completely parse a file, extracting all tags.

class minecraft.datatypes.ParticleType(name: Identifier, id: Varint, data: bytes)#

Bases: DataType

Represents a particle.

Variables:
  • name (Identifier) – The name of this particle.

  • id (Varint) – The ID of this particle.

  • data (bytes) – The particle’s data.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.PlayerInfoUpdatePlayer(uuid: UUID, add_player: DataProxy | None = None, initialize_chat: DataProxy | None = None, update_gamemode: DataProxy | None = None, update_listed: DataProxy | None = None, update_latency: DataProxy | None = None, update_display_name: DataProxy | None = None)#

Bases: DataType

Represents a player info update for a single player.

Variables:
  • uuid (UUID) – The UUID of the player.

  • add_player (DataProxy) – The add player data.

  • initialize_chat (DataProxy) – The initialize chat data.

  • update_gamemode (DataProxy) – The update gamemode data.

  • update_listed (DataProxy) – The update listed data.

  • update_latency (DataProxy) – The update latency data.

  • update_display_name (DataProxy) – The update display name data.

Data Proxy Attributes

  • add_player:
    • **name**( String) - The name of the player.

    • properties (list[Property]) - The properties of the player.

  • initialize_chat:
    • has_signature_data (Boolean) - Whether the object has signature data. Other attributes will be None if this is False.

    • chat_session_id (UUID | None) - The chat session ID.

    • public_key_expiry (Long | None) - The public key expiry.

    • public_key (ByteArray | None) - The public key.

    • public_key_signature (ByteArray | None) - The signature.

  • update_gamemode:
    • gamemode (VarInt) - The gamemode of the player.

  • update_listed:
    • listed (Boolean) - Whether the player is listed.

  • update_latency:
    • latency (VarInt) - The latency of the player.

  • update_display_name:
    • has_display_name (Boolean) - Whether the player has a display name.

    • display_name (String | None) - The display name of the player. None if has_display_name is False.

classmethod from_bytes(data: BytesIO, actions: Byte) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Position(x: Int, y: Int, z: Int)#

Bases: DataType

Represents a position in a world.

Variables:
  • x (Int) – The X coordinate of this position.

  • y (Int) – The Y coordinate of this position.

  • z (Int) – The Z coordinate of this position.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Property(name: String, value: String, signature: String | None = None)#

Bases: DataType

Represents a property.

Variables:
  • name (String) – The name of this property.

  • value (String) – The value of this property.

  • signature (String | None) – The signature of this property.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Quaternion(x: Float, y: Float, z: Float, w: Float)#

Bases: DataType

Represents a quaternion.

Variables:
  • x (Float) – The X coordinate of this quaternion.

  • y (Float) – The Y coordinate of this quaternion.

  • z (Float) – The Z coordinate of this quaternion.

  • w (Float) – The W coordinate of this quaternion.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Recipe(recipe_type: Identifier, recipe_id: Identifier, data: DataProxy)#

Bases: DataType

Represents a recipe.

Variables:

TODO

Add recipe types and their respective data proxy values.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Short(value: int)#

Bases: DataType

Represents a short.

Variables:

value (int) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Slot(present: Boolean, item_id: Varint | None = None, count: Byte | None = None, _nbt: NBT | None = None)#

Bases: DataType

Represents an item slot.

Variables:
  • present (Boolean) – Whether there is an item in this slot.

  • item_id (Varint | None) – The ID of the item in this slot.

  • count (UnsignedByte | None) – The count of the item in this slot.

  • nbt (NBT | None) – The NBT data of the item in this slot.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Statistic(category: StatCategory, stat_id: StatID, value: Varint)#

Bases: DataType

Represents a statistic.

Variables:
  • category (StatCategory) – The category of this statistic.

  • stat_id (StatID) – The ID of this statistic.

  • value (Varint) – The value of this statistic.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.String(value: str)#

Bases: DataType

Represents a string.

Variables:

value (str) – The value of this data type.

classmethod from_bytes(data: BytesIO, *, max_length: int = None) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Trade(input_item_1: Slot, output_item: Slot, input_item_2: Slot, trade_disabled: Boolean, trade_uses: Int, max_trade_uses: Int, xp: Int, special_price: Int, price_multiplier: Float, demand: Int)#

Bases: DataType

Represents a villager trade.

Variables:
  • input_item_1 (Slot) – The first input item of this trade.

  • output_item (Slot) – The output item of this trade.

  • input_item_2 (Slot) – The second input item of this trade.

  • trade_disabled (Boolean) – Whether this trade is disabled.

  • trade_uses (Int) – The number of times this trade has been used.

  • max_trade_uses (Int) – The maximum number of times this trade can be used.

  • xp (Int) – The amount of experience this trade gives.

  • special_price (Int) – The special price of this trade.

  • price_multiplier (Float) – The price multiplier of this trade.

  • demand (Int) – The demand of this trade.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.UUID(most: Unsigned64Int, least: Unsigned64Int)#

Bases: DataType

Represents a UUID. For a normal representation of this, see the uuid property.

Variables:
  • most (Unsigned64Int) – The most significant bits of this UUID.

  • least (Unsigned64Int) – The least significant bits of this UUID.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

classmethod from_string(string: str) Self#
classmethod from_uuid(uuid: UUID) Self#
property uuid: UUID#

The parsed UUID. (uuid.UUID)

class minecraft.datatypes.UnsignedByte(value: int)#

Bases: DataType

Represents an unsigned byte.

Variables:

value (int) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.UnsignedShort(value: int)#

Bases: DataType

Represents an unsigned short.

Variables:

value (int) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Varint(value: int)#

Bases: DataType

Represents a variable integer.

Variables:

value (int) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Varlong(value: int)#

Bases: DataType

Represents a variable long.

Variables:

value (int) – The value of this data type.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.Vector3(x: Float, y: Float, z: Float)#

Bases: DataType

Represents a 3D vector.

Variables:
  • x (Float) – The X coordinate of this vector.

  • y (Float) – The Y coordinate of this vector.

  • z (Float) – The Z coordinate of this vector.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType

class minecraft.datatypes.VillagerData(type: Varint, profession: Varint, level: Varint)#

Bases: DataType

Represents villager data.

Variables:
  • type (Varint) – The type of villager.

  • profession (Varint) – The profession of the villager.

  • level (Varint) – The level of the villager.

classmethod from_bytes(data: BytesIO) Self#

Creates a new instance of this data type from the given bytes.

Parameters:

data (io.BytesIO) – The bytes to read from.

Returns:

The new instance.

Return type:

DataType