Entity metadata

From wiki.vg
Revision as of 09:42, 15 November 2016 by Zyuiop (talk | contribs) (Update Mobs to 1.11)
Jump to navigation Jump to search

Various Entities have different metadata fields and status codes.

Mobs

Mobs are spawned via Spawn Mob.

Type Name x, z y ID
4 ElderGuardian 0.85 0.85 minecraft:elder_guardian
5 WitherSkeleton 0.7 2.4 minecraft:wither_skeleton
6 Stray 0.6 1.99 minecraft:stray
23 Husk 0.6 1.95 minecraft:husk
27 ZombieVillager 0.6 1.95 minecraft:zombie_villager
28 SkeletonHorse 1.396484 1.6 minecraft:skeleton_horse
29 ZombieHorse 1.396484 1.6 minecraft:zombie_horse
31 Donkey 1.396484 1.6 minecraft:donkey
32 Mule 1.396484 1.6 minecraft:mule
33 EvocationFangs 0.5 0.8 minecraft:evocation_fangs
34 EvocationIllager 0.6 1.95 minecraft:evocation_illager
35 Vex 0.4 0.8 minecraft:vex
36 VindicationIllager 0.6 1.95 minecraft:vindication_illager
50 Creeper 0.6 1.7 minecraft:creeper
51 Skeleton 0.6 1.99 minecraft:skeleton
52 Spider 1.4 0.9 minecraft:spider
53 Giant 0.6 * 6 1.8 * 6 minecraft:giant
54 Zombie 0.6 1.8 minecraft:zombie
55 Slime 0.51000005 * size 0.51000005 * size minecraft:slime
56 Ghast 4 4 minecraft:ghast
57 PigZombie 0.6 1.8 minecraft:zombie_pigman
58 Enderman 0.6 2.9 minecraft:enderman
59 CaveSpider 0.7 0.5 minecraft:cave_spider
60 Silverfish 0.4 0.3 minecraft:silverfish
61 Blaze 0.6 1.8 minecraft:blaze
62 LavaSlime (Magma Cube) 0.51000005 * size 0.51000005 * size minecraft:magma_cube
63 EnderDragon 16.0 8.0 minecraft:ender_dragon
64 WitherBoss 0.9 3.5 minecraft:wither
65 Bat 0.5 0.9 minecraft:bat
66 Witch 0.6 1.8 minecraft:witch
67 Endermite 0.4 0.3 minecraft:endermite
68 Guardian 0.85 0.85 minecraft:guardian
69 Shulker 1 1 minecraft:shulker
90 Pig 0.9 0.9 minecraft:pig
91 Sheep 0.9 1.3 minecraft:sheep
92 Cow 0.9 1.4 minecraft:cow
93 Chicken 0.4 0.7 minecraft:chicken
94 Squid 0.8 0.8 minecraft:squid
95 Wolf 0.6 0.85 minecraft:wolf
96 MushroomCow (Mooshroom) 0.9 1.3 minecraft:mooshroom
97 SnowMan 0.7 1.9 minecraft:snowman
98 Ozelot (Ocelot) 0.6 0.8 minecraft:ocelot
99 VillagerGolem (Iron Golem) 1.4 2.7 minecraft:villager_golem
100 EntityHorse 1.396484 1.6 minecraft:horse
101 Rabbit 0.4 0.5 minecraft:rabbit
102 PolarBear 1.3 1.4 minecraft:polar_bear
103 Llama 1.3964844 1.87 minecraft:llama
104 LlamaSpit 0.25 0.25 minecraft:llama_spit
120 Villager 0.6 1.95 minecraft:villager

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 2.0 * Radius 0.5
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
68 Llama spit 0.25 0.25
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
79 Evocation Fangs 0.8 0.5
90 Fishing Hook 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

Statuses:

21
Plays the guardian sound effect from this entity (works with any entity)

Projectile

Extends Entity.

No additional metadata.

Potion

Extends Projectile.

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

Statuses:

31
If the caught entity is the connected player, then cause them to be pulled toward the caster of the fishing rod.

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)

Statuses:

0
Spawns tipped arrow particle effects, if the color is greater than 0.

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

Statuses:

17
Triggers the firework explosion effect (based off of the firework info metadata)

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

Statuses:

2
Plays the hurt animation and hurt sound
3
Plays the death sound and death animation
29
Plays the shield block sound
30
Plays the shield break sound
33
Plays the thorns sound in addition to playing the hurt animation and hurt sound

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)

Statuses:

9
Marks item use as finished (finished eating, finished drinking, etc)
22
Enables reduced debug screen information
23
Disables reduced debug screen information
24
Set op permission level to 0
25
Set op permission level to 1
26
Set op permission level to 2
27
Set op permission level to 3
28
Set op permission level to 4

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.

Statuses:

32
Plays the hit sound, and resets a hit cooldown.

