LibChunkLoader
Chunk loader library for PocketMine created by @muqsit.
Install / Use
/learn @buchwasa/LibChunkLoaderREADME
libChunkLoader
Notice: As of the newer PM4 builds, this library has become useless:
Using a teleport example<br> Instead of
ChunkRegion::onChunkGenerated($player->getWorld(), $x >> 4, $z >> 4, function() use($player, $x, $z){
$player->teleport(new Vector3($x, $player->getWorld()->getHighestBlockAt($x, $z), $z));
});
Do
$player->getWorld()->orderChunkPopulation($x >> 4, $z >> 4, null)->onCompletion(function() use($player) : void{
$player->teleport(new Vector3($x, $player->getWorld()->getHighestBlockAt($x, $z), $z));
},
static function(): void{
//Handle an error here.
}
<br>
Notice: This actually was created by muqsit, I've only gone and made it a virion.
What is libChunkLoader?
libChunkLoader is a library that loads a chunk and keeps it loaded until you've done what you've need to do.<br> For instance, say I want to teleport a player to the highest block in my task. The highest block in an unloaded chunk is -1, because, well it's an unloaded chunk.<br> Using libChunkLoader, I can load that chunk to tell me what the highest block actually is and teleport the player to it.
How can I use libChunkLoader?
Here is an example of how to use it:
<?php
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use muqsit\chunkloader\ChunkRegion;
class ExampleTeleport{
public function teleport(Player $player, int $x, int $z){
ChunkRegion::onChunkGenerated($player->getWorld(), $x >> 4, $z >> 4, function() use($player, $x, $z){
$player->teleport(new Vector3($x, $player->getWorld()->getHighestBlockAt($x, $z), $z));
});
}
}
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
