Class DeferredRegister.Blocks
java.lang.Object
net.neoforged.neoforge.registries.DeferredRegister<Block>
net.neoforged.neoforge.registries.DeferredRegister.Blocks
- Enclosing class:
DeferredRegister<T>
Specialized DeferredRegister for
Blocks that uses the specialized DeferredBlock as the return type for register(java.lang.String, java.util.function.Function<net.minecraft.resources.ResourceLocation, ? extends B>).-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.registries.DeferredRegister
DeferredRegister.Blocks, DeferredRegister.DataComponents, DeferredRegister.Entities, DeferredRegister.Items -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <I extends Block>
DeferredBlock<I> createHolder(ResourceKey<? extends Registry<Block>> registryKey, ResourceLocation key) Create aDeferredHolderor an inheriting type to be stored.<B extends Block>
DeferredBlock<B> register(String name, Function<ResourceLocation, ? extends B> func) Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.<B extends Block>
DeferredBlock<B> Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.<B extends Block>
DeferredBlock<B> registerBlock(String name, Function<BlockBehaviour.Properties, ? extends B> func) Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.<B extends Block>
DeferredBlock<B> registerBlock(String name, Function<BlockBehaviour.Properties, ? extends B> func, Supplier<BlockBehaviour.Properties> properties) Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.<B extends Block>
DeferredBlock<B> registerBlock(String name, Function<BlockBehaviour.Properties, ? extends B> func, UnaryOperator<BlockBehaviour.Properties> properties) Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.<B extends Block>
DeferredBlock<B> registerBlock(String name, Function<BlockBehaviour.Properties, ? extends B> func, BlockBehaviour.Properties props) Deprecated, for removal: This API element is subject to removal in a future version.registerSimpleBlock(String name) Adds a new simpleBlockwith the defaultpropertiesto the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.registerSimpleBlock(String name, Supplier<BlockBehaviour.Properties> properties) Adds a new simpleBlockwith the givenpropertiesto the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.registerSimpleBlock(String name, UnaryOperator<BlockBehaviour.Properties> properties) Adds a new simpleBlockwith the givenpropertiesto the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.registerSimpleBlock(String name, BlockBehaviour.Properties props) Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class net.neoforged.neoforge.registries.DeferredRegister
addAlias, create, create, create, createBlocks, createDataComponents, createEntities, createItems, createTagKey, createTagKey, getEntries, getNamespace, getRegistry, getRegistryKey, getRegistryName, makeRegistry, register
-
Constructor Details
-
Blocks
-
-
Method Details
-
register
public <B extends Block> DeferredBlock<B> register(String name, Function<ResourceLocation, ? extends B> func) Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.- Overrides:
registerin classDeferredRegister<Block>- Parameters:
name- The new block's name. It will automatically have the namespace prefixed.func- A factory for the new block. The factory should not cache the created block.- Returns:
- A
DeferredHolderthat will track updates from the registry for this block.
-
register
Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.- Overrides:
registerin classDeferredRegister<Block>- Parameters:
name- The new block's name. It will automatically have the namespace prefixed.sup- A factory for the new block. The factory should not cache the created block.- Returns:
- A
DeferredHolderthat will track updates from the registry for this block.
-
registerBlock
@Deprecated(since="1.21.10", forRemoval=true) public <B extends Block> DeferredBlock<B> registerBlock(String name, Function<BlockBehaviour.Properties, ? extends B> func, BlockBehaviour.Properties props) Deprecated, for removal: This API element is subject to removal in a future version.Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.- Parameters:
name- The new block's name. It will automatically have the namespace prefixed.func- A factory for the new block. The factory should not cache the created block.props- The properties for the created block.- Returns:
- A
DeferredHolderthat will track updates from the registry for this block. - See Also:
-
registerBlock
public <B extends Block> DeferredBlock<B> registerBlock(String name, Function<BlockBehaviour.Properties, ? extends B> func, Supplier<BlockBehaviour.Properties> properties) Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.- Parameters:
name- The new block's name. It will automatically have the namespace prefixed.func- A factory for the new block. The factory should not cache the created block.properties- The supplied properties for the created block.- Returns:
- A
DeferredHolderthat will track updates from the registry for this block. - See Also:
-
registerBlock
public <B extends Block> DeferredBlock<B> registerBlock(String name, Function<BlockBehaviour.Properties, ? extends B> func, UnaryOperator<BlockBehaviour.Properties> properties) Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.- Parameters:
name- The new block's name. It will automatically have the namespace prefixed.func- A factory for the new block. The factory should not cache the created block.properties- The unary operator, which is passed a newBlockBehaviour.Propertiesfor the created block.- Returns:
- A
DeferredHolderthat will track updates from the registry for this block. - See Also:
-
registerBlock
public <B extends Block> DeferredBlock<B> registerBlock(String name, Function<BlockBehaviour.Properties, ? extends B> func) Adds a new block to the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically. This method uses the defaultBlockBehaviour.Properties.- Parameters:
name- The new block's name. It will automatically have the namespace prefixed.func- A factory for the new block. The factory should not cache the created block.- Returns:
- A
DeferredHolderthat will track updates from the registry for this block. - See Also:
-
registerSimpleBlock
@Deprecated(since="1.21.10", forRemoval=true) public DeferredBlock<Block> registerSimpleBlock(String name, BlockBehaviour.Properties props) Deprecated, for removal: This API element is subject to removal in a future version.Adds a new simpleBlockwith the givenpropertiesto the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.- Parameters:
name- The new block's name. It will automatically have the namespace prefixed.props- The properties for the created block.- Returns:
- A
DeferredHolderthat will track updates from the registry for this block. - See Also:
-
registerSimpleBlock
public DeferredBlock<Block> registerSimpleBlock(String name, Supplier<BlockBehaviour.Properties> properties) Adds a new simpleBlockwith the givenpropertiesto the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.- Parameters:
name- The new block's name. It will automatically have the namespace prefixed.properties- The supplied properties for the created block.- Returns:
- A
DeferredHolderthat will track updates from the registry for this block. - See Also:
-
registerSimpleBlock
public DeferredBlock<Block> registerSimpleBlock(String name, UnaryOperator<BlockBehaviour.Properties> properties) Adds a new simpleBlockwith the givenpropertiesto the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.- Parameters:
name- The new block's name. It will automatically have the namespace prefixed.properties- The unary operator, which is passed a newBlockBehaviour.Propertiesfor the created block.- Returns:
- A
DeferredHolderthat will track updates from the registry for this block. - See Also:
-
registerSimpleBlock
Adds a new simpleBlockwith the defaultpropertiesto the list of entries to be registered and returns aDeferredHolderthat will be populated with the created block automatically.- Parameters:
name- The new block's name. It will automatically have the namespace prefixed.- Returns:
- A
DeferredHolderthat will track updates from the registry for this block. - See Also:
-
createHolder
protected <I extends Block> DeferredBlock<I> createHolder(ResourceKey<? extends Registry<Block>> registryKey, ResourceLocation key) Description copied from class:DeferredRegisterCreate aDeferredHolderor an inheriting type to be stored.- Overrides:
createHolderin classDeferredRegister<Block>- Type Parameters:
I- The specific type of the entry.- Parameters:
registryKey- The key of the registry.key- The resource location of the entry.- Returns:
- The new instance of
DeferredHolderor an inheriting type.
-
registerBlock(String, Function, Supplier)orregisterBlock(String, Function, UnaryOperator)instead.