Started by Gabriel0314 on Sat, 07/17/2021 - 22:05
Topic category: Help with MCreator software
I am making a brawler class and I want to make sure the player is attacking with his fist. I don't know how to check if a player is not holding anything. Please Help!
You can try to check if "item in main-hand" is "Air". Not sure if it works (didn't test that myself), but it can work since "Air" is usually used for any "empty" element (for example in crafting or GUI).
Thank You this Works
This stopped working a few days after testing it. :( I need a new solution
try replacing "air" with "empty itemstack", personally using empty itemstack worked for me
in code it'd look something like this when checking for "provided itemstack"
or this, when checking for item in mainhand:
or differently, depending on where you use it. but take note that ItemStack.EMPTY should be what we're always gonna be looking for. basically we'd need to check if the item being held is equivalent to ItemStack.EMPTY ("Empty Itemstack" in procedure) as it's what actually tells the game that a certain item is indeed empty; checking for air won't work all the time i believe
how do i do this wihout custom code
im using procedures cus idk how to code
oh wait i figured it out
lol yea, in my 2nd comment i wasn't telling you to code it :P
in my 1st comment i said replace "air" w/ "empty itemstack", that's the only important thing you needed to know; the code is simply a demonstration of how it would like in code, as well as a few technical explanation as to why empty itemstack should be used ^^
demonstration of how it would look like*, sorry