mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-29 14:35:09 +00:00
More PhpStorm inspections, import cleanup
This commit is contained in:
parent
07f18d8f6c
commit
598e7aac8f
@ -118,7 +118,6 @@ use pocketmine\network\protocol\PlayerActionPacket;
|
|||||||
use pocketmine\network\protocol\PlayStatusPacket;
|
use pocketmine\network\protocol\PlayStatusPacket;
|
||||||
use pocketmine\network\protocol\ResourcePacksInfoPacket;
|
use pocketmine\network\protocol\ResourcePacksInfoPacket;
|
||||||
use pocketmine\network\protocol\RespawnPacket;
|
use pocketmine\network\protocol\RespawnPacket;
|
||||||
use pocketmine\network\protocol\SetDifficultyPacket;
|
|
||||||
use pocketmine\network\protocol\SetEntityMotionPacket;
|
use pocketmine\network\protocol\SetEntityMotionPacket;
|
||||||
use pocketmine\network\protocol\SetHealthPacket;
|
use pocketmine\network\protocol\SetHealthPacket;
|
||||||
use pocketmine\network\protocol\SetPlayerGameTypePacket;
|
use pocketmine\network\protocol\SetPlayerGameTypePacket;
|
||||||
@ -134,10 +133,7 @@ use pocketmine\permission\PermissibleBase;
|
|||||||
use pocketmine\permission\PermissionAttachment;
|
use pocketmine\permission\PermissionAttachment;
|
||||||
use pocketmine\plugin\Plugin;
|
use pocketmine\plugin\Plugin;
|
||||||
use pocketmine\tile\ItemFrame;
|
use pocketmine\tile\ItemFrame;
|
||||||
use pocketmine\tile\Sign;
|
|
||||||
use pocketmine\tile\Spawnable;
|
use pocketmine\tile\Spawnable;
|
||||||
use pocketmine\tile\Tile;
|
|
||||||
use pocketmine\utils\Binary;
|
|
||||||
use pocketmine\utils\TextFormat;
|
use pocketmine\utils\TextFormat;
|
||||||
use pocketmine\utils\UUID;
|
use pocketmine\utils\UUID;
|
||||||
|
|
||||||
@ -3612,27 +3608,4 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
public function isLoaderActive(){
|
public function isLoaderActive(){
|
||||||
return $this->isConnected();
|
return $this->isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $chunkX
|
|
||||||
* @param int $chunkZ
|
|
||||||
* @param string $payload
|
|
||||||
*
|
|
||||||
* @return DataPacket
|
|
||||||
*/
|
|
||||||
public static function getChunkCacheFromData($chunkX, $chunkZ, $payload){
|
|
||||||
$pk = new FullChunkDataPacket();
|
|
||||||
$pk->chunkX = $chunkX;
|
|
||||||
$pk->chunkZ = $chunkZ;
|
|
||||||
$pk->data = $payload;
|
|
||||||
$pk->encode();
|
|
||||||
|
|
||||||
$batch = new BatchPacket();
|
|
||||||
$batch->payload = zlib_encode(Binary::writeUnsignedVarInt(strlen($pk->getBuffer())) . $pk->getBuffer(), ZLIB_ENCODING_DEFLATE, Server::getInstance()->networkCompressionLevel);
|
|
||||||
|
|
||||||
$batch->encode();
|
|
||||||
$batch->isEncoded = true;
|
|
||||||
return $batch;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -489,7 +489,7 @@ namespace pocketmine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ThreadManager::init();
|
ThreadManager::init();
|
||||||
$server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
||||||
|
|
||||||
$logger->info("Stopping other threads");
|
$logger->info("Stopping other threads");
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ use pocketmine\nbt\tag\IntTag;
|
|||||||
use pocketmine\nbt\tag\ListTag;
|
use pocketmine\nbt\tag\ListTag;
|
||||||
use pocketmine\nbt\tag\StringTag;
|
use pocketmine\nbt\tag\StringTag;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\tile\Furnace;
|
use pocketmine\tile\Furnace as TileFurnace;
|
||||||
use pocketmine\tile\Tile;
|
use pocketmine\tile\Tile;
|
||||||
|
|
||||||
class BurningFurnace extends Solid{
|
class BurningFurnace extends Solid{
|
||||||
@ -101,11 +101,7 @@ class BurningFurnace extends Solid{
|
|||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null){
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
$t = $this->getLevel()->getTile($this);
|
if(!(($furnace = $this->getLevel()->getTile($this)) instanceof TileFurnace)){
|
||||||
$furnace = false;
|
|
||||||
if($t instanceof Furnace){
|
|
||||||
$furnace = $t;
|
|
||||||
}else{
|
|
||||||
$nbt = new CompoundTag("", [
|
$nbt = new CompoundTag("", [
|
||||||
new ListTag("Items", []),
|
new ListTag("Items", []),
|
||||||
new StringTag("id", Tile::FURNACE),
|
new StringTag("id", Tile::FURNACE),
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
namespace pocketmine\block;
|
namespace pocketmine\block;
|
||||||
|
|
||||||
use pocketmine\item\Tool;
|
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
|
|
||||||
class SeaLantern extends Solid{
|
class SeaLantern extends Solid{
|
||||||
|
@ -25,7 +25,6 @@ use pocketmine\event\entity\EntityDamageEvent;
|
|||||||
use pocketmine\event\entity\ItemDespawnEvent;
|
use pocketmine\event\entity\ItemDespawnEvent;
|
||||||
use pocketmine\event\entity\ItemSpawnEvent;
|
use pocketmine\event\entity\ItemSpawnEvent;
|
||||||
use pocketmine\item\Item as ItemItem;
|
use pocketmine\item\Item as ItemItem;
|
||||||
use pocketmine\nbt\NBT;
|
|
||||||
use pocketmine\nbt\tag\CompoundTag;
|
use pocketmine\nbt\tag\CompoundTag;
|
||||||
use pocketmine\nbt\tag\ShortTag;
|
use pocketmine\nbt\tag\ShortTag;
|
||||||
use pocketmine\nbt\tag\StringTag;
|
use pocketmine\nbt\tag\StringTag;
|
||||||
|
@ -32,7 +32,6 @@ use pocketmine\item\Item as ItemItem;
|
|||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\nbt\tag\ShortTag;
|
use pocketmine\nbt\tag\ShortTag;
|
||||||
use pocketmine\network\protocol\EntityEventPacket;
|
use pocketmine\network\protocol\EntityEventPacket;
|
||||||
use pocketmine\Server;
|
|
||||||
use pocketmine\utils\BlockIterator;
|
use pocketmine\utils\BlockIterator;
|
||||||
|
|
||||||
abstract class Living extends Entity implements Damageable{
|
abstract class Living extends Entity implements Damageable{
|
||||||
|
@ -28,7 +28,6 @@ use pocketmine\math\Vector3;
|
|||||||
use pocketmine\network\protocol\AddEntityPacket;
|
use pocketmine\network\protocol\AddEntityPacket;
|
||||||
use pocketmine\network\protocol\EntityEventPacket;
|
use pocketmine\network\protocol\EntityEventPacket;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\Server;
|
|
||||||
|
|
||||||
class Squid extends WaterAnimal implements Ageable{
|
class Squid extends WaterAnimal implements Ageable{
|
||||||
const NETWORK_ID = 17;
|
const NETWORK_ID = 17;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
namespace pocketmine\event\entity;
|
namespace pocketmine\event\entity;
|
||||||
|
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\Event;
|
|
||||||
use pocketmine\event\Cancellable;
|
use pocketmine\event\Cancellable;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
namespace pocketmine\event\entity;
|
namespace pocketmine\event\entity;
|
||||||
|
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\Event;
|
|
||||||
use pocketmine\event\Cancellable;
|
use pocketmine\event\Cancellable;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
namespace pocketmine\event\entity;
|
namespace pocketmine\event\entity;
|
||||||
|
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\Event;
|
|
||||||
use pocketmine\event\Cancellable;
|
use pocketmine\event\Cancellable;
|
||||||
use pocketmine\level\Level;
|
use pocketmine\level\Level;
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
namespace pocketmine\event\entity;
|
namespace pocketmine\event\entity;
|
||||||
|
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\Event;
|
|
||||||
use pocketmine\event\Cancellable;
|
use pocketmine\event\Cancellable;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
namespace pocketmine\event\entity;
|
namespace pocketmine\event\entity;
|
||||||
|
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\Event;
|
|
||||||
use pocketmine\event\Cancellable;
|
use pocketmine\event\Cancellable;
|
||||||
use pocketmine\level\Position;
|
use pocketmine\level\Position;
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
namespace pocketmine\event\player;
|
namespace pocketmine\event\player;
|
||||||
|
|
||||||
use pocketmine\Event;
|
|
||||||
use pocketmine\event\Cancellable;
|
use pocketmine\event\Cancellable;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
namespace pocketmine\event\server;
|
namespace pocketmine\event\server;
|
||||||
|
|
||||||
use pocketmine\event;
|
|
||||||
use pocketmine\event\Cancellable;
|
use pocketmine\event\Cancellable;
|
||||||
use pocketmine\network\protocol\DataPacket;
|
use pocketmine\network\protocol\DataPacket;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
namespace pocketmine\event\server;
|
namespace pocketmine\event\server;
|
||||||
|
|
||||||
use pocketmine\event;
|
|
||||||
use pocketmine\event\Cancellable;
|
use pocketmine\event\Cancellable;
|
||||||
use pocketmine\network\protocol\DataPacket;
|
use pocketmine\network\protocol\DataPacket;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
namespace pocketmine\event\server;
|
namespace pocketmine\event\server;
|
||||||
|
|
||||||
use pocketmine\event;
|
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\utils\Binary;
|
use pocketmine\utils\Binary;
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ use pocketmine\entity\Human;
|
|||||||
use pocketmine\event\entity\EntityEatItemEvent;
|
use pocketmine\event\entity\EntityEatItemEvent;
|
||||||
use pocketmine\network\protocol\EntityEventPacket;
|
use pocketmine\network\protocol\EntityEventPacket;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\Server;
|
|
||||||
|
|
||||||
abstract class Food extends Item implements FoodSource{
|
abstract class Food extends Item implements FoodSource{
|
||||||
public function canBeConsumed() : bool{
|
public function canBeConsumed() : bool{
|
||||||
|
@ -67,7 +67,6 @@ use pocketmine\inventory\InventoryHolder;
|
|||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\level\format\Chunk;
|
use pocketmine\level\format\Chunk;
|
||||||
use pocketmine\level\format\generic\BaseLevelProvider;
|
use pocketmine\level\format\generic\BaseLevelProvider;
|
||||||
use pocketmine\level\format\generic\EmptyChunkSection;
|
|
||||||
use pocketmine\level\format\LevelProvider;
|
use pocketmine\level\format\LevelProvider;
|
||||||
use pocketmine\level\generator\GenerationTask;
|
use pocketmine\level\generator\GenerationTask;
|
||||||
use pocketmine\level\generator\Generator;
|
use pocketmine\level\generator\Generator;
|
||||||
@ -85,13 +84,13 @@ use pocketmine\math\Vector3;
|
|||||||
use pocketmine\metadata\BlockMetadataStore;
|
use pocketmine\metadata\BlockMetadataStore;
|
||||||
use pocketmine\metadata\Metadatable;
|
use pocketmine\metadata\Metadatable;
|
||||||
use pocketmine\metadata\MetadataValue;
|
use pocketmine\metadata\MetadataValue;
|
||||||
use pocketmine\nbt\NBT;
|
|
||||||
use pocketmine\nbt\tag\CompoundTag;
|
use pocketmine\nbt\tag\CompoundTag;
|
||||||
use pocketmine\nbt\tag\DoubleTag;
|
use pocketmine\nbt\tag\DoubleTag;
|
||||||
use pocketmine\nbt\tag\FloatTag;
|
use pocketmine\nbt\tag\FloatTag;
|
||||||
use pocketmine\nbt\tag\ListTag;
|
use pocketmine\nbt\tag\ListTag;
|
||||||
use pocketmine\nbt\tag\ShortTag;
|
use pocketmine\nbt\tag\ShortTag;
|
||||||
use pocketmine\nbt\tag\StringTag;
|
use pocketmine\nbt\tag\StringTag;
|
||||||
|
use pocketmine\network\protocol\BatchPacket;
|
||||||
use pocketmine\network\protocol\DataPacket;
|
use pocketmine\network\protocol\DataPacket;
|
||||||
use pocketmine\network\protocol\FullChunkDataPacket;
|
use pocketmine\network\protocol\FullChunkDataPacket;
|
||||||
use pocketmine\network\protocol\LevelEventPacket;
|
use pocketmine\network\protocol\LevelEventPacket;
|
||||||
@ -104,6 +103,7 @@ use pocketmine\plugin\Plugin;
|
|||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\tile\Chest;
|
use pocketmine\tile\Chest;
|
||||||
use pocketmine\tile\Tile;
|
use pocketmine\tile\Tile;
|
||||||
|
use pocketmine\utils\Binary;
|
||||||
use pocketmine\utils\LevelException;
|
use pocketmine\utils\LevelException;
|
||||||
use pocketmine\utils\Random;
|
use pocketmine\utils\Random;
|
||||||
use pocketmine\utils\ReversePriorityQueue;
|
use pocketmine\utils\ReversePriorityQueue;
|
||||||
@ -896,8 +896,6 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$blockTest = 0;
|
|
||||||
|
|
||||||
foreach($this->chunkTickList as $index => $loaders){
|
foreach($this->chunkTickList as $index => $loaders){
|
||||||
Level::getXZ($index, $chunkX, $chunkZ);
|
Level::getXZ($index, $chunkX, $chunkZ);
|
||||||
|
|
||||||
@ -2297,7 +2295,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$index = Level::chunkHash($x, $z);
|
$index = Level::chunkHash($x, $z);
|
||||||
|
|
||||||
if(!isset($this->chunkCache[$index]) and $this->cacheChunks and $this->server->getMemoryManager()->canUseChunkCache()){
|
if(!isset($this->chunkCache[$index]) and $this->cacheChunks and $this->server->getMemoryManager()->canUseChunkCache()){
|
||||||
$this->chunkCache[$index] = Player::getChunkCacheFromData($x, $z, $payload);
|
$this->chunkCache[$index] = Level::getChunkCacheFromData($x, $z, $payload);
|
||||||
$this->sendChunkFromCache($x, $z);
|
$this->sendChunkFromCache($x, $z);
|
||||||
$this->timings->syncChunkSendTimer->stopTiming();
|
$this->timings->syncChunkSendTimer->stopTiming();
|
||||||
return;
|
return;
|
||||||
@ -2731,7 +2729,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$this->timings->doChunkGC->startTiming();
|
$this->timings->doChunkGC->startTiming();
|
||||||
|
|
||||||
foreach($this->chunks as $index => $chunk){
|
foreach($this->chunks as $index => $chunk){
|
||||||
if(!isset($this->unloadQueue[$index]) and (!isset($this->usedChunks[$index]) or count($this->usedChunks[$index]) === 0)){
|
if(!isset($this->unloadQueue[$index])){
|
||||||
Level::getXZ($index, $X, $Z);
|
Level::getXZ($index, $X, $Z);
|
||||||
if(!$this->isSpawnChunk($X, $Z)){
|
if(!$this->isSpawnChunk($X, $Z)){
|
||||||
$this->unloadChunkRequest($X, $Z, true);
|
$this->unloadChunkRequest($X, $Z, true);
|
||||||
@ -2774,6 +2772,28 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $chunkX
|
||||||
|
* @param int $chunkZ
|
||||||
|
* @param string $payload
|
||||||
|
*
|
||||||
|
* @return DataPacket
|
||||||
|
*/
|
||||||
|
public static function getChunkCacheFromData($chunkX, $chunkZ, $payload){
|
||||||
|
$pk = new FullChunkDataPacket();
|
||||||
|
$pk->chunkX = $chunkX;
|
||||||
|
$pk->chunkZ = $chunkZ;
|
||||||
|
$pk->data = $payload;
|
||||||
|
$pk->encode();
|
||||||
|
|
||||||
|
$batch = new BatchPacket();
|
||||||
|
$batch->payload = zlib_encode(Binary::writeUnsignedVarInt(strlen($pk->getBuffer())) . $pk->getBuffer(), ZLIB_ENCODING_DEFLATE, Server::getInstance()->networkCompressionLevel);
|
||||||
|
|
||||||
|
$batch->encode();
|
||||||
|
$batch->isEncoded = true;
|
||||||
|
return $batch;
|
||||||
|
}
|
||||||
|
|
||||||
public function setMetadata($metadataKey, MetadataValue $metadataValue){
|
public function setMetadata($metadataKey, MetadataValue $metadataValue){
|
||||||
$this->server->getLevelMetadata()->setMetadata($this, $metadataKey, $metadataValue);
|
$this->server->getLevelMetadata()->setMetadata($this, $metadataKey, $metadataValue);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ use pocketmine\utils\LevelException;
|
|||||||
|
|
||||||
class WeakPosition extends Position{
|
class WeakPosition extends Position{
|
||||||
|
|
||||||
|
protected $levelId = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $x
|
* @param int $x
|
||||||
* @param int $y
|
* @param int $y
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace pocketmine\level\format;
|
namespace pocketmine\level\format;
|
||||||
|
|
||||||
use pocketmine\level\format\Chunk;
|
|
||||||
use pocketmine\level\Level;
|
use pocketmine\level\Level;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ use pocketmine\nbt\tag\CompoundTag;
|
|||||||
use pocketmine\nbt\tag\IntTag;
|
use pocketmine\nbt\tag\IntTag;
|
||||||
use pocketmine\nbt\tag\LongTag;
|
use pocketmine\nbt\tag\LongTag;
|
||||||
use pocketmine\nbt\tag\StringTag;
|
use pocketmine\nbt\tag\StringTag;
|
||||||
|
use pocketmine\utils\ChunkException;
|
||||||
use pocketmine\utils\LevelException;
|
use pocketmine\utils\LevelException;
|
||||||
|
|
||||||
abstract class BaseLevelProvider implements LevelProvider{
|
abstract class BaseLevelProvider implements LevelProvider{
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace pocketmine\level\format;
|
namespace pocketmine\level\format\generic;
|
||||||
|
|
||||||
use pocketmine\level\Level;
|
use pocketmine\level\Level;
|
||||||
use pocketmine\nbt\NBT;
|
use pocketmine\nbt\NBT;
|
||||||
|
@ -23,8 +23,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace pocketmine\level\format\generic;
|
namespace pocketmine\level\format\generic;
|
||||||
|
|
||||||
use pocketmine\utils\ChunkException;
|
|
||||||
|
|
||||||
class EmptySubChunk extends SubChunk{
|
class EmptySubChunk extends SubChunk{
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
|
@ -30,13 +30,13 @@ use pocketmine\block\Block;
|
|||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\level\format\Chunk;
|
use pocketmine\level\format\Chunk;
|
||||||
use pocketmine\level\format\LevelProvider;
|
use pocketmine\level\format\LevelProvider;
|
||||||
use pocketmine\level\Level;
|
|
||||||
use pocketmine\nbt\NBT;
|
use pocketmine\nbt\NBT;
|
||||||
use pocketmine\nbt\tag\CompoundTag;
|
use pocketmine\nbt\tag\CompoundTag;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\tile\Tile;
|
use pocketmine\tile\Tile;
|
||||||
use pocketmine\tile\Spawnable;
|
use pocketmine\tile\Spawnable;
|
||||||
use pocketmine\utils\BinaryStream;
|
use pocketmine\utils\BinaryStream;
|
||||||
|
use pocketmine\utils\ChunkException;
|
||||||
|
|
||||||
class GenericChunk implements Chunk{
|
class GenericChunk implements Chunk{
|
||||||
|
|
||||||
|
@ -23,15 +23,19 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace pocketmine\level\format\region;
|
namespace pocketmine\level\format\region;
|
||||||
|
|
||||||
use pocketmine\level\format\Chunk;
|
|
||||||
use pocketmine\level\format\generic\GenericChunk;
|
use pocketmine\level\format\generic\GenericChunk;
|
||||||
use pocketmine\level\format\generic\SubChunk;
|
use pocketmine\level\format\generic\SubChunk;
|
||||||
use pocketmine\level\Level;
|
|
||||||
use pocketmine\nbt\NBT;
|
use pocketmine\nbt\NBT;
|
||||||
use pocketmine\nbt\tag\{ByteArrayTag, ByteTag, CompoundTag, IntArrayTag, IntTag, ListTag, LongTag};
|
use pocketmine\nbt\tag\{
|
||||||
|
ByteArrayTag,
|
||||||
|
ByteTag,
|
||||||
|
CompoundTag,
|
||||||
|
IntArrayTag,
|
||||||
|
IntTag,
|
||||||
|
ListTag,
|
||||||
|
LongTag
|
||||||
|
};
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\tile\Spawnable;
|
|
||||||
use pocketmine\utils\BinaryStream;
|
|
||||||
use pocketmine\utils\ChunkException;
|
use pocketmine\utils\ChunkException;
|
||||||
use pocketmine\utils\MainLogger;
|
use pocketmine\utils\MainLogger;
|
||||||
|
|
||||||
|
@ -24,16 +24,23 @@ declare(strict_types = 1);
|
|||||||
namespace pocketmine\level\format\region;
|
namespace pocketmine\level\format\region;
|
||||||
|
|
||||||
use pocketmine\level\format\Chunk;
|
use pocketmine\level\format\Chunk;
|
||||||
use pocketmine\level\format\LevelProvider;
|
|
||||||
use pocketmine\level\format\generic\GenericChunk;
|
use pocketmine\level\format\generic\GenericChunk;
|
||||||
use pocketmine\level\format\generic\SubChunk;
|
use pocketmine\level\format\generic\SubChunk;
|
||||||
use pocketmine\level\format\generic\BaseLevelProvider;
|
use pocketmine\level\format\generic\BaseLevelProvider;
|
||||||
use pocketmine\level\generator\Generator;
|
use pocketmine\level\generator\Generator;
|
||||||
use pocketmine\level\Level;
|
use pocketmine\level\Level;
|
||||||
use pocketmine\nbt\NBT;
|
use pocketmine\nbt\NBT;
|
||||||
use pocketmine\nbt\tag\{ByteArrayTag, ByteTag, CompoundTag, IntArrayTag, IntTag, ListTag, LongTag, StringTag};
|
use pocketmine\nbt\tag\{
|
||||||
|
ByteArrayTag,
|
||||||
|
ByteTag,
|
||||||
|
CompoundTag,
|
||||||
|
IntArrayTag,
|
||||||
|
IntTag,
|
||||||
|
ListTag,
|
||||||
|
LongTag,
|
||||||
|
StringTag
|
||||||
|
};
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\utils\ChunkException;
|
|
||||||
use pocketmine\utils\MainLogger;
|
use pocketmine\utils\MainLogger;
|
||||||
|
|
||||||
class McRegion extends BaseLevelProvider{
|
class McRegion extends BaseLevelProvider{
|
||||||
@ -137,9 +144,9 @@ class McRegion extends BaseLevelProvider{
|
|||||||
|
|
||||||
$subChunks = [];
|
$subChunks = [];
|
||||||
$fullIds = isset($chunk->Blocks) ? $chunk->Blocks->getValue() : str_repeat("\x00", 32768);
|
$fullIds = isset($chunk->Blocks) ? $chunk->Blocks->getValue() : str_repeat("\x00", 32768);
|
||||||
$fullData = isset($chunk->Data) ? $chunk->Data->getValue() : ($half = str_repeat("\x00", 16384));
|
$fullData = isset($chunk->Data) ? $chunk->Data->getValue() : (str_repeat("\x00", 16384));
|
||||||
$fullSkyLight = isset($chunk->SkyLight) ? $chunk->SkyLight->getValue() : str_repeat("\xff", 16384);
|
$fullSkyLight = isset($chunk->SkyLight) ? $chunk->SkyLight->getValue() : str_repeat("\xff", 16384);
|
||||||
$fullBlockLight = isset($chunk->BlockLight) ? $chunk->BlockLight->getValue() : $half;
|
$fullBlockLight = isset($chunk->BlockLight) ? $chunk->BlockLight->getValue() : (str_repeat("\x00", 16384));
|
||||||
|
|
||||||
for($y = 0; $y < 8; ++$y){
|
for($y = 0; $y < 8; ++$y){
|
||||||
$offset = ($y << 4);
|
$offset = ($y << 4);
|
||||||
|
@ -23,15 +23,19 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace pocketmine\level\format\region;
|
namespace pocketmine\level\format\region;
|
||||||
|
|
||||||
use pocketmine\level\format\Chunk;
|
|
||||||
use pocketmine\level\format\generic\GenericChunk;
|
use pocketmine\level\format\generic\GenericChunk;
|
||||||
use pocketmine\level\format\generic\SubChunk;
|
use pocketmine\level\format\generic\SubChunk;
|
||||||
use pocketmine\level\Level;
|
|
||||||
use pocketmine\nbt\NBT;
|
use pocketmine\nbt\NBT;
|
||||||
use pocketmine\nbt\tag\{ByteArrayTag, ByteTag, CompoundTag, IntArrayTag, IntTag, ListTag, LongTag};
|
use pocketmine\nbt\tag\{
|
||||||
|
ByteArrayTag,
|
||||||
|
ByteTag,
|
||||||
|
CompoundTag,
|
||||||
|
IntArrayTag,
|
||||||
|
IntTag,
|
||||||
|
ListTag,
|
||||||
|
LongTag
|
||||||
|
};
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\tile\Spawnable;
|
|
||||||
use pocketmine\utils\BinaryStream;
|
|
||||||
use pocketmine\utils\ChunkException;
|
use pocketmine\utils\ChunkException;
|
||||||
use pocketmine\utils\MainLogger;
|
use pocketmine\utils\MainLogger;
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ use pocketmine\block\RedstoneOre;
|
|||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\level\ChunkManager;
|
use pocketmine\level\ChunkManager;
|
||||||
use pocketmine\level\format\Chunk;
|
use pocketmine\level\format\Chunk;
|
||||||
use pocketmine\level\generator\biome\Biome;
|
|
||||||
use pocketmine\level\generator\populator\Ore;
|
use pocketmine\level\generator\populator\Ore;
|
||||||
use pocketmine\level\generator\populator\Populator;
|
use pocketmine\level\generator\populator\Populator;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
|
@ -53,7 +53,6 @@ class GenerationTask extends AsyncTask{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @var Chunk $chunk */
|
/** @var Chunk $chunk */
|
||||||
$chunk = $this->chunkClass;
|
|
||||||
$chunk = GenericChunk::fastDeserialize($this->chunk);
|
$chunk = GenericChunk::fastDeserialize($this->chunk);
|
||||||
if($chunk === null){
|
if($chunk === null){
|
||||||
//TODO error
|
//TODO error
|
||||||
@ -79,7 +78,6 @@ class GenerationTask extends AsyncTask{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/** @var Chunk $chunk */
|
/** @var Chunk $chunk */
|
||||||
$chunk = $this->chunkClass;
|
|
||||||
$chunk = GenericChunk::fastDeserialize($this->chunk, $level->getProvider());
|
$chunk = GenericChunk::fastDeserialize($this->chunk, $level->getProvider());
|
||||||
if($chunk === null){
|
if($chunk === null){
|
||||||
//TODO error
|
//TODO error
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
namespace pocketmine\level\generator;
|
namespace pocketmine\level\generator;
|
||||||
|
|
||||||
use pocketmine\level\format\Chunk;
|
use pocketmine\level\format\Chunk;
|
||||||
use pocketmine\level\format\generic\FullChunk;
|
use pocketmine\level\format\generic\GenericChunk;
|
||||||
use pocketmine\level\Level;
|
use pocketmine\level\Level;
|
||||||
use pocketmine\scheduler\AsyncTask;
|
use pocketmine\scheduler\AsyncTask;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
@ -41,7 +41,6 @@ class LightPopulationTask extends AsyncTask{
|
|||||||
|
|
||||||
public function onRun(){
|
public function onRun(){
|
||||||
/** @var Chunk $chunk */
|
/** @var Chunk $chunk */
|
||||||
$chunk = $this->chunkClass;
|
|
||||||
$chunk = GenericChunk::fastDeserialize($this->chunk);
|
$chunk = GenericChunk::fastDeserialize($this->chunk);
|
||||||
if($chunk === null){
|
if($chunk === null){
|
||||||
//TODO error
|
//TODO error
|
||||||
@ -59,7 +58,6 @@ class LightPopulationTask extends AsyncTask{
|
|||||||
$level = $server->getLevel($this->levelId);
|
$level = $server->getLevel($this->levelId);
|
||||||
if($level !== null){
|
if($level !== null){
|
||||||
/** @var Chunk $chunk */
|
/** @var Chunk $chunk */
|
||||||
$chunk = $this->chunkClass;
|
|
||||||
$chunk = GenericChunk::fastDeserialize($this->chunk, $level->getProvider());
|
$chunk = GenericChunk::fastDeserialize($this->chunk, $level->getProvider());
|
||||||
if($chunk === null){
|
if($chunk === null){
|
||||||
//TODO error
|
//TODO error
|
||||||
|
@ -28,8 +28,4 @@ class HellBiome extends Biome{
|
|||||||
public function getName(){
|
public function getName(){
|
||||||
return "Hell";
|
return "Hell";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColor(){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,4 @@ use pocketmine\level\generator\biome\Biome;
|
|||||||
|
|
||||||
abstract class NormalBiome extends Biome{
|
abstract class NormalBiome extends Biome{
|
||||||
|
|
||||||
public function getColor(){
|
|
||||||
return $this->grassColor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,4 @@ class SwampBiome extends GrassyBiome{
|
|||||||
public function getName(){
|
public function getName(){
|
||||||
return "Swamp";
|
return "Swamp";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColor(){
|
|
||||||
return 0x6a7039;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -94,7 +94,6 @@ use pocketmine\network\protocol\UpdateBlockPacket;
|
|||||||
use pocketmine\network\protocol\UseItemPacket;
|
use pocketmine\network\protocol\UseItemPacket;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\utils\Binary;
|
|
||||||
use pocketmine\utils\BinaryStream;
|
use pocketmine\utils\BinaryStream;
|
||||||
|
|
||||||
class Network{
|
class Network{
|
||||||
|
@ -21,16 +21,18 @@
|
|||||||
|
|
||||||
namespace pocketmine\network\protocol;
|
namespace pocketmine\network\protocol;
|
||||||
|
|
||||||
|
use pocketmine\resourcepacks\ResourcePackInfoEntry;
|
||||||
|
|
||||||
#include <rules/DataPacket.h>
|
#include <rules/DataPacket.h>
|
||||||
|
|
||||||
|
|
||||||
class ResourcePacksInfoPacket extends DataPacket{
|
class ResourcePacksInfoPacket extends DataPacket{
|
||||||
const NETWORK_ID = Info::RESOURCE_PACKS_INFO_PACKET;
|
const NETWORK_ID = Info::RESOURCE_PACKS_INFO_PACKET;
|
||||||
|
|
||||||
public $mustAccept = false; //force client to use selected resource packs
|
public $mustAccept = false; //if true, forces client to use selected resource packs
|
||||||
/** @var ResourcePackInfoEntry */
|
/** @var ResourcePackInfoEntry[] */
|
||||||
public $behaviourPackEntries = [];
|
public $behaviorPackEntries = [];
|
||||||
/** @var ResourcePackInfoEntry */
|
/** @var ResourcePackInfoEntry[] */
|
||||||
public $resourcePackEntries = [];
|
public $resourcePackEntries = [];
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
@ -41,8 +43,8 @@ class ResourcePacksInfoPacket extends DataPacket{
|
|||||||
$this->reset();
|
$this->reset();
|
||||||
|
|
||||||
$this->putBool($this->mustAccept);
|
$this->putBool($this->mustAccept);
|
||||||
$this->putShort(count($this->behaviourPackEntries));
|
$this->putShort(count($this->behaviorPackEntries));
|
||||||
foreach($this->behaviourPackEntries as $entry){
|
foreach($this->behaviorPackEntries as $entry){
|
||||||
$this->putString($entry->getPackId());
|
$this->putString($entry->getPackId());
|
||||||
$this->putString($entry->getVersion());
|
$this->putString($entry->getVersion());
|
||||||
$this->putLong($entry->getPackSize());
|
$this->putLong($entry->getPackSize());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user