Fill null UUIDs in CraftingDataPacket, remove all UUID things from CraftingRecipe

This allows deleting lots of code, and additionally provides a huge reduction in the compressed size of CraftingDataPacket. Since we don't care about these UUIDs (they are only used in CraftingEventPacket, which is broken and unused in PM) we fill them with zeros instead.
This commit is contained in:
Dylan K. Taylor
2018-03-28 20:03:04 +01:00
parent a1090623a2
commit ec332e3e60
5 changed files with 9 additions and 86 deletions

View File

@ -24,12 +24,8 @@ declare(strict_types=1);
namespace pocketmine\inventory;
use pocketmine\item\Item;
use pocketmine\utils\UUID;
class ShapelessRecipe implements CraftingRecipe{
/** @var UUID|null */
private $id = null;
/** @var Item[] */
private $ingredients = [];
/** @var Item[] */
@ -48,24 +44,6 @@ class ShapelessRecipe implements CraftingRecipe{
$this->results = array_map(function(Item $item) : Item{ return clone $item; }, $results);
}
/**
* @return UUID|null
*/
public function getId() : ?UUID{
return $this->id;
}
/**
* @param UUID $id
*/
public function setId(UUID $id){
if($this->id !== null){
throw new \InvalidStateException("Id is already set");
}
$this->id = $id;
}
public function getResults() : array{
return array_map(function(Item $item) : Item{ return clone $item; }, $this->results);
}