Jump to content

[1.10.2] ASM transformer crashes in normal but not in dev environment


Recommended Posts

Posted

I've made an ASM transformer to transform a method in the CommandBase class when I used it in the dev environment it worked fine but when I compiled it, it crashed. I tested both on MultiMC and the normal minecraft client both end up with the same result.

 

Right now I have it stripped down to a minimal transformation, so I could see where the fault lies, but I can't find it.

 

crash: https://paste.ee/p/nP0is

log: https://paste.ee/p/BEpYD

Transformer: https://gist.github.com/karelmikie3/f26a6ccc1495678f7c897d359e2961b7

Loader: https://gist.github.com/karelmikie3/e1f5fe78e49f3dbbfecc64c9bc9d4a57

jar: http://puu.sh/rHPtD.jar

Posted

I am Transforming the CommandBase.checkPermission method so I can run the permission check through custom checks of my mod that includes setting custom permission requirements for the commands themselves. I first had one of methods injected into it but it crashed so to eliminate any possible coding error I removed it and made it simply return true.

 

PS. I know about the CommandEvent in CommandHandler.executeCommand but that doesn't reach every call to the method such as the /help command checks if the player can use the command and so does auto tab completion.

Posted

Can't you override ALL the commans with custom command?

I mean, you copy list of all registered commands and then clear the orginal one. Now for each of those commands, you register your command "handler" instantiated with the command.

In your command "handler", you implement command and redirect all method calls to original command, except for the method you want to change...

 

This will work in 97% of the cases. If you want to get additional 3%, you can go for dynamic class generation of subclass of command with overriden methods. Though if you're not experienced enough with ASM, this is not recommended.

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.