Posted June 11, 20223 yr Hey guys, I'm updating my mod to 1.19 and I realized, the "getRegistryName()" method for blocks and items anymore. I guess there's a new way for that I don't know about yet? To be more specific, I've created a block overriding the use(...) method, and I want to check in there, whether the held item is from my own mod (then nothing should happen). In 1.18 and prior I achieved this via public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitresult) { //The item the player is holding Item item = player.getItemInHand(hand).getItem(); if (!level.isClientSide) { //compare namespace of item whether it is from my mod -> then nothing should happen if(item.getRegistryName().getNamespace().equals(BlockCarpentryMain.MOD_ID)) { return InteractionResult.PASS; } ... } } But now the getRegistryName() can't be called anymore and the ForgeRegistryEntry class seems to be gone. So my question is: Is there a new or different method now? Or should I do something completely different to retrieve the item's origin? As always, many thanks in advance for your help! Regards, Manu
June 12, 20223 yr Holy cow, that is not how you should handle that. It's your OWN item, you can override the OnUse code in a custom item class instead of using events. Its for a block? Use a custom BlockItem. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.