Skip to content

Commit

Permalink
fix(docs): Be more explicit in registration
Browse files Browse the repository at this point in the history
Closes #177
  • Loading branch information
ChampionAsh5357 committed Oct 17, 2024
1 parent d770815 commit cdd31c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/blockentities/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class MyBlockEntity extends BlockEntity {

As you may have noticed, we pass an undefined variable `type` to the super constructor. Let's leave that undefined variable there for a moment and instead move to registration.

Registration happens in a similar fashion to entities. We create an instance of the associated singleton class `BlockEntityType<?>` and register it to the block entity type registry, like so:
[Registration][registration] happens in a similar fashion to entities. We create an instance of the associated singleton class `BlockEntityType<?>` and register it to the block entity type registry, like so:

```java
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITY_TYPES =
Expand All @@ -41,6 +41,10 @@ public static final Supplier<BlockEntityType<MyBlockEntity>> MY_BLOCK_ENTITY = B
);
```

:::note
Remember that the `DeferredRegister` must be [registered][registration] to the mod event bus!
:::

Now that we have our block entity type, we can use it in place of the `type` variable we left earlier:

```java
Expand Down

0 comments on commit cdd31c9

Please sign in to comment.