Fixed some field types

This commit is contained in:
Dylan K. Taylor 2017-05-15 16:38:02 +01:00
parent fe3b5bac51
commit b41fef0276

View File

@ -49,13 +49,13 @@ class ClientboundMapItemDataPacket extends DataPacket{
public $colors = []; public $colors = [];
public function decode(){ public function decode(){
$this->mapId = $this->getVarInt(); $this->mapId = $this->getEntityUniqueId();
$this->type = $this->getUnsignedVarInt(); $this->type = $this->getUnsignedVarInt();
if(($this->type & 0x08) !== 0){ if(($this->type & 0x08) !== 0){
$count = $this->getUnsignedVarInt(); $count = $this->getUnsignedVarInt();
for($i = 0; $i < $count; ++$i){ for($i = 0; $i < $count; ++$i){
$this->eids[] = $this->getVarInt(); //entity unique ID, signed var-int $this->eids[] = $this->getEntityUniqueId();
} }
} }
@ -93,7 +93,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
public function encode(){ public function encode(){
$this->reset(); $this->reset();
$this->putVarInt($this->mapId); //entity unique ID, signed var-int $this->putEntityUniqueId($this->mapId);
$type = 0; $type = 0;
if(($eidsCount = count($this->eids)) > 0){ if(($eidsCount = count($this->eids)) > 0){
@ -111,7 +111,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
if(($type & 0x08) !== 0){ //TODO: find out what these are for if(($type & 0x08) !== 0){ //TODO: find out what these are for
$this->putUnsignedVarInt($eidsCount); $this->putUnsignedVarInt($eidsCount);
foreach($this->eids as $eid){ foreach($this->eids as $eid){
$this->putVarInt($eid); $this->putEntityUniqueId($eid);
} }
} }