|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * |
| 5 | + * _____ _____ _ ______ _____ _ _ _____ _ _ _____ |
| 6 | + * /\ |_ _| __ \ | | | ____| /\ | __ \| \ | |_ _| \ | |/ ____| |
| 7 | + * / \ | | | | | |______| | | |__ / \ | |__) | \| | | | | \| | | __ |
| 8 | + * / /\ \ | | | | | |______| | | __| / /\ \ | _ /| . ` | | | | . ` | | |_ | |
| 9 | + * / ____ \ _| |_| |__| | | |____| |____ / ____ \| | \ \| |\ |_| |_| |\ | |__| | |
| 10 | + * /_/ \_\_____|_____/ |______|______/_/ \_\_| \_\_| \_|_____|_| \_|\_____| |
| 11 | + * |
| 12 | + * This program is free software: you can redistribute it and/or modify |
| 13 | + * it under the terms of the GNU Lesser General Public License as published by |
| 14 | + * the Free Software Foundation, either version 3 of the License, or |
| 15 | + * (at your option) any later version. |
| 16 | + * |
| 17 | + * @author AID-LEARNING |
| 18 | + * @link https://github.com/AID-LEARNING |
| 19 | + * |
| 20 | + */ |
| 21 | + |
| 22 | +declare(strict_types=1); |
| 23 | + |
| 24 | +namespace SenseiTarzan\SymplyPlugin\Manager\Component; |
| 25 | + |
| 26 | +use pocketmine\crafting\RecipeIngredient; |
| 27 | +use pocketmine\crafting\ShapedRecipe; |
| 28 | +use pocketmine\item\Item; |
| 29 | + |
| 30 | +class SymplyShapedRecipe extends ShapedRecipe |
| 31 | +{ |
| 32 | + |
| 33 | + private string $type; |
| 34 | + |
| 35 | + /** |
| 36 | + * Constructs a ShapedRecipe instance. |
| 37 | + * |
| 38 | + * @param string[] $shape <br> |
| 39 | + * Array of 1, 2, or 3 strings representing the rows of the recipe. |
| 40 | + * This accepts an array of 1, 2 or 3 strings. Each string should be of the same length and must be at most 3 |
| 41 | + * characters long. Each character represents a unique type of ingredient. Spaces are interpreted as air. |
| 42 | + * @param RecipeIngredient[] $ingredients <br> |
| 43 | + * Char => Item map of items to be set into the shape. |
| 44 | + * This accepts an array of Items, indexed by character. Every unique character (except space) in the shape |
| 45 | + * array MUST have a corresponding item in this list. Space character is automatically treated as air. |
| 46 | + * @param Item[] $results List of items that this recipe produces when crafted. |
| 47 | + * |
| 48 | + * Note: Recipes **do not** need to be square. Do NOT add padding for empty rows/columns. |
| 49 | + */ |
| 50 | + public function __construct(array $shape, array $ingredients, array $results, string $type) |
| 51 | + { |
| 52 | + $this->type = $type; |
| 53 | + parent::__construct($shape, $ingredients, $results); |
| 54 | + } |
| 55 | + |
| 56 | + public function getType() : string |
| 57 | + { |
| 58 | + return $this->type; |
| 59 | + } |
| 60 | +} |
0 commit comments