GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
ClientboundMapItemDataPacket Class Reference

Public Member Functions

 decode ()
 
 encode ()
 
- Public Member Functions inherited from DataPacket
 pid ()
 
 encode ()
 
 decode ()
 
 reset ()
 
 clean ()
 
 __debugInfo ()
 
 getEntityMetadata (bool $types=true)
 
 putEntityMetadata (array $metadata)
 
 getName ()
 
- Public Member Functions inherited from BinaryStream
 __construct ($buffer="", $offset=0)
 
 reset ()
 
 setBuffer ($buffer=null, $offset=0)
 
 getOffset ()
 
 getBuffer ()
 
 get ($len)
 
 put ($str)
 
 getBool ()
 
 putBool ($v)
 
 getLong ()
 
 putLong ($v)
 
 getInt ()
 
 putInt ($v)
 
 getLLong ()
 
 putLLong ($v)
 
 getLInt ()
 
 putLInt ($v)
 
 getSignedShort ()
 
 putShort ($v)
 
 getShort ()
 
 putSignedShort ($v)
 
 getFloat (int $accuracy=-1)
 
 putFloat ($v)
 
 getLShort ($signed=true)
 
 putLShort ($v)
 
 getLFloat (int $accuracy=-1)
 
 putLFloat ($v)
 
 getTriad ()
 
 putTriad ($v)
 
 getLTriad ()
 
 putLTriad ($v)
 
 getByte ()
 
 putByte ($v)
 
 getUUID ()
 
 putUUID (UUID $uuid)
 
 getSlot ()
 
 putSlot (Item $item)
 
 getString ()
 
 putString ($v)
 
 getUnsignedVarInt ()
 
 putUnsignedVarInt ($v)
 
 getVarInt ()
 
 putVarInt ($v)
 
 getEntityId ()
 
 putEntityId ($v)
 
 getBlockCoords (&$x, &$y, &$z)
 
 putBlockCoords ($x, $y, $z)
 
 getVector3f (&$x, &$y, &$z)
 
 putVector3f ($x, $y, $z)
 
 feof ()
 

Data Fields

const NETWORK_ID = ProtocolInfo::CLIENTBOUND_MAP_ITEM_DATA_PACKET
 
const BITFLAG_TEXTURE_UPDATE = 0x02
 
const BITFLAG_DECORATION_UPDATE = 0x04
 
const BITFLAG_ENTITY_UPDATE = 0x08
 
 $mapId
 
 $type
 
 $eids = []
 
 $scale
 
 $decorations = []
 
 $width
 
 $height
 
 $xOffset = 0
 
 $yOffset = 0
 
 $colors = []
 
- Data Fields inherited from DataPacket
const NETWORK_ID = 0
 
 $isEncoded = false
 
- Data Fields inherited from BinaryStream
 $offset
 
 $buffer
 

Member Function Documentation

◆ decode()

decode ( )
47  {
48  $this->mapId = $this->getVarInt();
49  $this->type = $this->getUnsignedVarInt();
50  if(($this->type & self::BITFLAG_ENTITY_UPDATE) !== 0){
51  $count = $this->getUnsignedVarInt();
52  for($i = 0; $i < $count; ++$i){
53  $this->eids[] = $this->getVarInt(); //entity unique ID, signed var-int
54  }
55  }
56  if(($this->type & (self::BITFLAG_DECORATION_UPDATE | self::BITFLAG_TEXTURE_UPDATE)) !== 0){ //Decoration bitflag or colour bitflag
57  $this->scale = $this->getByte();
58  }
59  if(($this->type & self::BITFLAG_DECORATION_UPDATE) !== 0){
60  $count = $this->getUnsignedVarInt();
61  for($i = 0; $i < $count; ++$i){
62  $weird = $this->getVarInt();
63  $this->decorations[$i]["rot"] = $weird & 0x0f;
64  $this->decorations[$i]["img"] = $weird >> 4;
65  $this->decorations[$i]["xOffset"] = $this->getByte();
66  $this->decorations[$i]["yOffset"] = $this->getByte();
67  $this->decorations[$i]["label"] = $this->getString();
68  $this->decorations[$i]["color"] = Color::fromARGB($this->getLInt()); //already BE, don't need to reverse it again
69  }
70  }
71  if(($this->type & self::BITFLAG_TEXTURE_UPDATE) !== 0){
72  $this->width = $this->getVarInt();
73  $this->height = $this->getVarInt();
74  $this->xOffset = $this->getVarInt();
75  $this->yOffset = $this->getVarInt();
76  for($y = 0; $y < $this->height; ++$y){
77  for($x = 0; $x < $this->width; ++$x){
78  $this->colors[$y][$x] = Color::fromABGR($this->getUnsignedVarInt());
79  }
80  }
81  }
82  }

◆ encode()

encode ( )
87  {
88  $this->reset();
89  $this->putVarInt($this->mapId); //entity unique ID, signed var-int
90  $type = 0;
91  if(($eidsCount = count($this->eids)) > 0){
92  $type |= self::BITFLAG_ENTITY_UPDATE;
93  }
94  if(($decorationCount = count($this->decorations)) > 0){
95  $type |= self::BITFLAG_DECORATION_UPDATE;
96  }
97  if(count($this->colors) > 0){
98  $type |= self::BITFLAG_TEXTURE_UPDATE;
99  }
100  $this->putUnsignedVarInt($type);
101  if(($type & self::BITFLAG_ENTITY_UPDATE) !== 0){ //TODO: find out what these are for
102  $this->putUnsignedVarInt($eidsCount);
103  foreach($this->eids as $eid){
104  $this->putVarInt($eid);
105  }
106  }
107  if(($type & (self::BITFLAG_TEXTURE_UPDATE | self::BITFLAG_DECORATION_UPDATE)) !== 0){
108  $this->putByte($this->scale);
109  }
110  if(($type & self::BITFLAG_DECORATION_UPDATE) !== 0){
111  $this->putUnsignedVarInt($decorationCount);
112  foreach($this->decorations as $decoration){
113  $this->putVarInt(($decoration["rot"] & 0x0f) | ($decoration["img"] << 4));
114  $this->putByte($decoration["xOffset"]);
115  $this->putByte($decoration["yOffset"]);
116  $this->putString($decoration["label"]);
117  $this->putLInt($decoration["color"]->toARGB());
118  }
119  }
120  if(($type & self::BITFLAG_TEXTURE_UPDATE) !== 0){
121  $this->putVarInt($this->width);
122  $this->putVarInt($this->height);
123  $this->putVarInt($this->xOffset);
124  $this->putVarInt($this->yOffset);
125  for($y = 0; $y < $this->height; ++$y){
126  for($x = 0; $x < $this->width; ++$x){
127  $this->putUnsignedVarInt($this->colors[$y][$x]->toABGR());
128  }
129  }
130  }
131  }

Field Documentation

◆ $colors

$colors = []

◆ $decorations

$decorations = []

◆ $eids

$eids = []

◆ $height

$height

◆ $mapId

$mapId

◆ $scale

$scale

◆ $type

$type

◆ $width

$width

◆ $xOffset

$xOffset = 0

◆ $yOffset

$yOffset = 0

◆ BITFLAG_DECORATION_UPDATE

const BITFLAG_DECORATION_UPDATE = 0x04

◆ BITFLAG_ENTITY_UPDATE

const BITFLAG_ENTITY_UPDATE = 0x08

◆ BITFLAG_TEXTURE_UPDATE

const BITFLAG_TEXTURE_UPDATE = 0x02

◆ NETWORK_ID


The documentation for this class was generated from the following file: