This commit is contained in:
2026-10-02 11:07:09 -03:00
parent d5015edfa1
commit 9ca717d2d0
18 changed files with 449 additions and 38 deletions
+16
View File
@@ -46,6 +46,8 @@ interface Player {
add_effect(id: string, duration: number, options?: EffectOptions): void;
effect(id: string): { amplifier: number; duration: number } | undefined;
remove_effect(id: string): boolean;
is_swimming(): boolean; // see Swimming
}
```
@@ -124,6 +126,20 @@ has [`worn`](../items/index.md#worn-models) show.
Everyone is told what each player wears, the player too, and players joining later get it with the others. It isn't
saved: set it again when the player joins, the way the curios slots do.
## Swimming
Players swim by sprinting with their eyes under water. They keep swimming while they sprint in water, along the surface
too, and stop when they let go of sprint or leave the water. While swimming they lie flat in a box 0.8 blocks tall, with
their eyes at 0.6, so they fit through 1-block gaps. Under a low ceiling they stay in that box until there's room to
stand up.
`player.is_swimming()` says whether a player is swimming, like NeoForge's `isSwimming()`. It works on the server and in
client scripts, where `ctx.player.is_swimming()` is about the player on this client:
```ts
if (player.is_swimming()) player.add_effect("bworld:speed", 20);
```
## Death
When a player dies, everything they carried falls out where they died, and their tools lose durability (see
+1
View File
@@ -136,6 +136,7 @@ Client scripts can read what the client knows, to show it:
```ts
ctx.player.name;
ctx.player.position; // { x, y, z }
ctx.player.is_swimming(); // see ../entities/players.md#swimming
ctx.world.get_block(x, y, z); // a block id, what this client sees
ctx.world.time; // see Time
ctx.items.ids(); // every item, in load order