Code to fire a projectile with left click

Started by Spyjetray on

Topic category: Help with modding (Java Edition)

Last seen on 14:17, 4. Dec 2020
Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Code to fire a projectile with left click

Hi,

I want to make a piece of armour that when you wear it and press left click, it fires a projectile, regardless of what's in your hand.

I'm aware that this can be done with coding with a keypress event but I am clueless when it comes to coding and I can't find any tutorials for what I need.

Can someone write the code I need to make something like this work, or at the very least, link a tutorial on how to make somethiing like this?

Thanks.

Last seen on 18:54, 23. Aug 2023
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You don't need to code, all…
Tue, 09/01/2020 - 01:21

You don't need to code, all you need to do is use the procedure system within MCreator. Using the "player on left/right click in air" trigger or something, check if the player is wearing the armor, and if so, use the procedure block that launches a projectile.