Started by
Sir William Walrus
on
Topic category: Help with Minecraft modding (Java Edition)
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!
create a procedure like this:
save and build it. then "edit code of selected mod element" where the mod element is the the procedure you just created.
change the RightClickItem to RightClickEmpty, and comment out the 2 lines circled. save and build. done.
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?
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!
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
Ahhhh I see! Can you recommend and videos of forums to fix this? I would take like to get it figured out! :)
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)
Where is this "AND" block? The only one I could find is the one with 2 available spots (the one with = )