Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Merge remote-tracking branch 'upstream/stable' into stable #2

Merged
merged 2 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
namespace pocketmine\entity\behavior;

use pocketmine\entity\Entity;
use pocketmine\entity\Living;
use pocketmine\entity\Mob;
use pocketmine\Player;

Expand Down Expand Up @@ -71,7 +72,7 @@ public function __construct(Mob $mob, string $classTarget, bool $checkSight, int
}
}

return $this->isSuitableTargetLocal($entity, false);
return $entity instanceof Living and $this->isSuitableTargetLocal($entity, false);
}
};
}
Expand Down
6 changes: 3 additions & 3 deletions src/pocketmine/entity/hostile/Slime.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class Slime extends Monster{
public $height = 0;
public $width = 0;

public $squishAmount;
public $squishFactor;
public $prevSquishFactor;
public $squishAmount = 0;
public $squishFactor = 0;
public $prevSquishFactor = 0;

/** @var EntitySlimeMoveHelper */
protected $moveHelper;
Expand Down
1 change: 0 additions & 1 deletion src/pocketmine/entity/passive/Wolf.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

namespace pocketmine\entity\passive;

use pocketmine\entity\behavior\FindAttackableTargetBehavior;
use pocketmine\entity\behavior\FloatBehavior;
use pocketmine\entity\behavior\FollowOwnerBehavior;
use pocketmine\entity\behavior\HurtByTargetBehavior;
Expand Down
4 changes: 4 additions & 0 deletions src/pocketmine/entity/pathfinder/EntityNavigator.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ public function isBlocked(Vector3 $coord) : bool{
*/
public function removeSunnyPath() : void{
if($this->avoidsSun and $this->mob->level->isDayTime()){
if($this->mob->level->canSeeSky($this->mob)){
return;
}

$temp = new Vector3();
foreach($this->currentPath->getPoints() as $i => $point){
if($this->mob->level->canSeeSky($temp->setComponents($point->x, $point->height, $point->y))){
Expand Down
10 changes: 6 additions & 4 deletions src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
use pocketmine\network\mcpe\protocol\ModalFormResponsePacket;
use pocketmine\network\mcpe\protocol\MoveActorAbsolutePacket;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
use pocketmine\network\mcpe\protocol\NetworkStackLatencyPacket;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
Expand All @@ -65,6 +66,7 @@
use pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket;
use pocketmine\network\mcpe\protocol\RiderJumpPacket;
use pocketmine\network\mcpe\protocol\ServerSettingsRequestPacket;
use pocketmine\network\mcpe\protocol\SetActorMotionPacket;
use pocketmine\network\mcpe\protocol\SetLocalPlayerAsInitializedPacket;
use pocketmine\network\mcpe\protocol\SetPlayerGameTypePacket;
use pocketmine\network\mcpe\protocol\ShowCreditsPacket;
Expand Down Expand Up @@ -339,19 +341,19 @@ public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
return $this->player->handleLevelSoundEvent($packet);
}

public function handleMoveEntityAbsolute(MoveEntityAbsolutePacket $packet) : bool{
public function handleMoveActorAbsolute(MoveActorAbsolutePacket $packet) : bool{
$target = $this->player->getServer()->findEntity($packet->entityRuntimeId);
if($target !== null){
$target->setClientPositionAndRotation($packet->position, $packet->yRot, $packet->xRot, 3, ($packet->flags & MoveEntityAbsolutePacket::FLAG_TELEPORT) !== 0);
$target->onGround = ($packet->flags & MoveEntityAbsolutePacket::FLAG_GROUND) !== 0;
$target->setClientPositionAndRotation($packet->position, $packet->yRot, $packet->xRot, 3, ($packet->flags & MoveActorAbsolutePacket::FLAG_TELEPORT) !== 0);
$target->onGround = ($packet->flags & MoveActorAbsolutePacket::FLAG_GROUND) !== 0;

return true;
}

return false;
}

public function handleSetEntityMotion(SetEntityMotionPacket $packet) : bool{
public function handleSetActorMotion(SetActorMotionPacket $packet) : bool{
$target = $this->player->getServer()->findEntity($packet->entityRuntimeId);
if($target !== null){
$target->setClientMotion($packet->motion);
Expand Down