> For the complete documentation index, see [llms.txt](https://docs.aethercube.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aethercube.fr/developers/fr/plugins/interface.md). Agents can also search and read this documentation through its [MCP server](https://docs.aethercube.fr/~gitbook/mcp).

# Interface : écrans de chargement et effets d'écran

Cette page explique comment un plugin change l'écran de chargement, pour tout le serveur ou pour un joueur, et comment il affiche un effet plein écran. Elle sert à celles et ceux qui écrivent un plugin.

## Écrans de chargement

`server.loadingScreens()` contient le défaut valable pour tout le serveur, qui démarre avec la section `loading_screen` de `server.yml`.

| Méthode               | Sens                                                              |
| --------------------- | ----------------------------------------------------------------- |
| `defaults()`          | Le `LoadingScreen` par défaut actuel.                             |
| `setDefaults(screen)` | Le remplace. Il s'applique aux joueurs qui se connectent ensuite. |

Un `LoadingScreen` est immuable. Construis-en un avec `LoadingScreen.builder()` ou modifie l'actuel avec `toBuilder()` :

```java
LoadingScreens screens = getServer().loadingScreens();
screens.setDefaults(screens.defaults().toBuilder()
        .title("Emberhold")
        .subtitle("A server for the long road")
        .tip("Waystones stand on the ley lines.")
        .tipSeconds(8)
        .accentRgb(0xE07A2F)
        .backdrop("aethercube:frostveil")
        .build());
```

| Méthode du builder              | Limite                                                                                                 |
| ------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `title(text)`                   | 48 caractères.                                                                                         |
| `subtitle(text)`                | 120 caractères.                                                                                        |
| `tips(collection)`, `tip(text)` | 16 astuces de 160 caractères.                                                                          |
| `tipSeconds(n)`                 | `0` pour le défaut du client, sinon ramené entre 3 et 30.                                              |
| `accentRgb(rgb)`                | Les 24 bits de poids faible. `0` veut dire le défaut du client.                                        |
| `backdrop(id)`                  | 64 caractères. Un identifiant de fond intégré ou d'un pack. Vide, il fait défiler les fonds du client. |

Le builder ne lève jamais d'exception pour une chaîne trop longue ou étrange. Il coupe le texte aux limites, en comptant les caractères comme des points de code, et retire les caractères de contrôle. Un argument `null` lève `NullPointerException`. Une valeur vide veut dire « le défaut du client ».

Les fonds intégrés sont listés dans [Écran de chargement](https://docs.aethercube.fr/developers/fr/heberger-un-serveur/ecran-de-chargement.md).

### Un écran par joueur

`PlayerLoadingScreenEvent` est émis une fois par connexion sur le thread de simulation, après l'acceptation de la connexion et avant l'envoi du monde. Il démarre avec le défaut du serveur. Un listener le remplace pour ce joueur seulement :

```java
@EventHandler
public void onLoading(PlayerLoadingScreenEvent event) {
    event.setScreen(event.screen().toBuilder()
            .subtitle("Welcome back, " + event.player().displayName())
            .build());
}
```

Le joueur n'a pas encore d'entité : `event.player().entity()` vaut `null`.

## Effets d'écran

Un effet d'écran est un shader plein écran qu'un content pack déclare. Un plugin l'affiche à un joueur.

```java
ScreenEffect updraft = ScreenEffect.builder()
        .effect("skyglass:updraft")
        .intensity(0.8f)
        .params(1.0f)
        .fadeSeconds(1.5f)
        .build();

getServer().screenEffects().show(player, updraft);
```

| Méthode du builder             | Sens                                                                                                              |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------- |
| `effect(id)`                   | L'identifiant de l'effet, `namespace:name`, 64 caractères au maximum. Un identifiant vide coupe l'effet en cours. |
| `intensity(x)`                 | Force, ramenée entre 0 et 1. 1 par défaut.                                                                        |
| `params(float...)`, `param(x)` | Jusqu'à 8 nombres transmis au shader.                                                                             |
| `fadeSeconds(s)`               | Fondu à l'entrée ou à la sortie, ramené entre 0 et 10 secondes.                                                   |

`ScreenEffect.of(id)` en construit un avec les valeurs par défaut et `ScreenEffect.NONE` coupe l'effet.

| Appel                                  | Sens                                                                  |
| -------------------------------------- | --------------------------------------------------------------------- |
| `screenEffects().show(player, effect)` | Affiche ou remplace l'effet pour un joueur.                           |
| `screenEffects().clear(player)`        | Le retire.                                                            |
| `contentPacks().screenEffects()`       | L'ensemble des identifiants d'effets que les packs chargés déclarent. |

Les deux appels sont sûrs depuis n'importe quel thread. `show` lève `IllegalArgumentException` pour un identifiant non vide qu'aucun pack chargé ne déclare : vérifie donc d'abord `contentPacks().screenEffects().contains(id)`. Un pack peut être absent : `content_packs.enabled` peut être coupé et un pack peut être refusé.

Pour couper un effet avec un fondu, affiche un effet à identifiant vide avec un temps de fondu :

```java
getServer().screenEffects().show(player,
        ScreenEffect.builder().effect("").fadeSeconds(1.5f).build());
```

Un shader reçoit `intensity` (déjà fondue), `time`, la résolution et les 8 paramètres, rangés en deux `vec4<f32>`. Voir [Shaders](https://docs.aethercube.fr/developers/fr/content-packs/shaders.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.aethercube.fr/developers/fr/plugins/interface.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
