28 private int $slotFlags,
29 private array $equipActivatedEnchantments,
30 private array $heldActivatedEnchantments,
31 private array $selfActivatedEnchantments,
36 public function getCost() : int{ return $this->cost; }
38 public function getSlotFlags() : int{ return $this->slotFlags; }
49 public function getName() : string{ return $this->name; }
51 public function getOptionId() : int{ return $this->optionId; }
59 $result[] = Enchant::read($in);
67 private static function writeEnchantList(PacketSerializer $out, array $list) : void{
68 $out->putUnsignedVarInt(count($list));
69 foreach($list as $item){
74 public static function read(PacketSerializer $in) : self{
75 $cost = $in->getUnsignedVarInt();
77 $slotFlags = $in->getLInt();
78 $equipActivatedEnchants = self::readEnchantList($in);
79 $heldActivatedEnchants = self::readEnchantList($in);
80 $selfActivatedEnchants = self::readEnchantList($in);
82 $name = $in->getString();
83 $optionId = $in->readRecipeNetId();
85 return new self($cost, $slotFlags, $equipActivatedEnchants, $heldActivatedEnchants, $selfActivatedEnchants, $name, $optionId);
88 public function write(PacketSerializer $out) : void{
89 $out->putUnsignedVarInt($this->cost);
91 $out->putLInt($this->slotFlags);
92 self::writeEnchantList($out, $this->equipActivatedEnchantments);
93 self::writeEnchantList($out, $this->heldActivatedEnchantments);
94 self::writeEnchantList($out, $this->selfActivatedEnchantments);
96 $out->putString($this->name);
97 $out->writeRecipeNetId($this->optionId);
__construct(private int $cost, private int $slotFlags, private array $equipActivatedEnchantments, private array $heldActivatedEnchantments, private array $selfActivatedEnchantments, private string $name, private int $optionId)