Jump to content

[1.6.2][Fluids] FluidTank synchronisation.


SGStino

Recommended Posts

I'm not entirely sure how minecraft/forge works. I have an inventory made out of ItemStack instances, and if i modify it on a client/server, it'll eventually get synced to all other clients.

 

I mean, if i put an item in the inventory with player A, while player B is logged out, and player B logs in to look at the inventory, he will find the item.

 

However, when i do the same with FluidTanks, when let player A put something in the tank while player B is offline, player B won't see this addition when he logs back in and looks at the tank.

 

What is it that syncs up the ItemStacks in my TileEntity? And why isn't it doing it for the FluidTanks?

 

On a side note: i love the new fluid system if it does what i expect from it by looking at the interfaces! isGasious() etc.., yay!

Link to comment
Share on other sites

The TileFluidHandler is a very basic implementation of IFluidHandler, nothing in there is related with packets, unless NBT is used for packets?

 

But then, why doesn't it work to sync, since the same NBT is used for saving to disk. And that does work correctly, yet syncing clients and server doesn't seem to work.

Link to comment
Share on other sites

But, the tutorials say different. They modify the ItemStacks without regard to world.isRemote.

 

so, let say i don't do anything on the client's itemStacks, then for some reason if i, inside the GuiContainer want to show those items, i get to see them? So i suppose the Slots get the data via packets or something? And the server fills those packets in via the IInventory interface?

 

So if i want the tanks on the client to show up correctly, i look into the Slot code, find how they handle the packets and try to mimick this for fluids? Or is there a FluidSlot i'm missing?

Link to comment
Share on other sites

Well, i can sync TileEntity data between server and clients now with "markBlockForUpdate(x,y,z)" through NBT data, but for some reason i can't seem to find out how the slots are actually synchronized.

 

If a slot changes on the server, the client almost instantly gets to see this change, yet writeToNBT or readFromNBT never get called and the only thing i find in slot is that it uses the IInventory interface of the TileEntity instance on the client. So how does this change propagate to the server, and from there to other clients that are looking at the inventory?

 

It sets the chunk as modified in onInventoryChanged(); and calls func_96440_m, i assume this one notifies neighbors like comparators etc.

 

You probably mean the ICrafting interface then? in detectAndSendChanges? we sync the start and end events of our "crafting" process, so we an update or block renderers with animations accordingly, so doing this in the container isn't an option.

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.