Protocol changes for 1.5.0 "release"

what a piece of shit this version is...
This commit is contained in:
Dylan K. Taylor
2018-05-08 15:34:44 +01:00
parent b3ffce9729
commit b5dcdea6d8
11 changed files with 276 additions and 41 deletions

View File

@ -29,6 +29,7 @@ namespace pocketmine\network\mcpe\protocol;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\DimensionIds;
use pocketmine\network\mcpe\protocol\types\MapTrackedObject;
use pocketmine\utils\Color;
class ClientboundMapItemDataPacket extends DataPacket{
@ -49,8 +50,8 @@ class ClientboundMapItemDataPacket extends DataPacket{
/** @var int */
public $scale;
/** @var int[] */
public $decorationEntityUniqueIds = [];
/** @var MapTrackedObject[] */
public $trackedEntities = [];
/** @var array */
public $decorations = [];
@ -83,7 +84,16 @@ class ClientboundMapItemDataPacket extends DataPacket{
if(($this->type & self::BITFLAG_DECORATION_UPDATE) !== 0){
for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){
$this->decorationEntityUniqueIds[] = $this->getEntityUniqueId();
$object = new MapTrackedObject();
$object->type = $this->getLInt();
if($object->type === MapTrackedObject::TYPE_BLOCK){
$this->getBlockPosition($object->x, $object->y, $object->z);
}elseif($object->type === MapTrackedObject::TYPE_ENTITY){
$object->entityUniqueId = $this->getEntityUniqueId();
}else{
throw new \UnexpectedValueException("Unknown map object type");
}
$this->trackedEntities[] = $object;
}
for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){
@ -143,9 +153,16 @@ class ClientboundMapItemDataPacket extends DataPacket{
}
if(($type & self::BITFLAG_DECORATION_UPDATE) !== 0){
$this->putUnsignedVarInt(count($this->decorationEntityUniqueIds));
foreach($this->decorationEntityUniqueIds as $id){
$this->putEntityUniqueId($id);
$this->putUnsignedVarInt(count($this->trackedEntities));
foreach($this->trackedEntities as $object){
$this->putLInt($object->type);
if($object->type === MapTrackedObject::TYPE_BLOCK){
$this->putBlockPosition($object->x, $object->y, $object->z);
}elseif($object->type === MapTrackedObject::TYPE_ENTITY){
$this->putEntityUniqueId($object->entityUniqueId);
}else{
throw new \UnexpectedValueException("Unknown map object type");
}
}
$this->putUnsignedVarInt($decorationCount);