Skip to content

Commit a245370

Browse files
committed
Update to be up-to-date with latest Adventure docs
1 parent 797e815 commit a245370

File tree

4 files changed

+42
-19
lines changed

4 files changed

+42
-19
lines changed

src/content/docs/adventure/minimessage/format.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,32 @@ Preview
304304
<img style="max-height: 10rem;" alt="The result of parsing `<lang:commands.drop.success.single:'<red>1':'<blue>Stone'>!`, shown in-game in the Minecraft client's chat window in English" src={Translatable2.src} />
305305
</div>
306306

307+
### Fallback
308+
309+
:::note
310+
311+
The fallback option is only available since Minecraft 1.19.4.
312+
313+
:::
314+
315+
Allows displaying minecraft messages using the player locale, or a fallback if no text is available
316+
317+
Tag
318+
* `<lang_or:_key_:_fallback_:_value1_:_value2_...>`
319+
320+
Aliases
321+
* `tr_or`, `translate_or`
322+
323+
Arguments
324+
* `_key_`, the translation key
325+
* `_fallback_`, the fallback text to display
326+
* `_valueX_`, optional values that are used for placeholders in the key (they will end up in the `with` tag in the JSON)
327+
328+
Examples
329+
```mm
330+
You should get a <lang_or:block.minecraft.diamond_block:'Dirt Block'>!
331+
```
332+
307333
### Insertion
308334

309335
Allow insertion of text into chat via shift click

src/content/docs/adventure/platform/fabric.mdx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ As with the rest of the Adventure projects, releases are distributed on Maven Ce
4141
}
4242
4343
dependencies {
44-
modImplementation include("net.kyori:adventure-platform-fabric:|mod_version|") // for Minecraft 1.21.2-1.21.4
44+
modImplementation include("net.kyori:adventure-platform-fabric:|mod_version|") // for Minecraft 1.21.5
4545
}
4646
```
4747
</TabItem>
@@ -58,7 +58,7 @@ As with the rest of the Adventure projects, releases are distributed on Maven Ce
5858
}
5959

6060
dependencies {
61-
modImplementation(include("net.kyori:adventure-platform-fabric:|modversion|")!!) // for Minecraft 1.21.2-1.21.4
61+
modImplementation(include("net.kyori:adventure-platform-fabric:|modversion|")!!) // for Minecraft 1.21.5
6262
}
6363
```
6464
</TabItem>
@@ -153,7 +153,7 @@ For more complex use cases, `FabricServerAudiences` or `FabricClientAudiences` p
153153

154154
## Server
155155

156-
The logical-server side of the Fabric platform can be accessed any time a server is available, through a `FabricServerAudiences` instance. By default, translatable components will be rendered with the global translator, but a custom renderer can be passed when initializing the platform.
156+
The logical-server side of the Fabric platform can be accessed any time a server is available, through a `MinecraftServerAudiences` instance. By default, translatable components will be rendered with the global translator, but a custom renderer can be passed when initializing the platform.
157157

158158
All `AudienceProvider` interface methods are supported, except for the `permission` method. This will become supported as soon as Fabric gets a suitable permissions API.
159159

