mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Start migrating EnumTrait enums to PHP 8.1 native enums
This commit is contained in:
@ -211,10 +211,10 @@ final class CraftingManagerFromDataHelper{
|
||||
|
||||
foreach(self::loadJsonArrayOfObjectsFile(Path::join($directoryPath, 'shapeless_crafting.json'), ShapelessRecipeData::class) as $recipe){
|
||||
$recipeType = match($recipe->block){
|
||||
"crafting_table" => ShapelessRecipeType::CRAFTING(),
|
||||
"stonecutter" => ShapelessRecipeType::STONECUTTER(),
|
||||
"smithing_table" => ShapelessRecipeType::SMITHING(),
|
||||
"cartography_table" => ShapelessRecipeType::CARTOGRAPHY(),
|
||||
"crafting_table" => ShapelessRecipeType::CRAFTING,
|
||||
"stonecutter" => ShapelessRecipeType::STONECUTTER,
|
||||
"smithing_table" => ShapelessRecipeType::SMITHING,
|
||||
"cartography_table" => ShapelessRecipeType::CARTOGRAPHY,
|
||||
default => null
|
||||
};
|
||||
if($recipeType === null){
|
||||
|
@ -23,28 +23,22 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\crafting;
|
||||
|
||||
use pocketmine\utils\EnumTrait;
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* This doc-block is generated automatically, do not modify it manually.
|
||||
* This must be regenerated whenever registry members are added, removed or changed.
|
||||
* @see build/generate-registry-annotations.php
|
||||
* @generate-registry-docblock
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static ShapelessRecipeType CARTOGRAPHY()
|
||||
* @method static ShapelessRecipeType CRAFTING()
|
||||
* @method static ShapelessRecipeType SMITHING()
|
||||
* @method static ShapelessRecipeType STONECUTTER()
|
||||
*/
|
||||
final class ShapelessRecipeType{
|
||||
use EnumTrait;
|
||||
enum ShapelessRecipeType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new self("crafting"),
|
||||
new self("stonecutter"),
|
||||
new self("smithing"),
|
||||
new self("cartography")
|
||||
);
|
||||
}
|
||||
case CRAFTING;
|
||||
case STONECUTTER;
|
||||
case SMITHING;
|
||||
case CARTOGRAPHY;
|
||||
}
|
||||
|
Reference in New Issue
Block a user