Upgrade Aquatic

Upgrade Aquatic

26M Downloads

Pike crashes server

Mizoku3 opened this issue ยท 1 comments

commented

I have had this issue for a while in 1.16.5, with all versions of upgrade aquatic that are for 1.16. I at least think this mod is the culprit as I don't crash only after removing it, and it appears in the logs, here are my logs from the most recent crash:

java.lang.NullPointerException
at uniquee.handler.EntityEvents.onLootingLevel(EntityEvents.java:835)
at net.minecraftforge.eventbus.ASMEventHandler_454_EntityEvents_onLootingLevel_LootingLevelEvent.invoke(.dynamic)
at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)
at net.minecraftforge.eventbus.EventBus$$Lambda$2452/892279025.invoke(Unknown Source)
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)
at net.minecraftforge.common.ForgeHooks.getLootingLevel(ForgeHooks.java:402)
at net.minecraftforge.common.ForgeHooks.getLootingLevel(ForgeHooks.java:395)
at net.minecraft.loot.LootContext.getLootingModifier(LootContext.java:99)
at net.minecraft.loot.conditions.RandomChanceWithLooting.test(RandomChanceWithLooting.java:36)
at net.minecraft.loot.conditions.RandomChanceWithLooting.test(RandomChanceWithLooting.java:18)
at java.util.function.Predicate.lambda$and$10(Predicate.java:69)
at java.util.function.Predicate$$Lambda$499/668762558.test(Unknown Source)
at net.minecraft.loot.LootPool.func_216091_a(LootPool.java:84)
at net.minecraft.loot.LootTable.func_216114_a(LootTable.java:68)
at net.minecraft.loot.TableLootEntry.func_216154_a(SourceFile:33)
at net.silentchaos512.scalinghealth.loot.TableGlobalModifier.doApply(TableGlobalModifier.java:30)
at net.minecraftforge.common.loot.LootModifier.apply(LootModifier.java:53)
at net.minecraftforge.common.ForgeHooks.modifyLoot(ForgeHooks.java:1314)
at net.minecraft.loot.LootTable.func_216113_a(LootTable.java:86)
at com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity.generateFishingLoot(PikeEntity.java:448)
at com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity.func_213386_a(PikeEntity.java:302)
at net.minecraft.world.spawner.WorldEntitySpawner.func_234966_a_(WorldEntitySpawner.java:175)
at net.minecraft.world.spawner.WorldEntitySpawner.func_234967_a_(WorldEntitySpawner.java:124)
at net.minecraft.world.spawner.WorldEntitySpawner.func_234979_a_(WorldEntitySpawner.java:110)
at net.minecraft.world.server.ServerChunkProvider.func_241099_a_(ServerChunkProvider.java:364)
at net.minecraft.world.server.ServerChunkProvider$$Lambda$49915/28150323.accept(Unknown Source)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at net.minecraft.world.server.ServerChunkProvider.func_217220_m(ServerChunkProvider.java:351)
at net.minecraft.world.server.ServerChunkProvider.func_217207_a(ServerChunkProvider.java:326)
at net.minecraft.world.server.ServerWorld.func_72835_b(ServerWorld.java:333)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:851)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:787)
at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:642)
at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232)
at net.minecraft.server.MinecraftServer$$Lambda$48736/295316413.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)

