SkillAgentSearch skills...

LibChunkLoader

Chunk loader library for PocketMine created by @muqsit.

Install / Use

/learn @buchwasa/LibChunkLoader
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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.
    }

CI<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

View on GitHub
GitHub Stars8
CategoryDevelopment
Updated3y ago
Forks0

Languages

PHP

Security Score

75/100

Audited on Jan 28, 2023

No findings