Jump to content

[SOLVED] Container not working unless you open the gui.


Recommended Posts

Posted

I got a TileEntity that has also a Container and a Gui.

 

That said, it has only one slot and i write the contents to NBT and also read it.

 

When i put the itemstack inside all works perfectly. But when i log out and relog in, the server seems to be working fine (things are happening) but the client is not recognising the item inside unless i open the gui. Then all the animations that depend on that item can trigger after that.

 

Anything i missed? Packets? Sever or client only things? "!world.isRemote"?

 

EDIT: this is the TileEntityCode. I'll explain a bit.

 

  Reveal hidden contents

 

Posted
  On 10/10/2014 at 8:41 AM, MultiMote said:

People recommended S35PacketUpdateTileEntity.

 

Look at TileEntityFlowerPot@getDescriptionPacket for example.

 

Okay! thanks! gonna explore that.

Posted

SOLVED

 

Thank you very much.

 

This is what i added to the TileEntity:

 

public Packet getDescriptionPacket() {
	NBTTagCompound nbttagcompound = new NBTTagCompound();
	this.writeToNBT(nbttagcompound);
	return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord,
			this.zCoord, 5, nbttagcompound);
}

public void onDataPacket(NetworkManager net,
		S35PacketUpdateTileEntity packet) {

	readFromNBT(packet.func_148857_g());
}

 

:D

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.