Difference between revisions of "Entity metadata"
m (→FishingHook: ID + 1, not ID) |
(→Living: More details on potion effect flags) |
||
Line 735: | Line 735: | ||
| 8 | | 8 | ||
| VarInt | | VarInt | ||
− | |colspan="2"| Potion effect color | + | |colspan="2"| Potion effect color (or 0 if there is no effect) |
|- | |- | ||
| 9 | | 9 | ||
| Boolean | | Boolean | ||
− | |colspan="2"| Is potion effect ambient | + | |colspan="2"| Is potion effect ambient: reduces the number of particles generated by potions to 1/5 the normal amount |
|- | |- | ||
| 10 | | 10 |
Revision as of 15:37, 19 September 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 Polar Bear
- 3.29 Sheep
- 3.30 TameableAnimal
- 3.31 Ocelot
- 3.32 Wolf
- 3.33 Villager
- 3.34 Golem
- 3.35 IronGolem
- 3.36 Snowman
- 3.37 Shulker
- 3.38 Monster
- 3.39 Blaze
- 3.40 Creeper
- 3.41 Guardian
- 3.42 Skeleton
- 3.43 Spider
- 3.44 Witch
- 3.45 Wither
- 3.46 Zombie
- 3.47 Enderman
- 3.48 EnderDragon
- 3.49 Flying
- 3.50 Ghast
- 3.51 Slime
- 3.52 Minecart
- 3.53 MinecartCommandBlock
- 3.54 MinecartFurnace
- 3.55 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.4 | 0.5 |
102 | Polar Bear | 1.3 | 1.4 |
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 | OptBlockID (VarInt) | 0 for absent otherwise, 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 | |
5 | Boolean | No gravity |
Potion
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | Slot | Potion which is thrown |
FallingBlock
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | Position | spawn position |
AreaEffectCloud
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | Float | Radius | |
7 | VarInt | Color (only for mob spell particle) | |
8 | Boolean | Ignore radius and show effect as single point, not area | |
9 | VarInt | Particle ID | |
10 | VarInt | Particle parameter 1 | |
11 | VarInt | Particle parameter 2 |
FishingHook
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | VarInt | Hooked entity id + 1, or 0 if there is no hooked entity |
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 | |
---|---|---|---|
6 | 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 | |
---|---|---|---|
7 | VarInt | Color (0 for no particles) |
Boat
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | VarInt | Time since last hit | |
7 | VarInt | Forward direction | |
8 | Float | Damage taken | |
9 | VarInt | Type | |
10 | Boolean | Right paddle turning | |
11 | Boolean | Left paddle turning |
EnderCrystal
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | OptPosition | Beam target | |
7 | Boolean | Show bottom |
Fireball
Extends Entity.
No additional metadata.
WitherSkull
Extends Fireball.
Index | Type | Meaning | |
---|---|---|---|
6 | Boolean | Invulnerable |
Fireworks
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | Slot | Firework info |
Hanging
Extends Entity.
No additional metadata.
ItemFrame
Extends Hanging.
Index | Type | Meaning | |
---|---|---|---|
6 | Slot | Item | |
7 | VarInt | Rotation |
Item
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | Slot | Item |
Living
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | 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) | ||
7 | Float | Health | |
8 | VarInt | Potion effect color (or 0 if there is no effect) | |
9 | Boolean | Is potion effect ambient: reduces the number of particles generated by potions to 1/5 the normal amount | |
10 | VarInt | Number of arrows in entity |
Player
Extends Living.
Index | Type | Meaning | |
---|---|---|---|
11 | Float | Additional Hearts | |
12 | VarInt | Score | |
13 | 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 | ||
14 | Byte | Main hand (0 : Left, 1 : Right) |
ArmorStand
Extends Living.
Index | Type | Meaning | |
---|---|---|---|
11 | Byte | Bit mask | Meaning |
0x01 | is Small | ||
0x04 | has Arms | ||
0x08 | no BasePlate | ||
0x10 | set Marker | ||
12 | Rotation | Head rotation | |
13 | Rotation | Body rotation | |
14 | Rotation | Left arm rotation | |
15 | Rotation | Right arm rotation | |
16 | Rotation | Left leg rotation | |
17 | Rotation | Right leg rotation |
Note that armor stands with the invisible flag from the base entity class set also cannot be attacked or damaged, except for by the void.
Insentient
Extends Living.
Index | Type | Meaning | |
---|---|---|---|
11 | Byte | Bit mask | Meaning |
0x01 | NoAI | ||
0x02 | Left handed |
Ambient
Extends Insentient.
No additional metadata.
Bat
Extends Ambient.
Index | Type | Meaning | |
---|---|---|---|
12 | Byte | Bit mask | Meaning |
0x01 | Is hanging |
Creature
Extends Insentient.
No additional metadata.
Ageable
Extends Creature.
Index | Type | Meaning | |
---|---|---|---|
12 | Boolean | Is baby |
Animal
Extends Ageable.
No additional metadata.
Horse
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
13 | 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 | ||
14 | VarInt | Type | |
15 | VarInt | Variant (Color & Style) | |
16 | OptUUID | Owner | |
17 | VarInt | Armor |
Pig
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
13 | Boolean | Has saddle |
Rabbit
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
13 | VarInt | Type |
Polar Bear
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
13 | Boolean | Standing up |
Sheep
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
13 | Byte | Bit mask | Meaning |
0x0F | Color (matches dye damage values) | ||
0x10 | Is sheared |
TameableAnimal
Extends Animal.
Index | Type | Meaning | |
---|---|---|---|
13 | Byte | Bit mask | Meaning |
0x01 | Is sitting | ||
0x02 | Is angry (only used with wolves) | ||
0x04 | Is tamed | ||
14 | OptUUID | Owner |
Ocelot
Extends TameableAnimal.
Index | Type | Meaning | |
---|---|---|---|
15 | VarInt | Type |
Wolf
Extends TameableAnimal.
Index | Type | Meaning | |
---|---|---|---|
15 | Float | Damage taken (used for tail rotation) | |
16 | Boolean | Is begging | |
17 | VarInt | Collar color (values are those used with dyes) |
Villager
Extends Ageable.
Index | Type | Meaning | |
---|---|---|---|
13 | VarInt | Profession (Farmer = 0, Librarian = 1, Priest = 2, Blacksmith = 3, Butcher = 4) |
Golem
Extends Creature.
No additional metadata.
IronGolem
Extends Golem.
Index | Type | Meaning | |
---|---|---|---|
12 | Byte | Bit mask | Meaning |
0x01 | Is player-created |
Snowman
Extends Golem.
Index | Type | Meaning | |
---|---|---|---|
12 | Byte | Bit mask | Meaning |
0x10 | has no pumpkin hat |
Shulker
Extends Golem.
Index | Type | Meaning | |
---|---|---|---|
12 | Direction | Facing direction | |
13 | OptPosition | Attachment position | |
14 | Byte | Shield height |
Monster
Extends Creature.
No additional metadata.
Blaze
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
12 | Byte | Bit mask | Meaning |
0x01 | Is on fire |
Creeper
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
12 | VarInt | State (-1 = idle, 1 = fuse) | |
13 | Boolean | Is charged | |
14 | Boolean | Is ignited |
Guardian
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
12 | Byte | Bit mask | Meaning |
0x02 | is retracting spikes | ||
0x04 | is elderly | ||
13 | VarInt | Target EID |
Skeleton
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
12 | VarInt | Type (Normal = 0, Wither = 1, Stray = 2) | |
13 | 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 | |
---|---|---|---|
12 | Byte | Bit mask | Meaning |
0x01 | Is climbing |
Witch
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
12 | Boolean | Is aggresive |
Wither
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
12 | VarInt | Center head's target (entity ID, or 0 if no target) | |
13 | VarInt | Left(?) head's target (entity ID, or 0 if no target) | |
14 | VarInt | Right(?) head's target (entity ID, or 0 if no target) | |
15 | VarInt | Invulnerable time |
Zombie
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
12 | Boolean | Is baby | |
13 | VarInt | Zombie type (0 for zombie, profession+1 for villagers, 6 for Husk) | |
14 | Boolean | Is converting | |
15 | Boolean | Are hands held up |
Enderman
Extends Monster.
Index | Type | Meaning | |
---|---|---|---|
12 | Opt BlockID | Carried block | |
13 | Boolean | Is screaming |
EnderDragon
Extends Insentient.
Index | Type | Meaning | |
---|---|---|---|
12 | VarInt | Dragon phase |
Flying
Extends Insentient.
No additional metadata.
Ghast
Extends Flying.
Index | Type | Meaning | |
---|---|---|---|
12 | Boolean | Is attacking |
Slime
Extends Insentient.
Index | Type | Meaning | |
---|---|---|---|
12 | VarInt | Size |
Minecart
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | VarInt | Shaking power | |
7 | VarInt | Shaking direction | |
8 | Float | Shaking multiplier | |
9 | VarInt | Block ID and damage | |
10 | VarInt | Block Y position | |
11 | Boolean | Show block |
MinecartCommandBlock
Extends Minecart.
Index | Type | Meaning | |
---|---|---|---|
12 | String | Command | |
13 | Chat | Last output |
MinecartFurnace
Extends Minecart.
Index | Type | Meaning | |
---|---|---|---|
12 | Boolean | Is powered |
TNTPrimed
Extends Entity.
Index | Type | Meaning | |
---|---|---|---|
6 | VarInt | Fuse time |