PocketMine-MP 5.35.1 git-e32e836dad793a3a3c8ddd8927c00e112b1e576a
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
17use pmmp\encoding\ByteBufferReader;
18use pmmp\encoding\ByteBufferWriter;
20use Ramsey\Uuid\UuidInterface;
21
22final class MultiRecipe extends RecipeWithTypeId{
23
24 public const TYPE_REPAIR_ITEM = "00000000-0000-0000-0000-000000000001";
25 public const TYPE_MAP_EXTENDING = "D392B075-4BA1-40AE-8789-AF868D56F6CE";
26 public const TYPE_MAP_EXTENDING_CARTOGRAPHY = "8B36268C-1829-483C-A0F1-993B7156A8F2";
27 public const TYPE_MAP_CLONING = "85939755-BA10-4D9D-A4CC-EFB7A8E943C4";
28 public const TYPE_MAP_CLONING_CARTOGRAPHY = "442D85ED-8272-4543-A6F1-418F90DED05D";
29 public const TYPE_MAP_UPGRADING = "AECD2294-4B94-434B-8667-4499BB2C9327";
30 public const TYPE_MAP_UPGRADING_CARTOGRAPHY = "98C84B38-1085-46BD-B1CE-DD38C159E6CC";
31 public const TYPE_BOOK_CLONING = "D1CA6B84-338E-4F2F-9C6B-76CC8B4BD98D";
32 public const TYPE_BANNER_DUPLICATE = "B5C5D105-75A2-4076-AF2B-923EA2BF4BF0";
33 public const TYPE_BANNER_ADD_PATTERN = "D81AAEAF-E172-4440-9225-868DF030D27B";
34 public const TYPE_FIREWORKS = "00000000-0000-0000-0000-000000000002";
35 public const TYPE_MAP_LOCKING_CARTOGRAPHY = "602234E4-CAC1-4353-8BB7-B1EBFF70024B";
36
37 public function __construct(
38 int $typeId,
39 private UuidInterface $recipeId,
40 private int $recipeNetId
41 ){
42 parent::__construct($typeId);
43 }
44
45 public function getRecipeId() : UuidInterface{
46 return $this->recipeId;
47 }
48
49 public function getRecipeNetId() : int{
50 return $this->recipeNetId;
51 }
52
53 public static function decode(int $typeId, ByteBufferReader $in) : self{
54 $uuid = CommonTypes::getUUID($in);
55 $recipeNetId = CommonTypes::readRecipeNetId($in);
56 return new self($typeId, $uuid, $recipeNetId);
57 }
58
59 public function encode(ByteBufferWriter $out) : void{
60 CommonTypes::putUUID($out, $this->recipeId);
61 CommonTypes::writeRecipeNetId($out, $this->recipeNetId);
62 }
63}