Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Patch #214

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/concepts/registries.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,18 @@ public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(
We can then add our registry entries as static final fields using one of the following methods (see [the article on Blocks][block] for what parameters to add in `new Block()`):

```java
// Note: Using register method requires manual setting of Id for ResourceKey,
// while registerBlock does not require manual setting of Id.
public static final DeferredHolder<Block, Block> EXAMPLE_BLOCK_1 = BLOCKS.register(
// Our registry name.
"example_block"
"example_block",
// A supplier of the object we want to register.
() -> new Block(...)
);

public static final DeferredHolder<Block, SlabBlock> EXAMPLE_BLOCK_2 = BLOCKS.register(
// Our registry name.
"example_block"
"example_block",
// A function creating the object we want to register
// given its registry name as a ResourceLocation.
registryName -> new SlabBlock(...)
Expand All @@ -64,14 +66,14 @@ The class `DeferredHolder<R, T extends R>` holds our object. The type parameter
```java
public static final Supplier<Block> EXAMPLE_BLOCK_1 = BLOCKS.register(
// Our registry name.
"example_block"
"example_block",
// A supplier of the object we want to register.
() -> new Block(...)
);

public static final Supplier<SlabBlock> EXAMPLE_BLOCK_2 = BLOCKS.register(
// Our registry name.
"example_block"
"example_block",
// A function creating the object we want to register
// given its registry name as a ResourceLocation.
registryName -> new SlabBlock(...)
Expand Down