mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Enchantment: more static getters, firehose magic numbers
This is similar in nature to 646fea5a4e
.
On a side note: Migrating this way is a pain in the ass due to lack of types. What the heck is int supposed to mean?!?!?!?! At least if we wanted to go _back_ to magic numbers, it would be easy to locate everything with an Enchantment typehint...
This commit is contained in:
@ -537,12 +537,12 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
/** @var Durable[] $equipment */
|
||||
$equipment = [];
|
||||
|
||||
if(($item = $this->inventory->getItemInHand()) instanceof Durable and $item->hasEnchantment(Enchantment::MENDING)){
|
||||
if(($item = $this->inventory->getItemInHand()) instanceof Durable and $item->hasEnchantment(Enchantment::MENDING())){
|
||||
$equipment[$mainHandIndex] = $item;
|
||||
}
|
||||
//TODO: check offhand
|
||||
foreach($this->armorInventory->getContents() as $k => $item){
|
||||
if($item instanceof Durable and $item->hasEnchantment(Enchantment::MENDING)){
|
||||
if($item instanceof Durable and $item->hasEnchantment(Enchantment::MENDING())){
|
||||
$equipment[$k] = $item;
|
||||
}
|
||||
}
|
||||
@ -784,7 +784,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
return array_filter(array_merge(
|
||||
$this->inventory !== null ? array_values($this->inventory->getContents()) : [],
|
||||
$this->armorInventory !== null ? array_values($this->armorInventory->getContents()) : []
|
||||
), function(Item $item) : bool{ return !$item->hasEnchantment(Enchantment::VANISHING); });
|
||||
), function(Item $item) : bool{ return !$item->hasEnchantment(Enchantment::VANISHING()); });
|
||||
}
|
||||
|
||||
public function saveNBT() : CompoundTag{
|
||||
|
Reference in New Issue
Block a user