Introduced VanillaEnchantments registry

This commit is contained in:
Dylan K. Taylor
2020-10-23 20:48:19 +01:00
parent e9038336e3
commit a01c086481
16 changed files with 191 additions and 204 deletions

View File

@@ -27,6 +27,7 @@ use pocketmine\command\CommandSender;
use pocketmine\command\utils\InvalidCommandSyntaxException;
use pocketmine\item\enchantment\Enchantment;
use pocketmine\item\enchantment\EnchantmentInstance;
use pocketmine\item\enchantment\VanillaEnchantments;
use pocketmine\lang\TranslationContainer;
use pocketmine\utils\TextFormat;
use function count;
@@ -67,9 +68,9 @@ class EnchantCommand extends VanillaCommand{
}
if(is_numeric($args[1])){
$enchantment = Enchantment::get((int) $args[1]);
$enchantment = VanillaEnchantments::byMcpeId((int) $args[1]);
}else{
$enchantment = Enchantment::fromString($args[1]);
$enchantment = VanillaEnchantments::fromString($args[1]);
}
if(!($enchantment instanceof Enchantment)){