Package net.minecraft.enchantment
Class Enchantment
java.lang.Object
net.minecraft.enchantment.Enchantment
- Direct Known Subclasses:
AquaAffinityEnchantment
,BindingCurseEnchantment
,ChannelingEnchantment
,DamageEnchantment
,DepthStriderEnchantment
,EfficiencyEnchantment
,FireAspectEnchantment
,FlameEnchantment
,FrostWalkerEnchantment
,ImpalingEnchantment
,InfinityEnchantment
,KnockbackEnchantment
,LoyaltyEnchantment
,LuckEnchantment
,LureEnchantment
,MendingEnchantment
,MultishotEnchantment
,PiercingEnchantment
,PowerEnchantment
,ProtectionEnchantment
,PunchEnchantment
,QuickChargeEnchantment
,RespirationEnchantment
,RiptideEnchantment
,SilkTouchEnchantment
,SoulSpeedEnchantment
,SweepingEnchantment
,ThornsEnchantment
,UnbreakingEnchantment
,VanishingCurseEnchantment
public abstract class Enchantment extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Enchantment.Rarity
The rarity is an attribute of an enchantment. -
Field Summary
Fields Modifier and Type Field Description private Enchantment.Rarity
rarity
private EquipmentSlot[]
slotTypes
protected String
translationKey
EnchantmentTarget
type
-
Constructor Summary
Constructors Modifier Constructor Description protected
Enchantment(Enchantment.Rarity weight, EnchantmentTarget type, EquipmentSlot[] slotTypes)
-
Method Summary
Modifier and Type Method Description static Enchantment
byRawId(int id)
protected boolean
canAccept(Enchantment other)
Returns whether this enchantment can exist on an item stack with theother
enchantment.boolean
canCombine(Enchantment other)
Returns whether this enchantment can exist on an item stack with theother
enchantment and theother
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)
-
Field Details
-
slotTypes
-
rarity
-
type
-
translationKey
-
-
Constructor Details
-
Enchantment
protected Enchantment(Enchantment.Rarity weight, EnchantmentTarget type, EquipmentSlot[] slotTypes)
-
-
Method Details
-
byRawId
-
getEquipment
-
getRarity
-
getMinLevel
public int getMinLevel() -
getMaxLevel
public int getMaxLevel() -
getMinPower
public int getMinPower(int level) -
getMaxPower
public int getMaxPower(int level) -
getProtectionAmount
-
getAttackDamage
-
canCombine
Returns whether this enchantment can exist on an item stack with theother
enchantment and theother
enchantment can exist with this enchantment. -
canAccept
Returns whether this enchantment can exist on an item stack with theother
enchantment. -
getOrCreateTranslationKey
-
getTranslationKey
-
getName
-
isAcceptableItem
-
onTargetDamaged
-
onUserDamaged
-
isTreasure
public boolean isTreasure() -
isCursed
public boolean isCursed() -
isAvailableForEnchantedBookOffer
public boolean isAvailableForEnchantedBookOffer()Returns whether this enchantment will appear in the enchanted book trade offers of librarian villagers. -
isAvailableForRandomSelection
public boolean isAvailableForRandomSelection()Returns whether this enchantment will appear in the enchanting table or loots with random enchant function.
-