Jump to content

Recommended Posts

Posted

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?

Posted

This is jus an Idea, but you could try to hook you on a BlockDestructionEvent and check if the player is holding the tool.

 

Greetz Mechtecs

Wot M8 gonna rek ya :D

KAPPA

Posted

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.

Posted

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.

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.