PocketMine-MP 5.17.1 git-df4ada81e5d74a14046f27cf44a37dcee69d657e
pocketmine\network\mcpe\cache\ChunkCache Class Reference
+ Inheritance diagram for pocketmine\network\mcpe\cache\ChunkCache:
+ Collaboration diagram for pocketmine\network\mcpe\cache\ChunkCache:

Public Member Functions

 calculateCacheSize ()
 
 getHitPercentage ()
 
 onBlockChanged (Vector3 $block)
 
onBlockChanged as onChunkUnloaded as onChunkChanged (int $chunkX, int $chunkZ, Chunk $chunk)
 
 onChunkLoaded (int $chunkX, int $chunkZ, Chunk $chunk)
 
 onChunkPopulated (int $chunkX, int $chunkZ, Chunk $chunk)
 
 onChunkUnloaded (int $chunkX, int $chunkZ, Chunk $chunk)
 
 request (int $chunkX, int $chunkZ)
 

Static Public Member Functions

static getInstance (World $world, Compressor $compressor)
 
static pruneCaches ()
 

Detailed Description

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

Definition at line 41 of file ChunkCache.php.

Member Function Documentation

◆ calculateCacheSize()

pocketmine\network\mcpe\cache\ChunkCache::calculateCacheSize ( )

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.

Definition at line 196 of file ChunkCache.php.

◆ getHitPercentage()

pocketmine\network\mcpe\cache\ChunkCache::getHitPercentage ( )

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

Definition at line 209 of file ChunkCache.php.

◆ getInstance()

static pocketmine\network\mcpe\cache\ChunkCache::getInstance ( World  $world,
Compressor  $compressor 
)
static

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

Definition at line 48 of file ChunkCache.php.

◆ onBlockChanged()

pocketmine\network\mcpe\cache\ChunkCache::onBlockChanged ( Vector3  $block)
See also
ChunkListener::onBlockChanged()

Implements pocketmine\world\ChunkListener.

Definition at line 178 of file ChunkCache.php.

◆ onChunkChanged()

onBlockChanged as onChunkUnloaded as pocketmine\network\mcpe\cache\ChunkCache::onChunkChanged ( int  $chunkX,
int  $chunkZ,
Chunk  $chunk 
)
See also
ChunkListener::onChunkChanged()

Implements pocketmine\world\ChunkListener.

Definition at line 171 of file ChunkCache.php.

◆ onChunkLoaded()

pocketmine\world\ChunkListener::onChunkLoaded ( int  $chunkX,
int  $chunkZ,
Chunk  $chunk 
)
inherited

This method will be called when a registered chunk is loaded

◆ onChunkPopulated()

pocketmine\world\ChunkListener::onChunkPopulated ( int  $chunkX,
int  $chunkZ,
Chunk  $chunk 
)
inherited

This method will be called when a registered chunk is populated Usually it'll be sent with another call to onChunkChanged()

◆ onChunkUnloaded()

pocketmine\network\mcpe\cache\ChunkCache::onChunkUnloaded ( int  $chunkX,
int  $chunkZ,
Chunk  $chunk 
)
See also
ChunkListener::onChunkUnloaded()

Implements pocketmine\world\ChunkListener.

Definition at line 187 of file ChunkCache.php.

◆ pruneCaches()

static pocketmine\network\mcpe\cache\ChunkCache::pruneCaches ( )
static

Definition at line 68 of file ChunkCache.php.

◆ request()

pocketmine\network\mcpe\cache\ChunkCache::request ( int  $chunkX,
int  $chunkZ 
)

Requests asynchronous preparation of the chunk at the given coordinates.

Returns
CompressBatchPromise a promise of resolution which will contain a compressed chunk packet.

Definition at line 97 of file ChunkCache.php.


The documentation for this class was generated from the following file: