MainBreezy Posted March 28, 2024 Posted March 28, 2024 Im new to Forge modding and wanted to make a mod as a self project. Im trying to test if the player is holding a specific item when an event happens but it seems to not be doing anything. if(player.getItemInHand(InteractionHand.MAIN_HAND).equals(new ItemStack(ItemInit.SOUL_POUCH_ARTIFACT.get()))){ player.sendSystemMessage(Component.literal("Test")); } I know the event works because it runs fine without the if statement. Thanks. Quote
dee12452 Posted March 28, 2024 Posted March 28, 2024 Try if(player.getItemInHand(InteractionHand.MAIN_HAND).getItem() == ItemInit.SOUL_POUCH_ARTIFACT.get()) { player.sendSystemMessage(Component.literal("Test")); } Quote
MainBreezy Posted March 28, 2024 Author Posted March 28, 2024 9 minutes ago, dee12452 said: Try if(player.getItemInHand(InteractionHand.MAIN_HAND).getItem() == ItemInit.SOUL_POUCH_ARTIFACT.get()) { player.sendSystemMessage(Component.literal("Test")); } Yeah it worked ty!! 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.