Class RegistryBuilder<T>
java.lang.Object
net.neoforged.neoforge.registries.RegistryBuilder<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<RegistryCallback<T>> private @Nullable ResourceLocation
private boolean
private int
private boolean
private final ResourceKey
<? extends Registry<T>> private boolean
-
Constructor Summary
Constructors -
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.Deprecated.Vanilla has deprecated intrusive holders and is in the process of moving away from them, you should not use this unless you have no better option.
-
Field Details
-
registryKey
-
callbacks
-
defaultKey
-
intrusiveHolders
private boolean intrusiveHolders -
maxId
private int maxId -
sync
private boolean sync -
registrationCheck
private boolean registrationCheck
-
-
Constructor Details
-
RegistryBuilder
-
-
Method Details
-
defaultKey
-
defaultKey
-
withIntrusiveHolders
Deprecated.Vanilla has deprecated intrusive holders and is in the process of moving away from them, you should not use this unless you have no better option. -
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:
-