Class RegistryBuilder<T>
java.lang.Object
net.neoforged.neoforge.registries.RegistryBuilder<T>
-
Field Summary
Modifier and TypeFieldDescriptionprivate final List<RegistryCallback<T>>
private @Nullable ResourceLocation
private int
private boolean
private final ResourceKey<? extends Registry<T>>
private boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncallback
(RegistryCallback<T> callback) create()
Creates a new registry from this builder.defaultKey
(ResourceKey<T> key) Disables the safeguard that ensures this registry is registered toNewRegistryEvent
in due time.maxId
(int maxId) Sets the highest numerical id that an entry in this registry is allowed to use.onAdd
(AddCallback<T> callback) onBake
(BakeCallback<T> callback) onClear
(ClearCallback<T> callback) sync
(boolean sync) Sets whether this registry should have its numerical IDs synced to clients.
-
Field Details
-
registryKey
-
callbacks
-
defaultKey
-
maxId
private int maxId -
sync
private boolean sync -
registrationCheck
private boolean registrationCheck
-
-
Constructor Details
-
RegistryBuilder
-
-
Method Details
-
defaultKey
-
defaultKey
-
callback
-
onAdd
-
onBake
-
onClear
-
maxId
Sets the highest numerical id that an entry in this registry is allowed to use. Must be greater than or equal to zero.- Parameters:
maxId
- the highest numerical id
-
sync
Sets whether this registry should have its numerical IDs synced to clients. Default:false
. -
disableRegistrationCheck
Disables the safeguard that ensures this registry is registered toNewRegistryEvent
in due time. DO NOT CALL THIS METHOD UNLESS YOU KNOW WHAT YOU ARE DOING. -
create
Creates a new registry from this builder. UseNewRegistryEvent.create(RegistryBuilder)
orDeferredRegister.makeRegistry(Consumer)
to not have to call this manually. All created registries must be registered, seeNewRegistryEvent.register(Registry)
.- Returns:
- the created registry
- See Also:
-