Insentient

Extends Living.

Index Type Meaning
11 Byte Bit mask Meaning
0x01 NoAI
0x02 Left handed

Statuses:

20
Spawn explosion particle. Used when:
  • A silverfish enters a block
  • A silverfish exits a block
  • A mob spawner (or minecart mob spawner) spawns an entity (only with entities that support this status)

Ambient

Extends Insentient.

No additional metadata.

Bat

Extends Ambient.

Index Type Meaning
12 Byte Bit mask Meaning
0x01 Is hanging

WaterMob

Extends Insentient.

No additional metadata.

Squid

Extends WaterMob

No additional metadata.

Statuses:

19
Resets the squid's rotation to 0 radians. Occurs whenever the server calculates that the squid has rotated more than 2 pi radians.

Creature

Extends Insentient.

No additional metadata.

Ageable

Extends Creature.

Index Type Meaning
12 Boolean Is baby

Animal

Extends Ageable.

No additional metadata.

Statuses:

18
Spawn "love mode" heart particles

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

Statuses:

6
Spawn smoke particles (taming failed)
7
Spawn heart particles (taming succeeded)

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

Statuses:

1
Causes the rabbit to use its rotated jumping animation, and displays jumping particles.

Sheep

Extends Animal.

Index Type Meaning
13 Byte Bit mask Meaning
0x0F Color (matches dye damage values)
0x10 Is sheared

Statuses:

10
Causes the sheep to play the eating grass animation for the next 40 ticks

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

Statuses:

6
Spawn smoke particles (taming failed)
7
Spawn heart particles (taming succeeded)

Ocelot

Extends TameableAnimal.

Index Type Meaning
15 VarInt Type (0 = untamed, 1 = tuxedo, 2 = tabby, 3 = siamese). Used to render regardless as to whether it is tamed or not.

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)

Statuses:

8
Play wolf shaking water animation

Villager

Extends Ageable.

Index Type Meaning
13 VarInt Profession (Farmer = 0, Librarian = 1, Priest = 2, Blacksmith = 3, Butcher = 4)

Statuses:

12
Spawn villager mating heart particles
13
Spawn villager angry particles
14
Spawn villager happy particles

Golem

Extends Creature.

No additional metadata.

IronGolem

Extends Golem.

Index Type Meaning
12 Byte Bit mask Meaning
0x01 Is player-created

Statuses:

4
Plays attack animation and attack sound
11
Causes golem to hold out a rose poppy for 400 ticks (20 seconds)

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

Endermite

Extends Monster.

No additional metadata.

Giant Zombie

Extends Monster.

No additional metadata.

Guardian

Extends Monster.

Index Type Meaning
12 Byte Bit mask Meaning
0x02 is retracting spikes
0x04 is elderly
13 VarInt Target EID

Silverfish

Extends Monster.

No additional metadata.

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

Statues:

15
Spawns between 10 and 45 witchMagic particles. This status has a .075% chance of happening each tick.

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

Statuses:

16
Plays the zombie cure finished sound effect (unless the entity is silent)

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 (in 16ths of a block)
11 Boolean Show custom block

If show custom block is false, then each type of Minecart will render its own type of block with its own properties. Note that one does not need to send these values for the metadata fields, as the client will automatically select them if show custom block is false. They are only provided for reference to help with swapping out other blocks.

  • Rideable Minecarts contain air (0:0) and have a y position of 6
  • Chest Minecarts contain chests facing north (54:0) and have a y position of 8
  • Furnace Minecarts contain a normal furnace facing north when unpowered (61:0) and a lit furnace facing north when powered (62:0) and have a y position of 6 in both cases
  • Hopper Minecarts contain a hopper (154:0) and have a y position of 1
  • TNT Minecarts contain TNT (46:0) and have a y position of 6
  • Command block minecarts contain a Command Block (137:0) and have a y position of 6
  • Spawner Minecarts contain a spawner (52:0) and have a y position of 6

MinecartRideable

Extends Minecart.

No additional metadata.

MinecartContainer

Extends Minecart.

No additional metadata.

MinecartHopper

Extends MinecartContainer.

No additional metadata.

MinecartChest

Extends MinecartContainer.

No additional metadata.

MinecartFurnace

Extends Minecart.

Index Type Meaning
12 Boolean Is powered

MinecartTNT

Extends Minecart.

No additional metadata.

Statuses:

10
Causes the TNT to ignite. Does not play a sound; the sound must be played separately.

MinecartSpawner

Extends Minecart.

No additional metadata.

Statuses:

1
Resets the delay of the spawner to 200 ticks (the default minimum value).

MinecartCommandBlock

Extends Minecart.

Index Type Meaning
12 String Command
13 Chat Last output

TNTPrimed

Extends Entity.

Index Type Meaning
6 VarInt Fuse time