Astral Sorcery

Astral Sorcery

63M Downloads

Strange Incompatibility with Thaumcraft + SoL: Carrot

juliand665 opened this issue · 0 comments

commented

I'm one of the developers of Spice of Life: Carrot Edition, and we had this issue reported today: Cazsius/Spice-of-Life-Carrot-Edition#52. TL;DR: The Astral Tome is not automatically given to new players.

The issue occurs in a setup with the latest version of each involved mod (removing any of the three mods "fixes" the bug, i.e. the book is given out again):

  • Astral Sorcery 1.12.2-1.10.11
  • Thaumcraft 1.12.2-6.1.BETA26
  • Spice of Life: Carrot Edition 1.12.2-1.6.2

And their dependencies:

  • AppleCore 1.12.2-3.2.0 (for SoL: Carrot)
  • Baubles 1.12-1.5.2 (for Thaumcraft)

I've managed to narrow it down a little, but after creating dozens of worlds for testing purposes, I think you're better equipped to resolve this than us (I think your coremod hooking into AbstractAttributeMap may have something to do with it?).

Disabling (even just parts of) our login event handler fixes the issue. Specifically, the most simple way to trigger the issue is to replace our call to updateFoodHPModifier(player) with a (reflection-based, because it's private) invoke of ModifiableAttributeInstance's computeValue() on maxHealthAttribute(player).

Of course, this direct call is not what happens in practice. Instead, the method is usually indirectly called by us applying a new modifier to the max health attribute (thus indirectly marking it as dirty) and later getting the value with player.getMaxHealth(), thus causing computeValue() to be called since the cached value was marked as invalid.

I think what's happening is that, somewhere in DynamicPlayerAttributeModifier's getAmount(), it's causing the .astral playerdata file to be created, whose existence cancels you from handing out the book later on when your event handler for the login event is called.

I have no idea how Thaumcraft is involved in all this, but the issue doesn't occur if it's not present for whatever reason… I guess the order in which the event handlers are called might be different then?

The easiest way to fix this would probably be to simply store in the .astral file whether or not the book has been handed out, rather than checking for its existence.