mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Exterminate legacy item IDs
This commit is contained in:
@ -24,7 +24,8 @@ declare(strict_types=1);
|
||||
namespace pocketmine\item;
|
||||
|
||||
use pocketmine\block\utils\DyeColor;
|
||||
use pocketmine\data\bedrock\DyeColorIdMap;
|
||||
use pocketmine\data\runtime\RuntimeDataWriter;
|
||||
use pocketmine\data\runtime\RuntimeEnumSerializer;
|
||||
|
||||
class Dye extends Item{
|
||||
private DyeColor $color;
|
||||
@ -34,14 +35,8 @@ class Dye extends Item{
|
||||
parent::__construct($identifier, $name);
|
||||
}
|
||||
|
||||
public function getMeta() : int{
|
||||
return match($this->color->id()){
|
||||
DyeColor::BLACK()->id() => 16,
|
||||
DyeColor::BROWN()->id() => 17,
|
||||
DyeColor::BLUE()->id() => 18,
|
||||
DyeColor::WHITE()->id() => 19,
|
||||
default => DyeColorIdMap::getInstance()->toInvertedId($this->color)
|
||||
};
|
||||
protected function encodeType(RuntimeDataWriter $w) : void{
|
||||
RuntimeEnumSerializer::writeDyeColor($w, $this->color);
|
||||
}
|
||||
|
||||
public function getColor() : DyeColor{
|
||||
|
Reference in New Issue
Block a user