Difference between revisions of "Entity metadata"
m (→Zombie: add Husk type ID) |
m (→Skeleton: add Stray type ID) |
||
Line 1,226: | Line 1,226: | ||
| 11 | | 11 | ||
| VarInt | | VarInt | ||
− | |colspan="2"| Type (Normal = 0, Wither = 1) | + | |colspan="2"| Type (Normal = 0, Wither = 1, Stray = 2) |
|- | |- | ||
| 12 | | 12 |
Revision as of 23:47, 8 June 2016
Contents
- 1 Mobs
- 2 Objects
- 3 Entity Metadata Format
- 3.1 Entity
- 3.2 Potion
- 3.3 FallingBlock
- 3.4 AreaEffectCloud
- 3.5 FishingHook
- 3.6 Arrow
- 3.7 TippedArrow
- 3.8 Boat
- 3.9 EnderCrystal
- 3.10 Fireball
- 3.11 WitherSkull
- 3.12 Fireworks
- 3.13 Hanging
- 3.14 ItemFrame
- 3.15 Item
- 3.16 Living
- 3.17 Player
- 3.18 ArmorStand
- 3.19 Insentient
- 3.20 Ambient
- 3.21 Bat
- 3.22 Creature
- 3.23 Ageable
- 3.24 Animal
- 3.25 Horse
- 3.26 Pig
- 3.27 Rabbit
- 3.28 Sheep
- 3.29 TameableAnimal
- 3.30 Ocelot
- 3.31 Wolf
- 3.32 Villager
- 3.33 Golem
- 3.34 IronGolem
- 3.35 Snowman
- 3.36 Shulker
- 3.37 Monster
- 3.38 Blaze
- 3.39 Creeper
- 3.40 Guardian
- 3.41 Skeleton
- 3.42 Spider
- 3.43 Witch
- 3.44 Wither
- 3.45 Zombie
- 3.46 Enderman
- 3.47 EnderDragon
- 3.48 Flying
- 3.49 Ghast
- 3.50 Slime
- 3.51 Minecart
- 3.52 MinecartCommandBlock
- 3.53 MinecartFurnace
- 3.54 TNTPrimed
Mobs
Mobs are spawned via Spawn Mob. There are two extra mob types in the code that refer to mobs classes that can never spawn: Mob and Monster (they are always subclasses, aka another more specific type).
Type | Name | x, z | y |
---|---|---|---|
48 | Mob | N/A | N/A |
49 | Monster | N/A | N/A |
50 | Creeper | 0.6 | 1.7 |
51 | Skeleton | 0.6 | 1.99 |
52 | Spider | 1.4 | 0.9 |
53 | Giant Zombie | 0.6 * 6 | 1.8 * 6 |
54 | Zombie | 0.6 | 1.8 |
55 | Slime | 0.51000005 * size | 0.51000005 * size |
56 | Ghast | 4 | 4 |
57 | Zombie Pigman | 0.6 | 1.8 |
58 | Enderman | 0.6 | 2.9 |
59 | Cave Spider | 0.7 | 0.5 |
60 | Silverfish | 0.4 | 0.3 |
61 | Blaze | 0.6 | 1.8 |
62 | Magma Cube | 0.51000005 * size | 0.51000005 * size |
63 | Ender Dragon | 16.0 | 8.0 |
64 | Wither | 0.9 | 3.5 |
65 | Bat | 0.5 | 0.9 |
66 | Witch | 0.6 | 1.8 |
67 | Endermite | 0.4 | 0.3 |
68 | Guardian | 0.85 | 0.85 |
69 | Shulker | 1 | 1 |
90 | Pig | 0.9 | 0.9 |
91 | Sheep | 0.9 | 1.3 |
92 | Cow | 0.9 | 1.4 |
93 | Chicken | 0.4 | 0.7 |
94 | Squid | 0.8 | 0.8 |
95 | Wolf | 0.6 | 0.85 |
96 | Mooshroom | 0.9 | 1.3 |
97 | Snowman | 0.7 | 1.9 |
98 | Ocelot | 0.6 | 0.8 |
99 | Iron Golem | 1.4 | 2.7 |
100 | Horse | 1.4 | 1.6 |
101 | Rabbit | 0.6 | 0.7 |
120 | Villager | 0.6 | 1.95 |
Objects
Objects are spawned via Spawn Object. See Object Data for more details.
ID | Name | x, z | y |
---|---|---|---|
1 | Boat | 1.5 | 0.6 |
2 | Item Stack (Slot) | 0.25 | 0.25 |
3 | Area Effect Cloud | ? | ? |
10 | Minecart | 0.98 | 0.7 |
50 | Activated TNT | 0.98 | 0.98 |
51 | EnderCrystal | 2.0 | 2.0 |
60 | Tipped arrow (projectile; also used for regular arrows) | 0.5 | 0.5 |
61 | Snowball (projectile) | 0.25 | 0.25 |
62 | Egg (projectile) | 0.25 | 0.25 |
63 | FireBall (ghast projectile) | 1.0 | 1.0 |
64 | FireCharge (blaze projectile) | 0.3125 | 0.3125 |
65 | Thrown Enderpearl | 0.25 | 0.25 |
66 | Wither Skull (projectile) | 0.3125 | 0.3125 |
67 | Shulker Bullet | 0.3125 | 0.3125 |
70 | Falling Objects | 0.98 | 0.98 |
71 | Item frames | varies | varies |
72 | Eye of Ender | 0.25 | 0.25 |
73 | Thrown Potion | 0.25 | 0.25 |
75 | Thrown Exp Bottle | 0.25 | 0.25 |
76 | Firework Rocket | 0.25 | 0.25 |
77 | Leash Knot | 0.5 | 0.5 |
78 | ArmorStand | 0.5 | 2.0 |
90 | Fishing Float | 0.25 | 0.25 |
91 | Spectral Arrow | 0.5 | 0.5 |
93 | Dragon Fireball | 0.3125 | 0.3125 |
Since release 1.6, all minecarts are spawned with object type 10 and their functionality is then specified in the Data field within the packet. Also, their visual appearance may be sent via the Entity Metadata packet.
Entity Metadata Format
Note that entity metadata is a totally distinct concept from block metadata. All entities must send at least one item of metadata, in most cases this will be the health item.
An Entity Metadata is an array of entries, each of which looks like the following:
Name | Type | Meaning |
---|---|---|
Index | Unsigned Byte | Unique index key determining the meaning of the following value, see the table below. If this is 0xff then the it is the end of the Entity Metadata array and no more is read.
|
Type | Optional Byte Enum | Only if Index is not 0xff ; the type of the index, see the table below
|
Value | Optional value of Type | Only if Index is not 0xff : the value of the metadata field
|
Value of Type field | Type of Value field | Notes |
---|---|---|
0 | Byte | |
1 | VarInt | |
2 | Float | |
3 | String | |
4 | Chat | |
5 | Slot | |
6 | Boolean | |
7 | Rotation | 3 floats: rotation on x, rotation on y, rotation on z |
8 | Position | |
9 | OptPosition (Boolean + Optional Position) | Position is present if the Boolean is set to true |
10 | Direction (VarInt) | (Down = 0, Up = 1, North = 2, South = 3, West = 4, East = 5) |
11 | OptUUID (Boolean + Optional UUID) | UUID is present if the Boolean is set to true |
12 | BlockID (VarInt) | id << 4 | data
|
Entity classes also recursively use fields from classes they extend.
Entity
The base class.
Index | Type | Meaning | |
---|---|---|---|
0 | Byte | Bit mask | Meaning |
0x01 | On Fire | ||
0x02 | Crouched | ||
0x08 | Sprinting | ||
0x10 | Eating/drinking/blocking | ||
0x20 | Invisible | ||
0x40 | Glowing effect | ||
0x80 | Flying with elytra | ||
1 | VarInt | Air | |
2 | String | Custom name | |
3 | Boolean | Is custom name visible | |
4 | Boolean | Is silent |
Potion
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | Slot | Potion which is thrown |
FallingBlock
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | Position | spawn position |
AreaEffectCloud
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | Float | Radius | |
6 | VarInt | Color (only for mob spell particle) | |
7 | Boolean | Ignore radius and show effect as single point, not area | |
8 | VarInt | Particle ID |
FishingHook
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | VarInt | hooked entity id |
Arrow
Extends Entity.
Abstract base class for TippedArrow (which is used for regular arrows as well as tipped ones) and Spectral Arrow.
Index | Type | Meaning | |
---|---|---|---|
5 | Byte | Bit mask | Meaning |
0x01 | Is critical |
TippedArrow
Extends Arrow.
Used for both tipped and regular arrows. If not tipped, then color is set to 0 and no tipped arrow particles are used.
Index | Type | Meaning | |
---|---|---|---|
6 | VarInt | Color (0 for no particles) |
Boat
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | VarInt | Time since last hit | |
6 | VarInt | Forward direction | |
7 | Float | Damage taken | |
8 | VarInt | Type | |
9 | Boolean | Right paddle turning | |
10 | Boolean | Left paddle turning |
EnderCrystal
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | OptPosition | Beam target | |
6 | Boolean | Show bottom |
Fireball
Extends Entity.
No additional metadata.
WitherSkull
Extends Fireball.
Index | Type | Meaning | |
---|---|---|---|
5 | Boolean | Invulnerable |
Fireworks
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | Slot | Firework info |
Hanging
Extends Entity.
No additional metadata.
ItemFrame
Extends Hanging.
Index | Type | Meaning | |
---|---|---|---|
5 | Slot | Item | |
6 | VarInt | Rotation |
Item
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | Slot | Item |
Living
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | Byte | Likely used to limit placing blocks from both hands at the same time. | |
Bit mask | Meaning | ||
0x01 | Is hand active | ||
0x02 | Active hand (0 = main hand, 1 = offhand) | ||
6 | Float | Health | |
7 | VarInt | Potion effect color | |
8 | Boolean | Is potion effect ambient | |
9 | VarInt | Number of arrows in entity |
Player
Extends Living.
Index | Type | Meaning | |
---|---|---|---|
10 | Float | Additional Hearts | |
11 | VarInt | Score | |
12 | Byte | The Displayed Skin Parts bit mask that is sent in Client Settings | |
Bit mask | Meaning | ||
0x01 | Cape enabled | ||
0x02 | Jacket enabled | ||
0x04 | Left sleeve enabled | ||
0x08 | Right sleeve enabled | ||
0x10 | Left pants leg enabled | ||
0x20 | Right pants leg enabled | ||
0x40 | Hat enabled | ||
0x80 | Unused | ||
13 | Byte | Main hand (0 : Left, 1 : Right) |
ArmorStand
Extends Living.
Index | Type | Meaning | |
---|---|---|---|
10 | Byte | Bit mask | Meaning |
0x01 | is Small | ||
0x02 | has Gravity | ||
0x04 | has Arms | ||
0x08 | no BasePlate | ||
0x10 | set Marker | ||
11 | Rotation | Head rotation | |
12 | Rotation | Body rotation | |
13 | Rotation | Left arm rotation | |
14 | Rotation | Right arm rotation | |
15 | Rotation | Left leg rotation | |
16 | Rotation | Right leg rotation |
Insentient
Extends Living.
Index | Type | Meaning | |
---|---|---|---|
10 | Byte | Bit mask | Meaning |
0x01 | NoAI | ||
0x02 | Left handed |
Ambient
Extends Insentient.
No additional metadata.
Bat
Extends Ambient.
Index | Type | Meaning | |
---|---|---|---|
11 | Byte | Bit mask | Meaning |
0x01 | Is hanging |
Creature
Extends Insentient.
No additional metadata.
Ageable
Extends Creature.
Index | Type | Meaning | |
---|---|---|---|
11 | Boolean | Is baby |
Animal
Extends Ageable.
No additional metadata.
Horse
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
12 | Byte | Bit mask | Meaning |
0x01 | Unused | ||
0x02 | Is Tame | ||
0x04 | Is saddled | ||
0x08 | Has Chest | ||
0x10 | Is Bred (not used on the Notchian server; controlled via the unused Bred NBT flag) | ||
0x20 | Is eating | ||
0x40 | Is rearing (on hind legs) | ||
0x80 | Is mouth open | ||
13 | VarInt | Variant | |
14 | VarInt | Color & Style | |
15 | OptUUID | Owner | |
16 | VarInt | Armor |
Pig
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
12 | Boolean | Has saddle |
Rabbit
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
12 | VarInt | Type |
Sheep
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
12 | Byte | Bit mask | Meaning |
0x0F | Color (matches dye damage values) | ||
0x10 | Is sheared |
TameableAnimal
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
12 | Byte | Bit mask | Meaning |
0x01 | Is sitting | ||
0x02 | Is angry (only used with wolves) | ||
0x04 | Is tamed | ||
13 | OptUUID | Owner |
Ocelot
Extends TameableAnimal.
Index | Type | Meaning | |
---|---|---|---|
14 | VarInt | Type |
Wolf
Extends TameableAnimal.
Index | Type | Meaning | |
---|---|---|---|
14 | Float | Damage taken (used for tail rotation) | |
15 | Boolean | Is begging | |
16 | VarInt | Collar color (values are those used with dyes) |
Villager
Extends Ageable.
Index | Type | Meaning | |
---|---|---|---|
12 | VarInt | Profession (Farmer = 0, Librarian = 1, Priest = 2, Blacksmith = 3, Butcher = 4) |
Golem
Extends Creature.
No additional metadata.
IronGolem
Extends Golem.
Index | Type | Meaning | |
---|---|---|---|
11 | Byte | Bit mask | Meaning |
0x01 | Is player-created |
Snowman
Extends Golem.
Index | Type | Meaning | |
---|---|---|---|
10 | Byte | Bit mask | Meaning |
0x10 | has no pumpkin hat |
Shulker
Extends Golem.
Index | Type | Meaning | |
---|---|---|---|
11 | Direction | Facing direction | |
12 | OptPosition | Attachment position | |
13 | Byte | Shield height |
Monster
Extends Creature.
No additional metadata.
Blaze
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
11 | Byte | Bit mask | Meaning |
0x01 | Is on fire |
Creeper
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
11 | VarInt | State (-1 = idle, 1 = fuse) | |
12 | Boolean | Is charged | |
13 | Boolean | Is ignited |
Guardian
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
11 | Byte | Bit mask | Meaning |
0x02 | is retracting spikes | ||
0x04 | is elderly | ||
12 | VarInt | Target EID |
Skeleton
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
11 | VarInt | Type (Normal = 0, Wither = 1, Stray = 2) | |
12 | Boolean | Is swinging arms (Used to animate arms for melee attacks; only used when the skeleton does not have a bow in its hand) |
Spider
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
11 | Byte | Bit mask | Meaning |
0x01 | Is climbing |
Witch
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
11 | Boolean | Is aggresive |
Wither
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
11 | VarInt | First head's target | |
12 | VarInt | Second head's target | |
13 | VarInt | Third head's target | |
14 | VarInt | Invulnerable time |
Zombie
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
11 | Boolean | Is baby | |
12 | VarInt | Zombie type (0 for zombie, profession+1 for villagers, 6 for Husk) | |
13 | Boolean | Is converting | |
14 | Boolean | Are hands held up |
Enderman
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
11 | BlockID | Carried block | |
12 | Boolean | Is screaming |
EnderDragon
Extends Insentient.
Index | Type | Meaning | |
---|---|---|---|
11 | VarInt | Dragon phase |
Flying
Extends Insentient.
No additional metadata.
Ghast
Extends Flying.
Index | Type | Meaning | |
---|---|---|---|
11 | Boolean | Is attacking |
Slime
Extends Insentient.
Index | Type | Meaning | |
---|---|---|---|
11 | VarInt | Size |
Minecart
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | VarInt | Shaking power | |
6 | VarInt | Shaking direction | |
7 | Float | Shaking multiplier | |
8 | VarInt | Block ID and damage | |
9 | VarInt | Block Y position | |
10 | Boolean | Show block |
MinecartCommandBlock
Extends Minecart.
Index | Type | Meaning | |
---|---|---|---|
11 | String | Command | |
12 | Chat | Last output |
MinecartFurnace
Extends Minecart.
Index | Type | Meaning | |
---|---|---|---|
11 | Boolean | Is powered |
TNTPrimed
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
5 | VarInt | Fuse time |