Jump to content

[1.8] onItemLeftClick?


Bedrock_Miner

Recommended Posts

Hello guys!

 

I'm looking for a method that's called when the player left-clicks with his Item. I also want to cancel the actions afterwards.

 

It's easy for  a right-click. Just overriding the method there. But also there I don't know how to stop Minecraft from doing anything else (like pressing the button I look at).

For a left-click I don't even see a method that could do what I want. I only found onEntitySwing() which is called on left-click, but doesn't enable me to cancel block destruction afterwards.

 

Any ideas here?

Link to comment
Share on other sites

I inspected to it and found no way to do that; Left clicking calls Minecraft#func_147116_af(), which directly leads to attacking an entity or breaking a block. So there is no simple method to do what you want..

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

This sounds good! Thank you.

 

Is there also an event for left click in midair?

Nope there's no... (Minecraft.clickMouse() is called when left mouse button is pressed. There's no any events as far as i can see...)

Link to comment
Share on other sites

OK, then I'll try combining the event with the onEntitySwing method.

You should consider subscribing all the possible events, like block clicking and swinging, etc.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.