February 6, 201411 yr Author new TileEntityCharacter() ...Really. A new tile entity. No no no no. You have a tile entity somewhere that is involved. Generally when the player right clicks it is when you open a gui for it. That method is inside a tile entity and has reference to itself. Unfortunately with the code you have supplied I'm not sure you even HAVE a tile entity anywhere. So I don't know why you're trying to reference it at all. I think I figured out, but it crashes with a NPE: private void openCharacterGui(Packet250CustomPayload packet, EntityPlayer player) { DataInputStream inputStream = new DataInputStream( new ByteArrayInputStream(packet.data)); TileEntity tileEntity = player.worldObj.getBlockTileEntity((int)player.posX, (int)player.posY, (int)player.posZ); player.openGui( ExoWorld_Client.instance, GuiRegistry.guiCharacter, player.worldObj, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); //<------------------------ Here System.out.println("Gui Aperto!"); } I think because xCoord, yCoord and zCoord are empty
February 6, 201411 yr I am not going to repeat myself, so i'll quote Draco: floor, ceiling, round...none of those are going to locate a tile entity that encases the player's feet. You should get the location of the tile entity from itself and pass the xyz in the packet. And add that question: what is TileEntityCharacter supposed to do, and why do you insist on locating it inside the player ?
February 7, 201411 yr No: TileEntity tileEntity = player.worldObj.getBlockTileEntity((int)player.posX, (int)player.posY, (int)player.posZ); Your tileEntity is null. Because there's no tile entity AT that location. This has been your problem from the beginning. There is not, will not, never has been a tile entity at the player's feet because THERE IS NO ENTITY THERE so stop trying to reference it. You get a crash on that line because null does not have an xCoord value. 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.
February 7, 201411 yr Author No: TileEntity tileEntity = player.worldObj.getBlockTileEntity((int)player.posX, (int)player.posY, (int)player.posZ); Your tileEntity is null. Because there's no tile entity AT that location. This has been your problem from the beginning. There is not, will not, never has been a tile entity at the player's feet because THERE IS NO ENTITY THERE so stop trying to reference it. You get a crash on that line because null does not have an xCoord value. I think I need to change everything, because my intention was a new inventory gui (not like the standard one, but like the inventory character of every RPG) here's the screen: I need to delete tileentity, make a NEW container and a NEW gui (I delete the old ones) and then open it with "Minecraft.getMinecraft().displayGuiScreen();" right?
February 7, 201411 yr Yes. Delete the tile entity. You're not using a tile entity. At all. Anywhere. Get rid of it. Player inventory screen is not a tile entity. 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.
February 7, 201411 yr I need to delete tileentity, make a NEW container and a NEW gui (I delete the old ones) and then open it with "Minecraft.getMinecraft().displayGuiScreen();" right? You can keep your GuiCharacter and ContainerCharacter. Just delete anything related to TileEntityCharacter.
February 8, 201411 yr Author Finally, it works! It opens the gui, but it isn't resized as well. I'm fixing this problem right now, if you can help me then do it
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.