Yarn: Incorrect enchantment method names

Created on 4 Feb 2020  路  2Comments  路  Source: FabricMC/yarn

  • EnchantmentHelper.contains(Collection<Enchantment>, Enchantment) -> hasNoConflicts

    • The method returns true if the Collection<Enchantment> does not have conflicting enchantments.

  • Enchantment.isDifferent(Enchantment) -> "can be on the same item"

    • basically this.differs(other) && other.differs(this). differs itself is named wrong, so this method checks that both enchantments think the other one is a valid partner.

    • Example: SilkTouchEnchantment.differs returns false if the enchantment is FORTUNE, so they conflict even though Fortune uses the default impl.

  • Enchantment.differs(Enchantment) -> also "can be on the same item"

    • Checks if this enchantment is mutually exclusive with the passed enchantment.

bug

Most helpful comment

Imo hasNoConflicts is more like canCombine

All 2 comments

isDifferent would better be named as isCompatibleWith, though I'm not sure what to rename differs to.

Imo hasNoConflicts is more like canCombine

Was this page helpful?
0 / 5 - 0 ratings

Related issues

haykam821 picture haykam821  路  4Comments

Draylar picture Draylar  路  6Comments

liach picture liach  路  4Comments

ChloeDawn picture ChloeDawn  路  5Comments

Sollace picture Sollace  路  5Comments