Jump to content

TileEntity not loading


XZelnar

Recommended Posts

Hi, everyone!

I'm writing a little mod which adds blocks of different shape to minecaft. Each block has a TileEntity, which stores its type and texture index. When I place such blocks, they look fine and work as they are supposed to. But when I relog to my world, the TileEntityes do not load properly. Through debugging I found out, that they ARE loading (readFormNBT is called), but then block doesn't seem to have it. It also doesn't output any errors neither in console, nor in MFL log. My assumption is that it is loaded on the server side, but not on the client side (because the class constructor is called twice, when readFromNBT is called only once).

I've already tried to google the problem, but found nothing.

What could be causing that and what should I do to fix it?

P.S. Sorry for my bad english=)

Link to comment
Share on other sites

You need to use TileEntite's packet to tell the client what it should of read from the NBT.

As the client doesnt store the world file anywhere it relies on special packets to describe what tile entites are to it.

This has nothign to do with Forge, its just you havent written your TileEntity fully.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Thanks for your quick reply.

I'll try this in the morning, although I'm not quite sure how to do that.

 

Upd. 1:

So I looked at TileEntitySign class and saw the method I was missing. Thanks a lot for your patience and sorry for the stupid question=)

Link to comment
Share on other sites

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.