mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 00:39:45 +00:00
Merge branch '3.5'
This commit is contained in:
commit
9840a3c980
@ -169,7 +169,7 @@ class AddEntityPacket extends DataPacket{
|
|||||||
protected function decodePayload() : void{
|
protected function decodePayload() : void{
|
||||||
$this->entityUniqueId = $this->getEntityUniqueId();
|
$this->entityUniqueId = $this->getEntityUniqueId();
|
||||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||||
$this->type = array_search($t = $this->getString(), self::LEGACY_ID_MAP_BC);
|
$this->type = array_search($t = $this->getString(), self::LEGACY_ID_MAP_BC, true);
|
||||||
if($this->type === false){
|
if($this->type === false){
|
||||||
throw new \UnexpectedValueException("Can't map ID $t to legacy ID");
|
throw new \UnexpectedValueException("Can't map ID $t to legacy ID");
|
||||||
}
|
}
|
||||||
@ -207,6 +207,9 @@ class AddEntityPacket extends DataPacket{
|
|||||||
protected function encodePayload() : void{
|
protected function encodePayload() : void{
|
||||||
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
$this->putEntityUniqueId($this->entityUniqueId ?? $this->entityRuntimeId);
|
||||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||||
|
if(!isset(self::LEGACY_ID_MAP_BC[$this->type])){
|
||||||
|
throw new \InvalidArgumentException("Unknown entity numeric ID $this->type");
|
||||||
|
}
|
||||||
$this->putString(self::LEGACY_ID_MAP_BC[$this->type]);
|
$this->putString(self::LEGACY_ID_MAP_BC[$this->type]);
|
||||||
$this->putVector3($this->position);
|
$this->putVector3($this->position);
|
||||||
$this->putVector3Nullable($this->motion);
|
$this->putVector3Nullable($this->motion);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user