ProtectionEnchantment
extends Enchantment
in package
Manages enchantment type data.
Table of Contents
- $applicableDamageTypes : array<string|int, int>|null
- $typeModifier : float
- $maxLevel : int
- $name : Translatable|string
- $primaryItemFlags : int
- $rarity : int
- $secondaryItemFlags : int
- __clone() : mixed
- __construct() : mixed
- ProtectionEnchantment constructor.
- __serialize() : array<string|int, mixed>
- __unserialize() : void
- getMaxLevel() : int
- Returns the maximum level of this enchantment that can be found on an enchantment table.
- getName() : Translatable|string
- Returns a translation key for this enchantment's name.
- getPrimaryItemFlags() : int
- Returns a bitset indicating what item types can have this item applied from an enchanting table.
- getProtectionFactor() : int
- Returns the base EPF this enchantment type offers for the given enchantment level.
- getRarity() : int
- Returns an int constant indicating how rare this enchantment type is.
- getSecondaryItemFlags() : int
- Returns a bitset indicating what item types cannot have this item applied from an enchanting table, but can from an anvil.
- getTypeModifier() : float
- Returns the multiplier by which this enchantment type's EPF increases with each enchantment level.
- hasPrimaryItemType() : bool
- Returns whether this enchantment can apply to the item type from an enchanting table.
- hasSecondaryItemType() : bool
- Returns whether this enchantment can apply to the item type from an anvil, if it is not a primary item.
- isApplicable() : bool
- Returns whether this enchantment type offers protection from the specified damage source's cause.
Properties
$applicableDamageTypes
protected
array<string|int, int>|null
$applicableDamageTypes
= null
$typeModifier
protected
float
$typeModifier
$maxLevel
private
int
$maxLevel
$name
private
Translatable|string
$name
$primaryItemFlags
private
int
$primaryItemFlags
$rarity
private
int
$rarity
$secondaryItemFlags
private
int
$secondaryItemFlags
Methods
__clone()
public
final __clone() : mixed
Return values
mixed —__construct()
ProtectionEnchantment constructor.
public
__construct(Translatable|string $name, int $rarity, int $primaryItemFlags, int $secondaryItemFlags, int $maxLevel, float $typeModifier, array<string|int, int>|null $applicableDamageTypes) : mixed
Parameters
- $name : Translatable|string
- $rarity : int
- $primaryItemFlags : int
- $secondaryItemFlags : int
- $maxLevel : int
- $typeModifier : float
- $applicableDamageTypes : array<string|int, int>|null
-
EntityDamageEvent::CAUSE_* constants which this enchantment type applies to, or null if it applies to all types of damage.
Return values
mixed —__serialize()
public
final __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —__unserialize()
public
final __unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
Return values
void —getMaxLevel()
Returns the maximum level of this enchantment that can be found on an enchantment table.
public
getMaxLevel() : int
Return values
int —getName()
Returns a translation key for this enchantment's name.
public
getName() : Translatable|string
Return values
Translatable|string —getPrimaryItemFlags()
Returns a bitset indicating what item types can have this item applied from an enchanting table.
public
getPrimaryItemFlags() : int
Return values
int —getProtectionFactor()
Returns the base EPF this enchantment type offers for the given enchantment level.
public
getProtectionFactor(int $level) : int
Parameters
- $level : int
Return values
int —getRarity()
Returns an int constant indicating how rare this enchantment type is.
public
getRarity() : int
Return values
int —getSecondaryItemFlags()
Returns a bitset indicating what item types cannot have this item applied from an enchanting table, but can from an anvil.
public
getSecondaryItemFlags() : int
Return values
int —getTypeModifier()
Returns the multiplier by which this enchantment type's EPF increases with each enchantment level.
public
getTypeModifier() : float
Return values
float —hasPrimaryItemType()
Returns whether this enchantment can apply to the item type from an enchanting table.
public
hasPrimaryItemType(int $flag) : bool
Parameters
- $flag : int
Return values
bool —hasSecondaryItemType()
Returns whether this enchantment can apply to the item type from an anvil, if it is not a primary item.
public
hasSecondaryItemType(int $flag) : bool
Parameters
- $flag : int
Return values
bool —isApplicable()
Returns whether this enchantment type offers protection from the specified damage source's cause.
public
isApplicable(EntityDamageEvent $event) : bool
Parameters
- $event : EntityDamageEvent