Jump to content

[1.16.4] capNBT critical size


S-Spirit

Recommended Posts

I want to store in my ItemStacks big size data. I used capabilities, so all this data serializes into JSON and stores at capNBT. For now capNBT for one stack may be between 100 and 10 000 characters. I think near 3 000 is middle value. I have a few ideas, how make capNBT more short, but doesn't know, should I spend time to it or not. So I have few related questions:
1. Does Forge have limit to capNBT size?
2. Does ItemsStaks from closed chest (in loaded chanck) stores at RAM? Even if user doesn't open it?
3. Maybe exist some another nuances related to big capNBT?

Link to comment
Share on other sites

NBT is for serialization. Capabilities are runtime.

Don't serialize to JSON then store the result in NBT, just serialize to NBT.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

4 hours ago, loordgek said:

what are you trying to do from a end user perspective

I try to stores story of item craft ingredients. In my mode recipes are not strongly determined. So it is not possible to say "if this is X it was exacly created from Y and Z". So I have case when some item was created from 4 another item, and each of them was created from few another and e.t.c

 

4 hours ago, Draco18s said:

NBT is for serialization. Capabilities are runtime.

Don't serialize to JSON then store the result in NBT, just serialize to NBT.

I don't serialize capabilities manually. But at debug I see in ItemStack the field named "capNBT" (with JSON inside), and when I checked it size I started to worry

Edited by S-Spirit
Link to comment
Share on other sites

32 minutes ago, S-Spirit said:

I don't serialize capabilities manually.

Well there's your problem.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

10 minutes ago, Draco18s said:

Well there's your problem.

Sorry, I am confused a little. I implements writeNBT and readNBT methods for my capability. In this methods I construct nested CompoundNBT, ListNBT and e.t.c. Don't serializes all data to JSON and stores like NBT with 1 element. Is it right way?

 

1 minute ago, loordgek said:

no but syncing nbt to the client does have a limit

 

yes

Thanks. So I should remove this feature or implement it by more compact way.

Link to comment
Share on other sites

17 minutes ago, S-Spirit said:

I implements writeNBT and readNBT methods for my capability. In this methods I construct nested CompoundNBT, ListNBT and e.t.c. Don't serializes all data to JSON and stores like NBT with 1 element. Is it right way?

If you're using nested CompoundNBT and ListNBT and all that, then what are you doing with JSON?

JSON is a serialization format.

NBT is a serialization format.

They are not the same thing even if they do the same job.

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

27 minutes ago, Draco18s said:

If you're using nested CompoundNBT and ListNBT and all that, then what are you doing with JSON?

JSON is a serialization format.

NBT is a serialization format.

They are not the same thing even if they do the same job.

Oh, you are right! This string inside "capNBT" looks very similar to JSON and I thinked, NBT is system for wrapp and simplify JSON serialization. Thanks for clarification and sorry about that misunderstanding.

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.