Posted February 6, 20169 yr 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?
February 6, 20169 yr 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
February 7, 20169 yr Author How i find this 2 methods? You can post me an example? I didn't know what is and how to use "reflection"
February 7, 20169 yr 1.1. IDE "Search" tool. You HAVE TO learn to use it. 1.2. Reading source (yes, MC source and callbacks). 2. Pretty much: https://docs.oracle.com/javase/tutorial/reflect/ More on google. Point of interest (regarding moddig): ObfuscationReflectionHelper. 1.7.10 is no longer supported by forge, you are on your own.
February 7, 20169 yr 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.