PlasmaBlazer Posted December 27, 2014 Share Posted December 27, 2014 So for my mod I want to remove the item form the players inventory with onItemRightClick() but whenever I try this the game crashes. I have looked all over the internet and in the minecraftForge classes to find out how to do this but everything I try dosent work, here is the code for the method: @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(stack.getItemDamage()==2 && this.getResearch()!=null && player.getEntityData().getTag(this.getResearch())==null) { PlayerResearch.addResearch(player, this.getResearch()); stack.stackSize--; } return stack; } Any help would be appreciated Quote Link to comment Share on other sites More sharing options...
Elix_x Posted December 27, 2014 Share Posted December 27, 2014 Crash report please. I'm sure it crashes not on stack.stacksize--; Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
Degubi Posted December 27, 2014 Share Posted December 27, 2014 Do the nullChecks before checking the item dmg. Quote Link to comment Share on other sites More sharing options...
PlasmaBlazer Posted December 27, 2014 Author Share Posted December 27, 2014 Managed to solve the problem, it was actually being caused by the NBTTagCompound not being declared properly, DERP! Quote Link to comment Share on other sites More sharing options...
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.