Entities: Difference between revisions

From wiki.vg
Jump to navigation Jump to search
imported>Tigerw
m (Better described a value in minecart metadata)
imported>Kashike
(Kashike moved page Entities to Entity metadata: Separating statuses to their own page, renaming existing page to be specific to metadata)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
#REDIRECT [[Entity metadata]]
== Mobs ==
 
Mobs are spawned via [[Protocol#0x18|0x18 Mob Spawn]]
 
{| class="wikitable"
|-
! Type
! Name
! x, z
! y
|-
| 50
| Creeper
| 0.6
| 1.8
|-
| 51
| Skeleton
| 0.6
| 1.8
|-
| 52
| Spider
| 1.4
| 0.9
|-
| 53
| Giant Zombie
| 3.6
| 10.8
|-
| 54
| Zombie
| 0.6
| 1.8
|-
| 55
| Slime
| 0.6 * size
| 0.6 * size
|-
| 56
| Ghast
| 4
| 4
|-
| 57
| Zombie Pigman
| 0.6
| 1.8
|-
| 58
| Enderman
|
|
|-
| 59
| Cave Spider
|
|
|-
| 60
| Silverfish
|
|
|-
| 61
| Blaze
|
|
|-
| 62
| Magma Cube
| 0.6 * size
| 0.6 * size
|-
| 63
| Ender Dragon
|
|
|-
| 64
| Wither
|
|
|-
| 65
| Bat
|
|
|-
| 66
| Witch
|
|
|-
| 90
| Pig
| 0.9
| 0.9
|-
| 91
| Sheep
| 0.6
| 1.3
|-
| 92
| Cow
| 0.9
| 1.3
|-
| 93
| Chicken
| 0.3
| 0.4
|-
| 94
| Squid
| 0.95
| 0.95
|-
| 95
| Wolf
| 0.6
| 1.8
|-
| 96
| Mooshroom
|
|
|-
| 97
| Snowman
|
|
|-
| 98
| Ocelot
|
|
|-
| 99
| Iron Golem
|
|
|-
| 100
| Horse
|
|
|-
| 120
| Villager
|
|
|}
 
== Objects ==
 
Objects are spawned via [[Protocol#0x17|0x17 Spawn Object/Vehicle]]. See [[Object Data]] for more details.
 
{| class="wikitable"
|-
! ID
! Name
! x, z
! y
|-
| 1
| Boat
| 1.5
| 0.6
|-
| 2
| Item Stack ([[Slot]])
| 0.25
| 0.25
|-
| 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
|-
| 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
|-
| 90
| Fishing Float
| 0.25
| 0.25
|}
 
Since Release 1.6, all minecarts are spawned with object type 10 and their functionality is then specified in the [[Object_Data#Minecarts|Object data]] within the packet. Also, their visual appearance may be sent via the [[Entities#Minecart|Entity Metadata]] packet.
 
== Entity Metadata ==
 
=== 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.
 
The entity metadata format is quirky dictionary format, where the key and the value's type are packed in a single byte.
 
To parse, repeat the following procedure:
 
# Read an unsigned byte
# If this byte == 127, stop reading
# Decompose the byte. <br> The bottom 5 bits (0x1F) serve as an identifier (key) for the data to follow. <br> The top 3 bits (0xE0) serve as a type.
# Read and unpack based on the type (below)
 
{| class="wikitable"
|-
! Type
! Meaning
|-
| 0
| Byte
|-
| 1
| Short
|-
| 2
| Int
|-
| 3
| Float
|-
| 4
| String16
|-
| 5
| [[Slot Data|Slot]]
|-
| 6<sup>*</sup>
| Int, Int, Int (x, y, z)
|}
 
<nowiki>*</nowiki>Not currently used
 
 
In C-like psuedocode:
<source lang="c">
do {
    item = readByte();
    if (item == 0x7F) break;
    var index = item & 0x1F;
    var type = item >> 5;
   
    if (type == 0) metadata[index] = readByte();
    if (type == 1) metadata[index] = readShort();
    if (type == 2) metadata[index] = readInt();
    if (type == 3) metadata[index] = readFloat();
    if (type == 4) metadata[index] = readString16();
    if (type == 5) metadata[index] = readSlot();
    if (type == 6) {
        var vector;
        vector.x = readInt();
        vector.y = readInt();
        vector.z = readInt();
        metadata[index] = vector;
    }
} while (true);
</source>
 
 
=== Entity ===
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" colspan="2" | Meaning
|-
| rowspan="6" | 0
| rowspan="6" | Byte
! Bit Mask !! Meaning
|-
| 0x01 || On Fire
|-
| 0x02 || Crouched
|-
| 0x08 || Sprinting
|-
| 0x10 || Eating/Drinking/Blocking
|-
| 0x20 || Invisible
|-
| 1
| Short
| colspan="2" | Air
|}
 
=== Living Entity ===
<sup>Extends [[#Entity|Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 6
| Float
| Health
|-
| 7
| Int
| Potion Effect Color
|-
| 8
| Byte
| Is Potion Effect Ambient
|-
| 9
| Byte
| Number of Arrows in Entity
|-
| 10
| String
| Name Tag
|-
| 11
| Byte
| Always Show Name Tag
|}
 
=== Ageable ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 12
| Int
| Entity's Age (Negative = Child)
|}
 
=== Horse ===
<sup>Extends [[#Ageable|Ageable]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" colspan="3" | Meaning
|-
| rowspan="8" | 16
| rowspan="8" | Int
! Bit Mask
! colspan="2" | Meaning
|-
| 0x02
| colspan="2" | Is Tame
|-
| 0x04
| colspan="2" | Has Saddle
|-
| 0x08
| colspan="2" | Has Chest
|-
| 0x10
| colspan="2" | Is bred
|-
| 0x20
| colspan="2" | Is Eating
|-
| 0x40
| colspan="2" | Is Rearing
|-
| 0x80
| colspan="2" | Mouth Open
|-
| rowspan="6" | 19
| rowspan="6" | Byte
! Value
! colspan="2" | Type
|-
| 0
| colspan="2" | Horse
|-
| 1
| colspan="2" | Donkey
|-
| 2
| colspan="2" | Mule
|-
| 3
| colspan="2" | Zombie
|-
| 4
| colspan="2" | Skeleton
|-
| rowspan="15" | 20
| rowspan="15" | Int
!Bit Mask
! colspan="2" | Meaning
|-
| rowspan="8" | 0x00FF
! Value !! Color
|-
| 0 || White
|-
| 1 || Creamy
|-
| 2 || Chestnut
|-
| 3 || Brown
|-
| 4 || Black
|-
| 5 || Gray
|-
| 6 || Dark Down
|-
| rowspan="6" | 0xFF00
! Value !! Style
|-
| 0 || None
|-
| 1 || White
|-
| 2 || Whitefield
|-
| 3 || White Dots
|-
| 4 || Black Dots
|-
| 21
| String
| colspan="3" | Owner Name
|-
| rowspan="5" | 22
| rowspan="5" | Int
! Value
! colspan="2" | Type
|-
| 0
| colspan="2" | No Armor
|-
| 1
| colspan="2" | Iron Armor
|-
| 2
| colspan="2" | Gold Armor
|-
| 3
| colspan="2" | Diamond Armor
|}
 
=== Bat ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 16
| Byte
| Is Hanging
|}
 
 
=== Tameable ===
<sup>Extends [[#Ageable|Ageable]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" colspan="2"| Meaning
|-
| rowspan="3" | 16
| rowspan="3" | Byte
! Bit Mask !! Meaning
|-
| 0x01 || Is Sitting
|-
| 0x04 || Is Tame
|-
| 17
| String
| colspan="2" | Owner Name
|}
 
 
=== Ocelot ===
<sup>Extends [[#Tameable|Tameable]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 18
| Byte
| Ocelot Type
|}
 
 
=== Wolf ===
<sup>Extends [[#Tameable|Tameable]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" colspan="2"| Meaning
|-
| rowspan="3" | 16
| rowspan="3" | Byte
!Bit Mask !! Meaning
|-
| colspan="2" | Flags from Tameable
|-
| 0x02 || Is Angry
|-
| 18
| Float
| colspan="2" | Health
|-
| 19
| Byte
| colspan="2" | Begging
|-
| 20
| Byte
| colspan="2" | Collar Color
|}
 
 
=== Pig ===
<sup>Extends [[#Ageable|Ageable]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 16
| Byte
| Has Saddle
|}
 
 
=== Sheep ===
<sup>Extends [[#Ageable|Ageable]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" colspan="3"| Meaning
|-
| rowspan="19" | 16
| rowspan="19" | Byte
! Bit Mask
! colspan="2" | Meaning
|-
| rowspan="17" | 0x0F
! Value !! Color
|-
| 0 || White
|-
| 1 || Orange
|-
| 2 || Magenta
|-
| 3 || Light Blue
|-
| 4 || Yellow
|-
| 5 || Lime
|-
| 6 || Pink
|-
| 7 || Gray
|-
| 8 || Silver
|-
| 9 || Cyan
|-
| 10 || Purple
|-
| 11 || Blue
|-
| 12 || Brown
|-
| 13 || Green
|-
| 14 || Red
|-
| 15 || Black
|-
| 0x10
| colspan="2" | Is Sheared
|}
 
 
=== Villager ===
<sup>Extends [[#Ageable|Ageable]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" colspan="2" | Meaning
|-
| rowspan="6" | 13
| rowspan="6" | Byte
! Value !! Profession
|-
| 0 || Farmer
|-
| 1 || Librarian
|-
| 2 || Priest
|-
| 3 || Blacksmith
|-
| 4 || Butcher
|}
 
 
=== Enderman ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 16
| Byte
| Carried Block
|-
| 17
| Byte
| Carried Block Data
|-
| 18
| Byte
| Is Screaming
|}
 
 
=== Zombie ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 12
| Byte
| Is Child
|-
| 13
| Byte
| Is Villager
|-
| 14
| Byte
| Is Converting
|}
 
=== Zombie Pigman ===
<sup>Extends [[#Zombie|Zombie]]</sup>
 
 
=== Blaze ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 16
| Byte
| On Fire
|}
 
 
 
=== Spider ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 16
| Byte
| Climbing
|}
 
 
=== Cave Spider ===
<sup>Extends [[#Spider|Spider]]</sup>
 
 
=== Creeper ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 16
| Byte
| State (-1 = Idle, 1 = Fuse)
|-
| 17
| Byte
| Is Powered
|}
 
 
=== Ghast ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 16
| Byte
| Is Attacking
|}
 
 
=== Slime ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 16
| Byte
| Size
|}
 
 
=== Magma Cube ===
<sup>Extends [[#Slime|Slime]]</sup>
 
 
=== Skeleton ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" colspan="2" | Meaning
|-
| rowspan="3" | 13
| rowspan="3" | Byte
! Value !! Meaning
|-
| 0 || Normal
|-
| 1 || Wither
|}
 
 
=== Witch ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px"| Meaning
|-
| 21
| Byte
| Is Agressive
|}
 
 
=== Iron Golem ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px"| Meaning
|-
| 16
| Byte
| Is Player Created
|}
 
 
=== Wither ===
<sup>Extends [[#Living Entity|Living Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px"| Meaning
|-
| 17
| Int
| Watched Target
|-
| 18
| Int
| Watched Target
|-
| 19
| Int
| Watched Target
|-
| 20
| Int
| Invulnerable Time
|}
 
 
=== Boat ===
<sup>Extends [[#Entity|Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px"| Meaning
|-
| 17
| Int
| Time Since Hit
|-
| 18
| Int
| Forward Direction
|-
| 19
| Float
| Damage Taken
|}
 
 
=== Minecart ===
<sup>Extends [[#Entity|Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" colspan="2" | Meaning
|-
| 17
| Int
| colspan="2" | Shaking Power
|-
| 18
| Int
| colspan="2" | Shaking Direction
|-
| 19
| Float
| colspan="2" | Damage Taken / Shaking Multiplier
|-
| rowspan="3" | 20
| rowspan="3" | Int
! Bit Mask !! Meaning
|-
| 0x00FF || Block Id
|-
| 0xFF00 || Block Data
|-
| 21
| Int
| colspan="2" | Block Y Position
|-
| 22
| Byte
| colspan="2" | Show Block
|}
 
 
=== Furnace Minecart ===
<sup>Extends [[#Minecart|Minecart]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 16
| Byte
| Is Powered
|}
 
 
=== Item ===
<sup>Extends [[#Entity|Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 10
| Slot
| Item
|}
 
 
=== Arrow ===
<sup>Extends [[#Entity|Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 16
| Byte
| Is Critical
|}
 
 
=== Firework ===
<sup>Extends [[#Entity|Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 8
| Slot
| Firework Info
|}
 
 
=== Item Frame ===
<sup>Extends [[#Entity|Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 2
| Slot
| Item
|-
| 3
| Byte
| Rotation
|}
 
 
=== Ender Crystal ===
<sup>Extends [[#Entity|Entity]]</sup>
 
{| class="wikitable"
|-
! style="width: 75px" | Index
! style="width: 75px" | Type
! style="width: 250px" | Meaning
|-
| 8
| Int
| Health
|}

Latest revision as of 02:04, 13 November 2017

Redirect to: