Jump to content

TileEntity problem


vpklotar
 Share

Recommended Posts

Okay so I just got into modding, I have quite a bit experience with Java as I've created a java game as the project before this one, anyways my problem is that i have one TileEntity on the server and one on the Client, the problem is that they don't sync there variables :( So my problem is that I do get power into both entities, although one is drained bu the client gui still think it have power as it gets the client entity instread of the server entity  :'( I've been googling around for quite a time now and haven't found any solution to this so I hope i can get some here!

 

The TileEntity: https://github.com/vpklotar/Industrial-Line/blob/master/src/se/vpklotar/li/block/furnace/FurnaceEntity.java

The block: https://github.com/vpklotar/Industrial-Line/blob/master/src/se/vpklotar/li/block/furnace/Mk1Furnace.java

 

Main file: https://github.com/vpklotar/Industrial-Line/blob/master/src/se/vpklotar/il/Il.java

Link to comment
Share on other sites

there are methods called getDatapacket and onDataPacketrecived in the TileEntity. These get passed from the server to the client every time the block is marked for an update (via world.markBlockForUpdate). You can write the NBT for the server tile to the packet sent form this, then read it on the client. That's how i do it for one of my tile entities, Not quite as complex as yours but it should still apply.

Link to comment
Share on other sites

Sync with packets, using the classes in the FML.packet (or something like that, look for PacketDispatcher) and the getDescriptionPacket() in TileEntity.

 

Don't use too many packets, you'll bog down the server, client, and everything else on your computer.

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

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
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.

 Share



×
×
  • Create New...

Important Information

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