mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 04:15:04 +00:00
Don't explode when data contains invalid dye colour IDs
This commit is contained in:
@@ -33,7 +33,11 @@ trait ColorInMetadataTrait{
|
||||
* @see Block::readStateFromData()
|
||||
*/
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->color = DyeColorIdMap::getInstance()->fromId($stateMeta);
|
||||
$color = DyeColorIdMap::getInstance()->fromId($stateMeta);
|
||||
if($color === null){
|
||||
throw new InvalidBlockStateException("No dye colour corresponds to ID $stateMeta");
|
||||
}
|
||||
$this->color = $color;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user