[28Aug2021 01:49:10.373] [Server thread/FATAL] [net.minecraftforge.common.ForgeMod/]: Preparing crash report with UUID 14cfaabc-7122-4708-a048-dd528d26153e
[28Aug2021 01:49:10.376] [Server thread/ERROR] [net.minecraft.server.MinecraftServer/]: Encountered an unexpected exception
net.minecraft.crash.ReportedException: Exception ticking world
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:855) ~[?:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:787) ~[?:?]
at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:118) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:642) [?:?]
at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232) [?:?]
at net.minecraft.server.MinecraftServer$$Lambda$48736/295316413.run(Unknown Source) [?:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_51]
Caused by: java.lang.NullPointerException
at uniquee.handler.EntityEvents.onLootingLevel(EntityEvents.java:835) ~[?:?]
at net.minecraftforge.eventbus.ASMEventHandler_454_EntityEvents_onLootingLevel_LootingLevelEvent.invoke(.dynamic) ~[?:?]
at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?]
at net.minecraftforge.eventbus.EventBus$$Lambda$2452/892279025.invoke(Unknown Source) ~[?:?]
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?]
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?]
at net.minecraftforge.common.ForgeHooks.getLootingLevel(ForgeHooks.java:402) ~[?:?]
at net.minecraftforge.common.ForgeHooks.getLootingLevel(ForgeHooks.java:395) ~[?:?]
at net.minecraft.loot.LootContext.getLootingModifier(LootContext.java:99) ~[?:?]
at net.minecraft.loot.conditions.RandomChanceWithLooting.test(RandomChanceWithLooting.java:36) ~[?:?]
at net.minecraft.loot.conditions.RandomChanceWithLooting.test(RandomChanceWithLooting.java:18) ~[?:?]
at java.util.function.Predicate.lambda$and$10(Predicate.java:69) ~[?:1.8.0_51]
at java.util.function.Predicate$$Lambda$499/668762558.test(Unknown Source) ~[?:?]
at net.minecraft.loot.LootPool.func_216091_a(LootPool.java:84) ~[?:?]
at net.minecraft.loot.LootTable.func_216114_a(LootTable.java:68) ~[?:?]
at net.minecraft.loot.TableLootEntry.func_216154_a(SourceFile:33) ~[?:?]
at net.silentchaos512.scalinghealth.loot.TableGlobalModifier.doApply(TableGlobalModifier.java:30) ~[?:4.0.5+5]
at net.minecraftforge.common.loot.LootModifier.apply(LootModifier.java:53) ~[?:?]
at net.minecraftforge.common.ForgeHooks.modifyLoot(ForgeHooks.java:1314) ~[?:?]
at net.minecraft.loot.LootTable.func_216113_a(LootTable.java:86) ~[?:?]
at com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity.generateFishingLoot(PikeEntity.java:448) ~[?:3.1.0]
at com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity.func_213386_a(PikeEntity.java:302) ~[?:3.1.0]
at net.minecraft.world.spawner.WorldEntitySpawner.func_234966_a_(WorldEntitySpawner.java:175) ~[?:?]
at net.minecraft.world.spawner.WorldEntitySpawner.func_234967_a_(WorldEntitySpawner.java:124) ~[?:?]
at net.minecraft.world.spawner.WorldEntitySpawner.func_234979_a_(WorldEntitySpawner.java:110) ~[?:?]
at net.minecraft.world.server.ServerChunkProvider.func_241099_a_(ServerChunkProvider.java:364) ~[?:?]
at net.minecraft.world.server.ServerChunkProvider$$Lambda$49915/28150323.accept(Unknown Source) ~[?:?]
at java.util.ArrayList.forEach(ArrayList.java:1249) ~[?:1.8.0_51]
at net.minecraft.world.server.ServerChunkProvider.func_217220_m(ServerChunkProvider.java:351) ~[?:?]
at net.minecraft.world.server.ServerChunkProvider.func_217207_a(ServerChunkProvider.java:326) ~[?:?]
at net.minecraft.world.server.ServerWorld.func_72835_b(ServerWorld.java:333) ~[?:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:851) ~[?:?]
... 6 more

commented

This is a peculiar issue.
The crash appears to be caused by the combination of Upgrade Aquatic, Unique Enchantments, and Scaling Health.
I tested the combination of those three mods and was able to reproduce the error consistently.
The mod that is actually at fault here is Unique Enchantments.

Unique Enchantments has a listener for the LootingLevelEvent event where they call getDamageSource() and don't null check it before using the method's returned value: Line 835

getDamageSource() can return null even though Forge doesn't annotate it as @Nullable.

See the LootContext#getLootingModifier() method where a new LootingLevelEvent instance can get fired will null parameters.
This method is also in the stack trace.
Not every LootContext will contain values for the LootParameters.DAMAGE_SOURCE key.
For Pike generating fishing loot, only parameters from the LootParameterSets.FISHING LootParameterSet are assigned values meaning the value for LootParameters.DAMAGE_SOURCE is null.
This mistake is easy to make because the methods in LootingLevelEvent are annotated incorrectly.