Jump to content

Recommended Posts

Posted

Hi, i want to activate a press event (like left or right mouse click) using a command in my mod.

example "code"

public void exampleFunction{
   if(condition){
       leftMouseClick();
   }else if(condition2){
       pressH();
   }else{
       rightMouseClick();
   }
}

I have a good java experience, but a very little experience for making mod (i'v only make a tutorial mod).

Anyone can help me?

Posted

If you are working on a client side mod the Minecraft class is your way to go.

It has two methods "rightClickMouse" , and "clickMouse". You are free to guess what they do.

The methods are private, so you need to use reflection to call them

Posted

How i find this 2 methods? You can post me an example?

I didn't know what is and how to use "reflection"  :-[

 

I already told you how to find them. They are in the minecraft class. If you are inside the class u can use Strg+F to search

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.