30 private ?array $unlockingIngredients
39 public static function read(ByteBufferReader $in) : self{
43 $unlockingIngredients =
null;
44 if(!$unlockingContext){
45 $unlockingIngredients = [];
46 for($i = 0, $count = VarInt::readUnsignedInt($in); $i < $count; $i++){
47 $unlockingIngredients[] = CommonTypes::getRecipeIngredient($in);
51 return new self($unlockingIngredients);
54 public function write(ByteBufferWriter $out) : void{
55 CommonTypes::putBool($out, $this->unlockingIngredients === null);
56 if($this->unlockingIngredients !==
null){
57 VarInt::writeUnsignedInt($out, count($this->unlockingIngredients));
58 foreach($this->unlockingIngredients as $ingredient){
59 CommonTypes::putRecipeIngredient($out, $ingredient);