Campanion

Campanion

2M Downloads

Loyalty enchantment is still applicable to Spears

ejektaflex opened this issue ยท 6 comments

commented

I just enchanted a Spear with Loyalty III. It seems to have no effect. After checking the source for SpearEntity, there seems to be no tracking of the loyalty enchant like there is in TridentEntity. For the time being, this means that Loyalty enchantments do not work on Spears (even though Spears can accept Loyalty enchantments).

commented

This is on 1.16. I just realized what the problem is. My mod is adding random enchantments to items, and checks to see if it is a valid enchantment by calling Enchantment::isAcceptableItem on the Loyalty enchantment. It passes true, I assume because the Loyalty enchantment has the enchantment target EnchantmentTarget.TRIDENT. That target defines isAcceptableItem() == true if the item is a TridentItem, and a spear is indeed a TridentItem.

So therefore, if you extend TridentItem, Loyalty will always be a valid enchantment.

Solution 1 that I can see: Add a Mixin to EnchantmentTarget.TRIDENT that ensures that the item is not a SpearItem

Solution 2: Just change it so that Loyalty works on spears? I was honestly more excited for that, haha. I'd love to see Loyalty working on spears if possible. ๐Ÿ˜„

commented

Loyalty on spears doesn't really make sense. We already have a mixin for enchantments (https://github.com/TerraformersMC/Campanion/blob/1.16/src/main/java/com/terraformersmc/campanion/mixin/MixinEnchantment.java) but what I assume has happened is the loyalty enchantment predicate changed from 1.15 -to 1.16, with before just checking to see if the item is the trident item.

commented

What makes sense about Loyalty on a trident and not a spear? I'm not quite following that logic.

commented

Pretty much everything in this mod is meant for early game or a nomadic lifestyle. Having unbalanced, easy to make, items ruins that. If we were to add loyalty then they would essentially just be an early game craftable trident. We intentionally removed the loyalty code from the spear entity, and I'm highly doubtful we'll add it back

commented

Ah yes, that's true. I suppose that if a spear has Loyalty, there no reason to ever have a trident. I do see your point!

Any any case, this is still a bug so I assume that yeah, the predicate has changed. A fix would be excellent :^)

commented

What version are you on? Loyalty should not be possible to get on spears, although I may have fixed it on 1.16 but not 1.15