InfoEnchantment
is not an enchantment called "Info", but a data object that stores an enchantment together with its level.
Suggested names:
EnchantmentState
EnchantmentEntry
EnchantmentInfo
EnchantmentInfo
is probably the one that fits best out of those three. It's not perfect, but you could extrapolate the info as being the pairing of an "enchantment type" (Enchantment) with "enchantment level" (numeric).
What is it being used for, though?
It is used mostly in EnchantmentHelper to represent an enchantment that is going to be applied to an item.
So it's an application of an enchantment? Enchantment application? EnchantOptions
or EnchantAttributes
?
EnchantmentLevelPair
?
What about EnchantmentInstance
? A bit like StatusEffectInstance
not really an instance, and this class is actually very rarely used, more like a Map.Entry<Enchantment, Integer>
EnchantmentValue?
I am not following the first half of liach's logic, he doesn't really back up his "not really an instance" claim.
What I really have against EnchantmentInstance
is that it's not very descriptive, sort of like StatusEffectInstance
isn't very descriptive either, and neither is ItemInstance
, which seems to be Mojang's name for ItemStack
according to strings in the datafixers. The difference between the three is that for status effects, there doesn't really exist a better name, and it's hard to encompass its many fields into one name. ItemStack
is a good alternative to ItemInstance
as it's a well-established name that the wiki also uses, and makes logical sense.
I still think that EnchantmentLevelPair
is the best name, as it contains only two fields, enchantment and level. And its usage also screams that it's basically a Pair<Enchantment, Integer>
, that's used as a utility class inside EnchantmentHelper
and iirc nowhere else.
ItemInstance
, which seems to be Mojang's name for ItemStack according to strings in the datafixers.
The vanilla DFU type references use item_stack
.
The vanilla DFU type references use
item_stack
.
Maybe a fix refers to that name somewhere?
EnchantmentStack
:tiny_potato:
Also why didn't we go with EnchantmentInfo
before?
Do we have a EnchantmentLevel
class? What about EnchantmentLevels
(for more than once)?
The purpose of this class is to store an enchantment and level pair, so I suggest LevelledEnchantment
or EnchantmentLevelPair
.
EnchantmentStack
doesn't work. You can only have a stack of concrete objects.
What about renaming Enchantment
to EnchantmentType
and this one to Enchantment
?
EnchantmentType
still fits the other, and so does Enchantment
for this class, since you could say that the entire thing (type + level) is an enchantment, like "Sharpness II" for example.
Most helpful comment
What about renaming
Enchantment
toEnchantmentType
and this one toEnchantment
?EnchantmentType
still fits the other, and so doesEnchantment
for this class, since you could say that the entire thing (type + level) is an enchantment, like "Sharpness II" for example.