How do I make an armor set that when you right click with an empty hand, a command/procedure is run?

Started by Sir William Walrus on

Topic category: Help with modding (Java Edition)

Last seen on 07:25, 26. Mar 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make an armor set that when you right click with an empty hand, a command/procedure is run?

Hello! I have been using MCreator for a bit now, but just recently diving into the fun procedures. I am trying to figure out how to make a set of armor that when fully equipped, the player can right click with nothing in their hand to run a command. 

To be more specific, the armor is edible and I want the player to be able to take a bite out of it to regain food level. BONUS POINTS for also figuring out how to damage the armor on use.

Any help is greatly appreciated, thanks!

Last seen on 05:29, 31. Jan 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
create a procedure like this…
Mon, 03/15/2021 - 12:32

create a procedure like this:

https://cdn.discordapp.com/attachments/599250311852458006/820988537087328286/unknown.png

save and build it. then "edit code of selected mod element" where the mod element is the the procedure you just created.

https://cdn.discordapp.com/attachments/599250311852458006/820997476424876032/unknown.png

change the RightClickItem to RightClickEmpty, and comment out the 2 lines circled. save and build. done.

Last seen on 07:25, 26. Mar 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you so much ahznb!…
Mon, 03/15/2021 - 18:37

Thank you so much ahznb! This worked perfectly. I greatly appreciate it. Do you know by any chance how I can damage all of the armor when the procedure is called? So when the player right clicks to call the procedure, armor/durability is damaged?

Last seen on 05:29, 31. Jan 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
(No subject)
Tue, 03/16/2021 - 01:00

https://cdn.discordapp.com/attachments/599250311852458006/821186034410717194/unknown.png

Last seen on 07:25, 26. Mar 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You're a legend. Everything…
Tue, 03/16/2021 - 03:39

You're a legend. Everything seems to be working perfectly except for one last thing I could really use your help on!

So this is my current procedure below, but now there is a bug that popped up. I can right click to air with nothing in my hand to run the procedure and gain +2 food onto my current food level. The problem is that whenever I "take a bite of the armor" with right click, it seems to add a fake food level onto my current. It's hard to explain, but basically I don't think it is actually giving me the +2 like how it should. Even when it looks like my food bar is full, I do not regain health. When I eat a regular item after, it shows my real food level and goes back to normal. Any idea why this is happening? I can get you a video too if that would help. Thanks again, ahznb, I really appreciate the help!

Last seen on 05:29, 31. Jan 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
yeah thats probably because…
Tue, 03/16/2021 - 12:34

yeah thats probably because the procedure is running on the client side only. you need to tell the server to update your food levels. which requires a lot more coding

Last seen on 07:25, 26. Mar 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ahhhh I see! Can you…
Tue, 03/16/2021 - 17:19

Ahhhh I see! Can you recommend and videos of forums to fix this? I would take like to get it figured out! :)

Last seen on 05:29, 31. Jan 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
jabelar made a nice page to…
Wed, 03/17/2021 - 07:59

jabelar made a nice page to help with lots of minecraft modding - http://jabelarminecraft.blogspot.com/ some could be outdated, but its a nice read.

or you could just learn it from mcreator generated code. like when you create a keybind element in mcreator, look in the code thats generated, it does exactly what you want -- send custom data to the server or schedule a task to run on the server. you just have to copy some parts of that code and modify for your needs.

after you understand it, you'll need to put the code in the procedure that you just created with the code snippet. but this time, instead of using code snippets, you'll need to lock and manual edit the source code (can't use those nice code blocks anymore)

Last seen on 18:25, 25. Jul 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Where is this "AND" block?…
Sun, 07/24/2022 - 12:28

Where is this "AND" block? The only one I could find is the one with 2 available spots (the one with = )