InfoEnchantment -> EnchantmentLevelEntry (extends WeightedPicker.Entry) (#1182)

* InfoEnchantment -> EnchantmentsEntry (extends WeightedPicker.Entry)
Enchantment$Weight -> Enchantment$Rarity

again time to end that utter nonsense

Signed-off-by: liach <liach@users.noreply.github.com>

* Don't cry at me for not closing #1181 if you get fooled into think this is the actual "enchantment"
this thing is just a weighted picker entry; even client data gen properties entry (key-value pair) has proper hashCode and equals and this thing doesn't

Signed-off-by: liach <liach@users.noreply.github.com>

* Good suggestions earthcomputer

Signed-off-by: liach <liach@users.noreply.github.com>

* Suggested EnchantmentLevelEntry

Signed-off-by: liach <liach@users.noreply.github.com>

* Selected changes for enchantment helper

* Rephrase to make it less confusing per juuz

Co-authored-by: liach <liach@users.noreply.github.com>
This commit is contained in:
liach 2020-03-17 15:26:12 -05:00 committed by GitHub
parent 7937cb1803
commit 5f5d0a8746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 107 additions and 32 deletions

View File

@ -1,7 +1,7 @@
CLASS net/minecraft/class_1887 net/minecraft/enchantment/Enchantment
FIELD field_9083 type Lnet/minecraft/class_1886;
FIELD field_9084 translationKey Ljava/lang/String;
FIELD field_9085 weight Lnet/minecraft/class_1887$class_1888;
FIELD field_9085 rarity Lnet/minecraft/class_1887$class_1888;
FIELD field_9086 slotTypes [Lnet/minecraft/class_1304;
METHOD <init> (Lnet/minecraft/class_1887$class_1888;Lnet/minecraft/class_1886;[Lnet/minecraft/class_1304;)V
ARG 1 weight
@ -34,7 +34,7 @@ CLASS net/minecraft/class_1887 net/minecraft/enchantment/Enchantment
METHOD method_8184 getTranslationKey ()Ljava/lang/String;
METHOD method_8185 getEquipment (Lnet/minecraft/class_1309;)Ljava/util/Map;
ARG 1 entity
METHOD method_8186 getWeight ()Lnet/minecraft/class_1887$class_1888;
METHOD method_8186 getRarity ()Lnet/minecraft/class_1887$class_1888;
METHOD method_8187 getMinimumLevel ()I
METHOD method_8188 canCombine (Lnet/minecraft/class_1887;)Z
COMMENT Returns whether this enchantment can exist on an item stack with the
@ -55,8 +55,13 @@ CLASS net/minecraft/class_1887 net/minecraft/enchantment/Enchantment
METHOD method_8196 getAttackDamage (ILnet/minecraft/class_1310;)F
ARG 1 level
ARG 2 group
CLASS class_1888 Weight
CLASS class_1888 Rarity
COMMENT The rarity is an attribute of an enchantment.
COMMENT
COMMENT <p>It affects the chance of getting an enchantment from enchanting or
COMMENT loots as well as the combination cost in anvil.
FIELD field_9089 weight I
METHOD <init> (Ljava/lang/String;II)V
ARG 3 weight
METHOD method_8197 getWeight ()I
COMMENT Returns the weight of an enchantment in weighted pickers.

View File

@ -1,9 +1,22 @@
CLASS net/minecraft/class_1890 net/minecraft/enchantment/EnchantmentHelper
METHOD method_17884 (Ljava/util/Map;Lnet/minecraft/class_2487;Lnet/minecraft/class_1887;)V
ARG 2 enchantment
METHOD method_22445 getEnchantments (Lnet/minecraft/class_2499;)Ljava/util/Map;
METHOD method_22445 fromTag (Lnet/minecraft/class_2499;)Ljava/util/Map;
COMMENT Loads enchantments from an NBT list.
ARG 0 tag
METHOD method_24365 getMatchingEnchantedEquipment (Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;Ljava/util/function/Predicate;)Ljava/util/Map$Entry;
METHOD method_24365 chooseEquipmentWith (Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;Ljava/util/function/Predicate;)Ljava/util/Map$Entry;
COMMENT Returns a pair of an equipment slot and the item stack in the supplied
COMMENT entity's slot, indicating the item stack has the enchantment supplied
COMMENT and fulfills the extra condition.
COMMENT
COMMENT <p>If multiple equipment slots' item stacks are valid, a random pair is
COMMENT returned.
ARG 0 enchantment
COMMENT the enchantment the equipped item stack must have
ARG 1 entity
COMMENT the entity to choose equipments from
ARG 2 condition
COMMENT extra conditions for the item stack to pass for selection
METHOD method_25951 hasSoulSpeed (Lnet/minecraft/class_1309;)Z
ARG 0 entity
METHOD method_8199 getFireAspect (Lnet/minecraft/class_1309;)I
@ -18,15 +31,28 @@ CLASS net/minecraft/class_1890 net/minecraft/enchantment/EnchantmentHelper
METHOD method_8202 getRiptide (Lnet/minecraft/class_1799;)I
ARG 0 stack
METHOD method_8203 getEquipmentLevel (Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;)I
ARG 0 ench
COMMENT Returns the highest level of the passed enchantment in the enchantment's
COMMENT applicable equipment slots' item stacks.
ARG 0 enchantment
COMMENT the enchantment
ARG 1 entity
METHOD method_8204 getRandomEnchantedEquipment (Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;)Ljava/util/Map$Entry;
COMMENT the entity whose equipment slots are checked
METHOD method_8204 chooseEquipmentWith (Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;)Ljava/util/Map$Entry;
COMMENT Returns a pair of an equipment slot and the item stack in the supplied
COMMENT entity's slot, indicating the item stack has the enchantment supplied.
COMMENT
COMMENT <p>If multiple equipment slots' item stacks are valid, a random pair is
COMMENT returned.
ARG 0 enchantment
COMMENT the enchantment the equipped item stack must have
ARG 1 entity
COMMENT the entity to choose equipments from
METHOD method_8205 getKnockback (Lnet/minecraft/class_1309;)I
ARG 0 entity
METHOD method_8206 getLoyalty (Lnet/minecraft/class_1799;)I
ARG 0 stack
METHOD method_8209 accept (Lnet/minecraft/class_1890$class_1891;Ljava/lang/Iterable;)V
ARG 0 enchantmentHandler
METHOD method_8209 forEachEnchantment (Lnet/minecraft/class_1890$class_1891;Ljava/lang/Iterable;)V
ARG 0 action
ARG 1 stacks
METHOD method_8210 onUserDamaged (Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;)V
ARG 0 user
@ -37,6 +63,13 @@ CLASS net/minecraft/class_1890 net/minecraft/enchantment/EnchantmentHelper
ARG 0 user
ARG 1 target
METHOD method_8214 set (Ljava/util/Map;Lnet/minecraft/class_1799;)V
COMMENT Sets the enchantments on an item stack.
COMMENT
COMMENT <p>For enchanted books, it sets the enchantments to the item stack's
COMMENT stored enchantments than regular enchantments.
COMMENT
COMMENT @see net.minecraft.item.ItemStack#getEnchantments()
COMMENT @see net.minecraft.item.EnchantedBookItem#getEnchantmentTag(net.minecraft.item.ItemStack)
ARG 0 enchantments
ARG 1 stack
METHOD method_8215 getLure (Lnet/minecraft/class_1799;)I
@ -51,48 +84,74 @@ CLASS net/minecraft/class_1890 net/minecraft/enchantment/EnchantmentHelper
METHOD method_8219 getProtectionAmount (Ljava/lang/Iterable;Lnet/minecraft/class_1282;)I
ARG 0 equipment
ARG 1 source
METHOD method_8220 accept (Lnet/minecraft/class_1890$class_1891;Lnet/minecraft/class_1799;)V
ARG 0 enchantmentHandler
METHOD method_8220 forEachEnchantment (Lnet/minecraft/class_1890$class_1891;Lnet/minecraft/class_1799;)V
ARG 0 action
ARG 1 stack
METHOD method_8221 hasVanishingCurse (Lnet/minecraft/class_1799;)Z
ARG 0 stack
METHOD method_8222 getEnchantments (Lnet/minecraft/class_1799;)Ljava/util/Map;
METHOD method_8222 get (Lnet/minecraft/class_1799;)Ljava/util/Map;
COMMENT Gets the enchantments on an item stack.
COMMENT
COMMENT <p>For enchanted books, it retrieves from the item stack's stored than
COMMENT regular enchantments.
COMMENT
COMMENT @see net.minecraft.item.ItemStack#getEnchantments()
COMMENT @see net.minecraft.item.EnchantedBookItem#getEnchantmentTag(net.minecraft.item.ItemStack)
ARG 0 stack
METHOD method_8223 getLuckOfTheSea (Lnet/minecraft/class_1799;)I
ARG 0 stack
METHOD method_8224 hasBindingCurse (Lnet/minecraft/class_1799;)Z
ARG 0 stack
METHOD method_8225 getLevel (Lnet/minecraft/class_1887;Lnet/minecraft/class_1799;)I
COMMENT Gets the level of an enchantment on an item stack.
ARG 0 enchantment
ARG 1 stack
METHOD method_8226 getLooting (Lnet/minecraft/class_1309;)I
ARG 0 entity
METHOD method_8227 calculateEnchantmentPower (Ljava/util/Random;IILnet/minecraft/class_1799;)I
METHOD method_8227 calculateRequiredExperienceLevel (Ljava/util/Random;IILnet/minecraft/class_1799;)I
COMMENT Returns the required experience level for an enchanting option in the
COMMENT enchanting table's screen, or the enchantment screen.
ARG 0 random
ARG 1 num
ARG 2 enchantmentPower
ARG 3 rstack
COMMENT the random, which guarantees consistent results with the same seed
ARG 1 slotIndex
COMMENT the index of the enchanting option
ARG 2 bookshelfCount
COMMENT the number of bookshelves
ARG 3 stack
COMMENT the item stack to enchant
METHOD method_8228 hasChanneling (Lnet/minecraft/class_1799;)Z
ARG 0 stack
METHOD method_8229 getHighestApplicableEnchantmentsAtPower (ILnet/minecraft/class_1799;Z)Ljava/util/List;
METHOD method_8229 getPossibleEntries (ILnet/minecraft/class_1799;Z)Ljava/util/List;
COMMENT Gets all the possible entries for enchanting the {@code stack} at the
COMMENT given {@code power}.
ARG 0 power
ARG 1 stack
ARG 2 treasureAllowed
METHOD method_8230 getEnchantments (Ljava/util/Random;Lnet/minecraft/class_1799;IZ)Ljava/util/List;
METHOD method_8230 generateEnchantments (Ljava/util/Random;Lnet/minecraft/class_1799;IZ)Ljava/util/List;
COMMENT Generate the enchantments for enchanting the {@code stack}.
ARG 0 random
ARG 1 stack
ARG 2 level
ARG 3 hasTreasure
METHOD method_8231 remove (Ljava/util/List;Lnet/minecraft/class_1889;)V
ARG 0 infos
ARG 1 info
ARG 3 treasureAllowed
METHOD method_8231 removeConflicts (Ljava/util/List;Lnet/minecraft/class_1889;)V
COMMENT Remove entries conflicting with the picked entry from the possible
COMMENT entries.
ARG 0 possibleEntries
COMMENT the possible entries
ARG 1 pickedEntry
COMMENT the picked entry
METHOD method_8232 getDepthStrider (Lnet/minecraft/class_1309;)I
ARG 0 entity
METHOD method_8233 enchant (Ljava/util/Random;Lnet/minecraft/class_1799;IZ)Lnet/minecraft/class_1799;
COMMENT Enchants the {@code target} item stack and returns it.
ARG 0 random
COMMENT the seed
ARG 1 target
COMMENT the item stack to enchant
ARG 2 level
ARG 3 hasTreasure
COMMENT the experience level
ARG 3 treasureAllowed
COMMENT whether treasure enchantments may appear
METHOD method_8234 getEfficiency (Lnet/minecraft/class_1309;)I
ARG 0 entity
CLASS class_1891 Consumer

View File

@ -0,0 +1,15 @@
CLASS net/minecraft/class_1889 net/minecraft/enchantment/EnchantmentLevelEntry
COMMENT Represents an entry in an enchantments array, i.e. a pair between
COMMENT enchantment and level. This is also a weighted entry and is available
COMMENT for the weighted picker to pick from a list.
COMMENT
COMMENT <p>This is usually used where multiple enchantment to level mappings can
COMMENT exist, such as in enchanting logic. In other cases, vanilla prefers
COMMENT {@code Map<Enchantment, Integer>} over {@code List<EnchantmentLevelEntry>}.
COMMENT
COMMENT <p>This class is immutable. It does not override hashCode or equals.
FIELD field_9093 enchantment Lnet/minecraft/class_1887;
FIELD field_9094 level I
METHOD <init> (Lnet/minecraft/class_1887;I)V
ARG 1 enchantment
ARG 2 level

View File

@ -1,6 +0,0 @@
CLASS net/minecraft/class_1889 net/minecraft/enchantment/InfoEnchantment
FIELD field_9093 enchantment Lnet/minecraft/class_1887;
FIELD field_9094 level I
METHOD <init> (Lnet/minecraft/class_1887;I)V
ARG 1 enchantment
ARG 2 level

View File

@ -3,6 +3,6 @@ CLASS net/minecraft/class_1772 net/minecraft/item/EnchantedBookItem
ARG 0 stack
METHOD method_7807 addEnchantment (Lnet/minecraft/class_1799;Lnet/minecraft/class_1889;)V
ARG 0 stack
ARG 1 enchantmentInfo
ARG 1 entry
METHOD method_7808 forEnchantment (Lnet/minecraft/class_1889;)Lnet/minecraft/class_1799;
ARG 0 info

View File

@ -14,6 +14,8 @@ CLASS net/minecraft/class_1718 net/minecraft/screen/EnchantmentScreenHandler
ARG 2 playerInventory
ARG 3 context
METHOD method_17413 getSeed ()I
METHOD method_7637 getRandomEnchantments (Lnet/minecraft/class_1799;II)Ljava/util/List;
METHOD method_7637 generateEnchantments (Lnet/minecraft/class_1799;II)Ljava/util/List;
ARG 1 stack
ARG 2 slot
ARG 3 level
METHOD method_7638 getLapisCount ()I

View File

@ -10,6 +10,6 @@ CLASS net/minecraft/class_3549 net/minecraft/util/WeightedPicker
ARG 1 list
METHOD method_15447 getAt (Ljava/util/List;I)Lnet/minecraft/class_3549$class_3550;
ARG 0 list
ARG 1 pos
ARG 1 weightMark
CLASS class_3550 Entry
FIELD field_15774 weight I