Posted May 24, 201510 yr 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? http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 24, 201510 yr 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 KAPPA
May 24, 201510 yr Author Would be possible if you always play in creative I want to get left clicks instantly and also if you look right up into the air. http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 24, 201510 yr 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.
May 24, 201510 yr Author can't cancel this one.. http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 24, 201510 yr Author This doesn't cancel any block placing/destruction whatsoever. Just the swing animation. http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 24, 201510 yr PlayerInteractEvent??? It is called before any interaction (left click block, right click air, right click block) and can be canceled... Even works with breaking blocks in creative... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 24, 201510 yr Author This sounds good! Thank you. Is there also an event for left click in midair? http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 24, 201510 yr 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...) Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 24, 201510 yr Author OK, then I'll try combining the event with the onEntitySwing method. http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 25, 201510 yr 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.