mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 17:36:12 +00:00
Enchantment API changes, understandable constant names
This commit is contained in:
@ -543,8 +543,10 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
foreach($this->getNamedTag()->ench as $entry){
|
||||
if($entry["id"] === $id){
|
||||
$e = Enchantment::getEnchantment($entry["id"]);
|
||||
$e->setLevel($entry["lvl"]);
|
||||
return $e;
|
||||
if($e !== null){
|
||||
$e->setLevel($entry["lvl"]);
|
||||
return $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -627,8 +629,10 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
if($this->hasEnchantments()){
|
||||
foreach($this->getNamedTag()->ench as $entry){
|
||||
$e = Enchantment::getEnchantment($entry["id"]);
|
||||
$e->setLevel($entry["lvl"]);
|
||||
$enchantments[] = $e;
|
||||
if($e !== null){
|
||||
$e->setLevel($entry["lvl"]);
|
||||
$enchantments[] = $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user