Jump to content

Error loading mod outside dev environment


xoombie

Recommended Posts

On 1.15.2 - 31.2.0 mod runs fine in dev environment, but fails at the first of the following lines during common_setup event phase. If the first line is omitted, it fails on the second, indicating a general problem with symbol lookup in the runtime only environment:

 

this.updateAutoJump = ObfuscationReflectionHelper.findMethod(ClientPlayerEntity.class, "updateAutoJump", float.class, float.class);
this.mouseButtonSimulate = ObfuscationReflectionHelper.findMethod(MouseHelper.class, "mouseButtonCallback", long.class, int.class, int.class, int.class);

 

The relevant part of build.gradle:

minecraft {
    [...]
    mappings channel: 'snapshot', version: '20201216-1.15.1'
    //mappings channel: 'snapshot', version: '20200514-1.15.1' // also doesn't work
    [...]
}

 

Has anyone else encountered this problem?

 

Have researched for a day now, and just cannot see why the SRG names are not being consistently handled by ObfuscationReflectionHelper

 

Any help greatly appreciated

Link to comment
Share on other sites

On 12/16/2020 at 1:27 PM, diesieben07 said:

You have to give ObfuscationReflectionHelper the SRG names, not the MCP names.

Got it working.

 

Thanks for clearing up some confusion for this noob.

 

In case anyone else finds it useful, the SRG names are the cryptic kind, eg

func_189810_i

 

The dev environment will also accept human-friendly MCP names as ObfuscationReflectionHelper arguments, eg

updateAutoJump

 

The runtime-only environment (ie, during normal use) only works if ObfuscationReflectionHelper has SRG name arguments.

 

My working code now looks like:

 

        this.updateAutoJump = ObfuscationReflectionHelper.findMethod(ClientPlayerEntity.class, "func_189810_i", // func_189810_i = updateAutoJump
                float.class, float.class);

        this.mouseButtonSimulate = ObfuscationReflectionHelper.findMethod(MouseHelper.class, "func_198023_a", // func_198023_a = mouseButtonCallback
                long.class, int.class, int.class, int.class);

 

Useful links:

 

MCP, environments and naming

Tool for looking up SRG names

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.