Started by
TheBananite1
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make a block where you need to right click it with a certain item multiple times for it to charge up, does anybody have a simple procedure for this?
Hi, TheBananite1!
There is actually a simple way to do this. You need to make different textures and block elements for each stage of your custom block and connect them all with one procedure, testing for an item in your main hand that would add charges to the block and replacing a block itself, changing it to the next "stage".
Hope that helps!
Sorry, I'm still a bit new to Mcreator and its procedures, is it possible for you to recreate the procedure and send an image?
Sure! I can write a step by step instructions on how you can do it yourself!
1. Create a block element you will to be charged and create another block elements, which will be charged versions of the basic block (how many depends on how many stages you want). I did it like this:
I made textures with I, II, III number on them to make it clearer where I used which block.
2. Now you need to make some procedure elements though the "Trigger" tab after creating all blocks you need. Go to first block's "Trigger" tab (for me it is "Charge 1") and the hit the plus button of the first trigger called "On block right clicked". You can name it whatever you want. After that you need to check for a particular item in the main hand (I chose a diamond, see the picture below) with which you will be changing the stage of the block you clicked on and then replace this block with the one which will have the next stage. I added an action to remove 1 amount of item that I used only when player is in survival mode. I did it like this:
Don't forget that that procedure should be attached to the trigger called "On block right clicked". Double check that to be sure!
3. And that is actually it. For each next stage you only need to change block in "Replace block at..." procedure. In general, I made 3 blocks and 2 procedures for them and check what I've got as a result!
Tip: you can always add more procedures in the "do" section like playing custom or already existing Minecraft sounds or whatever you want.
Hope that helps!
Thanks for the help! You actually helped me learn a bit more about procedures because of this!
You are welcome! I am glad that I could help you!