mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 00:55:14 +00:00
Don't explode when data contains invalid dye colour IDs
This commit is contained in:
@ -73,11 +73,11 @@ final class DyeColorIdMap{
|
||||
return ~$this->toId($color) & 0xf;
|
||||
}
|
||||
|
||||
public function fromId(int $id) : DyeColor{
|
||||
return $this->idToEnum[$id]; //TODO: this might not be present (e.g. corrupted data)
|
||||
public function fromId(int $id) : ?DyeColor{
|
||||
return $this->idToEnum[$id];
|
||||
}
|
||||
|
||||
public function fromInvertedId(int $id) : DyeColor{
|
||||
public function fromInvertedId(int $id) : ?DyeColor{
|
||||
return $this->fromId(~$id & 0xf);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user