diff --git a/src/Player.php b/src/Player.php index 4e53a623..ad5db96b 100755 --- a/src/Player.php +++ b/src/Player.php @@ -961,7 +961,7 @@ class Player{ } $this->lastChunk = [$x, $z]; - if($this->lastOrderX != ($this->entity->x >> 4) || $this->lastOrderZ != ($this->entity->z >> 4)){ + if($this->lastOrderX != ((int)$this->entity->x >> 4) || $this->lastOrderZ != ((int)$this->entity->z >> 4)){ $this->orderChunks(); } $this->server->schedule(MAX_CHUNK_RATE, [$this, "getNextChunk"], $world); @@ -1940,7 +1940,6 @@ class Player{ } $this->entityMovementQueueLength += $len; - $this->entityMovementPacketsPerSecond += $packets; } /** diff --git a/src/entity/ai/tasks/TaskFollowParent.php b/src/entity/ai/tasks/TaskFollowParent.php index 99dcdbe6..0501e99b 100644 --- a/src/entity/ai/tasks/TaskFollowParent.php +++ b/src/entity/ai/tasks/TaskFollowParent.php @@ -2,6 +2,7 @@ class TaskFollowParent extends TaskBase { + public $speedMultiplier; public function __construct($speed){ $this->speedMultiplier = $speed; } diff --git a/src/entity/ai/tasks/TaskMate.php b/src/entity/ai/tasks/TaskMate.php index 5bfdd26b..9aa7c584 100644 --- a/src/entity/ai/tasks/TaskMate.php +++ b/src/entity/ai/tasks/TaskMate.php @@ -2,6 +2,7 @@ class TaskMate extends TaskBase { + public $speedMultiplier; public function __construct($speed){ $this->speedMultiplier = $speed; } diff --git a/src/entity/ai/tasks/TaskRangedAttack.php b/src/entity/ai/tasks/TaskRangedAttack.php index afba75fe..7267e8f1 100644 --- a/src/entity/ai/tasks/TaskRangedAttack.php +++ b/src/entity/ai/tasks/TaskRangedAttack.php @@ -5,6 +5,7 @@ class TaskRangedAttack extends \TaskBase public $server; public $attackCounter = 0; public $seenTicks = 0; + public $rangeSquared = 0; public function __construct($speed, $range){ $this->speedMultiplier = $speed; $this->rangeSquared = $range*$range; @@ -14,7 +15,6 @@ class TaskRangedAttack extends \TaskBase public function onStart(EntityAI $ai) { $this->selfCounter = 1; - $this->ticksNoSeen = 0; } public function onEnd(EntityAI $ai) diff --git a/src/entity/ai/tasks/TaskTempt.php b/src/entity/ai/tasks/TaskTempt.php index eee2f39a..14081cd2 100644 --- a/src/entity/ai/tasks/TaskTempt.php +++ b/src/entity/ai/tasks/TaskTempt.php @@ -2,6 +2,8 @@ class TaskTempt extends TaskBase { + public $speedMultiplier; + public $targetDistance; public function __construct($speed){ $this->speedMultiplier = $speed; $this->targetDistance = 10*10; diff --git a/src/entity/monster/Zombie.php b/src/entity/monster/Zombie.php index 95315008..f53d7248 100644 --- a/src/entity/monster/Zombie.php +++ b/src/entity/monster/Zombie.php @@ -32,7 +32,7 @@ class Zombie extends Monster{ } for($y = (int)$this->y; $y < 129; $y++){ - $block = $this->level->level->getBlockID($this->x, $y, $this->z); + $block = $this->level->level->getBlockID(floor($this->x), $y, floor($this->z)); if(StaticBlock::getIsSolid($block)){ return false; } diff --git a/src/entity/object/Arrow.php b/src/entity/object/Arrow.php index c98ec521..3175b23b 100644 --- a/src/entity/object/Arrow.php +++ b/src/entity/object/Arrow.php @@ -13,6 +13,7 @@ class Arrow extends Entity{ public $criticial = false; public $groundTicks = 0; public $shotByPlayer = false; + public $shotByEntity = false; function __construct(Level $level, $eid, $class, $type = 0, $data = []){ parent::__construct($level, $eid, $class, $type, $data); diff --git a/src/entity/object/ItemEntity.php b/src/entity/object/ItemEntity.php index 0d77fbff..56b07195 100644 --- a/src/entity/object/ItemEntity.php +++ b/src/entity/object/ItemEntity.php @@ -200,7 +200,7 @@ class ItemEntity extends Entity{ $friction = 0.98; if($this->onGround){ $friction = 0.588; - $v3 = $this->level->level->getBlockID($this->x, floor($this->boundingBox->minY) - 1, $this->z); + $v3 = $this->level->level->getBlockID(floor($this->x), floor($this->boundingBox->minY) - 1, floor($this->z)); if($v3 > 0) $friction = StaticBlock::getSlipperiness($v3); } diff --git a/src/utils/XorShift128Random.php b/src/utils/XorShift128Random.php index 8c874065..0e69b02a 100644 --- a/src/utils/XorShift128Random.php +++ b/src/utils/XorShift128Random.php @@ -28,6 +28,7 @@ class XorShift128Random{ } public function setSeed($seed){ + $seed = (int)$seed; $this->x = 123456789 ^ $seed; $this->y = 362436069 ^ ($seed << 17) | (($seed >> 15) & 0x7fffffff) & 0xffffffff; $this->z = 521288629 ^ ($seed << 31) | (($seed >> 1 ) & 0x7fffffff) & 0xffffffff; diff --git a/src/world/MobSpawner.php b/src/world/MobSpawner.php index ff8de7ae..21091ccd 100644 --- a/src/world/MobSpawner.php +++ b/src/world/MobSpawner.php @@ -71,8 +71,8 @@ class MobSpawner{ continue; } - $x = mt_rand($player->entity->x - 32, $player->entity->x + 32); - $z = mt_rand($player->entity->z - 32, $player->entity->z + 32); + $x = mt_rand(floor($player->entity->x - 32), ceil($player->entity->x + 32)); + $z = mt_rand(floor($player->entity->z - 32), ceil($player->entity->z + 32)); $diffX = $x-$player->entity->x; $diffZ = $z-$player->entity->z; $dist = $diffX*$diffX + $diffZ*$diffZ;