mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Introduce dedicated NBT data exceptions, fix up some corrupted chunk handling
This commit is contained in:
@ -35,6 +35,7 @@ use pocketmine\item\enchantment\EnchantmentInstance;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\LittleEndianNbtSerializer;
|
||||
use pocketmine\nbt\NBT;
|
||||
use pocketmine\nbt\NbtDataException;
|
||||
use pocketmine\nbt\tag\ByteTag;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
@ -64,11 +65,13 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
/** @var LittleEndianNbtSerializer */
|
||||
private static $cachedParser = null;
|
||||
|
||||
/**
|
||||
* @param string $tag
|
||||
*
|
||||
* @return CompoundTag
|
||||
* @throws NbtDataException
|
||||
*/
|
||||
private static function parseCompoundTag(string $tag) : CompoundTag{
|
||||
if($tag === ""){
|
||||
throw new \InvalidArgumentException("No NBT data found in supplied string");
|
||||
}
|
||||
|
||||
if(self::$cachedParser === null){
|
||||
self::$cachedParser = new LittleEndianNbtSerializer();
|
||||
}
|
||||
|
Reference in New Issue
Block a user