setRegistryName
public final T setRegistryName(ResourceLocation name)
Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item.
This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does.
Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items.
The supplied name will be prefixed with the currently active mod's modId.
If the supplied name already has a prefix that is different, it will be used and a warning will be logged.
If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown.
Returns 'this' to allow for chaining.
- Specified by:
setRegistryName
in interface IForgeRegistryEntry<T extends IForgeRegistryEntry<T>>
- Parameters:
name
- Unique registry name
- Returns:
- This instance