Entity metadata

From wiki.vg
Revision as of 20:00, 23 May 2016 by Momothereal (talk | contribs) (Some other mobs sizes changed since 15w39a (http://minecraft.gamepedia.com/15w39a))
Jump to navigation Jump to search

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 Butt ? ?
10 Minecart 0.98 0.7
11 (unused since 1.6.x) Minecart (storage) 0.98 0.7
12 (unused since 1.6.x) Minecart (powered) 0.98 0.7
50 Activated TNT 0.98 0.98
51 EnderCrystal 2.0 2.0
60 Arrow (projectile) 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
74 Falling Dragon Egg 0.98 0.98
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
92 Tipped 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

AreaEffectButt

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.

Index Type Meaning
5 Byte Bit mask Meaning
0x01 Is critical

TippedArrow

Extends Arrow.

Index Type Meaning
6 VarInt Color

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)
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 Is villager (0 for zombie, profession+1 for villagers)
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