Posted May 15, 20187 yr Edit: for break event the hand will always be your main hand and the itemstack you can get off of that don't know why they just didn't throw the enum hand in there in case a mod wants to change something up I must be noob but, there is no hand argument in break speed event and get active hand randomly returns null and crashes the game @SubscribeEvent public void breakFix(PlayerEvent.BreakSpeed e) { EntityPlayer p = e.getEntityPlayer(); String blockclazz = e.getState().getBlock().getHarvestTool(e.getState()); String itemclazz = ItemUtil.getToolClass(EntityUtil.getActiveItemStack(p,p.getActiveHand() ) );//error on this line null point exception if(!blockclazz.equals(itemclazz) ) e.setNewSpeed(1.0F); System.out.println(e.getNewSpeed()); } older version you literally just called player.getActiveItemStack() and it never returned null during events unless the player had no item in that slot here it randomly returns air when it's always pickaxe help. Edited May 15, 20187 yr by jredfox
May 15, 20187 yr 51 minutes ago, jredfox said: String blockclazz = e.getState().getBlock().getHarvestTool(e.getState()); String itemclazz = ItemUtil.getToolClass(EntityUtil.getActiveItemStack(p,p.getActiveHand() ) );//error on this line null point exception if(!blockclazz.equals(itemclazz) ) what are you trying to do??? About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
May 15, 20187 yr Author 4 minutes ago, Cadiboo said: what are you trying to do??? vanilla bugfix if not right toolclass have 1.0F which is what it's suppose to be. I need an itemstack for that Edited May 15, 20187 yr by jredfox
May 15, 20187 yr whats wrong with Spoiler player.getHeldItem(player.getActiveHand()).getItem() Try it before saying it doesn't work You also didn't post your EntityUtil.getActiveItemStack method Edited May 15, 20187 yr by Cadiboo About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
May 15, 20187 yr Author 6 minutes ago, Cadiboo said: whats wrong with Reveal hidden contents player.getHeldItem(player.getActiveHand()).getItem() Try it before saying it doesn't work You also didn't post your EntityUtil.getActiveItemStack method just returns p.getHeldItem(hand); I know it doesn't work always because I changed the toolclasses of diamond ore to axe and set the material to wood then next thing I know the speed is default for pickaxe when it should be 1.0F. It's due to vanilla hard coding a list of blocks rather then comparing block material mods shouldn't have this issue. I mean I could just always get the main hand but, since break speed can only be done with main hand stupid but, for other events I would like to know this. Edited May 15, 20187 yr by jredfox
May 15, 20187 yr 5 hours ago, jredfox said: other events I would like to know this Other events usually have a getHand() method 6 hours ago, Cadiboo said: You also didn't post your EntityUtil.getActiveItemStack method About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
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.