30 use GetTypeIdFromConstTrait;
32 public const ID = ItemStackRequestActionType::CRAFTING_RECIPE_AUTO;
39 private int $recipeId,
40 private int $repetitions,
41 private int $repetitions2,
42 private array $ingredients
45 public function getRecipeId() : int{ return $this->recipeId; }
47 public function getRepetitions() : int{ return $this->repetitions; }
49 public function getRepetitions2() : int{ return $this->repetitions2; }
57 public static function read(ByteBufferReader $in) : self{
59 $repetitions = Byte::readUnsigned($in);
60 $repetitions2 = Byte::readUnsigned($in);
62 for($i = 0, $count = Byte::readUnsigned($in); $i < $count; ++$i){
63 $ingredients[] = CommonTypes::getRecipeIngredient($in);
65 return new self($recipeId, $repetitions, $repetitions2, $ingredients);
68 public function write(ByteBufferWriter $out) : void{
69 CommonTypes::writeRecipeNetId($out, $this->recipeId);
70 Byte::writeUnsigned($out, $this->repetitions);
71 Byte::writeUnsigned($out, $this->repetitions2);
72 Byte::writeUnsigned($out, count($this->ingredients));
73 foreach($this->ingredients as $ingredient){
74 CommonTypes::putRecipeIngredient($out, $ingredient);