Difference between revisions of "Entity metadata"

From wiki.vg
Jump to navigation Jump to search
(Undo revision 13594 by Cybermaxke (talk))
Line 900: Line 900:
 
  | 9
 
  | 9
 
  | Particle
 
  | Particle
  | colspan="2"| The [[#Particle]]
+
  | The [[#Particle]]
 
  | <code>effect</code>
 
  | <code>effect</code>
 
  |- style="background-color: #f4cccc; text-decoration: line-through;"
 
  |- style="background-color: #f4cccc; text-decoration: line-through;"

Revision as of 18:06, 15 January 2018

Various Entities have different metadata fields and status codes.

Mobs

Mobs are spawned via Spawn Mob.

Warning.png Some entities (marked in yellow) should only be spawned using Spawn Object and their Object ID. While they also have an entity ID, this ID is only used internally. Servers should not attempt to spawn these entities using Spawn Mob with that entity ID, although clients should accept such packets if they appear.

Additionally, a few other entities (marked in blue) must be spawned in their own special ways:

Type Name bounding box x and z bounding box y ID
1 Item 0.25 0.25 minecraft:item
2 XPOrb 0.5 0.5 minecraft:xp_orb
3 AreaEffectCloud 2.0 * Radius 0.5 minecraft:area_effect_cloud
4 ElderGuardian 1.9975 (2.35 * guardian) 1.9975 (2.35 * guardian) minecraft:elder_guardian
5 WitherSkeleton 0.7 2.4 minecraft:wither_skeleton
6 Stray 0.6 1.99 minecraft:stray
7 ThrownEgg 0.25 0.25 minecraft:egg
8 LeashKnot 0.375 0.5 minecraft:leash_knot
9 Painting type width or 0.0625 (depth) type height minecraft:painting
10 Arrow 0.5 0.5 minecraft:arrow
11 Snowball 0.25 0.25 minecraft:snowball
12 Fireball (ghast) 1.0 1.0 minecraft:fireball
13 SmallFireball (blaze) 0.3125 0.3125 minecraft:small_fireball
14 ThrownEnderpearl 0.25 0.25 minecraft:ender_pearl
15 EyeOfEnderSignal 0.25 0.25 minecraft:eye_of_ender_signal
16 ThrownPotion 0.25 0.25 minecraft:potion
17 ThrownExpBottle 0.25 0.25 minecraft:xp_bottle
18 ItemFrame 0.75 or 0.0625 (depth) 0.75 minecraft:item_frame
19 WitherSkull 0.3125 0.3125 minecraft:wither_skull
20 PrimedTnt 0.98 0.98 minecraft:tnt
21 FallingSand 0.98 0.98 minecraft:falling_block
22 FireworksRocketEntity 0.25 0.25 minecraft:fireworks_rocket
23 Husk 0.6 1.95 minecraft:husk
24 SpectralArrow 0.5 0.5 minecraft:spectral_arrow
25 ShulkerBullet 0.3125 0.3125 minecraft:shulker_bullet
26 DragonFireball 1.0 1.0 minecraft:dragon_fireball
27 ZombieVillager 0.6 1.95 minecraft:zombie_villager
28 SkeletonHorse 1.3964844 1.6 minecraft:skeleton_horse
29 ZombieHorse 1.3964844 1.6 minecraft:zombie_horse
30 ArmorStand normal: 0.5 marker: 0.0 small: 0.25 normal: 1.975 marker: 0.0 small: 0.9875 minecraft:armor_stand
31 Donkey 1.3964844 1.6 minecraft:donkey
32 Mule 1.3964844 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
37 IllusionIllager 0.6 1.95 minecraft:illusion_illager
40 MinecartCommandBlock 0.98 0.7 minecraft:commandblock_minecart
41 Boat 1.375 0.5625 minecraft:boat
42 MinecartRideable 0.98 0.7 minecraft:minecart
43 MinecartChest 0.98 0.7 minecraft:chest_minecart
44 MinecartFurnace 0.98 0.7 minecraft:furnace_minecart
45 MinecartTNT 0.98 0.7 minecraft:tnt_minecart
46 MinecartHopper 0.98 0.7 minecraft:hopper_minecart
47 MinecartSpawner 0.98 0.7 minecraft:spawner_minecart
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 3.6 10.8 minecraft:giant
54 Zombie 0.6 1.95 minecraft:zombie
55 Slime 0.51000005 * size 0.51000005 * size minecraft:slime
56 Ghast 4 4 minecraft:ghast
57 PigZombie 0.6 1.95 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.95 minecraft:witch
67 Endermite 0.4 0.3 minecraft:endermite
68 Guardian 0.85 0.85 minecraft:guardian
69 Shulker 1.0 1.0-2.0 (depending on peek) 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.4 minecraft:mooshroom
97 SnowMan 0.7 1.9 minecraft:snowman
98 Ozelot (Ocelot) 0.6 0.7 minecraft:ocelot
99 VillagerGolem (Iron Golem) 1.4 2.7 minecraft:villager_golem
100 Horse (EntityHorse until 1.11) 1.3964844 1.6 minecraft:horse
101 Rabbit 0.4 0.5 minecraft:rabbit
102 PolarBear 1.3 1.4 minecraft:polar_bear
103 Llama 0.9 1.87 minecraft:llama
104 LlamaSpit 0.25 0.25 minecraft:llama_spit
105 Parrot 0.5 0.9 minecraft:parrot
120 Villager 0.6 1.95 minecraft:villager
200 EnderCrystal 2.0 2.0 minecraft:end_crystal

Objects

Objects are spawned via Spawn Object. See Object Data for more details.

Object IDs and Entity IDs are different. Most objects also have an entity ID, but should only ever be spawned via Spawn Object.

ID Name bounding box x and z bounding box y
1 Boat 1.375 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 0.75 or 0.0625 0.75
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.375 0.5
78 ArmorStand normal: 0.5 marker: 0.0 small: 0.25 normal: 1.975 marker: 0.0 small: 0.9875
79 Evocation Fangs 0.5 0.8
90 Fishing Hook 0.25 0.25
91 Spectral Arrow 0.5 0.5
93 Dragon Fireball 1.0 1.0

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. It is not required to send all metadata fields, or even any metadata fields, so long as the terminating entry is correctly sent.

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
13 NBT Tag

Entity classes also recursively inherit fields from classes they extend.

Entity

The base class.

Index Type Meaning Default
0 Byte Bit mask Meaning 0
0x01 On Fire
0x02 Crouched
0x04 Unused (previously riding)
0x08 Sprinting
0x10 Unused (previously eating/drinking/blocking; use hand state now)
0x20 Invisible
0x40 Glowing effect
0x80 Flying with elytra
1 VarInt Air 300
2 String Custom name
3 Boolean Is custom name visible false
4 Boolean Is silent false
5 Boolean No gravity false

Projectile

Extends Entity.

No additional metadata.

Snowball

Extends Projectile.

No additional metadata.

Egg

Extends Projectile.

No additional metadata.

Potion

Extends Projectile.

Index Type Meaning Default
6 Slot Potion which is thrown Empty

FallingBlock

Extends Entity.

Index Type Meaning Default
6 Position spawn position (0, 0, 0)

AreaEffectCloud

Extends Entity.

Index Type Meaning Default
6 Float Radius 0.5
7 VarInt Color (only for mob spell particle) 0
8 Boolean Ignore radius and show effect as single point, not area false
9 Particle The #Particle effect
9 VarInt Particle ID 15 (mobSpell)
10 VarInt Particle parameter 1 0
11 VarInt Particle parameter 2 0

FishingHook

Extends Entity.

Index Type Meaning Default
6 VarInt Hooked entity id + 1, or 0 if there is no hooked entity 0

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 Default
6 Byte Bit mask Meaning 0
0x01 Is critical

TippedArrow

Extends Arrow.

Used for both tipped and regular arrows. If not tipped, then color is set to -1 and no tipped arrow particles are used.

Index Type Meaning Default
7 VarInt Color (-1 for no particles) -1

Boat

Extends Entity.

Index Type Meaning Default
6 VarInt Time since last hit 0
7 VarInt Forward direction 1
8 Float Damage taken 0.0
9 VarInt Type (0=oak, 1=spruce, 2=birch, 3=jungle, 4=acacia, 5=dark oak) 0
10 Boolean Right paddle turning false
11 Boolean Left paddle turning false

EnderCrystal

Extends Entity.

Index Type Meaning Default
6 OptPosition Beam target Absent
7 Boolean Show bottom true

Fireball

Extends Entity.

No additional metadata.

WitherSkull

Extends Fireball.

Index Type Meaning Default
6 Boolean Invulnerable false

Fireworks

Extends Entity.

Index Type Meaning Default
6 Slot Firework info empty
7 VarInt Entity ID of entity which used firework (for elytra boosting) 0

Hanging

Extends Entity.

No additional metadata.

ItemFrame

Extends Hanging.

Index Type Meaning Default
6 Slot Item Empty
7 VarInt Rotation 0

Item

Extends Entity.

Index Type Meaning Default
6 Slot Item Empty

Living

Extends Entity.

Index Type Meaning Default
6 Byte Hand states, used to trigger blocking/eating/drinking animation. 0
Bit mask Meaning
0x01 Is hand active
0x02 Active hand (0 = main hand, 1 = offhand)
7 Float Health 1.0
8 VarInt Potion effect color (or 0 if there is no effect) 0
9 Boolean Is potion effect ambient: reduces the number of particles generated by potions to 1/5 the normal amount false
10 VarInt Number of arrows in entity 0

Player

Extends Living.

Index Type Meaning Default
11 Float Additional Hearts 0.0
12 VarInt Score 0
13 Byte The Displayed Skin Parts bit mask that is sent in Client Settings 0
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) 1
15 NBT Tag Left shoulder entity data (for occupying parrot) Empty
16 NBT Tag Right shoulder entity data (for occupying parrot) Empty

ArmorStand

Extends Living.

Index Type Meaning Default
11 Byte Bit mask Meaning 0
0x01 is Small
0x04 has Arms
0x08 no BasePlate
0x10 set Marker
12 Rotation Head rotation (0.0, 0.0, 0.0)
13 Rotation Body rotation (0.0, 0.0, 0.0)
14 Rotation Left arm rotation (-10.0, 0.0, -10.0)
15 Rotation Right arm rotation (-15.0, 0.0, 10.0)
16 Rotation Left leg rotation (-1.0, 0.0, -1.0)
17 Rotation Right leg rotation (1.0, 0.0, 1.0)

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 Default
11 Byte Bit mask Meaning 0
0x01 NoAI
0x02 Left handed

Ambient

Extends Insentient.

No additional metadata.

Bat

Extends Ambient.

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

WaterMob

Extends Insentient.

No additional metadata.

Squid

Extends WaterMob

No additional metadata.

Creature

Extends Insentient.

No additional metadata.

Ageable

Extends Creature.

Index Type Meaning Default
12 Boolean Is baby false

Animal

Extends Ageable.

No additional metadata.

AbstractHorse

Extends Animal.

Index Type Meaning Default
13 Byte Bit mask Meaning 0
0x01 Unused
0x02 Is Tame
0x04 Is saddled
0x08 Has bred
0x10 Is eating
0x20 Is rearing (on hind legs)
0x40 Is mouth open
0x80 Unused
14 OptUUID Owner Absent

Horse

Extends AbstractHorse.

Index Type Meaning Default
15 VarInt Variant (Color & Style) 0
16 VarInt Armor (0: none, 1: iron, 2: gold, 3: diamond) 0 (none)

ZombieHorse

Extends AbstractHorse.

SkeletonHorse

Extends AbstractHorse.

ChestedHorse

Extends AbstractHorse.

Index Type Meaning Default
15 Boolean Has Chest false

Donkey

Extends ChestedHorse.

Llama

Extends ChestedHorse.

Index Type Meaning Default
16 VarInt Strength (number of columns of 3 slots in the llama's inventory once a chest is equipped) 0
17 VarInt Carpet color (a dye color, or -1 if no carpet equipped) -1
18 VarInt Variant (0: llama_creamy.png, 1: llama_white.png, 2: llama_brown.png, 3: llama_gray.png) 0

Mule

Extends ChestedHorse.

Pig

Extends Animal.

Index Type Meaning Default
13 Boolean Has saddle false
14 VarInt Total time to "boost" with a carrot on a stick for 0

Whenever a carrot on a stick is used, if the pig is not currently boosting it will start to boost for 140 to 980 (inclusive) ticks. When boost time is changed, a counter is reset which counts up to the boost time, after which boosting will stop. The value remains set at its modified value even after boosting is stopped.

Rabbit

Extends Animal.

Index Type Meaning Default
13 VarInt Type 0

Polar Bear

Extends Animal.

Index Type Meaning Default
13 Boolean Standing up false

Sheep

Extends Animal.

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

TameableAnimal

Extends Animal.

Index Type Meaning Default
13 Byte Bit mask Meaning 0
0x01 Is sitting
0x02 Is angry (only used with wolves)
0x04 Is tamed
14 OptUUID Owner Absent

Ocelot

Extends TameableAnimal.

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

Wolf

Extends TameableAnimal.

Index Type Meaning Default
15 Float Damage taken (used for tail rotation) Value of health field (1.0)
16 Boolean Is begging false
17 VarInt Collar color (values are those used with dyes) 14 (Red)

Parrot

Extends TameableAnimal.

Index Type Meaning Default
15 VarInt Variant (0: red/blue, 1: blue, 2: green, 3: yellow/blue, 4: silver) 0

Villager

Extends Ageable.

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

Golem

Extends Creature.

No additional metadata.

IronGolem

Extends Golem.

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

Snowman

Extends Golem.

Index Type Meaning Default
12 Byte Bit mask Meaning 0x10
0x10 has no pumpkin hat

Shulker

Extends Golem.

Index Type Meaning Default
12 Direction Facing direction Down (0)
13 OptPosition Attachment position Absent
14 Byte Shield height 0
15 Byte Color (dye color) 10 (purple)

Monster

Extends Creature.

No additional metadata.

Blaze

Extends Monster.

Index Type Meaning Default
12 Byte Bit mask Meaning 0
0x01 Is on fire

Creeper

Extends Monster.

Index Type Meaning Default
12 VarInt State (-1 = idle, 1 = fuse) -1
13 Boolean Is charged false
14 Boolean Is ignited false

Endermite

Extends Monster.

No additional metadata.

Giant Zombie

Extends Monster.

No additional metadata.

Guardian

Extends Monster.

Index Type Meaning Default
12 Boolean Is retracting spikes false
13 VarInt Target EID 0
21
Plays the guardian sound effect from this entity.

ElderGuardian

Extends Guardian.

Silverfish

Extends Monster.

No additional metadata.

EvocationIllager

Extends Monster.

Index Type Meaning Default
12 Byte Spell (0: none, 1: summon vex, 2: attack, 3: wololo) 0

IllusionIllager

Extends EvocationIllager.

Vex

Extends Monster.

Index Type Meaning Default
12 Byte Bit mask Meaning 0
0x01 Is in attack mode

VindicationIllager

Extends Monster.

Index Type Meaning Default
12 Byte Bit mask Meaning 0
0x01 Has target (aggressive state)

EvocationFangs

Extends Entity.

No additional metadata.

AbstractSkeleton

Extends Monster.

Index Type Meaning Default
12 Boolean Is swinging arms false

Skeleton

Extends AbstractSkeleton.

Wither Skeleton

Extends AbstractSkeleton.

Stray

Extends AbstractSkeleton.

Spider

Extends Monster.

Index Type Meaning Default
12 Byte Bit mask Meaning 0
0x01 Is climbing

Witch

Extends Monster.

Index Type Meaning Default
12 Boolean Is drinking potion false

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 Default
12 VarInt Center head's target (entity ID, or 0 if no target) 0
13 VarInt Left(?) head's target (entity ID, or 0 if no target) 0
14 VarInt Right(?) head's target (entity ID, or 0 if no target) 0
15 VarInt Invulnerable time 0

Zombie

Extends Monster.

Index Type Meaning Default
12 Boolean Is baby false
13 VarInt Unused (previously type) 0
14 Boolean Are hands held up false

Zombie Villager

Extends Zombie.

Index Type Meaning Default
15 Boolean Is converting false
16 VarInt Profession 0

Husk

Extends Zombie.

Enderman

Extends Monster.

Index Type Meaning Default
12 Opt BlockID Carried block Absent
13 Boolean Is screaming false

EnderDragon

Extends Insentient.

Index Type Meaning Default
12 VarInt Dragon phase 10 (hover)

Phases (according to the wiki page on dragon data values) are:

  • 0: circling
  • 1: strafing (preparing to shoot a fireball)
  • 2: flying to the portal to land (part of transition to landed state)
  • 3: landing on the portal (part of transition to landed state)
  • 4: taking off from the portal (part of transition out of landed state)
  • 5: landed, performing breath attack
  • 6: landed, looking for a player for breath attack
  • 7: landed, roar before beginning breath attack
  • 8: charging player
  • 9: flying to portal to die
  • 10: hovering with no AI (default when using the /summon command).

Flying

Extends Insentient.

No additional metadata.

Ghast

Extends Flying.

Index Type Meaning Default
12 Boolean Is attacking false

Slime

Extends Insentient.

Index Type Meaning Default
12 VarInt Size 1

LlamaSpit

Extends Entity.

Minecart

Extends Entity.

Index Type Meaning Default
6 VarInt Shaking power 0
7 VarInt Shaking direction 1
8 Float Shaking multiplier 0.0
9 VarInt Custom block ID and damage 0
10 VarInt Custom block Y position (in 16ths of a block) 6
11 Boolean Show custom block false

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 Default
12 Boolean Is powered false

MinecartTNT

Extends Minecart.

No additional metadata.

MinecartSpawner

Extends Minecart.

No additional metadata.

MinecartCommandBlock

Extends Minecart.

Index Type Meaning Default
12 String Command
13 Chat Last output {"text":""}

TNTPrimed

Extends Entity.

Index Type Meaning Default
6 VarInt Fuse time 80