PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
pocketmine\item\enchantment\ProtectionEnchantment Class Reference
+ Inheritance diagram for pocketmine\item\enchantment\ProtectionEnchantment:
+ Collaboration diagram for pocketmine\item\enchantment\ProtectionEnchantment:

Public Member Functions

 __construct (Translatable|string $name, int $rarity, int $maxLevel, float $typeModifier, ?array $applicableDamageTypes, ?\Closure $minEnchantingPower=null, int $enchantingPowerRange=50)
 
 getMaxEnchantingPower (int $level)
 
 getMaxLevel ()
 
 getMinEnchantingPower (int $level)
 
 getName ()
 
 getProtectionFactor (int $level)
 
 getRarity ()
 
 getTypeModifier ()
 
 isApplicable (EntityDamageEvent $event)
 
 isCompatibleWith (Enchantment $other)
 

Protected Attributes

array $applicableDamageTypes = null
 
float $typeModifier
 

Detailed Description

Definition at line 31 of file ProtectionEnchantment.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\item\enchantment\ProtectionEnchantment::__construct ( Translatable|string $name,
int $rarity,
int $maxLevel,
float $typeModifier,
?array $applicableDamageTypes,
?\Closure $minEnchantingPower = null,
int $enchantingPowerRange = 50 )

ProtectionEnchantment constructor.

@phpstan-param null|(\Closure(int $level) : int) $minEnchantingPower

Parameters
int[] | null$applicableDamageTypesEntityDamageEvent::CAUSE_* constants which this enchantment type applies to, or null if it applies to all types of damage.
int$enchantingPowerRangeValue used to calculate the maximum enchanting power (minEnchantingPower + enchantingPowerRange)

Definition at line 44 of file ProtectionEnchantment.php.

Member Function Documentation

◆ getMaxEnchantingPower()

pocketmine\item\enchantment\Enchantment::getMaxEnchantingPower ( int $level)
inherited

Returns the maximum enchanting power value allowed for the particular level of the enchantment to be available in an enchanting table.

Enchanting power is a random value based on the number of bookshelves around an enchanting table and the enchantability of the item being enchanted. It is only used when determining the available enchantments for the enchantment options.

Definition at line 112 of file Enchantment.php.

◆ getMaxLevel()

pocketmine\item\enchantment\Enchantment::getMaxLevel ( )
inherited

Returns the maximum level of this enchantment that can be found on an enchantment table.

Definition at line 81 of file Enchantment.php.

◆ getMinEnchantingPower()

pocketmine\item\enchantment\Enchantment::getMinEnchantingPower ( int $level)
inherited

Returns the minimum enchanting power value required for the particular level of the enchantment to be available in an enchanting table.

Enchanting power is a random value based on the number of bookshelves around an enchanting table and the enchantability of the item being enchanted. It is only used when determining the available enchantments for the enchantment options.

Definition at line 100 of file Enchantment.php.

◆ getName()

pocketmine\item\enchantment\Enchantment::getName ( )
inherited

Returns a translation key for this enchantment's name.

Definition at line 67 of file Enchantment.php.

◆ getProtectionFactor()

pocketmine\item\enchantment\ProtectionEnchantment::getProtectionFactor ( int $level)

Returns the base EPF this enchantment type offers for the given enchantment level.

Definition at line 63 of file ProtectionEnchantment.php.

◆ getRarity()

pocketmine\item\enchantment\Enchantment::getRarity ( )
inherited

Returns an int constant indicating how rare this enchantment type is.

Definition at line 74 of file Enchantment.php.

◆ getTypeModifier()

pocketmine\item\enchantment\ProtectionEnchantment::getTypeModifier ( )

Returns the multiplier by which this enchantment type's EPF increases with each enchantment level.

Definition at line 56 of file ProtectionEnchantment.php.

◆ isApplicable()

pocketmine\item\enchantment\ProtectionEnchantment::isApplicable ( EntityDamageEvent $event)

Returns whether this enchantment type offers protection from the specified damage source's cause.

Definition at line 70 of file ProtectionEnchantment.php.

Referenced by pocketmine\item\Armor\getEnchantmentProtectionFactor().

+ Here is the caller graph for this function:

◆ isCompatibleWith()

pocketmine\item\enchantment\Enchantment::isCompatibleWith ( Enchantment $other)
inherited

Returns whether this enchantment can be applied to the item along with the given enchantment.

Definition at line 88 of file Enchantment.php.

Member Data Documentation

◆ $applicableDamageTypes

array pocketmine\item\enchantment\ProtectionEnchantment::$applicableDamageTypes = null
protected

Definition at line 34 of file ProtectionEnchantment.php.

◆ $typeModifier

float pocketmine\item\enchantment\ProtectionEnchantment::$typeModifier
protected

Definition at line 32 of file ProtectionEnchantment.php.


The documentation for this class was generated from the following file: