Skip to content

Commit 08fa5aa

Browse files
fix: update registry docs to compose event (#616)
* fix: update registry docs to compose event * a thing
1 parent a997bde commit 08fa5aa

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pnpm-workspace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
patchedDependencies:
22
3+
4+
onlyBuiltDependencies:
5+
- esbuild
6+
- sharp

src/content/docs/paper/dev/api/registries.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,19 @@ Modification of a registry can take two different forms.
123123

124124
### Create new entries
125125

126-
Creating new entries is done via the [`freeze` lifecycle event](jd:paper:io.papermc.paper.registry.event.RegistryEventProvider#freeze())
126+
Creating new entries is done via the [`compose` lifecycle event](jd:paper:io.papermc.paper.registry.event.RegistryEventProvider#compose())
127127
on the respective registries.
128-
The freeze event is called right before a registry's content is frozen in-place, meaning all Vanilla entries are registered.
129-
Plugins can hence register their own entries at this point.
128+
The compose event is called after a registry's content has been loaded from "vanilla" sources, like the built-in
129+
datapack or any detected, enabled, datapacks. Plugins can hence register their own entries at this point.
130130
The following example shows how to create a new enchantment:
131131

132132
```java title="TestPluginBootstrap.java"
133133
public class TestPluginBootstrap implements PluginBootstrap {
134134

135135
@Override
136136
public void bootstrap(BootstrapContext context) {
137-
// Register a new handler for the freeze lifecycle event on the enchantment registry
138-
context.getLifecycleManager().registerEventHandler(RegistryEvents.ENCHANTMENT.freeze().newHandler(event -> {
137+
// Register a new handler for the compose lifecycle event on the enchantment registry
138+
context.getLifecycleManager().registerEventHandler(RegistryEvents.ENCHANTMENT.compose().newHandler(event -> {
139139
event.registry().register(
140140
// The key of the registry
141141
// Plugins should use their own namespace instead of minecraft or papermc

0 commit comments

Comments
 (0)