Jump to content

[1.5.2]A mod tried to open a gui on the server without being a network mod


Recommended Posts

Posted

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

Posted

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 ?

 

Posted

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.

Posted

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:

MNGk0cZ.png

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?

Posted

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.

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.