Jump to content

[1.7.2] NBT and RAM Mem of ItemStack in MP.


Ernio

Recommended Posts

Hey,

 

Could someone say how correct is my thinking and answer later question:

 

In Multiplayer all NBT data for ItemStacks is saved on server side. Then the ItemStack (with its NBT) is sent to every player that will need to have it, and it will be saved to client's RAM.

 

Now let's say I have 3 string fields (i'll later convert them to integer Id's for .png) in NBT for every MyItem.class ItemStack that hold: "hand_txt", "body_txt" and "blade_txt".

 

Those strings are being read for all items that are instance of MyItem at least one time per tick (not sure) when custom renderer calls it.

public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data)

In this method renderer reads from NBT those 3 fields, pickups right icons and then renders them into one whole item.

 

The question is: Is reading from NBT on client side (since it is renderer) occurs "virtually" on client from itemstack's NBT saved inside RAM or for every tick, every player and every itemstack it is being resent from server and then read.

 

Someone told me that ItemStack NBT is sent to player once per his session, and ONLY updated when the server will detect any change it it's NBT - is this true? (because I really hope so).

 

We all know that reading from NBT (HDD) is something near dozens of thousands slower than RAM, and having it read every tick, for every player and loaded ItemStack will create a freaking LOT of requests to NBT.

 

Help :D Thanks.

 

 

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

What about the second part:

 

"Someone told me that ItemStack NBT is sent to player once per his session, and ONLY updated when the server will detect any change it it's NBT - is this true? (because I really hope so)."

 

Everytime I make request for some NBT data I call something from data I've alredy got on my client's "virtuall" data or I redownload it from multiplayer server?

 

And ofc. thanks for response :D

 

Oh and why is this so important:

Let's say I have 100 players that stand in one place in which there are 1000 items (MyItem.class) on floor/in their hands. Since every itemstack's renderer calls for 3x NBT String fields ("hand_txt", "body_txt" and "blade_txt") on every tick that makes:

20(tick)*100*1000*StringSize (wchich is around 10-20bytes), and that can be equal up to dozens of MB. If that kind of data would be sent from server in one second it would cause total connection crash.

 

And yes - I am reading source myself (right now), just thought you might know some of this stuff alredy.

1.7.10 is no longer supported by forge, you are on your own.

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.