#Help with Recaf (modding)

1 messages · Page 1 of 1 (latest)

clever yarrow
#

Hi! I'm trying to patch a mod im using for a game (not actually minecraft) to fix a crash. I dont really have any previous java experience, so I am not comfortable figuring out how to patch it from the outside at runtime (as in with a different .jar), so im using recaf to decompile the original mod, make changes, and recompile it.
It works fine, but there's a method that i need to change that doesnt get recompiled right, and i am not sure if there is a way to fix it or if its a limitation of the recompiling workflow. any help would be wondeful.

details:

The original mod imports ~.core.AbstractCreature and ~.character.AbstractPlayer from the vanilla game. Using the same decompiler on the game files itself, it seems that AbstractPlayer extends AbstractCreature
the line in question is
if (resourceDirectoryUrl != null && (__instance instanceof AbstractPlayer)) {
and the __instance in question is an argument of AbstractCreature; so by all accounts it should not be causing any problems
As far as i get it, my guess is that the recompiler, having no context for the imports, does not see the code as valid and fails with incompatible types, .AbstractCreature cannot be converted to .AbstractPlayer

Are there any realistic solutions to this? The tooling gives me the option to mess with the compiled java bytecode, but even if that's doable, seems like a poor idea.
I can remove the check in my patch entirely, and that seems to work without causing anything to break (maybe it wasnt necessary to begin with), but i would prefer to keep the original code without changes in the parts that dont need fixing.
are there any options i might be missing?

feel free to ask for more info (unless im asleep)

normal karmaBOT
#

<@&987246652869971988> please have a look, thanks.

hexed dune
#

I think the Minecraft tag isn't suitable for this you can choose Others tag if none match your requirements

#

and another thing is the mod open source and does it allow you to change it if not we can't help

marsh jewel
clever yarrow
#

just woke up
I'll go look into it soon

clever yarrow
marsh jewel
strong wren
#

btw, u should be working with source code, not .class files

#

if u dont have access to the source code what ur doing is likely agains terms

#

in which case u should contact the authors/owners

clever yarrow
clever yarrow
strong wren
#

the error message u shared (and we dont have seen the code its referring to) says that there is some code like Dog dog = animal; or similar

#

which, for obvious reasons, isnt allowed

#

we cant help u apply it to the code or make sense of it if u dont share the full error message of the compiler including the line numbers etc

#

so we know where in the code the bad line is at

clever yarrow
#

well, as i mentioned at the start, it seems like its an issue of the decompiling process / the recompiler not having enough context for the code it can't see? wouldn't know how this works exactly.

strong wren
#

ah, recompilation

#

yeah, its quite rare that u can just recompile like that

#

u most likely need the real source code

#

and build instructions

#

dependencies

#

etc

clever yarrow
#

Thats true, its probably less about me having to come up with some way to mangle the code into compiling and more about setting up the enviroment right if you think about it
ill go bother the dev themselves or the recaf community, i think, doesnt seem like this would be a good place for it with how specific of a situaiton this is

strong wren
#

aye. contacting the dev sounds good. as anything else is technically illegal anyways