ModMCdl Posted November 2, 2017 Posted November 2, 2017 (edited) Hey, so in my custom GUI, I'm getting a NullPointerException directed at the following override: (according to the console) @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(!worldIn.isRemote) playerIn.openGui(Reference.MOD_ID, GuiHandler.PESTLE_GUI, worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; } I just can't figure out why I'm getting this error. Crash report: https://pastebin.com/NyFi0T5X My GUI Handler: https://pastebin.com/b4w8x1Zf My Container: https://pastebin.com/YYhks7au Edited November 3, 2017 by ModMCdl Solved Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 On 11/2/2017 at 9:58 PM, diesieben07 said: How is the stack "directed at the override"? There is no reference to the code you posted in the stack trace. The issue is caused by a Slot having a null reference for it's inventory. In this case it can only be either the TileEntity or the player inventory. The latter is very unlikely. Please show your whole Block class. Expand An error in the console was pointing at it, must have been a fluke. Block Class: https://pastebin.com/hHA0scMf Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
Draco18s Posted November 2, 2017 Posted November 2, 2017 Or rather, show the TileEntity class Quote 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.
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 On 11/2/2017 at 10:01 PM, Draco18s said: Or rather, show the TileEntity class Expand TileEntityPestle.java https://pastebin.com/x1n5wapC Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 On 11/2/2017 at 10:06 PM, diesieben07 said: Your block does not override hasTileEntity, as such it does not have a TileEntity. Expand Ah, didn't realize that was a thing I needed to do! What would I put in the override here? Would I just return the tileentity I made? Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 (edited) On 11/2/2017 at 10:10 PM, diesieben07 said: Please read the documentation for the method. It clearly explains what it does. It is also f***ing self-explanatory. Expand Alright, no need to get all up in arms. I'm still learning here. And you going off doesn't help anyone who comes to this post in the future trying to solve the same problem. Edited November 2, 2017 by ModMCdl Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 On 11/2/2017 at 10:06 PM, diesieben07 said: Your block does not override hasTileEntity, as such it does not have a TileEntity. Expand Would I also need to override createTileEntity and, because I'm delving into new territory here, are there any thorough examples/explanations for how this is done? (Besides the documentations which helped me very little. Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 On 11/2/2017 at 10:58 PM, diesieben07 said: You need to both override hasTileEntity and createTileEntity, yes. The documentation has no information about TileEntities, I'd be curious what little help you got out of it despite that. Expand I went here: https://takahikokawasaki.github.io/minecraft-resources/javadoc/forge/1.8-11.14.1.1320/net/minecraft/block/Block.html#hasTileEntity(net.minecraft.block.state.IBlockState) Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 On 11/2/2017 at 11:03 PM, diesieben07 said: That is neither official nor up to date in any way, shape or form. Expand You directed to me "read the documentation for the method" and that was the only documentation I found. Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 On 11/2/2017 at 11:05 PM, diesieben07 said: You have an IDE, do you not? Expand It only gave me the standard Overrides "x" method Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 On 11/2/2017 at 11:07 PM, diesieben07 said: Yours must be broken then, you should look into fixing it: Expand I use eclipse. It has never done that. Hovering over the method is what brings up said explanation, and I only get "Overrides hasTileEntity" and the path. Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
Draco18s Posted November 2, 2017 Posted November 2, 2017 *Cough* This: Quote 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.
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 Once I overrode hasTileEntity and createTileEntity, I now error in my TileEntityPestle class. https://pastebin.com/15r7mcCS Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
Draco18s Posted November 2, 2017 Posted November 2, 2017 Your inventory is size 3. this.addSlotToContainer(new Slot(tileentity, 0, 31, 24)); this.addSlotToContainer(new Slot(tileentity, 1, 66, 43)); this.addSlotToContainer(new SlotPestleOutput(player.player, tileentity, 3, 119, 30)); 0, 1, 3. Yes. That is how we count. Quote 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.
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 On 11/2/2017 at 11:21 PM, Draco18s said: Your inventory is size 3. this.addSlotToContainer(new Slot(tileentity, 0, 31, 24)); this.addSlotToContainer(new Slot(tileentity, 1, 66, 43)); this.addSlotToContainer(new SlotPestleOutput(player.player, tileentity, 3, 119, 30)); 0, 1, 3. Yes. That is how we count. Expand Hahahahahaha NOW I feel stupid. I replaced everything that referenced the mysterious "slot 3" and reset the index to 0, 1, 2. Now the GUI works, it doesn't crash, and now I just have to figure out why the crafting recipes don't actually work! Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 (edited) Side note, what's the updated name for transferStackInSlot. It doesn't seem to be working for me in 1.11.2 Please just ignore that, I'm an idiot. Edited November 2, 2017 by ModMCdl Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 2, 2017 Author Posted November 2, 2017 On 11/2/2017 at 11:54 PM, diesieben07 said: transferStackInSlot still exists. Expand I am well aware. I'm just an idiot. Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
ModMCdl Posted November 3, 2017 Author Posted November 3, 2017 Now, because I'm very needy, can you also possibly point out what's wrong here with my crafting? I don't get any errors or crashes, it just doesn't work. Pestle Recipe class: https://pastebin.com/15huRuYq Quote Follow these rules when talking to me, and we'll get along fine. 1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them. 2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't? 3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum. ModMCdl - Co-Founder and Director of Design for Artemis Game Studios
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.