类 EnchantmentHelper
- java.lang.Object
-
- net.minecraft.enchantment.EnchantmentHelper
-
public class EnchantmentHelper extends Object
- Mappings:
Namespace Name official btnintermediary net/minecraft/class_1890named net/minecraft/enchantment/EnchantmentHelper
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 (专用程序包) static interfaceEnchantmentHelper.Consumer
-
构造器概要
构造器 构造器 说明 EnchantmentHelper()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static intcalculateRequiredExperienceLevel(Random random, int slotIndex, int bookshelfCount, ItemStack stack)Returns the required experience level for an enchanting option in the enchanting table's screen, or the enchantment screen.static Map.Entry<EquipmentSlot,ItemStack>chooseEquipmentWith(Enchantment enchantment, LivingEntity entity)Returns a pair of an equipment slot and the item stack in the supplied entity's slot, indicating the item stack has the enchantment supplied.static Map.Entry<EquipmentSlot,ItemStack>chooseEquipmentWith(Enchantment enchantment, LivingEntity entity, Predicate<ItemStack> condition)Returns a pair of an equipment slot and the item stack in the supplied entity's slot, indicating the item stack has the enchantment supplied and fulfills the extra condition.static ItemStackenchant(Random random, ItemStack target, int level, boolean treasureAllowed)Enchants thetargetitem stack and returns it.private static voidforEachEnchantment(EnchantmentHelper.Consumer consumer, Iterable<ItemStack> stacks)private static voidforEachEnchantment(EnchantmentHelper.Consumer consumer, ItemStack stack)static Map<Enchantment,Integer>fromNbt(ListTag list)Loads enchantments from an NBT list.static List<EnchantmentLevelEntry>generateEnchantments(Random random, ItemStack stack, int level, boolean treasureAllowed)Generate the enchantments for enchanting thestack.static Map<Enchantment,Integer>get(ItemStack stack)Gets the enchantments on an item stack.static floatgetAttackDamage(ItemStack stack, EntityGroup group)static intgetDepthStrider(LivingEntity entity)static intgetEfficiency(LivingEntity entity)static intgetEquipmentLevel(Enchantment enchantment, LivingEntity entity)Returns the highest level of the passed enchantment in the enchantment's applicable equipment slots' item stacks.static intgetFireAspect(LivingEntity entity)static intgetKnockback(LivingEntity entity)static intgetLevel(Enchantment enchantment, ItemStack stack)Gets the level of an enchantment on an item stack.static intgetLooting(LivingEntity entity)static intgetLoyalty(ItemStack stack)static intgetLuckOfTheSea(ItemStack stack)static intgetLure(ItemStack stack)static List<EnchantmentLevelEntry>getPossibleEntries(int power, ItemStack stack, boolean treasureAllowed)Gets all the possible entries for enchanting thestackat the givenpower.static intgetProtectionAmount(Iterable<ItemStack> equipment, DamageSource source)static intgetRespiration(LivingEntity entity)static intgetRiptide(ItemStack stack)static floatgetSweepingMultiplier(LivingEntity entity)static booleanhasAquaAffinity(LivingEntity entity)static booleanhasBindingCurse(ItemStack stack)static booleanhasChanneling(ItemStack stack)static booleanhasFrostWalker(LivingEntity entity)static booleanhasSoulSpeed(LivingEntity entity)static booleanhasVanishingCurse(ItemStack stack)static booleanisCompatible(Collection<Enchantment> existing, Enchantment candidate)Returns whether thecandidateenchantment is compatible with theexistingenchantments.static voidonTargetDamaged(LivingEntity user, Entity target)static voidonUserDamaged(LivingEntity user, Entity attacker)static voidremoveConflicts(List<EnchantmentLevelEntry> possibleEntries, EnchantmentLevelEntry pickedEntry)Remove entries conflicting with the picked entry from the possible entries.static voidset(Map<Enchantment,Integer> enchantments, ItemStack stack)Sets the enchantments on an item stack.
-
-
-
方法详细资料
-
getLevel
public static int getLevel(Enchantment enchantment, ItemStack stack)
Gets the level of an enchantment on an item stack.- Mappings:
Namespace Name Mixin selector official aLbtn;a(Lbtl;Lbpr;)Iintermediary method_8225Lnet/minecraft/class_1890;method_8225(Lnet/minecraft/class_1887;Lnet/minecraft/class_1799;)Inamed getLevelLnet/minecraft/enchantment/EnchantmentHelper;getLevel(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/item/ItemStack;)I
-
get
public static Map<Enchantment,Integer> get(ItemStack stack)
Gets the enchantments on an item stack.For enchanted books, it retrieves from the item stack's stored than regular enchantments.
- 另请参阅:
ItemStack.getEnchantments(),EnchantedBookItem.getEnchantmentNbt(ItemStack)- Mappings:
Namespace Name Mixin selector official aLbtn;a(Lbpr;)Ljava/util/Map;intermediary method_8222Lnet/minecraft/class_1890;method_8222(Lnet/minecraft/class_1799;)Ljava/util/Map;named getLnet/minecraft/enchantment/EnchantmentHelper;get(Lnet/minecraft/item/ItemStack;)Ljava/util/Map;
-
fromNbt
public static Map<Enchantment,Integer> fromNbt(ListTag list)
Loads enchantments from an NBT list.- Mappings:
Namespace Name Mixin selector official aLbtn;a(Lnb;)Ljava/util/Map;intermediary method_22445Lnet/minecraft/class_1890;method_22445(Lnet/minecraft/class_2499;)Ljava/util/Map;named fromNbtLnet/minecraft/enchantment/EnchantmentHelper;fromNbt(Lnet/minecraft/nbt/ListTag;)Ljava/util/Map;
-
set
public static void set(Map<Enchantment,Integer> enchantments, ItemStack stack)
Sets the enchantments on an item stack.For enchanted books, it sets the enchantments to the item stack's stored enchantments than regular enchantments.
- 另请参阅:
ItemStack.getEnchantments(),EnchantedBookItem.getEnchantmentNbt(ItemStack)- Mappings:
Namespace Name Mixin selector official aLbtn;a(Ljava/util/Map;Lbpr;)Vintermediary method_8214Lnet/minecraft/class_1890;method_8214(Ljava/util/Map;Lnet/minecraft/class_1799;)Vnamed setLnet/minecraft/enchantment/EnchantmentHelper;set(Ljava/util/Map;Lnet/minecraft/item/ItemStack;)V
-
forEachEnchantment
private static void forEachEnchantment(EnchantmentHelper.Consumer consumer, ItemStack stack)
- Mappings:
Namespace Name Mixin selector official aLbtn;a(Lbtn$a;Lbpr;)Vintermediary method_8220Lnet/minecraft/class_1890;method_8220(Lnet/minecraft/class_1890$class_1891;Lnet/minecraft/class_1799;)Vnamed forEachEnchantmentLnet/minecraft/enchantment/EnchantmentHelper;forEachEnchantment(Lnet/minecraft/enchantment/EnchantmentHelper$Consumer;Lnet/minecraft/item/ItemStack;)V
-
forEachEnchantment
private static void forEachEnchantment(EnchantmentHelper.Consumer consumer, Iterable<ItemStack> stacks)
- Mappings:
Namespace Name Mixin selector official aLbtn;a(Lbtn$a;Ljava/lang/Iterable;)Vintermediary method_8209Lnet/minecraft/class_1890;method_8209(Lnet/minecraft/class_1890$class_1891;Ljava/lang/Iterable;)Vnamed forEachEnchantmentLnet/minecraft/enchantment/EnchantmentHelper;forEachEnchantment(Lnet/minecraft/enchantment/EnchantmentHelper$Consumer;Ljava/lang/Iterable;)V
-
getProtectionAmount
public static int getProtectionAmount(Iterable<ItemStack> equipment, DamageSource source)
- Mappings:
Namespace Name Mixin selector official aLbtn;a(Ljava/lang/Iterable;Larv;)Iintermediary method_8219Lnet/minecraft/class_1890;method_8219(Ljava/lang/Iterable;Lnet/minecraft/class_1282;)Inamed getProtectionAmountLnet/minecraft/enchantment/EnchantmentHelper;getProtectionAmount(Ljava/lang/Iterable;Lnet/minecraft/entity/damage/DamageSource;)I
-
getAttackDamage
public static float getAttackDamage(ItemStack stack, EntityGroup group)
- Mappings:
Namespace Name Mixin selector official aLbtn;a(Lbpr;Latc;)Fintermediary method_8218Lnet/minecraft/class_1890;method_8218(Lnet/minecraft/class_1799;Lnet/minecraft/class_1310;)Fnamed getAttackDamageLnet/minecraft/enchantment/EnchantmentHelper;getAttackDamage(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/EntityGroup;)F
-
getSweepingMultiplier
public static float getSweepingMultiplier(LivingEntity entity)
- Mappings:
Namespace Name Mixin selector official aLbtn;a(Lasy;)Fintermediary method_8217Lnet/minecraft/class_1890;method_8217(Lnet/minecraft/class_1309;)Fnamed getSweepingMultiplierLnet/minecraft/enchantment/EnchantmentHelper;getSweepingMultiplier(Lnet/minecraft/entity/LivingEntity;)F
-
onUserDamaged
public static void onUserDamaged(LivingEntity user, Entity attacker)
- Mappings:
Namespace Name Mixin selector official aLbtn;a(Lasy;Lasl;)Vintermediary method_8210Lnet/minecraft/class_1890;method_8210(Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;)Vnamed onUserDamagedLnet/minecraft/enchantment/EnchantmentHelper;onUserDamaged(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;)V
-
onTargetDamaged
public static void onTargetDamaged(LivingEntity user, Entity target)
- Mappings:
Namespace Name Mixin selector official bLbtn;b(Lasy;Lasl;)Vintermediary method_8213Lnet/minecraft/class_1890;method_8213(Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;)Vnamed onTargetDamagedLnet/minecraft/enchantment/EnchantmentHelper;onTargetDamaged(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;)V
-
getEquipmentLevel
public static int getEquipmentLevel(Enchantment enchantment, LivingEntity entity)
Returns the highest level of the passed enchantment in the enchantment's applicable equipment slots' item stacks.- 参数:
enchantment- the enchantmententity- the entity whose equipment slots are checked- Mappings:
Namespace Name Mixin selector official aLbtn;a(Lbtl;Lasy;)Iintermediary method_8203Lnet/minecraft/class_1890;method_8203(Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;)Inamed getEquipmentLevelLnet/minecraft/enchantment/EnchantmentHelper;getEquipmentLevel(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/entity/LivingEntity;)I
-
getKnockback
public static int getKnockback(LivingEntity entity)
- Mappings:
Namespace Name Mixin selector official bLbtn;b(Lasy;)Iintermediary method_8205Lnet/minecraft/class_1890;method_8205(Lnet/minecraft/class_1309;)Inamed getKnockbackLnet/minecraft/enchantment/EnchantmentHelper;getKnockback(Lnet/minecraft/entity/LivingEntity;)I
-
getFireAspect
public static int getFireAspect(LivingEntity entity)
- Mappings:
Namespace Name Mixin selector official cLbtn;c(Lasy;)Iintermediary method_8199Lnet/minecraft/class_1890;method_8199(Lnet/minecraft/class_1309;)Inamed getFireAspectLnet/minecraft/enchantment/EnchantmentHelper;getFireAspect(Lnet/minecraft/entity/LivingEntity;)I
-
getRespiration
public static int getRespiration(LivingEntity entity)
- Mappings:
Namespace Name Mixin selector official dLbtn;d(Lasy;)Iintermediary method_8211Lnet/minecraft/class_1890;method_8211(Lnet/minecraft/class_1309;)Inamed getRespirationLnet/minecraft/enchantment/EnchantmentHelper;getRespiration(Lnet/minecraft/entity/LivingEntity;)I
-
getDepthStrider
public static int getDepthStrider(LivingEntity entity)
- Mappings:
Namespace Name Mixin selector official eLbtn;e(Lasy;)Iintermediary method_8232Lnet/minecraft/class_1890;method_8232(Lnet/minecraft/class_1309;)Inamed getDepthStriderLnet/minecraft/enchantment/EnchantmentHelper;getDepthStrider(Lnet/minecraft/entity/LivingEntity;)I
-
getEfficiency
public static int getEfficiency(LivingEntity entity)
- Mappings:
Namespace Name Mixin selector official fLbtn;f(Lasy;)Iintermediary method_8234Lnet/minecraft/class_1890;method_8234(Lnet/minecraft/class_1309;)Inamed getEfficiencyLnet/minecraft/enchantment/EnchantmentHelper;getEfficiency(Lnet/minecraft/entity/LivingEntity;)I
-
getLuckOfTheSea
public static int getLuckOfTheSea(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official bLbtn;b(Lbpr;)Iintermediary method_8223Lnet/minecraft/class_1890;method_8223(Lnet/minecraft/class_1799;)Inamed getLuckOfTheSeaLnet/minecraft/enchantment/EnchantmentHelper;getLuckOfTheSea(Lnet/minecraft/item/ItemStack;)I
-
getLure
public static int getLure(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official cLbtn;c(Lbpr;)Iintermediary method_8215Lnet/minecraft/class_1890;method_8215(Lnet/minecraft/class_1799;)Inamed getLureLnet/minecraft/enchantment/EnchantmentHelper;getLure(Lnet/minecraft/item/ItemStack;)I
-
getLooting
public static int getLooting(LivingEntity entity)
- Mappings:
Namespace Name Mixin selector official gLbtn;g(Lasy;)Iintermediary method_8226Lnet/minecraft/class_1890;method_8226(Lnet/minecraft/class_1309;)Inamed getLootingLnet/minecraft/enchantment/EnchantmentHelper;getLooting(Lnet/minecraft/entity/LivingEntity;)I
-
hasAquaAffinity
public static boolean hasAquaAffinity(LivingEntity entity)
- Mappings:
Namespace Name Mixin selector official hLbtn;h(Lasy;)Zintermediary method_8200Lnet/minecraft/class_1890;method_8200(Lnet/minecraft/class_1309;)Znamed hasAquaAffinityLnet/minecraft/enchantment/EnchantmentHelper;hasAquaAffinity(Lnet/minecraft/entity/LivingEntity;)Z
-
hasFrostWalker
public static boolean hasFrostWalker(LivingEntity entity)
- Mappings:
Namespace Name Mixin selector official iLbtn;i(Lasy;)Zintermediary method_8216Lnet/minecraft/class_1890;method_8216(Lnet/minecraft/class_1309;)Znamed hasFrostWalkerLnet/minecraft/enchantment/EnchantmentHelper;hasFrostWalker(Lnet/minecraft/entity/LivingEntity;)Z
-
hasSoulSpeed
public static boolean hasSoulSpeed(LivingEntity entity)
- Mappings:
Namespace Name Mixin selector official jLbtn;j(Lasy;)Zintermediary method_25951Lnet/minecraft/class_1890;method_25951(Lnet/minecraft/class_1309;)Znamed hasSoulSpeedLnet/minecraft/enchantment/EnchantmentHelper;hasSoulSpeed(Lnet/minecraft/entity/LivingEntity;)Z
-
hasBindingCurse
public static boolean hasBindingCurse(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official dLbtn;d(Lbpr;)Zintermediary method_8224Lnet/minecraft/class_1890;method_8224(Lnet/minecraft/class_1799;)Znamed hasBindingCurseLnet/minecraft/enchantment/EnchantmentHelper;hasBindingCurse(Lnet/minecraft/item/ItemStack;)Z
-
hasVanishingCurse
public static boolean hasVanishingCurse(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official eLbtn;e(Lbpr;)Zintermediary method_8221Lnet/minecraft/class_1890;method_8221(Lnet/minecraft/class_1799;)Znamed hasVanishingCurseLnet/minecraft/enchantment/EnchantmentHelper;hasVanishingCurse(Lnet/minecraft/item/ItemStack;)Z
-
getLoyalty
public static int getLoyalty(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official fLbtn;f(Lbpr;)Iintermediary method_8206Lnet/minecraft/class_1890;method_8206(Lnet/minecraft/class_1799;)Inamed getLoyaltyLnet/minecraft/enchantment/EnchantmentHelper;getLoyalty(Lnet/minecraft/item/ItemStack;)I
-
getRiptide
public static int getRiptide(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official gLbtn;g(Lbpr;)Iintermediary method_8202Lnet/minecraft/class_1890;method_8202(Lnet/minecraft/class_1799;)Inamed getRiptideLnet/minecraft/enchantment/EnchantmentHelper;getRiptide(Lnet/minecraft/item/ItemStack;)I
-
hasChanneling
public static boolean hasChanneling(ItemStack stack)
- Mappings:
Namespace Name Mixin selector official hLbtn;h(Lbpr;)Zintermediary method_8228Lnet/minecraft/class_1890;method_8228(Lnet/minecraft/class_1799;)Znamed hasChannelingLnet/minecraft/enchantment/EnchantmentHelper;hasChanneling(Lnet/minecraft/item/ItemStack;)Z
-
chooseEquipmentWith
@Nullable public static Map.Entry<EquipmentSlot,ItemStack> chooseEquipmentWith(Enchantment enchantment, LivingEntity entity)
Returns a pair of an equipment slot and the item stack in the supplied entity's slot, indicating the item stack has the enchantment supplied.If multiple equipment slots' item stacks are valid, a random pair is returned.
- 参数:
enchantment- the enchantment the equipped item stack must haveentity- the entity to choose equipments from- Mappings:
Namespace Name Mixin selector official bLbtn;b(Lbtl;Lasy;)Ljava/util/Map$Entry;intermediary method_8204Lnet/minecraft/class_1890;method_8204(Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;)Ljava/util/Map$Entry;named chooseEquipmentWithLnet/minecraft/enchantment/EnchantmentHelper;chooseEquipmentWith(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/entity/LivingEntity;)Ljava/util/Map$Entry;
-
chooseEquipmentWith
@Nullable public static Map.Entry<EquipmentSlot,ItemStack> chooseEquipmentWith(Enchantment enchantment, LivingEntity entity, Predicate<ItemStack> condition)
Returns a pair of an equipment slot and the item stack in the supplied entity's slot, indicating the item stack has the enchantment supplied and fulfills the extra condition.If multiple equipment slots' item stacks are valid, a random pair is returned.
- 参数:
enchantment- the enchantment the equipped item stack must haveentity- the entity to choose equipments fromcondition- extra conditions for the item stack to pass for selection- Mappings:
Namespace Name Mixin selector official aLbtn;a(Lbtl;Lasy;Ljava/util/function/Predicate;)Ljava/util/Map$Entry;intermediary method_24365Lnet/minecraft/class_1890;method_24365(Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;Ljava/util/function/Predicate;)Ljava/util/Map$Entry;named chooseEquipmentWithLnet/minecraft/enchantment/EnchantmentHelper;chooseEquipmentWith(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/entity/LivingEntity;Ljava/util/function/Predicate;)Ljava/util/Map$Entry;
-
calculateRequiredExperienceLevel
public static int calculateRequiredExperienceLevel(Random random, int slotIndex, int bookshelfCount, ItemStack stack)
Returns the required experience level for an enchanting option in the enchanting table's screen, or the enchantment screen.- 参数:
random- the random, which guarantees consistent results with the same seedslotIndex- the index of the enchanting optionbookshelfCount- the number of bookshelvesstack- the item stack to enchant- Mappings:
Namespace Name Mixin selector official aLbtn;a(Ljava/util/Random;IILbpr;)Iintermediary method_8227Lnet/minecraft/class_1890;method_8227(Ljava/util/Random;IILnet/minecraft/class_1799;)Inamed calculateRequiredExperienceLevelLnet/minecraft/enchantment/EnchantmentHelper;calculateRequiredExperienceLevel(Ljava/util/Random;IILnet/minecraft/item/ItemStack;)I
-
enchant
public static ItemStack enchant(Random random, ItemStack target, int level, boolean treasureAllowed)
Enchants thetargetitem stack and returns it.- 参数:
random- the seedtarget- the item stack to enchantlevel- the experience leveltreasureAllowed- whether treasure enchantments may appear- Mappings:
Namespace Name Mixin selector official aLbtn;a(Ljava/util/Random;Lbpr;IZ)Lbpr;intermediary method_8233Lnet/minecraft/class_1890;method_8233(Ljava/util/Random;Lnet/minecraft/class_1799;IZ)Lnet/minecraft/class_1799;named enchantLnet/minecraft/enchantment/EnchantmentHelper;enchant(Ljava/util/Random;Lnet/minecraft/item/ItemStack;IZ)Lnet/minecraft/item/ItemStack;
-
generateEnchantments
public static List<EnchantmentLevelEntry> generateEnchantments(Random random, ItemStack stack, int level, boolean treasureAllowed)
Generate the enchantments for enchanting thestack.- Mappings:
Namespace Name Mixin selector official bLbtn;b(Ljava/util/Random;Lbpr;IZ)Ljava/util/List;intermediary method_8230Lnet/minecraft/class_1890;method_8230(Ljava/util/Random;Lnet/minecraft/class_1799;IZ)Ljava/util/List;named generateEnchantmentsLnet/minecraft/enchantment/EnchantmentHelper;generateEnchantments(Ljava/util/Random;Lnet/minecraft/item/ItemStack;IZ)Ljava/util/List;
-
removeConflicts
public static void removeConflicts(List<EnchantmentLevelEntry> possibleEntries, EnchantmentLevelEntry pickedEntry)
Remove entries conflicting with the picked entry from the possible entries.- 参数:
possibleEntries- the possible entriespickedEntry- the picked entry- Mappings:
Namespace Name Mixin selector official aLbtn;a(Ljava/util/List;Lbto;)Vintermediary method_8231Lnet/minecraft/class_1890;method_8231(Ljava/util/List;Lnet/minecraft/class_1889;)Vnamed removeConflictsLnet/minecraft/enchantment/EnchantmentHelper;removeConflicts(Ljava/util/List;Lnet/minecraft/enchantment/EnchantmentLevelEntry;)V
-
isCompatible
public static boolean isCompatible(Collection<Enchantment> existing, Enchantment candidate)
Returns whether thecandidateenchantment is compatible with theexistingenchantments.- Mappings:
Namespace Name Mixin selector official aLbtn;a(Ljava/util/Collection;Lbtl;)Zintermediary method_8201Lnet/minecraft/class_1890;method_8201(Ljava/util/Collection;Lnet/minecraft/class_1887;)Znamed isCompatibleLnet/minecraft/enchantment/EnchantmentHelper;isCompatible(Ljava/util/Collection;Lnet/minecraft/enchantment/Enchantment;)Z
-
getPossibleEntries
public static List<EnchantmentLevelEntry> getPossibleEntries(int power, ItemStack stack, boolean treasureAllowed)
Gets all the possible entries for enchanting thestackat the givenpower.- Mappings:
Namespace Name Mixin selector official aLbtn;a(ILbpr;Z)Ljava/util/List;intermediary method_8229Lnet/minecraft/class_1890;method_8229(ILnet/minecraft/class_1799;Z)Ljava/util/List;named getPossibleEntriesLnet/minecraft/enchantment/EnchantmentHelper;getPossibleEntries(ILnet/minecraft/item/ItemStack;Z)Ljava/util/List;
-
-