Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Looking at it from outside - seems easy - just extend NBTBase and make your read/write streams.

 

Looking at the inside - NBT types are hard-coded and even worse - are actually used in few places.

protected static NBTBase createNewByType(byte id)

 

What I want to ask - how would I approach making such array? I was thinking about overriding "createNewByType" + using #writeUTF8StringToBuffer (or something like that, forgot name).

 

Will that work? Maybe someone has such thing in utility? (on my way to check out SevenCommons).

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

One way to save string Arrays to NBT is use a Standard compound, set one integer Holding the length and then writing with a loop The compound,using String.valueOf(i) as key. But there might be better ways to do so

  • Author

I know "ways", I am just looking to implement best way (without using useless tagKeys).

 

Instead of:

{List:[0:{Thingy:"String",},1:{Thingy:"String",},2:{Thingy:"String",},],}

There will be: (obviously not realistic example)

{List:[lenght, String, String, String,],}

 

Btw. if anyone is interested why - when ItemStack has tons of strings in it and is used VERY often (super common item, there is more of it than e.g iron ingots) it actually matters if you are sending almost half the data less.

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

Why not just use a NBTList with type String?

As for the issue when 'sending less data' should not be an issue, things are compressed when needed.

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

  • Author

Why not just use a NBTList with type String?

 

If by NBTList you ment NBTTagList - I just relized that NBTTagString(string) is also an NBTTag.

 

Before:

NBTTagList strings = new NBTTagList();

NBTTagCompound nbt;
for (String s : stringsToAdd)
{
nbt = new NBTTagCompound()
nbt.setString("S", s);
strings.appendTag(nbt);
}

 

Now:

NBTTagList strings = new NBTTagList();

NBTTagString string;
for (String s : stringsToAdd)
{
string = new NBTTagString(s)
strings.appendTag(string);
}

 

This closes thread - SOLVED.

 

Thanks for pointing it out!

 

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.