PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
MultiRecipe.php
1<?php
2
3/*
4 * This file is part of BedrockProtocol.
5 * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6 *
7 * BedrockProtocol is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 */
12
13declare(strict_types=1);
14
15namespace pocketmine\network\mcpe\protocol\types\recipe;
16
18use Ramsey\Uuid\UuidInterface;
19
20final class MultiRecipe extends RecipeWithTypeId{
21
22 public const TYPE_REPAIR_ITEM = "00000000-0000-0000-0000-000000000001";
23 public const TYPE_MAP_EXTENDING = "D392B075-4BA1-40AE-8789-AF868D56F6CE";
24 public const TYPE_MAP_EXTENDING_CARTOGRAPHY = "8B36268C-1829-483C-A0F1-993B7156A8F2";
25 public const TYPE_MAP_CLONING = "85939755-BA10-4D9D-A4CC-EFB7A8E943C4";
26 public const TYPE_MAP_CLONING_CARTOGRAPHY = "442D85ED-8272-4543-A6F1-418F90DED05D";
27 public const TYPE_MAP_UPGRADING = "AECD2294-4B94-434B-8667-4499BB2C9327";
28 public const TYPE_MAP_UPGRADING_CARTOGRAPHY = "98C84B38-1085-46BD-B1CE-DD38C159E6CC";
29 public const TYPE_BOOK_CLONING = "D1CA6B84-338E-4F2F-9C6B-76CC8B4BD98D";
30 public const TYPE_BANNER_DUPLICATE = "B5C5D105-75A2-4076-AF2B-923EA2BF4BF0";
31 public const TYPE_BANNER_ADD_PATTERN = "D81AAEAF-E172-4440-9225-868DF030D27B";
32 public const TYPE_FIREWORKS = "00000000-0000-0000-0000-000000000002";
33 public const TYPE_MAP_LOCKING_CARTOGRAPHY = "602234E4-CAC1-4353-8BB7-B1EBFF70024B";
34
35 public function __construct(
36 int $typeId,
37 private UuidInterface $recipeId,
38 private int $recipeNetId
39 ){
40 parent::__construct($typeId);
41 }
42
43 public function getRecipeId() : UuidInterface{
44 return $this->recipeId;
45 }
46
47 public function getRecipeNetId() : int{
48 return $this->recipeNetId;
49 }
50
51 public static function decode(int $typeId, PacketSerializer $in) : self{
52 $uuid = $in->getUUID();
53 $recipeNetId = $in->readRecipeNetId();
54 return new self($typeId, $uuid, $recipeNetId);
55 }
56
57 public function encode(PacketSerializer $out) : void{
58 $out->putUUID($this->recipeId);
59 $out->writeRecipeNetId($this->recipeNetId);
60 }
61}