So I am using an if statement to check if the item in main hand is a custom sword item I have made.
@SubscribeEvent
public static void living(LivingEvent live) {
LivingEntity player = live.getEntityLiving();
if(rightclick) {
rightclick = false;
if(player.getHeldItemMainhand().getItem() == //I dont know what to put here){
}
}
}
I have my item under a Registry Handler, but if I write this,
player.getHeldItemMainhand().getItem() == RegistryHandler.MY_ITEM
it doesnt work.
But it works for vanilla minecraft items if you write,
player.getHeldItemMainhand().getItem() == Items.STICK
So I am using an if statement to check if the item in main hand is a custom sword item I have made.
I figured it out. All you have to do it add .get() at the end.
player.getHeldItemMainhand().getItem() == RegistryHandler.MY_ITEM.get()