Plague doctor kills rats in 1.20.1 version
doktokto opened this issue · 5 comments
I tried Rats 8.0.6 - 1.20 and Rats 8.0.5 - 1.20. I removed all other mods to make sure that there is no any conflicts.
Every time plague doctor appears with 2 rats and then kill them.
It's easy to reproduce the problem in Creative world by creating plague doctor and rats.
I use forge 47.1.43.
@GizmoTheMoonPig thank you for the fix, it works! Unfortunately after I downloaded the source code and compiled the mod - world started to freeze after 100% loading. I found out that it is because of a conflict with this mod https://www.curseforge.com/minecraft/mc-mods/snowy-spirit
It was fine before.
Maybe you have ideas how to fix that?
Mod works fine with just it and snowy spirit installed. I'm assuming it doesn't crash so a crashlog won't be applicable here, but you drop me a debug.log from your logs/
folder when you get a chance? It might have something in it that I can use
@GizmoTheMoonPig you right, I tested only rats and snowy-spirit together and they work just fine. I guess something else is involved, but I didn't manage to figure it out yet. I have a lot of mods. Removing snowy-spirit solves the problem, but problem occurred after I updated rats mod.
Here is the debug file.
Maybe problem is in the line 7566 where addPlagueDoctorSpawningAndCacheMobs triggers net.mehvahdjukaar.snowyspirit.common.ai.WinterVillagerAI.onVillagerBrainInitialize:
[27Sep2023 08:48:22.113] [Render thread/ERROR] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: Exception caught during firing event: Cannot invoke "net.minecraft.client.multiplayer.ClientLevel.m_46472_()" because "net.minecraft.client.Minecraft.m_91087_().f_91073_" is null
Index: 3
Listeners:
0: NORMAL
1: net.minecraftforge.eventbus.EventBus$$Lambda$4968/0x0000000800dbadd0@566dd9d5
2: net.minecraftforge.eventbus.EventBus$$Lambda$4968/0x0000000800dbadd0@32dd0e75
3: net.minecraftforge.eventbus.EventBus$$Lambda$4968/0x0000000800dbadd0@61336126
java.lang.NullPointerException: Cannot invoke "net.minecraft.client.multiplayer.ClientLevel.m_46472_()" because "net.minecraft.client.Minecraft.m_91087_().f_91073_" is null
at TRANSFORMER/[email protected]/sereneseasons.handler.season.SeasonHandler.getClientSeasonState(SeasonHandler.java:206)
at TRANSFORMER/[email protected]/sereneseasons.api.season.SeasonHelper.getSeasonState(SeasonHelper.java:30)
at TRANSFORMER/[email protected]/net.mehvahdjukaar.snowyspirit.integration.forge.SeasonModCompatImpl.isWinter(SeasonModCompatImpl.java:22)
at TRANSFORMER/[email protected]/net.mehvahdjukaar.snowyspirit.integration.SeasonModCompat.isWinter(SeasonModCompat.java)
at TRANSFORMER/[email protected]/net.mehvahdjukaar.snowyspirit.SnowySpirit.isChristmasSeason(SnowySpirit.java:114)
at TRANSFORMER/[email protected]/net.mehvahdjukaar.snowyspirit.common.ai.WinterVillagerAI.onVillagerBrainInitialize(WinterVillagerAI.java:29)
at TRANSFORMER/[email protected]/net.mehvahdjukaar.moonlight.api.events.forge.MoonlightEventsHelperImpl.lambda$addListener$0(MoonlightEventsHelperImpl.java:20)
at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:260)
at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:252)
at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315)
at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296)
at TRANSFORMER/[email protected]/net.mehvahdjukaar.moonlight.api.events.forge.MoonlightEventsHelperImpl.postEvent(MoonlightEventsHelperImpl.java:39)
at TRANSFORMER/[email protected]/net.mehvahdjukaar.moonlight.api.events.MoonlightEventsHelper.postEvent(MoonlightEventsHelper.java)
at TRANSFORMER/[email protected]/net.mehvahdjukaar.moonlight.core.misc.VillagerAIInternal.onRegisterBrainGoals(VillagerAIInternal.java:32)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.npc.Villager.handler$zlj000$reg(Villager.java:2471)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.npc.Villager.m_35424_(Villager.java:189)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.npc.Villager.m_8075_(Villager.java:156)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.LivingEntity.(LivingEntity.java:245)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.Mob.(Mob.java:123)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.PathfinderMob.(PathfinderMob.java:14)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.AgeableMob.(AgeableMob.java:29)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.npc.AbstractVillager.(AbstractVillager.java:49)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.npc.Villager.(Villager.java:139)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.npc.Villager.(Villager.java:135)
at TRANSFORMER/[email protected]/net.minecraft.world.entity.EntityType.m_20615_(EntityType.java:525)
at TRANSFORMER/[email protected]}/com.github.alexthe666.rats.server.events.ForgeEvents.lambda$addPlagueDoctorSpawningAndCacheMobs$0(ForgeEvents.java:231)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at TRANSFORMER/[email protected]}/com.github.alexthe666.rats.server.events.ForgeEvents.addPlagueDoctorSpawningAndCacheMobs(ForgeEvents.java:231)
at TRANSFORMER/[email protected]}/com.github.alexthe666.rats.server.events.ForgeEvents_addPlagueDoctorSpawningAndCacheMobs_Load.invoke(.dynamic)
at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73)
at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315)
at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296)
at TRANSFORMER/[email protected]/net.minecraft.client.multiplayer.ClientLevel.(ClientLevel.java:182)
at TRANSFORMER/[email protected]/net.minecraft.client.multiplayer.ClientPacketListener.m_5998(ClientPacketListener.java:403)
at TRANSFORMER/[email protected]/net.minecraft.network.protocol.game.ClientboundLoginPacket.m_5797(ClientboundLoginPacket.java:95)
at TRANSFORMER/[email protected]/net.minecraft.network.protocol.game.ClientboundLoginPacket.m_5797_(ClientboundLoginPacket.java:25)
at TRANSFORMER/[email protected]/net.minecraft.network.protocol.PacketUtils.m_263899_(PacketUtils.java:22)
at TRANSFORMER/[email protected]/net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:156)
at TRANSFORMER/[email protected]/net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23)
at TRANSFORMER/[email protected]/net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:130)
at TRANSFORMER/[email protected]/net.minecraft.util.thread.BlockableEventLoop.m_18699_(BlockableEventLoop.java:115)
at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1106)
at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.m_91374_(Minecraft.java:718)
at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.main(Main.java:218)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111)
at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99)
at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$makeService$0(CommonClientLaunchHandler.java:25)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:108)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:78)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)
ok, turns out you just need serene seasons, snowy spirit, and rats to replicate this.
It looks like Serene Seasons isn't checking that the ClientLevel isn't null before fetching the dimension in getClientSeasonState
. Snowy spirit calls for this in their seasons compat when determining if its Christmas season. In rats, I build a cache of all Mobs on level load for the first time to use for the mob filter using LevelEvent.Load. For some reason brains are constructed in the entity's constructor, causing the code Snow Spirit injects into villagers for Serene Seasons compat to fire. This event fires just before the ClientLevel is assigned to the game, so everything crashes and burns.
I would report this to Serene Seasons. You're more than welcome to link this issue to it, and if I got anything wrong, I'm sure someone will correct me.