Skip to content

Commit

Permalink
Re-add repetition2 field
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanCraft623 committed Aug 15, 2024
1 parent ad98252 commit 1657bd4
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ final class CraftRecipeAutoStackRequestAction extends ItemStackRequestAction{
final public function __construct(
private int $recipeId,
private int $repetitions,
private int $repetitions2,
private array $ingredients
){}

public function getRecipeId() : int{ return $this->recipeId; }

public function getRepetitions() : int{ return $this->repetitions; }

public function getRepetitions2() : int{ return $this->repetitions2; }

/**
* @return RecipeIngredient[]
* @phpstan-return list<RecipeIngredient>
Expand All @@ -51,18 +54,18 @@ public function getIngredients() : array{ return $this->ingredients; }
public static function read(PacketSerializer $in) : self{
$recipeId = $in->readRecipeNetId();
$repetitions = $in->getByte();
$in->getByte(); //repetitions property is sent twice, mojang...
$repetition2 = $in->getByte(); //repetitions property is sent twice, mojang...
$ingredients = [];
for($i = 0, $count = $in->getByte(); $i < $count; ++$i){
$ingredients[] = $in->getRecipeIngredient();
}
return new self($recipeId, $repetitions, $ingredients);
return new self($recipeId, $repetitions, $repetitions2, $ingredients);

Check failure on line 62 in src/types/inventory/stackrequest/CraftRecipeAutoStackRequestAction.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.2)

Undefined variable: $repetitions2

Check failure on line 62 in src/types/inventory/stackrequest/CraftRecipeAutoStackRequestAction.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.3)

Undefined variable: $repetitions2

Check failure on line 62 in src/types/inventory/stackrequest/CraftRecipeAutoStackRequestAction.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.3)

Undefined variable: $repetitions2
}

public function write(PacketSerializer $out) : void{
$out->writeRecipeNetId($this->recipeId);
$out->putByte($this->repetitions);
$out->putByte($this->repetitions); //...
$out->putByte($this->repetition2);

Check failure on line 68 in src/types/inventory/stackrequest/CraftRecipeAutoStackRequestAction.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.2)

Access to an undefined property pocketmine\network\mcpe\protocol\types\inventory\stackrequest\CraftRecipeAutoStackRequestAction::$repetition2.

Check failure on line 68 in src/types/inventory/stackrequest/CraftRecipeAutoStackRequestAction.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.3)

Access to an undefined property pocketmine\network\mcpe\protocol\types\inventory\stackrequest\CraftRecipeAutoStackRequestAction::$repetition2.

Check failure on line 68 in src/types/inventory/stackrequest/CraftRecipeAutoStackRequestAction.php

View workflow job for this annotation

GitHub Actions / Tests (PHP 8.3)

Access to an undefined property pocketmine\network\mcpe\protocol\types\inventory\stackrequest\CraftRecipeAutoStackRequestAction::$repetition2.
$out->putByte(count($this->ingredients));
foreach($this->ingredients as $ingredient){
$out->putRecipeIngredient($ingredient);
Expand Down

0 comments on commit 1657bd4

Please sign in to comment.