AM2PlayGround

AM2PlayGround

2.5k Downloads

Outer damage component causes crash

Closed this issue ยท 3 comments

commented

Oh boy, here I go finding another way to crash the game again!

I made a projectile-outer damage spell and the game frequently(but not always) crashes when something is hit by it. Seems related to the outer damage specifically?

Still using 0.11.3 with this fork of AM2.5

crash-2024-10-03_02.28.14-server.txt

commented

I made a projectile-outer damage spell and the game frequently(but not always) crashes when something is hit by it. Seems related to the outer damage specifically?

This is strange.
According to your crash log, something is null on line
airburn.am2playground.spell.components.OuterDamage.debuff(OuterDamage.java:78),

77 if(target.worldObj.rand.nextBoolean()) {
78	target.addPotionEffect(new PotionEffect(PotionSunScorned.instance.id, 160, buffPower));
79 }

but target, worldObj and rand cannot be null, otherwise it would cause the game to crash on another line 77, not 78.
That also explains why this not always crashes (50% chance).
And thus one and only sus amogus is PotionSunScorned.instance, but it's Thaumcraft field!
Can it be null? Well, probably.
To register potions, Thaumcraft does something like this:

start = getNextPotionId(start);
if (start >= 0) {
	potionSunScornedID = start;
	PotionSunScorned.instance = new PotionSunScorned(potionSunScornedID, true, ...);
	PotionSunScorned.init();
	Thaumcraft.log.info("Initializing PotionSunScorned with id " + start);
}

If getNextPotionId() somehow returns -1 or something, potion will not be registred.
You can track it by searching something like PotionSunScorned in server log on startup, for me it looks like this:
[14:37:35] [Server thread/INFO] [THAUMCRAFT]: Initializing PotionSunScorned with id 64
Try to buff yourself with that potion via commands or NEI potion editor maybe?
I will fix that on my side by null checking, but it's strange behaviour of your world, so please check it.
Also, [Flux Disease] spell, [Chilling Look] ritual and [Focus: Spell] wand foci uses the same API to check potion effects, so consider test them as well.

commented

Oh, you're right! It's almost definitely an ID issue in my setup.

I've had to shuffle a lot of IDs around in my modpack and I guess this is how I learned that Thaumcraft is one of those mods that straight up will not work in the higher ID ranges created by extension mods; none of the Thaumcraft specific effects appear to actually exist, so it makes sense that the spell part wouldn't work right if the effect doesn't actually exist in-game.

Then again, it's possible to disable the individual effects in Thaumcraft in the config anyways(at least you can with the GTNH fork thought I was using a fork but I'm not, whoops; so this is just base TC4 behavior), so it would probably be a good idea to check for whether the effect exists or not first anyways.

Apologies for the erroneous report. Thought I got it all working in my setup already, but apparently not.

commented

Then again, it's possible to disable the individual effects in Thaumcraft in the config anyways(at least you can with the GTNH fork), so it would probably be a good idea to check for whether the effect exists or not first anyways.

Sure thing, I'll do some checks for that.