public abstract class Enchantment extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Enchantment.Rarity
The rarity is an attribute of an enchantment.
|
Modifier and Type | Field and Description |
---|---|
private Enchantment.Rarity |
rarity |
private EquipmentSlot[] |
slotTypes |
protected String |
translationKey |
EnchantmentTarget |
type |
Modifier | Constructor and Description |
---|---|
protected |
Enchantment(Enchantment.Rarity weight,
EnchantmentTarget type,
EquipmentSlot[] slotTypes) |
Modifier and Type | Method and Description |
---|---|
static Enchantment |
byRawId(int id) |
protected boolean |
canAccept(Enchantment other)
Returns whether this enchantment can exist on an item stack with the
other enchantment. |
boolean |
canCombine(Enchantment other)
Returns whether this enchantment can exist on an item stack with the
other enchantment and the other enchantment can exist
with this enchantment. |
float |
getAttackDamage(int level,
EntityGroup group) |
Map<EquipmentSlot,ItemStack> |
getEquipment(LivingEntity entity) |
int |
getMaxLevel() |
int |
getMaxPower(int level) |
int |
getMinLevel() |
int |
getMinPower(int level) |
Text |
getName(int level) |
protected String |
getOrCreateTranslationKey() |
int |
getProtectionAmount(int level,
DamageSource source) |
Enchantment.Rarity |
getRarity() |
String |
getTranslationKey() |
boolean |
isAcceptableItem(ItemStack stack) |
boolean |
isAvailableForEnchantedBookOffer()
Returns whether this enchantment will appear in the enchanted book trade
offers of librarian villagers.
|
boolean |
isAvailableForRandomSelection()
Returns whether this enchantment will appear in the enchanting table or
loots with random enchant function.
|
boolean |
isCursed() |
boolean |
isTreasure() |
void |
onTargetDamaged(LivingEntity user,
Entity target,
int level) |
void |
onUserDamaged(LivingEntity user,
Entity attacker,
int level) |
private final EquipmentSlot[] slotTypes
private final Enchantment.Rarity rarity
public final EnchantmentTarget type
protected Enchantment(Enchantment.Rarity weight, EnchantmentTarget type, EquipmentSlot[] slotTypes)
@Environment(value=CLIENT) @Nullable public static Enchantment byRawId(int id)
public Map<EquipmentSlot,ItemStack> getEquipment(LivingEntity entity)
public Enchantment.Rarity getRarity()
public int getMinLevel()
public int getMaxLevel()
public int getMinPower(int level)
public int getMaxPower(int level)
public int getProtectionAmount(int level, DamageSource source)
public float getAttackDamage(int level, EntityGroup group)
public final boolean canCombine(Enchantment other)
other
enchantment and the other
enchantment can exist
with this enchantment.protected boolean canAccept(Enchantment other)
other
enchantment.protected String getOrCreateTranslationKey()
public String getTranslationKey()
public Text getName(int level)
public boolean isAcceptableItem(ItemStack stack)
public void onTargetDamaged(LivingEntity user, Entity target, int level)
public void onUserDamaged(LivingEntity user, Entity attacker, int level)
public boolean isTreasure()
public boolean isCursed()
public boolean isAvailableForEnchantedBookOffer()
public boolean isAvailableForRandomSelection()