Class RegistryBuilder<T>
java.lang.Object
net.neoforged.neoforge.registries.RegistryBuilder<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<RegistryCallback<T>> private @Nullable net.minecraft.resources.ResourceLocation
private boolean
private int
private boolean
private final net.minecraft.resources.ResourceKey
<? extends net.minecraft.core.Registry<T>> private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionRegistryBuilder
(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey) -
Method Summary
Modifier and TypeMethodDescriptioncallback
(RegistryCallback<T> callback) net.minecraft.core.Registry
<T> create()
Creates a new registry from this builder.defaultKey
(net.minecraft.resources.ResourceKey<T> key) defaultKey
(net.minecraft.resources.ResourceLocation 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
private final net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey -
callbacks
-
defaultKey
@Nullable private @Nullable net.minecraft.resources.ResourceLocation defaultKey -
intrusiveHolders
private boolean intrusiveHolders -
maxId
private int maxId -
sync
private boolean sync -
registrationCheck
private boolean registrationCheck
-
-
Constructor Details
-
RegistryBuilder
public RegistryBuilder(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey)
-
-
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:
-