mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 07:39:57 +00:00
updated NBT dependency
This commit is contained in:
parent
ab628d0254
commit
3fa628f259
8
composer.lock
generated
8
composer.lock
generated
@ -437,12 +437,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pmmp/NBT.git",
|
"url": "https://github.com/pmmp/NBT.git",
|
||||||
"reference": "b4746c1d3c0f465dc4406754018f96b113ec4170"
|
"reference": "221212bd1991430a74374295261795a9a13875bb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pmmp/NBT/zipball/b4746c1d3c0f465dc4406754018f96b113ec4170",
|
"url": "https://api.github.com/repos/pmmp/NBT/zipball/221212bd1991430a74374295261795a9a13875bb",
|
||||||
"reference": "b4746c1d3c0f465dc4406754018f96b113ec4170",
|
"reference": "221212bd1991430a74374295261795a9a13875bb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -470,7 +470,7 @@
|
|||||||
"source": "https://github.com/pmmp/NBT/tree/master",
|
"source": "https://github.com/pmmp/NBT/tree/master",
|
||||||
"issues": "https://github.com/pmmp/NBT/issues"
|
"issues": "https://github.com/pmmp/NBT/issues"
|
||||||
},
|
},
|
||||||
"time": "2019-11-29T21:29:01+00:00"
|
"time": "2019-12-09T11:21:10+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pocketmine/raklib",
|
"name": "pocketmine/raklib",
|
||||||
|
@ -614,7 +614,7 @@ class Server{
|
|||||||
|
|
||||||
if(file_exists($path . "$name.dat")){
|
if(file_exists($path . "$name.dat")){
|
||||||
try{
|
try{
|
||||||
return (new BigEndianNbtSerializer())->readCompressed(file_get_contents($path . "$name.dat"))->getTag();
|
return (new BigEndianNbtSerializer())->readCompressed(file_get_contents($path . "$name.dat"))->mustGetCompoundTag();
|
||||||
}catch(NbtDataException $e){ //zlib decode error / corrupt data
|
}catch(NbtDataException $e){ //zlib decode error / corrupt data
|
||||||
rename($path . "$name.dat", $path . "$name.dat.bak");
|
rename($path . "$name.dat", $path . "$name.dat.bak");
|
||||||
$this->logger->error($this->getLanguage()->translateString("pocketmine.data.playerCorrupted", [$name]));
|
$this->logger->error($this->getLanguage()->translateString("pocketmine.data.playerCorrupted", [$name]));
|
||||||
|
@ -518,7 +518,7 @@ class InGamePacketHandler extends PacketHandler{
|
|||||||
$block = $this->player->getLocation()->getWorld()->getBlock($pos);
|
$block = $this->player->getLocation()->getWorld()->getBlock($pos);
|
||||||
try{
|
try{
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
$nbt = (new NetworkNbtSerializer())->read($packet->namedtag, $offset, 512)->getTag();
|
$nbt = (new NetworkNbtSerializer())->read($packet->namedtag, $offset, 512)->mustGetCompoundTag();
|
||||||
}catch(NbtDataException $e){
|
}catch(NbtDataException $e){
|
||||||
throw new BadPacketException($e->getMessage(), 0, $e);
|
throw new BadPacketException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ class NetworkBinaryStream extends BinaryStream{
|
|||||||
throw new BadPacketException("Unexpected NBT count $c");
|
throw new BadPacketException("Unexpected NBT count $c");
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
$compound = (new NetworkNbtSerializer())->read($this->buffer, $this->offset, 512)->getTag();
|
$compound = (new NetworkNbtSerializer())->read($this->buffer, $this->offset, 512)->mustGetCompoundTag();
|
||||||
}catch(NbtDataException $e){
|
}catch(NbtDataException $e){
|
||||||
throw new BadPacketException($e->getMessage(), 0, $e);
|
throw new BadPacketException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ class BedrockWorldData extends BaseNbtWorldData{
|
|||||||
protected function load() : CompoundTag{
|
protected function load() : CompoundTag{
|
||||||
$nbt = new LittleEndianNbtSerializer();
|
$nbt = new LittleEndianNbtSerializer();
|
||||||
try{
|
try{
|
||||||
$worldData = $nbt->read(substr(file_get_contents($this->dataPath), 8))->getTag();
|
$worldData = $nbt->read(substr(file_get_contents($this->dataPath), 8))->mustGetCompoundTag();
|
||||||
}catch(NbtDataException $e){
|
}catch(NbtDataException $e){
|
||||||
throw new CorruptedWorldException($e->getMessage(), 0, $e);
|
throw new CorruptedWorldException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ class JavaWorldData extends BaseNbtWorldData{
|
|||||||
protected function load() : CompoundTag{
|
protected function load() : CompoundTag{
|
||||||
$nbt = new BigEndianNbtSerializer();
|
$nbt = new BigEndianNbtSerializer();
|
||||||
try{
|
try{
|
||||||
$worldData = $nbt->readCompressed(file_get_contents($this->dataPath))->getTag();
|
$worldData = $nbt->readCompressed(file_get_contents($this->dataPath))->mustGetCompoundTag();
|
||||||
}catch(NbtDataException $e){
|
}catch(NbtDataException $e){
|
||||||
throw new CorruptedWorldException($e->getMessage(), 0, $e);
|
throw new CorruptedWorldException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
|
|||||||
$palette = [];
|
$palette = [];
|
||||||
for($i = 0, $paletteSize = $stream->getLInt(); $i < $paletteSize; ++$i){
|
for($i = 0, $paletteSize = $stream->getLInt(); $i < $paletteSize; ++$i){
|
||||||
$offset = $stream->getOffset();
|
$offset = $stream->getOffset();
|
||||||
$tag = $nbt->read($stream->getBuffer(), $offset)->getTag();
|
$tag = $nbt->read($stream->getBuffer(), $offset)->mustGetCompoundTag();
|
||||||
$stream->setOffset($offset);
|
$stream->setOffset($offset);
|
||||||
|
|
||||||
$id = $stringToLegacyId[$tag->getString("name")] ?? BlockLegacyIds::INFO_UPDATE;
|
$id = $stringToLegacyId[$tag->getString("name")] ?? BlockLegacyIds::INFO_UPDATE;
|
||||||
@ -392,7 +392,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
|
|||||||
$entities = [];
|
$entities = [];
|
||||||
if(($entityData = $this->db->get($index . self::TAG_ENTITY)) !== false and $entityData !== ""){
|
if(($entityData = $this->db->get($index . self::TAG_ENTITY)) !== false and $entityData !== ""){
|
||||||
try{
|
try{
|
||||||
$entities = array_map(function(TreeRoot $root) : CompoundTag{ return $root->getTag(); }, $nbt->readMultiple($entityData));
|
$entities = array_map(function(TreeRoot $root) : CompoundTag{ return $root->mustGetCompoundTag(); }, $nbt->readMultiple($entityData));
|
||||||
}catch(NbtDataException $e){
|
}catch(NbtDataException $e){
|
||||||
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
|
|||||||
$tiles = [];
|
$tiles = [];
|
||||||
if(($tileData = $this->db->get($index . self::TAG_BLOCK_ENTITY)) !== false and $tileData !== ""){
|
if(($tileData = $this->db->get($index . self::TAG_BLOCK_ENTITY)) !== false and $tileData !== ""){
|
||||||
try{
|
try{
|
||||||
$tiles = array_map(function(TreeRoot $root) : CompoundTag{ return $root->getTag(); }, $nbt->readMultiple($tileData));
|
$tiles = array_map(function(TreeRoot $root) : CompoundTag{ return $root->mustGetCompoundTag(); }, $nbt->readMultiple($tileData));
|
||||||
}catch(NbtDataException $e){
|
}catch(NbtDataException $e){
|
||||||
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ trait LegacyAnvilChunkTrait{
|
|||||||
protected function deserializeChunk(string $data) : Chunk{
|
protected function deserializeChunk(string $data) : Chunk{
|
||||||
$nbt = new BigEndianNbtSerializer();
|
$nbt = new BigEndianNbtSerializer();
|
||||||
try{
|
try{
|
||||||
$chunk = $nbt->readCompressed($data)->getTag();
|
$chunk = $nbt->readCompressed($data)->mustGetCompoundTag();
|
||||||
}catch(NbtDataException $e){
|
}catch(NbtDataException $e){
|
||||||
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ class McRegion extends RegionWorldProvider{
|
|||||||
protected function deserializeChunk(string $data) : Chunk{
|
protected function deserializeChunk(string $data) : Chunk{
|
||||||
$nbt = new BigEndianNbtSerializer();
|
$nbt = new BigEndianNbtSerializer();
|
||||||
try{
|
try{
|
||||||
$chunk = $nbt->readCompressed($data)->getTag();
|
$chunk = $nbt->readCompressed($data)->mustGetCompoundTag();
|
||||||
}catch(NbtDataException $e){
|
}catch(NbtDataException $e){
|
||||||
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user