Extra Golems

Extra Golems

7M Downloads

Crash w/ Apotheosis

Shadows-of-Fire opened this issue ยท 8 comments

commented

Shadows-of-Fire/Apotheosis#685

Apotheosis applies a number of stats to all living entities via EntityAttributeModificationEvent, but I've been reported missing attribute crashes from this mod. That particular crash can only happen if the entity type in question does not have attributes setup properly via EntityAttributeCreationEvent.

Interestingly, I see you have a handler for that event here https://github.com/MinecraftModDevelopmentMods/Extra-Golems/blob/master-1.19/src/main/java/com/mcmoddev/golems/EGRegistry.java#L93

and I was able to debug that my event handler does fire for that entity type. which means that I successfully add my attributes to golems:golem

The code responsible for that is here https://github.com/Shadows-of-Fire/Apotheosis/blob/1.19/src/main/java/shadows/apotheosis/adventure/AdventureModule.java#L227

Yet despite all that, this crash still occurs, which means that the attribute does not actually get applied to the entity. I'm not sure what the cause of that might be, but it has to be something with the golem entity and the attribute handling.

commented

Thanks for the detailed information. I remembered that golem attributes are re-created based on the datapack here:
https://github.com/MinecraftModDevelopmentMods/Extra-Golems/blob/master-1.19/src/main/java/com/mcmoddev/golems/entity/GolemBase.java#L142

This is necessary to update health, attack damage, armor, etc. for the different golems (since all golems share the same entity type, they don't actually use the ones registered in EntityAttributeCreationEvent)

To fix this, I will likely need to fire EntityAttributeModificationEvent somewhere and store the results, but I'm not sure if that is allowed by Forge.

commented

I think it would be fine if you refired it with only your golem entity types and only used the results of your refiring for the golem attributes

commented

However, you mentioned a datapack, and this is a mod bus event. So you may not be able to fire it that late.

commented

If not, maybe I can find a way to copy the registered attributes and merge them with the datapack values.

commented

Does Apotheosis alone use the attributes? Or do I need to download one of the modules to test my fix?

commented

There is only one Apotheosis - the modules are configurable internal submods.

commented

Fixed in Extra Golems 19.2.4 (pending approval on CF).
Thank you for the help :)

commented

I should note this also happened with 1.18.2 and Apotheosis. Will you also be making a patch for 1.18.2 to fix the issue there?