Jump to content

[1.8]How you create a mouse event to use leftclick in custom actions ?? <SOLVED>


Recommended Posts

Posted

good days

 

i wanna use left click to make somethink whith a custome item a sort of

onItemRightClick() but  onItemLeftClick() version

 

time ago someone tell that a must create a custom event thath time  i tink wass done whit a KeyInputHandler class

and let it for later

and now i realize thath nop dont works this way 

 

package mercenarymod.utilidades;

import org.lwjgl.input.Mouse;

import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import mercenarymod.utilidades.gearbox;

public class KeyInputHandler {

    @SubscribeEvent
    public void onKeyInput(InputEvent.KeyInputEvent event) {
       
    	if(KeyBindings.gearup.isPressed()){
            System.out.println("gearUp");
            gearbox.up();}
            
        if(KeyBindings.geardown.isPressed()){
            System.out.println("geardown");
        	gearbox.down();}
       
        
        if(KeyBindings.extraer.isPressed()){
            System.out.println("extraer");
        	//todavia nu se que hacer con el pero nesesita world and entityplayer ;
                                           }
        
        if (Mouse.isButtonDown(0)){System.out.println("Botton Zero");}
        
        if (Mouse.isButtonDown(1)){System.out.println("Botton Uno");}
        
        if (Mouse.isButtonDown(2)){System.out.println("Botton Dos");}
        
        
    }

}

 

well i get stuck  an have no idea of wtha i m doing

 

how do you make a custom event trigger by left click ??

Posted

 

is so easy that i get embarrased

 

 

public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack)
    {

	World worldIn=entityLiving.getEntityWorld();
	EntityPlayer playerIn=(EntityPlayer) entityLiving;

	System.out.println("SWING"+"entityLiving="+entityLiving.getName()+"\n Mundo="+worldIn.isRemote+"\n playerIn="+playerIn.getName());


        return false;
    }

 

[19:30:40] [Client thread/INFO] [sTDOUT]:

SWINGentityLiving=Player380

Mundo=true

playerIn=Player380

[19:30:40] [server thread/INFO] [sTDOUT]:

SWINGentityLiving=Player380

Mundo=false

playerIn=Player380

[19:30:43] [Client thread/INFO] [sTDOUT]:

SWINGentityLiving=Player380

Mundo=true

playerIn=Player380

[19:30:43] [server thread/INFO] [sTDOUT]:

SWINGentityLiving=Player380

Mundo=false

playerIn=Player380

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.