Open Lumnyl opened 6 days ago
I've managed to reproduce this crash on both Fabric and Forge. I was initially very confused about the cause, since this crash should not ordinarily be possible.
Normally, Patched tries to capture the FallbackResourceManager
instance since its inject is in a static
method. This is fine because no one calls wrapForDebug
and all the vanilla ones that do are already handled. The instance is also stored in a ThreadLocal
so there can't in theory be any concurrency issues. This of course means that under normal circumstances this crash is impossible.
However, these aren't normal circumstances, and the stacktrace is very misleading about this. I believe what's happened is the following:
MultiPackResourceManager
invokes the corresponding FallbackResourceManager
to grab the textureFallbackResourceManager
instanceFallbackResourceManager
asks the PackResources
for the resourceAnd now this is where things get interesting:
BabySkeletonPackResources
asks the MultiPackResourceManager
for the vanilla skeleton textureMultiPackResourceManager
invokes the corresponding FallbackResourceManager
to grab the textureFallbackResourceManager
instanceFallbackResourceManager
asks the PackResources
for the resourceFallbackResourceManager
instance (!!!)BabySkeletonPackResources
BabySkeletonPackResources
returns the raw IoSupplier
And here's the actual crash part:
FallbackResourceManager
receives the IoSupplier
and calls wrapForDebug
on itFallbackResourceManager
instance to work with (since this was released in step 12
)In summary, the problem is that the MultiPackResourceManager
is queried twice when retrieving a resource, which causes Patched to become confused and crash.
Right now, I can see two options for addressing this problem:
FallbackResourceManager
right before the createResource()
call, instead of at the top of getResource()
PackResources
rather than fishing it out of the MultiPackResourceManager
, although this is complicated and comes with its own problemsI can attempt to fix this at some point soon for 1.21.1 (since I'm sure it's still an issue there), but I'm not sure when I'll end up backporting it to 1.20.1. I've had a backport planned for the forty some other features added since then but haven't gotten around to actually backporting them yet.
Whenever a Baby Skeleton or Baby Wither Skeleton spawns, the game crashes. Using the Fabric modloader.
Crash logs : https://paste.ee/p/CPomi (regular skeleton) https://paste.ee/p/h6NF5 (wither skeleton) Link to mod : https://modrinth.com/mod/tiny-skeletons I also reported the bug to the mod's author.