Entity Metadata
Entity metadata is a format introduced in Beta 1.2 for sending entity state over the network. This page will document the possible metadata values of mobs and how metadata is encoded in Beta 1.7.3. For the packet used to send the metadata, see Entity Metadata.
Format
To read entity metadata, follow these steps:
- Read an unsigned byte.
- If the byte is
127, stop reading. - The ID of the metadata value is the bottom 5 bits, equal to
byte & 31. - The data type is the top 5 bits, equal to
byte >> 5. See below for a list of all data types.
Data Types
| ID | Type | Note |
|---|---|---|
| 0 | Byte | |
| 1 | Short | |
| 2 | Integer | |
| 3 | Float | |
| 4 | String | Uses the modified UCS-2 string format. |
| 5 | Item | Short (item/block ID), byte (quantity), short (metadata). |
| 6 | Coordinates | Three integers for X, Y, and Z. |
Mobs
| Name | Metadata | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Entity |
| ||||||||||||
| Player |
| ||||||||||||
| Pig |
| ||||||||||||
| Creeper |
| ||||||||||||
| Sheep |
| ||||||||||||
| Slime |
| ||||||||||||
| Ghast |
| ||||||||||||
| Wolf |
|
NOTE
1 1 for blowing up, -1 otherwise.
2 You can use a 0x10 bit mask for shearedness and 0x0F for color.
Flags
All entities extending the Entity class must support this bit field at metadata ID 0. In later versions, this is also used for sprinting and eating/drinking. To get the flag at an ID, you can use value & mask != 0.
| ID | Bit Mask | Name |
|---|---|---|
| 0 | 0x01 | Burning? |
| 1 | 0x02 | Sneaking? |
| 2 | 0x04 | Riding? |
Relevant Classes
| Name (MCP) | Name (Mojang) | Notes |
|---|---|---|
DataWatcher | SynchedEntityData | Watches metadata values for changes and sends packets. |
WatchableObject | SynchedEntityData.DataItem | Represents a metadata value that can be changed. |
Packet40EntityMetadata | SetEntityDataPacket | The packet that notifies the client of metadata changes in a mob. |