PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
AttributeModifier.php
1<?php
2
3/*
4 * This file is part of BedrockProtocol.
5 * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6 *
7 * BedrockProtocol is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 */
12
13declare(strict_types=1);
14
15namespace pocketmine\network\mcpe\protocol\types\entity;
16
18
20
25 public function __construct(
26 private string $id,
27 private string $name,
28 private float $amount,
29 private int $operation,
30 private int $operand,
31 private bool $serializable //???
32 ){}
33
34 public function getId() : string{ return $this->id; }
35
36 public function getName() : string{ return $this->name; }
37
38 public function getAmount() : float{ return $this->amount; }
39
40 public function getOperation() : int{ return $this->operation; }
41
42 public function getOperand() : int{ return $this->operand; }
43
44 public function isSerializable() : bool{ return $this->serializable; }
45
46 public static function read(PacketSerializer $in) : self{
47 $id = $in->getString();
48 $name = $in->getString();
49 $amount = $in->getLFloat();
50 $operation = $in->getLInt();
51 $operand = $in->getLInt();
52 $serializable = $in->getBool();
53
54 return new self($id, $name, $amount, $operation, $operand, $serializable);
55 }
56
57 public function write(PacketSerializer $out) : void{
58 $out->putString($this->id);
59 $out->putString($this->name);
60 $out->putLFloat($this->amount);
61 $out->putLInt($this->operation);
62 $out->putLInt($this->operand);
63 $out->putBool($this->serializable);
64 }
65}
__construct(private string $id, private string $name, private float $amount, private int $operation, private int $operand, private bool $serializable)