quat1024 / apathy

Apathetic Mobs but it's Overengineered
9 stars 5 forks source link

Crash on world load [1.19.2 Quilt, 2.4.1] #20

Closed twilight-sparkle-irl closed 1 year ago

twilight-sparkle-irl commented 1 year ago
java.lang.NullPointerException: Cannot invoke "agency.highlysuspect.apathy.rule.Rule.apply(Object, Object)" because "this.rule" is null
    at agency.highlysuspect.apathy.config.MobConfig.allowedToTargetPlayer(MobConfig.java:49)
    at net.minecraft.class_1309.handler$edk000$apathy$onCanAttack(class_1309.java:15097)
    at net.minecraft.class_1309.method_18395(class_1309.java)
    at net.minecraft.class_4051.method_18419(class_4051.java:77)
    at net.minecraft.class_1924.method_18468(class_1924.java:144)
    at net.minecraft.class_1924.method_18463(class_1924.java:126)
    at net.minecraft.class_1400.method_18415(class_1400.java:61)
    at net.minecraft.class_1400.method_6264(class_1400.java:51)
    at net.minecraft.class_1628$class_1631.method_6264(class_1628.java:260)
    at net.minecraft.class_4135.method_6264(class_4135.java:22)
    at net.minecraft.class_1355.method_6275(class_1355.java:98)
    at net.minecraft.class_1308.method_6023(class_1308.java:749)
    at net.minecraft.class_1309.method_6007(class_1309.java:2641)
    at net.minecraft.class_1308.method_6007(class_1308.java:553)
    at net.minecraft.class_1588.method_6007(class_1588.java:44)
    at net.minecraft.class_1309.method_5773(class_1309.java:2385)
    at net.minecraft.class_1308.method_5773(class_1308.java:353)
    at net.minecraft.class_1628.method_5773(class_1628.java:88)
    at net.minecraft.class_3218.method_18762(class_3218.java:712)
    at net.minecraft.class_1937.method_18472(class_1937.java:466)
    at net.minecraft.class_3218.method_31420(class_3218.java:371)
    at net.minecraft.class_5574.method_31791(class_5574.java:54)
    at net.minecraft.class_3218.method_18765(class_3218.java:339)
    at net.minecraft.server.MinecraftServer.redirect$bod000$carpet-fixes$catchExceptions(MinecraftServer.java:5782)
    at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:875)
    at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:819)
    at net.minecraft.class_1132.method_3748(class_1132.java:98)
    at net.minecraft.server.MinecraftServer.handler$ejn000$carpet$modifiedRunLoop(MinecraftServer.java:8885)
    at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:644)
    at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:257)
    at java.base/java.lang.Thread.run(Thread.java:833)

Full log: https://mclo.gs/Cqhyr5u

quat1024 commented 1 year ago

Well that's weird.

That field gets set when loading the config, which happens on every server resource load, which (at least on Fabric) happens pretty early and surely before any mobs get to tick. Either things happen out-of-order on Quilt, or the config is failing to load for some other reason, or i was wrong about how early that was and somehow i nor noone noticed until now

config field is null beforehand (which was a lazy fix for the config being unable to refer to mobs added by mods, cause i forgor about world load events)

I am rewriting the Everything atm (and i'm tempted to go "1.19.2 is unsupported, if you want to play the latest version you should at least have conviction"), i'll include a nullcheck or default value tho

n.b for debuggers, the 1.19.2 branch has the code for this version

twilight-sparkle-irl commented 1 year ago

Yeah, I noticed you were phasing out 1.19.2 but I figured it was at least worth noting. There's probably at least one or two other people out there like me who are also a little behind on the move to latest, too.

Seems to be related to the order in which mods load (adding and removing mods affects if it happens) and I have a sizable list of mods, so it's perhaps possible that resource load takes long enough that a mob ticks in the meantime?

Edit: Not sure if load order was just fine multiple times in a row or not, but it seems simply adding if (rule == null) return fallthrough; over here causes the issue to no longer happen with no ill effect. I don't typically log out close enough to a mob for mobs temporarily being aggressive in the worst case scenario is a problem, so I haven't noticed anything not working properly so far.

quat1024 commented 1 year ago

Oh, forgot to close this. This should be resolved with 2.5.