Started by
supermj767
on
Topic category: Help with Minecraft modding (Java Edition)
Hello, supermj767 here, I'm going to show you how to make the ability to strip custom log blocks whilst having the ability to place on them without the need of code at all!
I have seen many tutorials on "how to make make a block strippable" but none of them work very well.
Simply create a procedure mod element
Use the "player right clicks block" global procedure :
Then make a procedure that looks like this :
And your done!
If you want to make this work for the off hand (left hand) aswell just change every "Item in main-hand" to "Item in off-hand" and it should work.
This procedure acts exactly as it does in regular Minecraft!
Important: Make sure NOT to apply it to your custom log!
If you have a problem please explain in the comments below and I will help you.
Post any questions or feedback in the comments, Thank you!
Edited by supermj767 on Tue, 10/18/2022 - 20:16
THANKS SO MUCH
No problem!
i'm on mcreator 2024.1 and i can't find the "is [] tooltype []" block
You can use the search bar. Try searching for "tooltype." It should work.
nvm they changed it to "is [] of item type []"
I figured.
I have the problem of not being hable to place blocks on my logs unless I sneak.
I know there's a way to fix it, but it seems like I'm not smart enough to figure out what "not applying the proccedure to the custom block" is supposed to mean.
I've tried things but they all didn't work.
@Azertium Go into your custom block element and do not add the procedure to the right click event. It should look like this - It should say "(no procedure)"
Omg can't believe it was right in front of me this whole time.
Thank you for the help.
No problemo, Good luck on the project! :)
Hi,
This has worked perfectly so far! However, there's a pretty major problem.
When holding a block or similar item with right-click functionality in the other hand, the procedure is run at the same time as whatever the function of the other item held is.
For example, noob-towering while holding an axe in the main or offhand, and holding the custom strippable block in the other hand, will strip the log beneath whenever you jump up and place a new one, but wont cancel the block placement of the new one like vanilla would.
Is there a fix for this?
To elaborate on my previous reply, holding an axe in the offhand but a vanilla log in the mainhand will only place the log and won't strip it, but holding the axe in the main hand and the vanilla log in the offhand will prioritize stripping the log you're looking at, cancelling out the placement of the log in the offhand. Ideally, this should be how the custom procedure works as well.
You cold possibly make sone special case for when it's in your off hand and somitting else is in your main hand. Or possibly use the cancel global trigger procedure block to prevent this from happening. Just try and mess around with it I'm sure there's a way. Hope this helps!
Managed a bit of a workaround (ignore the fact it's an "else if", just using that for multiple wood types). Doesn't let you strip the custom block as long as you've got a block in the other hand, so it doesn't work entirely like vanilla, but meh.
At this point it would genuinely just be easier to follow one coding tutorial or copy/paste how Minecraft strips logs and go off that, but I don't want to have to rewrite that every single time I want to add another block to the mod using MCreator's UI.
Hope this helps other people at least, and if any of you find a way to improve upon it to be closer to vanilla, please let the rest of us know