24 use GetTypeIdFromConstTrait;
26 public const ID = ItemDescriptorType::MOLANG;
28 public function __construct(
29 private string $molangExpression,
30 private int $molangVersion
33 public function getMolangExpression() :
string{
return $this->molangExpression; }
35 public function getMolangVersion() :
int{
return $this->molangVersion; }
37 public static function read(ByteBufferReader $in) :
self{
38 $expression = CommonTypes::getString($in);
39 $version = Byte::readUnsigned($in);
41 return new self($expression, $version);
44 public function write(ByteBufferWriter $out) :
void{
45 CommonTypes::putString($out, $this->molangExpression);
46 Byte::writeUnsigned($out, $this->molangVersion);