NovaMaterial
NovaMaterial
is the material class for items and blocks added by Nova.
Getting a NovaMaterial
by name
To get a NovaMaterial
you first have to get the NovaMaterialRegistry
using the previously retrieved Nova instance.
Using this registry, you can now get a NovaMaterial
by id. It needs to be in the format namespace:name
.
- This will throw an exception if the material is not found. However, wrench always exists.
If you're unsure or processing user input usegetOrNull
instead.
Info
The same methods also exist for getting a NovaMaterial
from an ItemStack
.
If you want to retrieve all materials with a certain name and ignore the namespace, you can do this:
Getting the id of a material
Example for nova:wrench
:
Getting the translated name of a material
Nova uses the resource pack to translate items client side. However, if you still need to get the translated name of a material,
you can use NovaMaterial.getLocalizedName(locale)
. The locale is the language code of the language you want to get the name in.
The code is the same as the language code used by Minecraft.
Info
If the given language code could not be found or is invalid, the english name of the material will be returned.
Example for nova:wrench
: