Skip to content

ChunkCache ​

class · pocketmine\network\mcpe\cache\ChunkCache · source

Implements ChunkListener

This class is used by the current MCPE protocol system to store cached chunk packets for fast resending.

Methods ​

calculateCacheSize() ​

php
public function calculateCacheSize() : int

Returns the number of bytes occupied by the cache data in this cache. This does not include the size of any promises referenced by the cache.

getHitPercentage() ​

php
public function getHitPercentage() : float

Returns the percentage of requests to the cache which resulted in a cache hit.

getInstance() ​

php
public static function getInstance(\pocketmine\world\World $world, \pocketmine\network\mcpe\compression\Compressor $compressor) : self

Fetches the ChunkCache instance for the given world. This lazily creates cache systems as needed.

onBlockChanged() ​

php
public function onBlockChanged(\pocketmine\math\Vector3 $block) : void

onChunkChanged() ​

php
public function onChunkChanged(int $chunkX, int $chunkZ, \pocketmine\world\format\Chunk $chunk) : void

onChunkUnloaded() ​

php
public function onChunkUnloaded(int $chunkX, int $chunkZ, \pocketmine\world\format\Chunk $chunk) : void

pruneCaches() ​

php
public static function pruneCaches() : void

request() ​

php
public function request(int $chunkX, int $chunkZ) : \pocketmine\network\mcpe\compression\CompressBatchPromise|string

Requests asynchronous preparation of the chunk at the given coordinates.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.