Retrieve

Get meta on item

Retrieve the metadata on an item. If the metadata is associated with a specific class, provide the class information.

First option:

Retrieve a string NBT value set on the item from the key.

@Nullable public String getMetadata(@Nonnull final ItemStack itemStack, @Nonnull final String key);

Second option:

This option give you option to retrieve several values with same instance and that improve the performance .

@Nullable public NBTValueWrapper getMetadata(@Nonnull final ItemStack itemStack);

Third option :

Deprecated method and will not work for non string values any more and the preformance is not so good as the other 2 options.

public <T> T getMetadata(new ItemStack(Material.CHEST),Class.class, "key");

Last updated