From a4593d4668a421e89401e00598fbacc16aab5052 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 23 Jun 2014 23:24:27 +0200 Subject: [PATCH] Fixed #1531 --- src/pocketmine/entity/Entity.php | 10 +++++----- src/pocketmine/level/format/generic/BaseChunk.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index ab1308558..c5b0083eb 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -821,8 +821,8 @@ abstract class Entity extends Position implements Metadatable{ return $list; } - public function setPositionAndRotation(Vector3 $pos, $yaw, $pitch){ - if($this->setPosition($pos) === true){ + public function setPositionAndRotation(Vector3 $pos, $yaw, $pitch, $force = false){ + if($this->setPosition($pos, $force) === true){ $this->setRotation($yaw, $pitch); return true; @@ -837,14 +837,14 @@ abstract class Entity extends Position implements Metadatable{ $this->scheduleUpdate(); } - public function setPosition(Vector3 $pos){ + public function setPosition(Vector3 $pos, $force = false){ if($pos instanceof Position and $pos->getLevel() instanceof Level and $pos->getLevel() !== $this->getLevel()){ if($this->switchLevel($pos->getLevel()) === false){ return false; } } - if(!$this->justCreated){ + if(!$this->justCreated and $force !== true){ $ev = new EntityMoveEvent($this, $pos); if($this instanceof Player){ for($side = 2; $side <= 5; ++$side){ @@ -936,7 +936,7 @@ abstract class Entity extends Position implements Metadatable{ $pos = $ev->getTo(); $this->setMotion(new Vector3(0, 0, 0)); - if($this->setPositionAndRotation($pos, $yaw === false ? $this->yaw : $yaw, $pitch === false ? $this->pitch : $pitch) !== false){ + if($this->setPositionAndRotation($pos, $yaw === false ? $this->yaw : $yaw, $pitch === false ? $this->pitch : $pitch, true) !== false){ if($this instanceof Player){ $this->airTicks = 300; $this->fallDistance = 0; diff --git a/src/pocketmine/level/format/generic/BaseChunk.php b/src/pocketmine/level/format/generic/BaseChunk.php index 59456d4d2..48f6d4342 100644 --- a/src/pocketmine/level/format/generic/BaseChunk.php +++ b/src/pocketmine/level/format/generic/BaseChunk.php @@ -210,7 +210,7 @@ abstract class BaseChunk implements Chunk{ } public function getHighestBlockAt($x, $z){ - for($Y = self::SECTION_COUNT; $Y >= 0; --$Y){ + for($Y = self::SECTION_COUNT - 1; $Y >= 0; --$Y){ if(!$this->isSectionEmpty($Y)){ $column = $this->sections[$Y]->getBlockIdColumn($x, $z); for($y = 15; $y >= 0; --$y){