mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Made some changes for 0.12
This commit is contained in:
committed by
Shoghi Cervantes
parent
0380e9009a
commit
4258e22c02
@ -24,9 +24,12 @@ namespace pocketmine\level\format\anvil;
|
||||
use pocketmine\level\format\FullChunk;
|
||||
use pocketmine\level\format\mcregion\McRegion;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\nbt\NBT;
|
||||
use pocketmine\nbt\tag\Byte;
|
||||
use pocketmine\nbt\tag\ByteArray;
|
||||
use pocketmine\nbt\tag\Compound;
|
||||
use pocketmine\network\protocol\FullChunkDataPacket;
|
||||
use pocketmine\tile\Spawnable;
|
||||
use pocketmine\utils\ChunkException;
|
||||
|
||||
class Anvil extends McRegion{
|
||||
@ -66,7 +69,36 @@ class Anvil extends McRegion{
|
||||
}
|
||||
|
||||
public function requestChunkTask($x, $z){
|
||||
return new ChunkRequestTask($this->getLevel(), $this->getChunk($x, $z, true));
|
||||
$chunk = $this->getChunk($x, $z, false);
|
||||
if(!($chunk instanceof Chunk)){
|
||||
throw new ChunkException("Invalid Chunk sent");
|
||||
}
|
||||
|
||||
$tiles = "";
|
||||
|
||||
if(count($chunk->getTiles()) > 0){
|
||||
$nbt = new NBT(NBT::LITTLE_ENDIAN);
|
||||
$list = [];
|
||||
foreach($chunk->getTiles() as $tile){
|
||||
if($tile instanceof Spawnable){
|
||||
$list[] = $tile->getSpawnCompound();
|
||||
}
|
||||
}
|
||||
$nbt->setData($list);
|
||||
$tiles = $nbt->write();
|
||||
}
|
||||
|
||||
$ordered = $chunk->getBlockIdArray() .
|
||||
$chunk->getBlockDataArray() .
|
||||
$chunk->getBlockSkyLightArray() .
|
||||
$chunk->getBlockLightArray() .
|
||||
pack("C*", ...$chunk->getHeightMapArray()) .
|
||||
pack("N*", ...$chunk->getBiomeColorArray()) .
|
||||
$tiles;
|
||||
|
||||
$this->getLevel()->chunkRequestCallback($x, $z, $ordered, FullChunkDataPacket::ORDER_LAYERED);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -133,17 +133,12 @@ class McRegion extends BaseLevelProvider{
|
||||
$tiles = $nbt->write();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$heightmap = pack("C*", ...$chunk->getHeightMapArray());
|
||||
$biomeColors = pack("N*", ...$chunk->getBiomeColorArray());
|
||||
|
||||
$ordered = $chunk->getBlockIdArray() .
|
||||
$chunk->getBlockDataArray() .
|
||||
$chunk->getBlockSkyLightArray() .
|
||||
$chunk->getBlockLightArray() .
|
||||
$heightmap .
|
||||
$biomeColors .
|
||||
pack("C*", ...$chunk->getHeightMapArray()) .
|
||||
pack("N*", ...$chunk->getBiomeColorArray()) .
|
||||
$tiles;
|
||||
|
||||
$this->getLevel()->chunkRequestCallback($x, $z, $ordered);
|
||||
|
Reference in New Issue
Block a user