@@ -162,9 +162,9 @@ To get started with Adventure, set up an audience provider like this:
162162
```java
163163
public class MyMod implements ModInitializer {
164164

165-
private volatile FabricServerAudiences adventure;
165+
private volatile MinecraftServerAudiences adventure;
166166

167-
public FabricServerAudiences adventure() {
167+
public MinecraftServerAudiences adventure() {
168168
if (this.adventure == null) {
169169
throw new IllegalStateException("Tried to access Adventure without a running server!");
170170
}
@@ -177,12 +177,8 @@ public class MyMod implements ModInitializer {
177177
// This will ensure any platform data is cleared between game instances
178178
// This is important on the integrated server, where multiple server instances
179179
// can exist for one mod initialization.
180-
ServerLifecycleEvents.SERVER_STARTING.register(server ->
181-
this.adventure = FabricServerAudiences.of(server)
182-
);
183-
ServerLifecycleEvents.SERVER_STOPPED.register(server ->
184-
this.adventure = null
185-
);
180+
ServerLifecycleEvents.SERVER_STARTING.register(server -> this.adventure = MinecraftServerAudiences.of(server));
181+
ServerLifecycleEvents.SERVER_STOPPED.register(server -> this.adventure = null);
186182
}
187183
}
188184
```
@@ -226,13 +222,13 @@ void registerCommands(final CommandDispatcher dispatcher, final boolean isDedica
226222
Special for the Fabric platform, purely client-side operations are supported. The setup is less involved than it is for the server,
227223
since the client is a singleton, and there is only one subject that can be acted on: the client's player.
228224
229-
This means that for most users the `FabricClientAudiences` object can be treated as a singleton. The only exception is users using a
225+
This means that for most users the `MinecraftClientAudiences` object can be treated as a singleton. The only exception is users using a
230226
custom renderer. This makes using Adventure audiences fairly simple, as this code example shows:
231227
232228
```java
233229
void doThing() {
234230
// Get the audience
235-
final Audience client = FabricClientAudiences.of().audience();
231+
final Audience client = MinecraftClientAudiences.of().audience();
236232
237233
// Do something. This will only work when the player is in game.
238234
client.sendMessage(Component.text("meow", NamedTextColor.DARK_PURPLE));

src/content/docs/adventure/platform/modded.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ As with the rest of the Adventure projects, releases are distributed on Maven Ce
4141
4242
dependencies {
4343
// Loom project
44-
modCompileOnly("net.kyori:adventure-platform-mod-shared-fabric-repack:|mod_version|") // for Minecraft 1.21.2-1.21.4
44+
modCompileOnly("net.kyori:adventure-platform-mod-shared-fabric-repack:|mod_version|") // for Minecraft 1.21.5
4545
4646
// NeoGradle/ModDevGradle/VanillaGradle project
47-
compileOnly("net.kyori:adventure-platform-mod-shared:|mod_version|") // for Minecraft 1.21.2-1.21.4
47+
compileOnly("net.kyori:adventure-platform-mod-shared:|mod_version|") // for Minecraft 1.21.5
4848
}
4949
```
5050
</TabItem>
@@ -62,10 +62,10 @@ As with the rest of the Adventure projects, releases are distributed on Maven Ce
6262

6363
dependencies {
6464
// Loom project
65-
modCompileOnly("net.kyori:adventure-platform-mod-shared-fabric-repack:|mod_version|") // for Minecraft 1.21.2-1.21.4
65+
modCompileOnly("net.kyori:adventure-platform-mod-shared-fabric-repack:|mod_version|") // for Minecraft 1.21.5
6666

6767
// NeoGradle/ModDevGradle/VanillaGradle project
68-
compileOnly("net.kyori:adventure-platform-mod-shared:|mod_version|") // for Minecraft 1.21.2-1.21.4
68+
compileOnly("net.kyori:adventure-platform-mod-shared:|mod_version|") // for Minecraft 1.21.5
6969
}
7070
```
7171
</TabItem>
@@ -81,6 +81,7 @@ Each major Minecraft release will require different platform versions. For older
8181

8282
| Minecraft Version | Adventure version | `adventure-platform-(mod-shared/fabric/neoforge)` version |
8383
|-------------------|-------------------|-----------------------------------------------------------|
84+
| 1.21.2-1.21.4 | 4.20.0 | 6.3.0 |
8485
| 1.21-1.21.1 | 4.17.0 | 6.0.0 |
8586

8687
</details>

src/content/docs/adventure/platform/neoforge.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ releases are distributed on Maven Central, and snapshots on Sonatype OSS:
3131
}
3232
3333
dependencies {
34-
implementation jarJar("net.kyori:adventure-platform-neoforge:|mod_version|") // for Minecraft 1.21.2-1.21.4
34+
implementation jarJar("net.kyori:adventure-platform-neoforge:|mod_version|") // for Minecraft 1.21.5
3535
}
3636
```
3737
</TabItem>
@@ -48,7 +48,7 @@ releases are distributed on Maven Central, and snapshots on Sonatype OSS:
4848
}
4949

5050
dependencies {
51-
implementation(jarJar("net.kyori:adventure-platform-neoforge:|mod_version|")!!) // for Minecraft 1.21.2-1.21.4
51+
implementation(jarJar("net.kyori:adventure-platform-neoforge:|mod_version|")!!) // for Minecraft 1.21.5
5252
}
5353
```
5454
</TabItem>

0 commit comments

Comments
 (0)