Safrodev / Zenith

An unofficial fabric port of Apotheosis
https://www.curseforge.com/minecraft/mc-mods/zenith
MIT License
4 stars 4 forks source link

Crash with other enchantment related mods (e.g. Dark Enchanting, Enchanting Infuser) #6

Closed Fuzss closed 2 years ago

Fuzss commented 2 years ago

You seem to be setting the EnchantmentCategory field on Enchantment to null for (some?) enchantments. This really doesn't work out very well as the field is not expected to be null and is also public, so mod compat really is an issue here.

https://crashy.net/eAYaiO3W2Pp8uIma8Jhj

Safrodev commented 2 years ago

Hmm this is pretty strange considering Apotheosis does not ever change the Enchantment#category field

Azzmikaelson commented 2 years ago

Will there be an update to fix this issue with Enchanting infuser?

Fuzss commented 2 years ago

This is the cause: https://github.com/Safrodev/Apotheosis-Fabric/blob/1f4a6c0ec27dd2f601253f4ccade79433cee5228/src/main/java/safro/apotheosis/ench/enchantments/InertEnchantment.java#L11

The Forge mod has this, too, not sure what else they do, because on Forge everything works as expected.

Safrodev commented 2 years ago

Ah I see. This enchantment is not supposed to be obtainable through normal means, but dark enchanting grabs all registered enchantments. Thank you for finding this though, I should be able to fix it.

Fuzss commented 2 years ago

Just an idea, but how about making your own EnchantmentCategory for this single enchantment which simply doesn’t match any item?

Creating a custom EnchantmentCategory can easily be done on Forge via enum extending, but Fabric doesn’t have such a feature unfortunately. Therefore I made my own library a while ago: https://github.com/Fuzss/extensibleenums-fabric I really think this could be quite useful here. Also here is a mod where I‘ve used said library: https://github.com/Fuzss/bagofholding-fabric/blob/f91433e4bec7e3f8101ad9871884cdb0b61724d0/src/main/java/fuzs/bagofholding/registry/ModRegistry.java#L29

Safrodev commented 2 years ago

I appreciate the help but I managed to fix it with some minor tweaks. Everything should be working in v0.2.5 :)