Topic category: Help with MCreator software
Hey!
So in a mod I need an action that when you right click an item in the air, it will check if you have 40 XP levels.
If you do, it will take 40 away and give an item.
I have tried the command "/xp -40L @p" but it will happen even if you have less than 40.
Even then, I can't see how to make an if/then action with this.
I found this piece of code from "nigathan":
if (player.level >= 5) {
player.addLevel(-5)
player.giveItem(...)
}
So in MCreator, I set it to where if you right click the item in the air it will run that code.
But when exporting the mod, I get 2 errors:
error: ';' expected player.addLevel(-40)
error: ';' expected player.giveItem(mcreator_testLightsaberXP.block)
I just need a way for this to work, whether the code gets fixed or a work-around.
Sorry for such a long post :D
Any help would be appreciated.
have you tried global events
I looked at that, but these trigger an event. But I need an event, not a trigger.
This was the first result on google when I wanted to do the same, found most of the code blocks in Math and Logic to get "if [[get xp level of [player]] greater than or equal to [5] then [remove [5] xp levels from [player], [add [item] to [player] inventory]"