public abstract class Enchantment extends ForgeRegistryEntry<Enchantment>
修飾子とタイプ | クラスと説明 |
---|---|
static class |
Enchantment.Rarity |
修飾子とタイプ | フィールドと説明 |
---|---|
protected java.lang.String |
name |
EnchantmentType |
type |
delegate
修飾子 | コンストラクタと説明 |
---|---|
protected |
Enchantment(Enchantment.Rarity rarityIn,
EnchantmentType typeIn,
EquipmentSlotType[] slots) |
修飾子とタイプ | メソッドと説明 |
---|---|
float |
calcDamageByCreature(int level,
CreatureAttribute 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.
|
protected java.lang.String |
getDefaultTranslationKey() |
ITextComponent |
getDisplayName(int level) |
static Enchantment |
getEnchantmentByID(int id)
Gets an Enchantment from the registry, based on a numeric ID.
|
java.util.Map<EquipmentSlotType,ItemStack> |
getEntityEquipment(LivingEntity livingEntityIn)
Gets map of all the entity's currently equipped gear that this enchantment can go on
|
int |
getMaxEnchantability(int enchantmentLevel) |
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.
|
boolean |
isAllowedOnBooks()
Is this enchantment allowed to be enchanted on books via Enchantment Table
|
boolean |
isCompatibleWith(Enchantment enchantmentIn) |
boolean |
isCurse() |
boolean |
isTreasureEnchantment() |
void |
onEntityDamaged(LivingEntity user,
Entity target,
int level)
Called whenever a mob is damaged with an item that has this enchantment on it.
|
void |
onUserHurt(LivingEntity 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.
|
getRegistryName, getRegistryType, setRegistryName, setRegistryName, setRegistryName
@Nullable public EnchantmentType type
@Nullable protected java.lang.String name
protected Enchantment(Enchantment.Rarity rarityIn, EnchantmentType typeIn, EquipmentSlotType[] slots)
@Nullable public static Enchantment getEnchantmentByID(int id)
public java.util.Map<EquipmentSlotType,ItemStack> getEntityEquipment(LivingEntity livingEntityIn)
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, CreatureAttribute creatureType)
public final boolean isCompatibleWith(Enchantment enchantmentIn)
protected boolean canApplyTogether(Enchantment ench)
protected java.lang.String getDefaultTranslationKey()
public java.lang.String getName()
public ITextComponent getDisplayName(int level)
public boolean canApply(ItemStack stack)
public void onEntityDamaged(LivingEntity user, Entity target, int level)
public void onUserHurt(LivingEntity 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()