mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +00:00
Lock player position for delayed teleport, and add related assertions
This commit is contained in:
parent
ccef0455ab
commit
740a8ad436
@ -1941,7 +1941,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
$this->forceMovement = new Vector3($this->x, $this->y, $this->z);
|
$this->forceMovement = new Vector3($this->x, $this->y, $this->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->forceMovement instanceof Vector3 and ($newPos->distanceSquared($this->forceMovement) > 0.1 or $revert)){
|
if($this->teleportPosition !== null or ($this->forceMovement instanceof Vector3 and ($newPos->distanceSquared($this->forceMovement) > 0.1 or $revert))){
|
||||||
$this->sendPosition($this->forceMovement, $packet->yaw, $packet->pitch, MovePlayerPacket::MODE_RESET);
|
$this->sendPosition($this->forceMovement, $packet->yaw, $packet->pitch, MovePlayerPacket::MODE_RESET);
|
||||||
}else{
|
}else{
|
||||||
$packet->yaw %= 360;
|
$packet->yaw %= 360;
|
||||||
|
@ -1297,6 +1297,8 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
//TODO: big messy loop
|
//TODO: big messy loop
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
assert(abs($dx) <= 20 and abs($dy) <= 20 and abs($dz) <= 20, "Movement distance is excessive: dx=$dx, dy=$dy, dz=$dz");
|
||||||
|
|
||||||
$list = $this->level->getCollisionCubes($this, $this->level->getTickRate() > 1 ? $this->boundingBox->getOffsetBoundingBox($dx, $dy, $dz) : $this->boundingBox->addCoord($dx, $dy, $dz), false);
|
$list = $this->level->getCollisionCubes($this, $this->level->getTickRate() > 1 ? $this->boundingBox->getOffsetBoundingBox($dx, $dy, $dz) : $this->boundingBox->addCoord($dx, $dy, $dz), false);
|
||||||
|
|
||||||
foreach($list as $bb){
|
foreach($list as $bb){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user