mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-12 12:55:21 +00:00
Throw a more specific exception on unknown block IDs
This commit is contained in:
parent
8b80c70b9c
commit
be2fe160b3
@ -23,6 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\data\bedrock\block;
|
namespace pocketmine\data\bedrock\block;
|
||||||
|
|
||||||
final class BlockStateDeserializeException extends \RuntimeException{
|
class BlockStateDeserializeException extends \RuntimeException{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2534,7 +2534,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
|
|||||||
public function deserializeBlock(BlockStateData $blockStateData) : Block{
|
public function deserializeBlock(BlockStateData $blockStateData) : Block{
|
||||||
$id = $blockStateData->getName();
|
$id = $blockStateData->getName();
|
||||||
if(!array_key_exists($id, $this->deserializeFuncs)){
|
if(!array_key_exists($id, $this->deserializeFuncs)){
|
||||||
throw new BlockStateDeserializeException("Unknown block ID \"$id\"");
|
throw new UnsupportedBlockStateException("Unknown block ID \"$id\"");
|
||||||
}
|
}
|
||||||
$reader = new Reader($blockStateData);
|
$reader = new Reader($blockStateData);
|
||||||
$block = $this->deserializeFuncs[$id]($reader);
|
$block = $this->deserializeFuncs[$id]($reader);
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
<?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\data\bedrock\block\convert;
|
||||||
|
|
||||||
|
use pocketmine\data\bedrock\block\BlockStateDeserializeException;
|
||||||
|
|
||||||
|
final class UnsupportedBlockStateException extends BlockStateDeserializeException{
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user