Posted September 29, 201510 yr I am making a gun mod in which you right click or left click and you will aim your gun but in the events and messages their is in a crash i have read in the crash report that it is the holding gun fault anyway here is the code. crash report http://pastebin.com/6wAD7k4d holding gun code http://pastebin.com/aAbuR5zN
September 29, 201510 yr You can't do this: heldItem.stackTagCompound.getInteger("zoomed") Without 1st checking if ItemStack has NBT. Default is NULL. Item only has NBT if you assign one. Btw - you know about IExtendedEntityProperties right? Holding data in IEEP would be better (considering you need to know if player is aiming) than in ItemStack, just saying. 1.7.10 is no longer supported by forge, you are on your own.
September 29, 201510 yr Author http://files.enjin.com.s3.amazonaws.com/499751/modules/forum/attachments/help_1420178371.png
September 29, 201510 yr ItemStack#stackTagCompound can be null. and diesieben told you what the problem is. I thought u wre coming up with a new problem
September 29, 201510 yr Author tried everyting i know could you guys help aiming event http://pastebin.com/Ma8uZjup aming message http://pastebin.com/sZpwjsjZ not holding gun http://pastebin.com/LDG8j3dS already go the notholding gun class
September 29, 201510 yr You can't do this: heldItem.stackTagCompound.getInteger("zoomed") Without 1st checking if ItemStack has NBT. Default is NULL. Item only has NBT if you assign one. DO THE NULL CHECK! As to other stuff: You know that you can use InputEvent.KeyInputEvent and do all that you are doing in ClientTickEvent, just more efficient. Also: MinecraftForgeClient.registerItemRenderer(Mitems.g17, new Renderg17Aim()); WHAT THE HELL. Registering stuff happens ONLY in Mod#init() !!! Make ONE renderer with two cases. 3rd: message.value = 2; What's the point of this? 4th: EntityPlayer player = ctx.getServerHandler().playerEntity; EntityPlayerMP playermp = ctx.getServerHandler().playerEntity; Why? Bro, there is so much bad coding in there I can't comprehend it! 1.7.10 is no longer supported by forge, you are on your own.
September 29, 201510 yr ItemStack#stackTagCompound can be null. you are still not checking for the tag compouind beeing null
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.