Left Click With No Item In Hand

Started by lol_LLG on Sat, 11/05/2022 - 09:23

Topic category: Help with modding (Java Edition)

Last seen on 15:39, 20. Dec 2022
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Left Click With No Item In Hand
Sat, 11/05/2022 - 09:23

I have a huge problem: i want to run a procedure when the player left clicks, but there is no keybinding for that. I want also that the procedure is runnable only if the player has no item in main hand. I'm desperate because to detect the left click i have to use global triggers like "player uses item" or "player left click on block" or "entity attaked" (setting the sourceentity logic nbt tag "leftclicked" to true), BUT i don't want items in hand and i don't want to hit an entity to trigger the procedure ("player left click on block" trigger is useless to me).

Other details to what i want to do: i want that when a player has a custom effect, has no items in main hand, and left clicks, even if has clicked in air, it run a procedure that shoots a fireball, whatever the player has clicked.

I searched everywhere but i didn't found the answer. I hope someone can answer.

Sorry for the bad english.

Last seen on 00:40, 27. Jan 2023
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I recommend using a custom…
Sat, 12/03/2022 - 18:36

I recommend using a custom keybind for this. Add a new keybinding, set it to left click by default, and then add your trigger for whenever that button is clicked. You'll want to make sure you check that the player has an empty itemstack in their main hand, and probably check that they don't have any menus open, or it will literally trigger whenever the left-click button is pushed.

Last seen on 15:39, 20. Dec 2022
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I created the keybind but i…
Thu, 12/08/2022 - 14:35

I created the keybind but i can't set it to left click, or i don't know how to do. In the given list of keys there aren't left\right click.

Last seen on 00:09, 27. Jan 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
If you use fabric with…
Thu, 12/08/2022 - 15:34

If you use fabric with fabric essentials, there is a new global trigger for when a player left clicks

Last seen on 15:39, 20. Dec 2022
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thank you very much for your…
Tue, 12/20/2022 - 08:26

Thank you very much for your tip, but i use forge. I will consider the option of rebuild all the mod in fabric version, but i prefer continuing use forge version.