Open winsrp opened 3 years ago
Same here. My crash-report:
Description: Exception ticking world
java.lang.IllegalArgumentException: Unsupported mob type for TemptGoal
at net.minecraft.entity.ai.goal.TemptGoal.<init>(SourceFile:40) ~[?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:quark.mixins.json:TemptGoalMixin,pl:mixin:A}
at pam.pamhc2crops.entities.ai.MoreTemptation.<init>(MoreTemptation.java:9) ~[pamhc2crops:1.0.2] {re:classloading}
at pam.pamhc2crops.events.TemptationTask.onEntitySpawn(TemptationTask.java:183) ~[pamhc2crops:1.0.2] {re:classloading}
at net.minecraftforge.eventbus.ASMEventHandler_1188_TemptationTask_onEntitySpawn_EntityJoinWorldEvent.invoke(.dynamic) ~[?:?] {}
at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {}
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.minecraft.world.server.ServerWorld.func_217440_f(ServerWorld.java:829) ~[?:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:abnormals_core.mixins.json:ServerWorldMixin,pl:mixin:APP:quark.mixins.json:ServerWorldMixin,pl:mixin:A}
at net.minecraft.world.server.ChunkManager.lambda$null$25(ChunkManager.java:763) ~[?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,xf:OptiFine:default,pl:mixin:A}
at com.mojang.datafixers.util.Either.lambda$mapLeft$0(Either.java:162) ~[datafixerupper-4.0.26.jar:?] {re:classloading}
at com.mojang.datafixers.util.Either$Left.map(Either.java:38) ~[datafixerupper-4.0.26.jar:?] {re:classloading}
at com.mojang.datafixers.util.Either.mapLeft(Either.java:162) ~[datafixerupper-4.0.26.jar:?] {re:classloading}
at net.minecraft.world.server.ChunkManager.lambda$func_219200_b$26(ChunkManager.java:733) ~[?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,xf:OptiFine:default,pl:mixin:A}
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642) ~[?:?] {}
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478) ~[?:?] {}
at net.minecraft.world.chunk.ChunkTaskPriorityQueueSorter.func_219083_b(SourceFile:58) ~[?:?] {re:classloading}
at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(ThreadTaskExecutor.java:189) ~[?:?] {re:computing_frames,pl:accesstransformer:B,xf:OptiFine:default,re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,xf:OptiFine:default}
at net.minecraft.world.server.ServerChunkProvider$ChunkExecutor.func_213166_h(ServerChunkProvider.java:514) ~[?:?] {re:classloading}
at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(ThreadTaskExecutor.java:151) ~[?:?] {re:computing_frames,pl:accesstransformer:B,xf:OptiFine:default,re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,xf:OptiFine:default}
at net.minecraft.world.server.ServerChunkProvider$ChunkExecutor.func_213168_p(ServerChunkProvider.java:522) ~[?:?] {re:classloading}
at net.minecraft.world.server.ServerChunkProvider.func_217234_d(ServerChunkProvider.java:267) ~[?:?] {re:classloading,pl:accesstransformer:B,re:mixin,pl:accesstransformer:B}
at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:722) ~[?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:A}
at net.minecraft.server.MinecraftServer.func_213168_p(MinecraftServer.java:711) ~[?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:A}
at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213161_c(ThreadTaskExecutor.java:167) ~[?:?] {re:computing_frames,pl:accesstransformer:B,xf:OptiFine:default,re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,xf:OptiFine:default}
at net.minecraft.server.MinecraftServer.func_213202_o(MinecraftServer.java:697) ~[?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:A}
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:646) ~[?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:A}
at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232) ~[?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:betterendforge.mixins.json:MinecraftServerMixin,pl:mixin:A}
at java.lang.Thread.run(Thread.java:829) [?:?] {}
Same here, with same log.
I have investigated this issue happening on my server. This happens when a ChickenEntity
/CowEntity
/PigEntity
/RabbitEntity
/SheepEntity
is riding an Entity
which has a PathNavigator
that is neither a GroundPathNavigator
or FlyingPathNavigator
. The issue comes from the fact that MobEntity::getNavigator
will return the PathNavigator
of the Entity
it is riding when that Entity
is a MobEntity
. TemptGoal
(the superclass of MoreTemptation
) checks that getNavigator()
is either an instance of GroundPathNavigator
or FlyingPathNavigator
in its constructor and if it isn't, you get the llegalArgumentException
seen here.
My server was crashing because a Pig was riding a Crocodile from Alex's Mobs, which can have a custom PathNavigator. Likely because when crocodiles attack mobs they are forced into riding the crocodile. I guess the chunk unloaded before the Pig had been killed, then whenever the chunk got loaded again, it crashed the server.
As a quick and dirty workaround I compiled an edited version of this mod that changes TemptationTask::onEntityspawn
to initially call Entity::dismount
if getNavigator
doesn't return one of the expected PathNavigator
subclasses. (I tried Entity::stopRiding first, but that froze the server for some reason).
This issue is also present in the Pam's Harvestcraft 2 Trees mod, I haven't checked any of the others Pam's mods.
This bug is causing my server to crash. Hopefully we can get an update to fix this?
As a quick and dirty workaround I compiled an edited version of this mod that changes
TemptationTask::onEntityspawn
to initially callEntity::dismount
ifgetNavigator
doesn't return one of the expectedPathNavigator
subclasses. (I tried Entity::stopRiding first, but that froze the server for some reason).
Would it be possible for you @Mysteryem to share your patched build while there is still no official fix? This crash is frustrating some players on my server and I'm unfortunately not very good at Java.
As a quick and dirty workaround I compiled an edited version of this mod that changes
TemptationTask::onEntityspawn
to initially callEntity::dismount
ifgetNavigator
doesn't return one of the expectedPathNavigator
subclasses. (I tried Entity::stopRiding first, but that froze the server for some reason).Would it be possible for you @Mysteryem to share your patched build while there is still no official fix? This crash is frustrating some players on my server and I'm unfortunately not very good at Java.
Unfortunately, this project's license prohibits sharing any such files, regardless of whether it's a compiled build or edited source code. The source code is visible (which helps with finding the cause of bugs like this), but this is not an open source project by any means.
@Mysteryem Since I'm not familiar with Java, could you please elaborate on a detailed guide? I wonder why Pam's mod wants to getPathNavigator since there's no need for Pam's mod, a farming mod, to modify or read mob data. If this is something that can be done by simply extracting the jar file, edit the code, recompile it in zip format and rename it to jar I would be very much grateful. It's a little disappointing that the two authors wouldn't collaborate on this.
@JuicyCosmos In order for mobs like pigs and sheep to follow players when they hold fruit/veg/seeds from Pam's mods an AI task is added to pigs/sheep/etc. that makes them follow after players when they hold out the correct fruit/veg/seeds for that animal. This AI task is built on top of the AI task that vanilla Minecraft uses for making mobs follow you when you hold out wheat/carrots/etc. which has the check that getNavigator() returns a PathNavigator of a valid type. You might wonder why then that same vanilla AI task doesn't crash on its own and that's because, as far as I can tell, the vanilla AI tasks get added before the entity they're riding gets set so it avoids the issue entirely since there is no ridden entity at that time.
To make the modifications you would need to edit the source code in this repository and recompile the mod from the source code yourself, which would require a basic understanding of programming and Java and how to set your choice of IDE for minecraft mod development, my previous comment should already be enough for someone who knows what they're doing to make. It would be too much work for me to teach someone up to that level
As a quick and dirty workaround I compiled an edited version of this mod that changes
TemptationTask::onEntityspawn
to initially callEntity::dismount
ifgetNavigator
doesn't return one of the expectedPathNavigator
subclasses. (I tried Entity::stopRiding first, but that froze the server for some reason).
A better solution, which would fix more mods than this would be to either work with Forge to alter the vanilla TemptGoal
class that is the cause of all these problems or find a modder who knows how to use mixin to make a mod to modify the vanilla code for the TemptGoal
class.
@Mysteryem Thanks for shedding more light on the issue! I had minimal programming experience only with the surface level Python they taught in the uni, though I aim to learn more about programming in the future. Based on your description of the cause of the crash, I suppose any mod that forces those animals to ride a modded modded entity with a custom pathNavigator would result in a crash when paired with pam's? That would be a lot of mods incompatible. If that's the case this should really be up to forge to better implement, like you've said. I may want to remove pam's mods in favor of small but more polished farming mods. The best I can do for now is do some testing and see. (Wait, how do those mod, given they have the crop tempting feature, avoid causing crashes? Do they all use mixins?) Thank you for your generous info again.
@JuicyCosmos Yes, when paired with Alex's Mobs (or another mod that brings this issue to the surface), SimpleFarming used to run into the same issue, as did Quark.
SimpleFarming added checks that getNavigator()
returns a valid PathNavigator and only adds the AI goal if it's valid: https://github.com/cweckerl/simplefarming/commit/238307d602adb11099d6e68884086b2ed7c2537c
And Quark added a Try-Catch block for the exception that gets thrown when the PathNavigator is of an invalid type, ignoring whenever adding the AI goal would fail and throw an IllegalArgumentException: https://github.com/VazkiiMods/Quark/commit/0a7e2eddd3b5b4fd132b4e19f04ea5a261949ce0
Both I would describe as workarounds, since in both cases, the entity that would have caused the crash never gets given the AI goal it's supposed to have, though it's unlikely to be noticeable in most circumstances.
Using mixins to alter the vanilla TempGoal class in mods like SimpleFarming and Quark would probably not be a very good idea, because then you'd have a bunch of mods all modifying the same vanilla code (Mixin may be designed to handle this better than everyone writing their own coremods, but I still wouldn't advise it), it would be more suited for a mod made specifically for performing that fix or a mod designed to fix a whole bunch of vanilla issues.
As most of these mods are adding the AI goal in the EntityJoinWorldEvent
event it may be a decent workaround to make a mod that also listens to the EntityJoinWorldEvent
event, but on a HIGH or HIGHEST priority (most mods probably don't specify a priority, meaning they use NORMAL priority). That way, the mod can check if getNavigator()
returns a valid PathNavigator
and call dismount()
in advance of the other mods adding their AI goals. This does then have the problem that even mobs that aren't going to be given custom AI goals are going to dismount whatever they're riding if their mount doesn't have a valid type of PathNavigator
, though it may be possible to fix this by keeping track of the Entity that dismounted and its mount in the HIGH/HIGHEST priority EntityJoinWorldEvent
listener and then remount that same Entity in a second EntityJoinWorldEvent
listener set to LOW/LOWEST priority which would likely happen after any mods have added their extra AI goals.
Using version 1.16.3-1.0.2 got this error on the log that crashes single player