Class DeferredRegister.Items
java.lang.Object
net.neoforged.neoforge.registries.DeferredRegister<Item>
net.neoforged.neoforge.registries.DeferredRegister.Items
- Direct Known Subclasses:
DeferredItems
- Enclosing class:
DeferredRegister<T>
Specialized DeferredRegister for
Items
that uses the specialized DeferredItem
as the return type for register(java.lang.String, java.util.function.Function<net.minecraft.resources.ResourceLocation, ? extends I>)
.-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.registries.DeferredRegister
DeferredRegister.Blocks, DeferredRegister.DataComponents, DeferredRegister.Items
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <I extends Item>
DeferredItem<I> createHolder
(ResourceKey<? extends Registry<Item>> registryKey, ResourceLocation key) Create aDeferredHolder
or an inheriting type to be stored.<I extends Item>
DeferredItem<I> register
(String name, Function<ResourceLocation, ? extends I> func) Adds a new item to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.<I extends Item>
DeferredItem<I> Adds a new item to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.<I extends Item>
DeferredItem<I> registerItem
(String name, Function<Item.Properties, ? extends I> func) Adds a new item to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.<I extends Item>
DeferredItem<I> registerItem
(String name, Function<Item.Properties, ? extends I> func, Item.Properties props) Adds a new item to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.registerSimpleBlockItem
(String name, Supplier<? extends Block> block) Adds a new simpleBlockItem
for the givenBlock
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.registerSimpleBlockItem
(String name, Supplier<? extends Block> block, Item.Properties properties) Adds a new simpleBlockItem
for the givenBlock
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.registerSimpleBlockItem
(Holder<Block> block) Adds a new simpleBlockItem
for the givenBlock
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.registerSimpleBlockItem
(Holder<Block> block, Item.Properties properties) Adds a new simpleBlockItem
for the givenBlock
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.registerSimpleItem
(String name) Adds a new simpleItem
with the defaultproperties
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.registerSimpleItem
(String name, Item.Properties props) Adds a new simpleItem
with the givenproperties
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.Methods inherited from class net.neoforged.neoforge.registries.DeferredRegister
addAlias, create, create, create, createBlocks, createDataComponents, createItems, createTagKey, createTagKey, getEntries, getNamespace, getRegistry, getRegistryKey, getRegistryName, makeRegistry, register
-
Constructor Details
-
Items
-
-
Method Details
-
register
public <I extends Item> DeferredItem<I> register(String name, Function<ResourceLocation, ? extends I> func) Adds a new item to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.- Overrides:
register
in classDeferredRegister<Item>
- Parameters:
name
- The new item's name. It will automatically have the namespace prefixed.func
- A factory for the new item. The factory should not cache the created item.- Returns:
- A
DeferredItem
that will track updates from the registry for this item. - See Also:
-
register
Adds a new item to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.- Overrides:
register
in classDeferredRegister<Item>
- Parameters:
name
- The new item's name. It will automatically have the namespace prefixed.sup
- A factory for the new item. The factory should not cache the created item.- Returns:
- A
DeferredItem
that will track updates from the registry for this item. - See Also:
-
registerSimpleBlockItem
public DeferredItem<BlockItem> registerSimpleBlockItem(String name, Supplier<? extends Block> block, Item.Properties properties) Adds a new simpleBlockItem
for the givenBlock
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.- Parameters:
name
- The new item's name. It will automatically have the namespace prefixed.block
- The supplier for the block to create aBlockItem
for.properties
- The properties for the createdBlockItem
.- Returns:
- A
DeferredItem
that will track updates from the registry for this item. - See Also:
-
registerSimpleBlockItem
public DeferredItem<BlockItem> registerSimpleBlockItem(String name, Supplier<? extends Block> block) Adds a new simpleBlockItem
for the givenBlock
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically. This method uses the defaultItem.Properties
.- Parameters:
name
- The new item's name. It will automatically have the namespace prefixed.block
- The supplier for the block to create aBlockItem
for.- Returns:
- A
DeferredItem
that will track updates from the registry for this item. - See Also:
-
registerSimpleBlockItem
public DeferredItem<BlockItem> registerSimpleBlockItem(Holder<Block> block, Item.Properties properties) Adds a new simpleBlockItem
for the givenBlock
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically. Where the name is determined by the name of the given block.- Parameters:
block
- TheDeferredHolder
of theBlock
for theBlockItem
.properties
- The properties for the createdBlockItem
.- Returns:
- A
DeferredItem
that will track updates from the registry for this item. - See Also:
-
registerSimpleBlockItem
Adds a new simpleBlockItem
for the givenBlock
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically. Where the name is determined by the name of the given block and uses the defaultItem.Properties
.- Parameters:
block
- TheDeferredHolder
of theBlock
for theBlockItem
.- Returns:
- A
DeferredItem
that will track updates from the registry for this item. - See Also:
-
registerItem
public <I extends Item> DeferredItem<I> registerItem(String name, Function<Item.Properties, ? extends I> func, Item.Properties props) Adds a new item to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.- Parameters:
name
- The new item's name. It will automatically have the namespace prefixed.func
- A factory for the new item. The factory should not cache the created item.props
- The properties for the created item.- Returns:
- A
DeferredItem
that will track updates from the registry for this item. - See Also:
-
registerItem
public <I extends Item> DeferredItem<I> registerItem(String name, Function<Item.Properties, ? extends I> func) Adds a new item to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically. This method uses the defaultItem.Properties
.- Parameters:
name
- The new item's name. It will automatically have the namespace prefixed.func
- A factory for the new item. The factory should not cache the created item.- Returns:
- A
DeferredItem
that will track updates from the registry for this item. - See Also:
-
registerSimpleItem
Adds a new simpleItem
with the givenproperties
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.- Parameters:
name
- The new item's name. It will automatically have the namespace prefixed.props
- A factory for the new item. The factory should not cache the created item.- Returns:
- A
DeferredItem
that will track updates from the registry for this item. - See Also:
-
registerSimpleItem
Adds a new simpleItem
with the defaultproperties
to the list of entries to be registered and returns aDeferredItem
that will be populated with the created item automatically.- Parameters:
name
- The new item's name. It will automatically have the namespace prefixed.- Returns:
- A
DeferredItem
that will track updates from the registry for this item. - See Also:
-
createHolder
protected <I extends Item> DeferredItem<I> createHolder(ResourceKey<? extends Registry<Item>> registryKey, ResourceLocation key) Description copied from class:DeferredRegister
Create aDeferredHolder
or an inheriting type to be stored.- Overrides:
createHolder
in classDeferredRegister<Item>
- 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
DeferredHolder
or an inheriting type.
-