Added rotation transformations to remaining packet

This commit is contained in:
Shoghi Cervantes 2015-01-16 01:43:40 +01:00
parent 63f1a50be4
commit 5bd76e955c
No known key found for this signature in database
GPG Key ID: 78464DB0A7837F89
2 changed files with 9 additions and 3 deletions

View File

@ -1232,11 +1232,11 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
if($this->onGround){
$this->inAirTicks = 0;
}else{
if($this->inAirTicks > 20 and $this->isSurvival() and !$this->isSleeping() and $this->spawned and !$this->server->getAllowFlight()){
if($this->inAirTicks > 20 and $this->isSurvival() and !$this->isSleeping() and $this->spawned){
$expectedVelocity = (-$this->gravity) / $this->drag - ((-$this->gravity) / $this->drag) * exp(-$this->drag * ($this->inAirTicks - 2));
$diff = ($this->speed->y - $expectedVelocity) ** 2;
if($diff > 0.6 and $expectedVelocity < $this->speed->y){
if($diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){
$this->kick("Flying is not enabled on this server");
}
return false;
@ -1541,6 +1541,13 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
if($this->spawned === false or $this->dead === true){
break;
}
$packet->yaw %= 360;
$packet->pitch %= 360;
if($packet->yaw < 0){
$packet->yaw += 360;
}
$this->setRotation($packet->yaw, $this->pitch);
break;
case ProtocolInfo::MOVE_PLAYER_PACKET:

View File

@ -243,7 +243,6 @@ class Utils{
(string) memory_get_usage() . "." . memory_get_peak_usage(),
php_uname(),
phpversion(),
extension_loaded("gmp") ? gmp_strval(gmp_random(4)) : microtime(),
zend_version(),
(string) getmypid(),
(string) getmyuid(),