Closed SettingDust closed 9 months ago
This error happens when Patched fails to capture the underlying FallbackResourceManager
instance (but that's probably obvious), since wrapForDebug()
is static
. If this error occurred then I'd expect it's either because patched$captureThis
wasn't injected or wrapForDebug()
was called without the injector running.
I can't be certain without seeing the stacktrace of the error, but this call looks pretty suspect (as patched$captureThis
doesn't target getResourceStack()
).
If this is the problem, then there's probably two options: either I could introduce some kind of "wrapped" wrapForDebug
method that you could call when possible, or I could expand the capture/releaseThis
injectors to also target getResourceStack()
.
Although, I don't think Patched can patch HOCON files anyway, so you could likely just take out the call to wrapForDebug()
(I don't imagine you need the debug InputStream
, unless you're expecting other mods to also target that method).
I import the patched in dev env and get the stack trace. And yeah, the line is the problem.
I think Patched will patch the HOCON file since it's loaded as JSON into the game
It's fine after remove the line
I think Patched will patch the HOCON file since it's loaded as JSON into the game
If I understand what the mod does correctly, which is (what I assume) prioritizing .hocon
files when .json
files are requested (so you can write say, .hocon
loot tables), Patched won't patch .hocon files, although it might patch the .json
ones. That'd probably matter more if you were using getResource()
to retrieve the .hocon
files (which might be the case -- I haven't looked at anything outside of that mixin). So I guess there's a decent chance Patched will touch the resulting files, assuming they end in .json
.
At some point in the future I may look into supporting getResourceStack()
. It's a bit strange since it doesn't actually use wrapForDebug()
, so it would need a fresh injector. I'm not really certain what all getResourceStack()
is used for (and I don't have my IDE open to check), but I haven't noticed anything mysteriously unpatchable (besides like, tags).
My mod will transform hocon to json when getting resource. So the resource handled by patchedis always json.
Things like tag is loading by the method you haven't touched. Patch the json at there definitely helpful. GL
https://github.com/SettingDust/HoconResourceLoader
The error is https://github.com/EnderTurret/PatchedMod/blob/1.20.x/common/src/main/java/net/enderturret/patchedmod/mixin/MixinFallbackResourceManager.java#L44
THIS is null