mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-08 20:58:34 +00:00
Send player movements as direct packets
This commit is contained in:
parent
e6edace944
commit
0ab3da88be
@ -81,7 +81,6 @@ use pocketmine\network\protocol\SetSpawnPositionPacket;
|
|||||||
use pocketmine\network\protocol\SetTimePacket;
|
use pocketmine\network\protocol\SetTimePacket;
|
||||||
use pocketmine\network\protocol\StartGamePacket;
|
use pocketmine\network\protocol\StartGamePacket;
|
||||||
use pocketmine\network\protocol\TakeItemEntityPacket;
|
use pocketmine\network\protocol\TakeItemEntityPacket;
|
||||||
use pocketmine\network\protocol\UnloadChunkPacket;
|
|
||||||
use pocketmine\network\protocol\UpdateBlockPacket;
|
use pocketmine\network\protocol\UpdateBlockPacket;
|
||||||
use pocketmine\network\SourceInterface;
|
use pocketmine\network\SourceInterface;
|
||||||
use pocketmine\permission\PermissibleBase;
|
use pocketmine\permission\PermissibleBase;
|
||||||
@ -499,10 +498,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$entity->despawnFrom($this);
|
$entity->despawnFrom($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*$pk = new UnloadChunkPacket();
|
|
||||||
$pk->chunkX = $x;
|
|
||||||
$pk->chunkZ = $z;
|
|
||||||
$this->dataPacket($pk);*/
|
|
||||||
$this->getLevel()->freeChunk($x, $z, $this);
|
$this->getLevel()->freeChunk($x, $z, $this);
|
||||||
unset($this->usedChunks[$index]);
|
unset($this->usedChunks[$index]);
|
||||||
|
|
||||||
@ -2092,7 +2088,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$pk = new MessagePacket;
|
$pk = new MessagePacket;
|
||||||
$pk->source = ""; //Do not use this ;)
|
$pk->source = ""; //Do not use this ;)
|
||||||
$pk->message = $this->removeFormat === false ? $m : TextFormat::clean($m);
|
$pk->message = $this->removeFormat === false ? $m : TextFormat::clean($m);
|
||||||
$this->dataPacket($pk);
|
$this->directDataPacket($pk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2286,7 +2282,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$pk->bodyYaw = $this->yaw;
|
$pk->bodyYaw = $this->yaw;
|
||||||
$pk->pitch = $this->pitch;
|
$pk->pitch = $this->pitch;
|
||||||
$pk->yaw = $this->yaw;
|
$pk->yaw = $this->yaw;
|
||||||
$this->dataPacket($pk);
|
$this->directDataPacket($pk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ use pocketmine\network\protocol\MovePlayerPacket;
|
|||||||
use pocketmine\network\protocol\RemoveEntityPacket;
|
use pocketmine\network\protocol\RemoveEntityPacket;
|
||||||
use pocketmine\network\protocol\SetEntityMotionPacket;
|
use pocketmine\network\protocol\SetEntityMotionPacket;
|
||||||
use pocketmine\network\protocol\SetTimePacket;
|
use pocketmine\network\protocol\SetTimePacket;
|
||||||
use pocketmine\network\protocol\UnloadChunkPacket;
|
|
||||||
use pocketmine\Network;
|
use pocketmine\Network;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\plugin\Plugin;
|
use pocketmine\plugin\Plugin;
|
||||||
@ -503,7 +502,10 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
[$this->id, $this->x, $this->y, $this->z, $this->yaw, $this->pitch]
|
[$this->id, $this->x, $this->y, $this->z, $this->yaw, $this->pitch]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
Server::broadcastPacket($this->hasSpawned, $pk);
|
|
||||||
|
foreach($this->hasSpawned as $player){
|
||||||
|
$player->directDataPacket($pk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($this->lastMotionX != $this->motionX or $this->lastMotionY != $this->motionY or $this->lastMotionZ != $this->motionZ)){
|
if(($this->lastMotionX != $this->motionX or $this->lastMotionY != $this->motionY or $this->lastMotionZ != $this->motionZ)){
|
||||||
@ -658,10 +660,6 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
$entity->despawnFrom($this);
|
$entity->despawnFrom($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*$pk = new UnloadChunkPacket();
|
|
||||||
$pk->chunkX = $X;
|
|
||||||
$pk->chunkZ = $Z;
|
|
||||||
$this->dataPacket($pk);*/
|
|
||||||
}
|
}
|
||||||
$this->getLevel()->freeAllChunks($this);
|
$this->getLevel()->freeAllChunks($this);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user