Rename enchantmentcontainer creation method

- Slightly changed the name of the static method in the EnchantmentContainer class that is used to create new containers from ItemStacks. It's purpose/usage is a bit more clear now.
This commit is contained in:
Pim van der Loos 2022-03-13 23:29:16 +01:00
parent bb40e20d90
commit ca2b28e267
No known key found for this signature in database
GPG Key ID: C16F020ADAE6D5A8
2 changed files with 5 additions and 5 deletions

View File

@ -68,7 +68,7 @@ public class ArmoredElytraBuilder
*/ */
public @Nullable ItemStack enchant(ItemStack armoredElytra, ItemStack sourceItem, @Nullable String name) public @Nullable ItemStack enchant(ItemStack armoredElytra, ItemStack sourceItem, @Nullable String name)
{ {
final EnchantmentContainer enchantments = EnchantmentContainer.getEnchantments(sourceItem, plugin); final EnchantmentContainer enchantments = EnchantmentContainer.getEnchantmentsOf(sourceItem, plugin);
if (enchantments.isEmpty()) if (enchantments.isEmpty())
return null; return null;
return newBuilder().ofElytra(armoredElytra).addEnchantments(enchantments).withName(name).build(); return newBuilder().ofElytra(armoredElytra).addEnchantments(enchantments).withName(name).build();
@ -364,7 +364,7 @@ public class ArmoredElytraBuilder
@Override @Override
public IStep2 addEnchantments(ItemStack sourceItem) public IStep2 addEnchantments(ItemStack sourceItem)
{ {
return addEnchantments(EnchantmentContainer.getEnchantments(sourceItem, plugin)); return addEnchantments(EnchantmentContainer.getEnchantmentsOf(sourceItem, plugin));
} }
@Override @Override
@ -414,7 +414,7 @@ public class ArmoredElytraBuilder
if (currentArmorTier == null) if (currentArmorTier == null)
currentArmorTier = nbtEditor.getArmorTier(elytra); currentArmorTier = nbtEditor.getArmorTier(elytra);
combinedEnchantments = EnchantmentContainer.getEnchantments(newArmoredElytra, plugin); combinedEnchantments = EnchantmentContainer.getEnchantmentsOf(newArmoredElytra, plugin);
durability = durabilityManager.getRealDurability(newArmoredElytra, currentArmorTier); durability = durabilityManager.getRealDurability(newArmoredElytra, currentArmorTier);
return this; return this;

View File

@ -57,7 +57,7 @@ public class EnchantmentContainer implements Iterable<Map.Entry<Enchantment, Int
* @param plugin The {@link ArmoredElytra} instance to use. * @param plugin The {@link ArmoredElytra} instance to use.
* @return A new {@link EnchantmentContainer} with the enchantments from the item. * @return A new {@link EnchantmentContainer} with the enchantments from the item.
*/ */
public static EnchantmentContainer getEnchantments(final ItemStack is, final ArmoredElytra plugin) public static EnchantmentContainer getEnchantmentsOf(final ItemStack is, final ArmoredElytra plugin)
{ {
if (is == null) if (is == null)
return new EnchantmentContainer(Collections.emptyMap(), plugin); return new EnchantmentContainer(Collections.emptyMap(), plugin);
@ -144,7 +144,7 @@ public class EnchantmentContainer implements Iterable<Map.Entry<Enchantment, Int
* Remove any entries from the list of enchantments that are mutually exclusive to each other. * Remove any entries from the list of enchantments that are mutually exclusive to each other.
* <br>First instance of a mutually exclusive enchantment gets priority * <br>First instance of a mutually exclusive enchantment gets priority
*/ */
public void filterMutuallyExclusive() private void filterMutuallyExclusive()
{ {
final List<Enchantment> disallowedEnchantments = new LinkedList<>(); final List<Enchantment> disallowedEnchantments = new LinkedList<>();
for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet())