public abstract class Enchantment extends IForgeRegistryEntry.Impl<Enchantment>
Modifier and Type | Class and Description |
---|---|
static class |
Enchantment.Rarity |
IForgeRegistryEntry.Impl<T extends IForgeRegistryEntry<T>>
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
name
Used in localisation and stats.
|
static RegistryNamespaced<ResourceLocation,Enchantment> |
REGISTRY |
EnumEnchantmentType |
type
The EnumEnchantmentType given to this Enchantment.
|
delegate
Modifier | Constructor and Description |
---|---|
protected |
Enchantment(Enchantment.Rarity rarityIn,
EnumEnchantmentType typeIn,
EntityEquipmentSlot[] slots) |
Modifier and Type | Method and Description |
---|---|
float |
calcDamageByCreature(int level,
EnumCreatureAttribute creatureType)
Calculates the additional damage that will be dealt by an item with this enchantment.
|
int |
calcModifierDamage(int level,
DamageSource source)
Calculates the damage protection of the enchantment based on level and damage source passed.
|
boolean |
canApply(ItemStack stack)
Determines if this enchantment can be applied to a specific ItemStack.
|
boolean |
canApplyAtEnchantingTable(ItemStack stack)
This applies specifically to applying at the enchanting table.
|
protected boolean |
canApplyTogether(Enchantment ench)
Determines if the enchantment passed can be applyied together with this enchantment.
|
boolean |
func_191560_c(Enchantment p_191560_1_) |
static Enchantment |
getEnchantmentByID(int id)
Gets an Enchantment from the registry, based on a numeric ID.
|
static Enchantment |
getEnchantmentByLocation(java.lang.String location)
Retrieves an enchantment by using its location name.
|
static int |
getEnchantmentID(Enchantment enchantmentIn)
Gets the numeric ID for the passed enchantment.
|
java.util.List<ItemStack> |
getEntityEquipment(EntityLivingBase entityIn)
Gets list of all the entity's currently equipped gear that this enchantment can go on
|
int |
getMaxEnchantability(int enchantmentLevel)
Returns the maximum value of enchantability nedded on the enchantment level passed.
|
int |
getMaxLevel()
Returns the maximum level that the enchantment can have.
|
int |
getMinEnchantability(int enchantmentLevel)
Returns the minimal value of enchantability needed on the enchantment level passed.
|
int |
getMinLevel()
Returns the minimum level that the enchantment can have.
|
java.lang.String |
getName()
Return the name of key in translation table of this enchantment.
|
Enchantment.Rarity |
getRarity()
Retrieves the weight value of an Enchantment.
|
java.lang.String |
getTranslatedName(int level)
Returns the correct traslated name of the enchantment and the level in roman numbers.
|
boolean |
isAllowedOnBooks()
Is this enchantment allowed to be enchanted on books via Enchantment Table
|
boolean |
isCurse() |
boolean |
isTreasureEnchantment() |
void |
onEntityDamaged(EntityLivingBase user,
Entity target,
int level)
Called whenever a mob is damaged with an item that has this enchantment on it.
|
void |
onUserHurt(EntityLivingBase user,
Entity attacker,
int level)
Whenever an entity that has this enchantment on one of its associated items is damaged this method will be
called.
|
static void |
registerEnchantments()
Registers all of the vanilla enchantments.
|
Enchantment |
setName(java.lang.String enchName)
Sets the enchantment name
|
getRegistryName, getRegistryType, setRegistryName, setRegistryName, setRegistryName
public static final RegistryNamespaced<ResourceLocation,Enchantment> REGISTRY
public EnumEnchantmentType type
protected java.lang.String name
protected Enchantment(Enchantment.Rarity rarityIn, EnumEnchantmentType typeIn, EntityEquipmentSlot[] slots)
public static Enchantment getEnchantmentByID(int id)
public static int getEnchantmentID(Enchantment enchantmentIn)
public static Enchantment getEnchantmentByLocation(java.lang.String location)
public java.util.List<ItemStack> getEntityEquipment(EntityLivingBase entityIn)
public Enchantment.Rarity getRarity()
public int getMinLevel()
public int getMaxLevel()
public int getMinEnchantability(int enchantmentLevel)
public int getMaxEnchantability(int enchantmentLevel)
public int calcModifierDamage(int level, DamageSource source)
public float calcDamageByCreature(int level, EnumCreatureAttribute creatureType)
public final boolean func_191560_c(Enchantment p_191560_1_)
protected boolean canApplyTogether(Enchantment ench)
public Enchantment setName(java.lang.String enchName)
public java.lang.String getName()
public java.lang.String getTranslatedName(int level)
public boolean canApply(ItemStack stack)
public void onEntityDamaged(EntityLivingBase user, Entity target, int level)
public void onUserHurt(EntityLivingBase user, Entity attacker, int level)
public boolean isTreasureEnchantment()
public boolean isCurse()
public boolean canApplyAtEnchantingTable(ItemStack stack)
canApply(ItemStack)
applies for all possible enchantments.stack
- public boolean isAllowedOnBooks()
public static void registerEnchantments()