Eidolon

Eidolon

16M Downloads

[1.16.4] Soul Enchanter can enchant tools that can't normally be enchanted

NielsPilgaard opened this issue ยท 5 comments

commented

Describe the bug
I was able to enchant Tetra tools with the Soul Enchanter.

To Reproduce

  • Cheat in a Hammer from Tetra through the creative menu (to make sure it is modular and unenchantable)
  • Place down a Soul Enchanter
  • Put the Hammer in the Soul Enchanter along with some Soul Shards - Enchant it.

Environment
Singleplayer
eidolon-0.2.7

commented

Is Tetra using the default enchantment tag to store modifiers? Eidolon definitely checks that the item is either:

  • enchantable
  • already enchanted
  • a book

I can see that Tetra modular tools return false for enchantable, and they clearly aren't books, so the only thing I can think of at the moment that would cause this is if Tetra puts its modifiers under the Enchantments tag.

It's not immediately clear to me, then, if this should be fixed on Eidolon's or Tetra's side. I think the best solution would be for Tetra to simply use another tag, if the "enchantments" it uses aren't actually acquired by enchanting. But I can see from the code that that would be a fairly invasive change. I'll try and figure out a check I can do on my end. Merely checking isEnchantable isn't sufficient, since the Soul Enchanter is meant to enchant already-enchanted items. Worst-case scenario I could just manually check for Tetra items, but that's not very robust.

commented

Tetra most likely puts its modifiers under the Enchantments tag: They are enchantments, but they are applied by placing books within the tool, through the Tetra Workbench.

We had a similar issue with the Industrial Foregoing Enchantment Extractor, the dev's solution was to blacklist items based on a tag, in this case called industrialforegoing:enchantment_extractor_blacklist. Perhaps you could add and check a similar tag?

commented

There's actually a really simple solution on Tetra's end, I think. There's a method Item#canApplyAtEnchantingTable Forge provides to specify which enchantments are compatible with a given item. It doesn't seem that Tetra overrides this, and as far as I can it is not used in the Tetra codebase at all. Simply overriding this to prevent enchantments being applied should fix the issue with Eidolon and potentially with other future enchanting mods.

If mickelus is unwilling to do this I can also make a tag, but I am currently in the midst of a larger content update so I can't say when I'd be able to release it. It's also a less robust solution in general, I think, so I'd prefer to avoid it.

commented

@mickelus There is a Tetra enchant compatibility issue, please read above :)

commented

I've got separate fields in the nbt tag for my modules & modifiers, when those change I populate the Enchantments tag based on the modifiers that are "enchantments". If the Enchantments tag is modified by something else it will be overwritten the next time the modules or modifiers changes for the item.