- All Implemented Interfaces:
- Direct Known Subclasses:
public abstract class ForgeRegistryEntry<V extends IForgeRegistryEntry<V>> extends Object implements IForgeRegistryEntry<V>
Default implementation of IForgeRegistryEntry, this is necessary to reduce redundant code. This also enables the registrie's ability to manage delegates. Which are automatically updated if another entry overrides existing ones in the registry.
Nested Class Summary
Method SummaryModifier and TypeMethodDescription
(package private) ResourceLocationThis will assert that the registry name is valid and warn about potential registry overrides It is important as it detects cases where modders unintentionally register objects with the "minecraft" namespace, leading to dangerous errors later.
final ResourceLocationA unique identifier for this entry, if this entry is registered already it will return it's official registry name.Determines the type for this entry, used to look up the correct registry in the global registries list as there can only be one registry per concrete class.Sets a unique name for this Item.
registryNameprivate ResourceLocation registryName
setRegistryNameSets 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.
getRegistryName@Nullable public final ResourceLocation getRegistryName()A unique identifier for this entry, if this entry is registered already it will return it's official registry name. Otherwise it will return the name set in setRegistryName(). If neither are valid null is returned.
getRegistryTypeDetermines the type for this entry, used to look up the correct registry in the global registries list as there can only be one registry per concrete class.
checkRegistryNameThis will assert that the registry name is valid and warn about potential registry overrides It is important as it detects cases where modders unintentionally register objects with the "minecraft" namespace, leading to dangerous errors later.
name- The registry name
- A verified "correct" registry name