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

What are the specific differences between Capabilities and NBT data?

For example...

Under what circumstances should I use each?

Which is quicker to access?

How do they store data?

I know from the documentation that Capabilities, particularly the ones already provided by Forge, are very useful in compatibility, so it's clear that they should be used accordingly. It's less clear, however, which to choose for less universal or less openly visible/utilized concepts.

If there's other information that might be interesting or useful that you'd like to share about them, that would also be appreciated.

Thanks in advance.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

7 minutes ago, SerpentDagger said:

Under what circumstances should I use each?

In an ideal world, everyone would use Capabilities and not mess with the ItemStacks NBTTagCompound at all. So basically always use Capabilities.

8 minutes ago, SerpentDagger said:

Which is quicker to access?

If we are talking computer performance, I think NBTTagCompound just boils down to a HashMap and a Capability is also stored in a HashMap. Capability are easier to read and NBT is sloppy. If we are talking the amount of time to write the code, it comes down to how much information, for small amounts NBT is faster to implement but larger amounts it's typically faster to create a Capability.

11 minutes ago, SerpentDagger said:

How do they store data?

In RAM NBT is a HashMap<String, INBT> where INBT is a single NBT attribute a Compound/HashMap, List/ArrayList, NBTInt/int, etc. Where as in a Capability you define your own object that is attached to a Object(Entity, ItemStack, World, etc) and you store it there in whatever manner you want(not NBT).

On disk everything is converted to NBT and written in Minecraft's custom file format.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

Thanks, that's exactly what I was looking for. I'll convert my NBT things over to Capabilities, then, since it seems there's no real advantage in using NBT data instead.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

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.