27 public const ID = AttributeValueType::COLOR;
29 public const OPERATION_OVERRIDE =
"override";
30 public const OPERATION_ALPHA_BLEND =
"alpha_blend";
31 public const OPERATION_ADD =
"add";
32 public const OPERATION_SUBTRACT =
"subtract";
33 public const OPERATION_MULTIPLY =
"multiply";
35 public function __construct(
37 private string $operation,
40 public function getTypeId() :
int{
46 public function getOperation() :
string{
return $this->operation; }
48 public static function read(ByteBufferReader $in) :
self{
49 $value = match(VarInt::readUnsignedInt($in)){
50 AttributeValueColorArray::ID => AttributeValueColorArray::read($in),
51 AttributeValueColorString::ID => AttributeValueColorString::read($in),
54 $operation = CommonTypes::getString($in);
62 public function write(ByteBufferWriter $out) :
void{
63 VarInt::writeUnsignedInt($out, $this->value->getTypeId());
64 $this->value->write($out);
65 CommonTypes::putString($out, $this->operation);