23 use GetTypeIdFromConstTrait;
25 public const ID = ItemDescriptorType::INT_ID_META;
27 public function __construct(
31 if($id === 0 && $meta !== 0){
32 throw new \InvalidArgumentException(
"Meta cannot be non-zero for air");
36 public function getId() :
int{
return $this->id; }
38 public function getMeta() :
int{
return $this->meta; }
40 public static function read(ByteBufferReader $in) :
self{
41 $id = LE::readSignedShort($in);
43 $meta = LE::readSignedShort($in);
48 return new self($id, $meta);
51 public function write(ByteBufferWriter $out) :
void{
52 LE::writeSignedShort($out, $this->
id);
54 LE::writeSignedShort($out, $this->meta);