mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
protocol: fixed missing field of CraftRecipeAuto
This commit is contained in:
parent
9c5cec77b1
commit
dc07ac33d3
@ -23,12 +23,38 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types\inventory\stackrequest;
|
||||
|
||||
use pocketmine\network\mcpe\NetworkBinaryStream;
|
||||
|
||||
/**
|
||||
* Tells that the current transaction crafted the specified recipe, using the recipe book. This is effectively the same
|
||||
* as the regular crafting result action.
|
||||
*/
|
||||
final class CraftRecipeAutoStackRequestAction extends ItemStackRequestAction{
|
||||
use CraftRecipeStackRequestActionTrait;
|
||||
|
||||
/** @var int */
|
||||
private $recipeId;
|
||||
/** @var int */
|
||||
private $repetitions;
|
||||
|
||||
final public function __construct(int $recipeId, int $repetitions){
|
||||
$this->recipeId = $recipeId;
|
||||
$this->repetitions = $repetitions;
|
||||
}
|
||||
|
||||
public function getRecipeId() : int{ return $this->recipeId; }
|
||||
|
||||
public function getRepetitions() : int{ return $this->repetitions; }
|
||||
|
||||
public static function getTypeId() : int{ return ItemStackRequestActionType::CRAFTING_RECIPE_AUTO; }
|
||||
|
||||
public static function read(NetworkBinaryStream $in) : self{
|
||||
$recipeId = $in->readGenericTypeNetworkId();
|
||||
$repetitions = $in->getByte();
|
||||
return new self($recipeId, $repetitions);
|
||||
}
|
||||
|
||||
public function write(NetworkBinaryStream $out) : void{
|
||||
$out->writeGenericTypeNetworkId($this->recipeId);
|
||||
$out->putByte($this->repetitions);
|
||||
}
|
||||
}
|
||||
|
@ -23,11 +23,30 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types\inventory\stackrequest;
|
||||
|
||||
use pocketmine\network\mcpe\NetworkBinaryStream;
|
||||
|
||||
/**
|
||||
* Tells that the current transaction crafted the specified recipe.
|
||||
*/
|
||||
final class CraftRecipeStackRequestAction extends ItemStackRequestAction{
|
||||
use CraftRecipeStackRequestActionTrait;
|
||||
|
||||
/** @var int */
|
||||
private $recipeId;
|
||||
|
||||
final public function __construct(int $recipeId){
|
||||
$this->recipeId = $recipeId;
|
||||
}
|
||||
|
||||
public function getRecipeId() : int{ return $this->recipeId; }
|
||||
|
||||
public static function getTypeId() : int{ return ItemStackRequestActionType::CRAFTING_RECIPE; }
|
||||
|
||||
public static function read(NetworkBinaryStream $in) : self{
|
||||
$recipeId = $in->readGenericTypeNetworkId();
|
||||
return new self($recipeId);
|
||||
}
|
||||
|
||||
public function write(NetworkBinaryStream $out) : void{
|
||||
$out->writeGenericTypeNetworkId($this->recipeId);
|
||||
}
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types\inventory\stackrequest;
|
||||
|
||||
use pocketmine\network\mcpe\NetworkBinaryStream;
|
||||
|
||||
trait CraftRecipeStackRequestActionTrait{
|
||||
|
||||
/** @var int */
|
||||
private $recipeId;
|
||||
|
||||
final public function __construct(int $recipeId){
|
||||
$this->recipeId = $recipeId;
|
||||
}
|
||||
|
||||
public function getRecipeId() : int{ return $this->recipeId; }
|
||||
|
||||
public static function read(NetworkBinaryStream $in) : self{
|
||||
$recipeId = $in->readGenericTypeNetworkId();
|
||||
return new self($recipeId);
|
||||
}
|
||||
|
||||
public function write(NetworkBinaryStream $out) : void{
|
||||
$out->writeGenericTypeNetworkId($this->recipeId);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user