mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
Make use of isInLoadedTerrain()
This commit is contained in:
parent
8ac1b18b17
commit
2a40c0d82c
@ -1541,14 +1541,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$this->server->getLogger()->warning($this->getName() . " moved too fast, reverting movement");
|
$this->server->getLogger()->warning($this->getName() . " moved too fast, reverting movement");
|
||||||
$this->server->getLogger()->debug("Old position: " . $this->asVector3() . ", new position: " . $this->newPosition);
|
$this->server->getLogger()->debug("Old position: " . $this->asVector3() . ", new position: " . $this->newPosition);
|
||||||
$revert = true;
|
$revert = true;
|
||||||
}else{
|
}elseif(!$this->level->isInLoadedTerrain($newPos) or !$this->level->isChunkGenerated($newPos->getFloorX() >> 4, $newPos->getFloorZ() >> 4)){
|
||||||
$chunkX = $newPos->getFloorX() >> 4;
|
$revert = true;
|
||||||
$chunkZ = $newPos->getFloorZ() >> 4;
|
$this->nextChunkOrderRun = 0;
|
||||||
|
|
||||||
if(!$this->level->isChunkLoaded($chunkX, $chunkZ) or !$this->level->isChunkGenerated($chunkX, $chunkZ)){
|
|
||||||
$revert = true;
|
|
||||||
$this->nextChunkOrderRun = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$revert and $distanceSquared != 0){
|
if(!$revert and $distanceSquared != 0){
|
||||||
|
@ -26,6 +26,7 @@ namespace pocketmine\tile;
|
|||||||
use pocketmine\inventory\ChestInventory;
|
use pocketmine\inventory\ChestInventory;
|
||||||
use pocketmine\inventory\DoubleChestInventory;
|
use pocketmine\inventory\DoubleChestInventory;
|
||||||
use pocketmine\inventory\InventoryHolder;
|
use pocketmine\inventory\InventoryHolder;
|
||||||
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\nbt\tag\CompoundTag;
|
use pocketmine\nbt\tag\CompoundTag;
|
||||||
use pocketmine\nbt\tag\IntTag;
|
use pocketmine\nbt\tag\IntTag;
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function checkPairing(){
|
protected function checkPairing(){
|
||||||
if($this->isPaired() and !$this->getLevel()->isChunkLoaded($this->pairX >> 4, $this->pairZ >> 4)){
|
if($this->isPaired() and !$this->getLevel()->isInLoadedTerrain(new Vector3($this->pairX, $this->y, $this->pairZ))){
|
||||||
//paired to a tile in an unloaded chunk
|
//paired to a tile in an unloaded chunk
|
||||||
$this->doubleInventory = null;
|
$this->doubleInventory = null;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user