Quplet / Qu-Enchantments

Me just adding whatever enchantments I think is cool that fit with vanilla Minecraft.
Apache License 2.0
2 stars 7 forks source link

Shield Enchant compatibility with Basic Shields Mod #15

Open BioMasterZap opened 8 months ago

BioMasterZap commented 8 months ago

I am not sure which end the issue is on but for Qu Enchantments v1.3.8 on Fabric 1.20.4 I am unable to get Bashing and Reflections on modded shields, only the vanilla shields. The shield mod I am using is Basic Shields v1.4.1 (this is a 1.20.2 release that works for 1.20.4), which requires Fabric Shield Lib (v1.7.2).

Either Basic Shields or Fabric Shield Lib does allow for shields to be enchanted and they can get Unbreaking, but they cannot get Bashing or Reflection through enchantment table or books and anvil. They are tagged as #fabric:shields and I used Crafttweaker to add #c:shields but that did not seem to fix it. If there is anything else I can do on my end through Crafttweaker or Datapacks to get the modded shields working with the enchants or if it is clearly an issue with the other mod, let me know.

Quplet commented 8 months ago

Unfortunately, whether something can be enchanted with certain enchantments is not controlled by tags at this point. It must be hard-coded into the logic. Specifically an enum in EnchantmentTarget.java. My logic added to this enum (https://github.com/Quplet/Qu-Enchantments/blob/1.20.X/src/main/java/qu/quEnchantments/asm/Shield.java) specifically targets ShieldItem for its enchantment ability. Meaning any mod that adds a shield to the game that extends from the base Shield item will work. Unfortunately looking at Fabric Shield Lib source, they make their own shield item from scratch, ignoring the in-game one. Unfortunately, I can't exactly allow for their shields to work without hardcoding in support for that specific library, which I'm not particularly fond of doing. Seeing that this library is officially supported by Fabric I might consider making an exception. I'll see.