Mob Variants

Mob Variants

95.5k Downloads

[Client Crash] NullPointerException when Undead Warrior entity is loaded

Closed this issue ยท 0 comments

commented

Environment Information:

  • Mod Version: frycmobvariants 6.5.1+1.21
  • Minecraft Version: 1.21.1
  • Fabric Loader Version: 0.17.2
  • Environment: Client connecting to a dedicated Fabric server.

Bug Description:
The client's game crashes when connecting to a server and loading chunks that contain an Undead Warrior entity. The crash report indicates a java.lang.NullPointerException originating from the mod's StatusEffectHelper class.

It seems that when the client tries to create or render the UndeadWarriorEntity, the code attempts to pick a random status effect from a list (availableStatusEffects), but this list has not been initialized on the client side and is null. This causes the game to crash immediately and disconnect the player from the server.

Steps to Reproduce the Error:

  1. Set up a Fabric server and a client with Minecraft 1.21.1 and frycmobvariants version 6.5.1.
  2. On the server, ensure an UndeadWarriorEntity is present in the world (either by finding one naturally in a cave or spawning one with commands).
  3. Have a player connect to the server with the same mod installed.
  4. As soon as the chunks containing the Undead Warrior are sent to the client, the client's game will crash.

Expected Behavior:
The client should be able to load and render the UndeadWarriorEntity without crashing. The list of available status effects should be properly initialized before being accessed.

Crash Log:
The complete client crash log is attached below for more details:

---- Minecraft Network Protocol Error Report ----
// This time is not my fault, I promise!

Time: 2025-08-27 17:05:07
Description: Packet handling error

java.lang.NullPointerException: Cannot invoke "java.util.HashMap.size()" because "net.fryc.frycmobvariants.util.StatusEffectHelper.availableStatusEffects" is null
        at knot//net.fryc.frycmobvariants.util.StatusEffectHelper.pickRandomStatusEffect(StatusEffectHelper.java:25)
        at knot//net.fryc.frycmobvariants.mobs.cave.UndeadWarriorEntity.<init>(UndeadWarriorEntity.java:55)
        at knot//net.minecraft.class_1299.method_5883(class_1299.java:552)
        at knot//net.minecraft.class_634.method_53876(class_634.java:505)
        at knot//net.minecraft.class_634.method_11112(class_634.java:483)
        at knot//net.minecraft.class_2604.method_11178(class_2604.java:109)
        at knot//net.minecraft.class_2604.method_11054(class_2604.java:19)
        at knot//net.minecraft.class_634.method_48294(class_634.java:2203)
        at knot//net.minecraft.class_8042.method_48329(class_8042.java:19)
        at knot//net.minecraft.class_8042.method_11054(class_8042.java:7)
        at knot//net.minecraft.class_2600.method_11072(class_2600.java:27)
        at knot//net.minecraft.class_1255.method_18859(class_1255.java:162)
        at knot//net.minecraft.class_4093.method_18859(class_4093.java:23)
        at knot//net.minecraft.class_1255.method_16075(class_1255.java:136)
        at knot//net.minecraft.class_1255.method_5383(class_1255.java:121)
        at knot//net.minecraft.class_310.method_1523(class_310.java:1240)
        at knot//net.minecraft.class_310.method_1514(class_310.java:882)
        at knot//net.minecraft.client.main.Main.main(Main.java:256)
        at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:506)
        at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:72)
        at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at com.modrinth.theseus.MinecraftLaunch.relaunch(MinecraftLaunch.java:63)
        at com.modrinth.theseus.MinecraftLaunch.main(MinecraftLaunch.java:28)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
        at knot//net.fryc.frycmobvariants.util.StatusEffectHelper.pickRandomStatusEffect(StatusEffectHelper.java:25)
        at knot//net.fryc.frycmobvariants.mobs.cave.UndeadWarriorEntity.<init>(UndeadWarriorEntity.java:55)
        at knot//net.minecraft.class_1299.method_5883(class_1299.java:552)
        at knot//net.minecraft.class_634.method_53876(class_634.java:505)
        at knot//net.minecraft.class_634.method_11112(class_634.java:483)
        at knot//net.minecraft.class_2604.method_11178(class_2604.java:109)
        at knot//net.minecraft.class_2604.method_11054(class_2604.java:19)

-- Incoming Packet --
Details:
        Type: clientbound/minecraft:bundle
        Is Terminal: false
        Is Skippable: false
Stacktrace:
        at knot//net.minecraft.class_2600.method_59803(class_2600.java:56)
        at knot//net.minecraft.class_8673.method_60882(class_8673.java:136)
        at knot//net.minecraft.class_8673.method_59807(class_8673.java:113)
        at knot//net.minecraft.class_2600.method_11072(class_2600.java:32)
        at knot//net.minecraft.class_1255.method_18859(class_1255.java:162)
        at knot//net.minecraft.class_4093.method_18859(class_4093.java:23)
        at knot//net.minecraft.class_1255.method_16075(class_1255.java:136)
        at knot//net.minecraft.class_1255.method_5383(class_1255.java:121)
        at knot//net.minecraft.class_310.method_1523(class_310.java:1240)
        at knot//net.minecraft.class_310.method_1514(class_310.java:882)
        at knot//net.minecraft.client.main.Main.main(Main.java:256)
        at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:506)
        at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:72)
        at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at com.modrinth.theseus.MinecraftLaunch.relaunch(MinecraftLaunch.java:63)
        at com.modrinth.theseus.MinecraftLaunch.main(MinecraftLaunch.java:28)

-- System Details --
Details:
        Minecraft Version: 1.21.1
        Fabric Mods:
                frycmobvariants: Mob Variants 6.5.1+1.21
                ... (and others)