AzureDoom / MCDoom

Adds Doom related content to Minecraft
45 stars 17 forks source link

Game crashes when doom hunter in the first stage killed by damage not from mob #126

Closed XiaoYuOvO closed 11 months ago

XiaoYuOvO commented 11 months ago

If a damage that has no mob source(e.g. an arrow created by the dispenser or command, the explosion from the rocket) killed the doom hunter that is on the first stage(has not been killed). The game will crash and here is the stacktrace:

java.lang.NullPointerException: Ticking entity
    at java.base/java.util.Objects.requireNonNull(Objects.java:208)
    at mod.azure.doom.entities.tiersuperheavy.DoomHunterEntity.method_6078(DoomHunterEntity.java:271)
    at net.minecraft.class_1309.method_5643(class_1309.java:1222)
    at mod.azure.doom.entities.DemonEntity.method_5643(DemonEntity.java:161)
    at mod.azure.doom.entities.projectiles.entity.RocketMobEntity.lambda$explode$1(RocketMobEntity.java:101)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at mod.azure.doom.entities.projectiles.entity.RocketMobEntity.explode(RocketMobEntity.java:100)
    at mod.azure.doom.entities.projectiles.entity.RocketMobEntity.method_24920(RocketMobEntity.java:76)
    at net.minecraft.class_1676.method_7488(class_1676.java:157)
    at net.minecraft.class_1668.method_5773(class_1668.java:77)
    at mod.azure.doom.entities.projectiles.entity.RocketMobEntity.method_5773(RocketMobEntity.java:119)
    at net.minecraft.class_3218.method_18762(class_3218.java:739)
    at net.minecraft.class_1937.method_18472(class_1937.java:480)
    at net.minecraft.class_3218.method_31420(class_3218.java:385)
    at net.minecraft.class_5574.method_31791(class_5574.java:54)
    at net.minecraft.class_3218.method_18765(class_3218.java:353)
    at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:897)
    at net.minecraft.class_3176.method_3813(class_3176.java:283)
    at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:824)
    at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671)
    at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265)
    at java.base/java.lang.Thread.run(Thread.java:833)
XiaoYuOvO commented 11 months ago

And I find that just remove the Objects.requireNonNull and it can work perfectly