MC Dungeons Weapons

MC Dungeons Weapons

12M Downloads

Ecchang giver get conflict enchantments

LILPRINCES opened this issue ยท 4 comments

commented

I found a problem. Enchant giver can get conflict enchantments on the enchantment table, just like harp crossbow can get penetrating with multiple shots, but it can't do this on the anvil. I don't know if this is a bug or a deliberate design. If it is a deliberate design, can you add a configuration so that it doesn't do much.

verison: mcdw-5.0.3-1.18
fabric-api-0.58.0+1.18.2

enchant table
anvil

commented

Ugh, DH makes me sad. The reason why this is happening, as far as I assume (I'm 99% sure) is that because Enchant Giver technically does not make them an enchantment but instead overrides the getEnchantLevel method, it will not register incompatibilities and more importantly, will let you enchant on the enchant table. The reason this still works on the anvil afaik is because it assumes that you might actually have an enchantment on the item and it does look for incompatibilities for which it would see the innate enchant. Conversely enchant table looks strictly at the potential enchants to see if they would be suitable for the item based on EnchantTarget. There are 2 solutions that I see:

  1. Mixin to ItemStack or manipulate how EnchantGiver works to actually forcefully give the innate enchantment to the items when they are created. This would then require us to mixin to the grindstone to cover ourselves. A disadvantage of this is it would make it so innately enchanted items can't be put in the enchantment table.
  2. Mixin to EnchantmentHelper.getPossibleEntries and add a requirement mimicking what is done in the anvil.

It seems that we don't have a perfect solution, but OK, thank you for your work

commented

Ugh, DH makes me sad. The reason why this is happening, as far as I assume (I'm 99% sure) is that because Enchant Giver technically does not make them an enchantment but instead overrides the getEnchantLevel method, it will not register incompatibilities and more importantly, will let you enchant on the enchant table. The reason this still works on the anvil afaik is because it assumes that you might actually have an enchantment on the item and it does look for incompatibilities for which it would see the innate enchant. Conversely enchant table looks strictly at the potential enchants to see if they would be suitable for the item based on EnchantTarget. There are 2 solutions that I see:

  1. Mixin to ItemStack or manipulate how EnchantGiver works to actually forcefully give the innate enchantment to the items when they are created. This would then require us to mixin to the grindstone to cover ourselves. A disadvantage of this is it would make it so innately enchanted items can't be put in the enchantment table.
  2. Mixin to EnchantmentHelper.getPossibleEntries and add a requirement mimicking what is done in the anvil.
commented

Thanks for the heads up about this. I'll take a look at it in the morning :)

Sorry to bother you so late,Have a good sleep, my bro

commented

Thanks for the heads up about this. I'll take a look at it in the morning :)