mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
This reverts commit 3bb450244f
.
PhpStorm you lying piece of shit... you only showed me the usages in Level!
This change should be revised and redone later.
98 lines
2.4 KiB
PHP
98 lines
2.4 KiB
PHP
<?php
|
|
|
|
/*
|
|
*
|
|
* ____ _ _ __ __ _ __ __ ____
|
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* @author PocketMine Team
|
|
* @link http://www.pocketmine.net/
|
|
*
|
|
*
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace pocketmine\level;
|
|
|
|
use pocketmine\block\Block;
|
|
use pocketmine\level\format\Chunk;
|
|
use pocketmine\math\Vector3;
|
|
|
|
/**
|
|
* If you want to keep chunks loaded and receive notifications on a specific area,
|
|
* extend this class and register it into Level. This will also tick chunks.
|
|
*
|
|
* Register Level->registerChunkLoader($this, $chunkX, $chunkZ)
|
|
* Unregister Level->unregisterChunkLoader($this, $chunkX, $chunkZ)
|
|
*
|
|
* WARNING: When moving this object around in the world or destroying it,
|
|
* be sure to free the existing references from Level, otherwise you'll leak memory.
|
|
*/
|
|
interface ChunkLoader{
|
|
|
|
/**
|
|
* Returns the ChunkLoader id.
|
|
* Call Level::generateChunkLoaderId($this) to generate and save it
|
|
*
|
|
* @return int
|
|
*/
|
|
public function getLoaderId() : int;
|
|
|
|
/**
|
|
* @return float
|
|
*/
|
|
public function getX();
|
|
|
|
/**
|
|
* @return float
|
|
*/
|
|
public function getZ();
|
|
|
|
/**
|
|
* This method will be called when a Chunk is replaced by a new one
|
|
*
|
|
* @param Chunk $chunk
|
|
*/
|
|
public function onChunkChanged(Chunk $chunk);
|
|
|
|
/**
|
|
* This method will be called when a registered chunk is loaded
|
|
*
|
|
* @param Chunk $chunk
|
|
*/
|
|
public function onChunkLoaded(Chunk $chunk);
|
|
|
|
|
|
/**
|
|
* This method will be called when a registered chunk is unloaded
|
|
*
|
|
* @param Chunk $chunk
|
|
*/
|
|
public function onChunkUnloaded(Chunk $chunk);
|
|
|
|
/**
|
|
* This method will be called when a registered chunk is populated
|
|
* Usually it'll be sent with another call to onChunkChanged()
|
|
*
|
|
* @param Chunk $chunk
|
|
*/
|
|
public function onChunkPopulated(Chunk $chunk);
|
|
|
|
/**
|
|
* This method will be called when a block changes in a registered chunk
|
|
*
|
|
* @param Block|Vector3 $block
|
|
*/
|
|
public function onBlockChanged(Vector3 $block);
|
|
|
|
}
|