From f49d590794f7f0952456766ba42c9a108ec5252d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 15 Feb 2019 16:27:00 +0000 Subject: [PATCH] Level: remove getTiles(), more removal of tiles from user interface --- .../command/defaults/GarbageCollectorCommand.php | 5 +---- .../command/defaults/StatusCommand.php | 3 +-- src/pocketmine/level/Level.php | 16 +--------------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/pocketmine/command/defaults/GarbageCollectorCommand.php b/src/pocketmine/command/defaults/GarbageCollectorCommand.php index 7df2d16ed..6058f160c 100644 --- a/src/pocketmine/command/defaults/GarbageCollectorCommand.php +++ b/src/pocketmine/command/defaults/GarbageCollectorCommand.php @@ -48,17 +48,15 @@ class GarbageCollectorCommand extends VanillaCommand{ $chunksCollected = 0; $entitiesCollected = 0; - $tilesCollected = 0; $memory = memory_get_usage(); foreach($sender->getServer()->getLevelManager()->getLevels() as $level){ - $diff = [count($level->getChunks()), count($level->getEntities()), count($level->getTiles())]; + $diff = [count($level->getChunks()), count($level->getEntities())]; $level->doChunkGarbageCollection(); $level->unloadChunks(true); $chunksCollected += $diff[0] - count($level->getChunks()); $entitiesCollected += $diff[1] - count($level->getEntities()); - $tilesCollected += $diff[2] - count($level->getTiles()); $level->clearCache(true); } @@ -67,7 +65,6 @@ class GarbageCollectorCommand extends VanillaCommand{ $sender->sendMessage(TextFormat::GREEN . "---- " . TextFormat::WHITE . "Garbage collection result" . TextFormat::GREEN . " ----"); $sender->sendMessage(TextFormat::GOLD . "Chunks: " . TextFormat::RED . number_format($chunksCollected)); $sender->sendMessage(TextFormat::GOLD . "Entities: " . TextFormat::RED . number_format($entitiesCollected)); - $sender->sendMessage(TextFormat::GOLD . "Tiles: " . TextFormat::RED . number_format($tilesCollected)); $sender->sendMessage(TextFormat::GOLD . "Cycles: " . TextFormat::RED . number_format($cyclesCollected)); $sender->sendMessage(TextFormat::GOLD . "Memory freed: " . TextFormat::RED . number_format(round((($memory - memory_get_usage()) / 1024) / 1024, 2), 2) . " MB"); diff --git a/src/pocketmine/command/defaults/StatusCommand.php b/src/pocketmine/command/defaults/StatusCommand.php index d83f38019..96b811b2f 100644 --- a/src/pocketmine/command/defaults/StatusCommand.php +++ b/src/pocketmine/command/defaults/StatusCommand.php @@ -112,8 +112,7 @@ class StatusCommand extends VanillaCommand{ $tickRate = $level->getTickRate() > 1 ? " (tick rate " . $level->getTickRate() . ")" : ""; $sender->sendMessage(TextFormat::GOLD . "World \"{$level->getFolderName()}\"$levelName: " . TextFormat::RED . number_format(count($level->getChunks())) . TextFormat::GREEN . " chunks, " . - TextFormat::RED . number_format(count($level->getEntities())) . TextFormat::GREEN . " entities, " . - TextFormat::RED . number_format(count($level->getTiles())) . TextFormat::GREEN . " tiles. " . + TextFormat::RED . number_format(count($level->getEntities())) . TextFormat::GREEN . " entities. " . "Time $timeColor" . round($level->getTickRateTime(), 2) . "ms" . $tickRate ); } diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 3ad2f7656..127f2c6a8 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -133,9 +133,6 @@ class Level implements ChunkManager, Metadatable{ public const DIFFICULTY_NORMAL = 2; public const DIFFICULTY_HARD = 3; - /** @var Tile[] */ - private $tiles = []; - /** @var Player[] */ private $players = []; @@ -2008,16 +2005,6 @@ class Level implements ChunkManager, Metadatable{ return $currentTarget; } - - /** - * Returns a list of the Tile entities in this level - * - * @return Tile[] - */ - public function getTiles() : array{ - return $this->tiles; - } - /** * Returns a list of the players in this level * @@ -2576,7 +2563,6 @@ class Level implements ChunkManager, Metadatable{ throw new \InvalidStateException("Attempted to create tile " . get_class($tile) . " in unloaded chunk $chunkX $chunkZ"); } - $this->tiles[Level::blockHash($tile->x, $tile->y, $tile->z)] = $tile; $tile->scheduleUpdate(); } @@ -2590,7 +2576,7 @@ class Level implements ChunkManager, Metadatable{ throw new \InvalidArgumentException("Invalid Tile level"); } - unset($this->tiles[$blockHash = Level::blockHash($tile->x, $tile->y, $tile->z)], $this->updateTiles[$blockHash]); + unset($this->updateTiles[Level::blockHash($tile->x, $tile->y, $tile->z)]); $chunkX = $tile->getFloorX() >> 4; $chunkZ = $tile->getFloorZ() >> 4;