Ecrans Gastinel : accueil (Solo, Serveur Gastinel en un clic avec etat en direct, autres serveurs, options, quitter), serveurs simplifies, options essentielles, menu pause, fond maison et police Inter

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cette révision appartient à :
Théo GastineletClaude Opus 5.5 a révisé 2026-10-17 01:27:48 +02:00
1 Parent ae3848efcc
révision 91924fd20d
19 fichiers modifiés
+1088 -1

Aucun fichier ne correspond à votre recherche

+2 -1
Voir le fichier
@@ -1,10 +1,11 @@
#!/bin/sh
# Compile GastinelClient dans un conteneur JDK 21 jetable (rien n'est installé sur l'hôte).
# 8 Go : la décompilation du client (Vineflower) échoue avec 4 Go.
# Usage (sur cornafserver) : sh build-sur-cornafserver.sh -> build/libs/*.jar
set -e
cd "$(dirname "$0")"
mkdir -p "$HOME/.cache/gastinelclient-gradle"
nice -n 10 docker run --rm --memory 4g --cpus 4 \
nice -n 10 docker run --rm --memory 8g --cpus 4 \
-u "$(id -u):$(id -g)" \
-e GRADLE_USER_HOME=/gradle-home \
-v "$HOME/.cache/gastinelclient-gradle:/gradle-home" \
Fichier binaire non affiché.
+61
Voir le fichier
@@ -0,0 +1,61 @@
"""Génère l'arrière-plan de l'accueil GastinelClient (1920x1080, PNG).
Papier réchauffé, courbes de niveau fines (relief imaginaire façon Vercors), une ligne de crête
à l'encre et un repère orange. La moitié gauche reste presque vide pour le menu.
Usage : python outils/fond.py (écrit src/main/resources/assets/gastinelclient/textures/gui/fond.png)
"""
import os
import numpy as np
from PIL import Image, ImageDraw
W, H, SS = 1920, 1080, 2 # sur-échantillonnage x2 pour adoucir les traits
PAPIER = np.array([242, 240, 230], float)
FILET = np.array([218, 213, 200], float)
FILET_FORT = np.array([196, 188, 170], float)
ys, xs = np.mgrid[0:H * SS, 0:W * SS].astype(float) / SS
u, v = xs / W, ys / H
# Relief : un plateau (falaises) à droite + ondulations douces
relief = (
1.6 * np.exp(-((u - 0.78) ** 2 / 0.05 + (v - 0.62) ** 2 / 0.09))
+ 0.9 * np.exp(-((u - 0.98) ** 2 / 0.02 + (v - 0.25) ** 2 / 0.05))
+ 0.25 * np.sin(5.1 * u + 2.3 * v) * np.cos(3.7 * v - 1.2 * u)
+ 0.12 * np.sin(13 * u + 7 * v + 1.0)
)
k = 18.0
f = relief * k
d = np.abs(f - np.round(f)) # distance à la courbe la plus proche
grad = np.hypot(*np.gradient(f, 1.0 / SS)) + 1e-6
dist_px = d / grad
ligne = np.clip(1.2 - dist_px * 1.4, 0, 1)
maitresse = (np.round(f).astype(int) % 5 == 0)
# Masque : rien sous le menu à gauche, apparition progressive vers la droite
masque = np.clip((u - 0.34) / 0.22, 0, 1) ** 1.5
img = np.ones((H * SS, W * SS, 3)) * PAPIER
coul = np.where(maitresse[..., None], FILET_FORT, FILET)
a = (ligne * masque)[..., None]
img = img * (1 - a) + coul * a
pil = Image.fromarray(img.astype(np.uint8)).resize((W, H), Image.LANCZOS)
dr = ImageDraw.Draw(pil)
# Ligne de crête (encre), polyline anguleuse : pas d'arrondi
crete = [(1010, 820), (1120, 760), (1185, 772), (1260, 690), (1330, 668), (1372, 600),
(1460, 596), (1520, 640), (1600, 560), (1700, 548), (1770, 610), (1920, 590)]
dr.line(crete, fill=(45, 42, 38), width=2)
# Repère du spawn : carré orange franc + filet vertical
sx, sy = 1460, 596
dr.line([(sx, sy - 120), (sx, sy - 8)], fill=(45, 42, 38), width=1)
dr.rectangle([sx - 6, sy - 6 - 120, sx + 6, sy + 6 - 120], fill=(232, 89, 12))
# Croix de repérage dans les coins (filets fins)
for cx, cy in [(1840, 80), (1840, 1000), (760, 80), (760, 1000)]:
dr.line([(cx - 10, cy), (cx + 10, cy)], fill=(160, 152, 136), width=1)
dr.line([(cx, cy - 10), (cx, cy + 10)], fill=(160, 152, 136), width=1)
out = os.path.join(os.path.dirname(__file__), "..", "src", "main", "resources", "assets",
"gastinelclient", "textures", "gui", "fond.png")
pil.save(out, optimize=True)
print("écrit", os.path.normpath(out), pil.size)
+31
Voir le fichier
@@ -0,0 +1,31 @@
package com.gastinelclient;
import net.neoforged.neoforge.common.ModConfigSpec;
/** config/gastinelclient-client.toml */
public final class Config {
private static final ModConfigSpec.Builder B = new ModConfigSpec.Builder();
public static final ModConfigSpec.ConfigValue<String> SERVEUR_NOM = B
.comment("Nom affiché pour le serveur principal")
.define("serveurNom", "Serveur Gastinel");
public static final ModConfigSpec.ConfigValue<String> SERVEUR_ADRESSE = B
.comment("Adresse du serveur principal (bouton « Serveur Gastinel » de l'accueil)")
.define("serveurAdresse", "gastinel.me:25565");
public static final ModConfigSpec.BooleanValue ACCUEIL = B
.comment("Remplacer l'écran d'accueil de Minecraft")
.define("remplacerAccueil", true);
public static final ModConfigSpec.BooleanValue PAUSE = B
.comment("Remplacer le menu pause de Minecraft")
.define("remplacerPause", true);
public static final ModConfigSpec SPEC = B.build();
private Config() {}
// La config CLIENT est chargée pendant le démarrage ; par prudence, valeurs par défaut si elle ne l'est pas encore.
public static String nom() { try { return SERVEUR_NOM.get(); } catch (IllegalStateException e) { return SERVEUR_NOM.getDefault(); } }
public static String adresse() { try { return SERVEUR_ADRESSE.get(); } catch (IllegalStateException e) { return SERVEUR_ADRESSE.getDefault(); } }
public static boolean accueil() { try { return ACCUEIL.get(); } catch (IllegalStateException e) { return true; } }
public static boolean pause() { try { return PAUSE.get(); } catch (IllegalStateException e) { return true; } }
}
+41
Voir le fichier
@@ -0,0 +1,41 @@
package com.gastinelclient;
import com.gastinelclient.ecrans.AccueilScreen;
import com.gastinelclient.ecrans.PauseGastinel;
import net.minecraft.client.gui.screens.PauseScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.TitleScreen;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.neoforge.client.event.ScreenEvent;
import net.neoforged.neoforge.common.NeoForge;
/**
* GastinelClient : remplace l'écran d'accueil et le menu pause par les écrans Gastinel.
* On ne modifie pas NeoForge : on intercepte simplement l'ouverture des écrans vanilla
* (ScreenEvent.Opening) et on en ouvre un autre à la place.
*/
@Mod(value = GastinelClient.MODID, dist = Dist.CLIENT)
public final class GastinelClient {
public static final String MODID = "gastinelclient";
public GastinelClient(IEventBus modBus, ModContainer container) {
container.registerConfig(ModConfig.Type.CLIENT, Config.SPEC);
NeoForge.EVENT_BUS.addListener(GastinelClient::avantOuverture);
}
private static void avantOuverture(ScreenEvent.Opening e) {
Screen s = e.getNewScreen();
if (s == null) return;
// Classe exacte : on ne remplace pas un écran d'un autre mod qui hériterait de TitleScreen.
if (s.getClass() == TitleScreen.class && Config.accueil()) {
e.setNewScreen(new AccueilScreen());
} else if (s.getClass() == PauseScreen.class && ((PauseScreen) s).showsPauseMenu() && Config.pause()) {
// showsPauseMenu() == false : pause « silencieuse » (F3+Échap), on la laisse telle quelle.
e.setNewScreen(new PauseGastinel());
}
}
}
+48
Voir le fichier
@@ -0,0 +1,48 @@
package com.gastinelclient.core;
import java.util.Locale;
/** Textes calculés, sans dépendance à Minecraft (testés par JUnit). */
public final class Libelles {
private Libelles() {}
/** « En ligne · 3/20 joueurs · 12 ms » ; singulier pour 0 ou 1 joueur. */
public static String enLigne(int joueurs, int max, long pingMs) {
String j = joueurs <= 1 ? "joueur" : "joueurs";
StringBuilder sb = new StringBuilder("En ligne · ").append(joueurs);
if (max > 0) sb.append('/').append(max);
sb.append(' ').append(j);
if (pingMs >= 0) sb.append(" · ").append(pingMs).append(" ms");
return sb.toString();
}
/** Nettoie une adresse tapée : espaces, préfixe minecraft://, barre finale. Chaîne vide si rien d'utile. */
public static String nettoyerAdresse(String brut) {
if (brut == null) return "";
String s = brut.strip().replace(" ", "");
if (s.toLowerCase(Locale.ROOT).startsWith("minecraft://")) s = s.substring("minecraft://".length());
while (s.endsWith("/")) s = s.substring(0, s.length() - 1);
return s;
}
/** Adresse sans le port par défaut, pour l'affichage (« gastinel.me:25565 » → « gastinel.me »). */
public static String adresseCourte(String adresse) {
String s = nettoyerAdresse(adresse);
return s.endsWith(":25565") ? s.substring(0, s.length() - 6) : s;
}
/** Pourcentage arrondi : 0.456 → « 46 % » (espace insécable fine à la française). */
public static String pourcent(double v) {
return Math.round(Math.max(0, Math.min(1, v)) * 100) + " %";
}
/** Ajoute un pas à une valeur dans [0, 1] en évitant les 0.30000000000000004. */
public static double pas01(double v, double pas) {
double r = Math.round((v + pas) * 100.0) / 100.0;
return Math.max(0, Math.min(1, r));
}
public static int borne(int v, int min, int max) {
return Math.max(min, Math.min(max, v));
}
}
+136
Voir le fichier
@@ -0,0 +1,136 @@
package com.gastinelclient.ecrans;
import com.gastinelclient.Config;
import com.gastinelclient.core.Libelles;
import com.gastinelclient.ui.Bouton;
import com.gastinelclient.ui.Charte;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.ConnectScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.worldselection.SelectWorldScreen;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.multiplayer.ServerList;
import net.minecraft.client.multiplayer.ServerStatusPinger;
import net.minecraft.client.multiplayer.resolver.ServerAddress;
import net.neoforged.neoforge.client.gui.ModListScreen;
import java.net.UnknownHostException;
/**
* Écran d'accueil Gastinel : Solo, Serveur Gastinel (un clic), Autres serveurs, Options, Quitter.
* Le bouton du serveur affiche son état en direct (ping comme la liste multijoueur vanilla).
*/
public class AccueilScreen extends EcranGastinel {
private final ServerStatusPinger pinger = new ServerStatusPinger();
private ServerData gastinel;
private volatile String etat = "Recherche du serveur…";
private volatile int couleurEtat = Charte.DOUX;
public AccueilScreen() {
super("Accueil", null);
}
@Override
protected void init() {
this.gastinel = serveurGastinel();
int m = marge(), l = colonne();
int bloc = 46 + 32 + 4 * 21;
int y = Math.max(14, (this.height - 24 - bloc) / 2) + 46;
addRenderableWidget(new Bouton(m, y, l, 21, "Solo", Bouton.Genre.MENU,
() -> this.minecraft.setScreen(new SelectWorldScreen(this))));
y += 21;
addRenderableWidget(new Bouton(m, y, l, 32, Config.nom(), Bouton.Genre.PRIMAIRE, this::rejoindreGastinel)
.sousTitre(this::sousTitreServeur, () -> couleurEtat));
y += 32;
addRenderableWidget(new Bouton(m, y, l, 21, "Autres serveurs", Bouton.Genre.MENU,
() -> this.minecraft.setScreen(new ServeursScreen(this))));
y += 21;
addRenderableWidget(new Bouton(m, y, l, 21, "Options", Bouton.Genre.MENU,
() -> this.minecraft.setScreen(new OptionsSimplesScreen(this))));
y += 21;
addRenderableWidget(new Bouton(m, y, l, 21, "Quitter", Bouton.Genre.MENU, () -> this.minecraft.stop()));
String mods = "Mods";
lien(this.width - m - this.font.width(Charte.txt(mods)), this.height - 20, mods,
() -> this.minecraft.setScreen(new ModListScreen(this)));
// Relancé à chaque retour sur l'accueil : l'état affiché reste frais.
etat = "Recherche du serveur…";
couleurEtat = Charte.DOUX;
lancerPing();
}
/** Reprend l'entrée de la liste multijoueur si elle existe (garde le choix du pack de ressources). */
private ServerData serveurGastinel() {
String adr = Libelles.nettoyerAdresse(Config.adresse());
ServerList liste = new ServerList(this.minecraft);
liste.load();
for (int i = 0; i < liste.size(); i++) {
ServerData d = liste.get(i);
if (Libelles.nettoyerAdresse(d.ip).equalsIgnoreCase(adr)
|| Libelles.adresseCourte(d.ip).equalsIgnoreCase(Libelles.adresseCourte(adr))) {
return d;
}
}
return new ServerData(Config.nom(), adr, ServerData.Type.OTHER);
}
private void lancerPing() {
ServerData d = this.gastinel;
Thread t = new Thread(() -> {
try {
pinger.pingServer(d, () -> {}, () -> { etat = "Hors ligne pour le moment"; couleurEtat = Charte.ROUGE; });
} catch (UnknownHostException e) {
etat = "Adresse introuvable";
couleurEtat = Charte.ROUGE;
} catch (Exception e) {
etat = "Hors ligne pour le moment";
couleurEtat = Charte.ROUGE;
}
}, "GastinelClient ping");
t.setDaemon(true);
t.start();
}
private String sousTitreServeur() {
ServerData d = this.gastinel;
if (d != null && d.players != null) {
couleurEtat = Charte.VERT;
return Libelles.enLigne(d.players.online(), d.players.max(), d.ping);
}
return etat;
}
private void rejoindreGastinel() {
ServerData d = this.gastinel;
ConnectScreen.startConnecting(this, this.minecraft, ServerAddress.parseString(d.ip), d, false, null);
}
@Override
public void tick() {
pinger.tick();
}
@Override
public void removed() {
pinger.removeAll();
}
@Override
public boolean shouldCloseOnEsc() {
return false;
}
@Override
public void render(GuiGraphics g, int mx, int my, float pt) {
super.render(g, mx, my, pt);
int m = marge(), l = colonne();
int bloc = 46 + 32 + 4 * 21;
int y = Math.max(14, (this.height - 24 - bloc) / 2);
Charte.texte(g, this.font, Charte.gras("SERVEUR MINECRAFT"), m, y, Charte.ORANGE);
Charte.grandTitre(g, this.font, "Gastinel", m - 1, y + 12, 3f, Charte.ENCRE);
Charte.filet(g, m, m + l, y + 45, Charte.ENCRE);
piedDePage(g);
}
}
+61
Voir le fichier
@@ -0,0 +1,61 @@
package com.gastinelclient.ecrans;
import com.gastinelclient.ui.Bouton;
import com.gastinelclient.ui.Charte;
import net.minecraft.SharedConstants;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.neoforged.fml.ModList;
import org.jetbrains.annotations.Nullable;
/** Base des écrans Gastinel hors partie : fond maison, marges, pied de page. */
public abstract class EcranGastinel extends Screen {
@Nullable protected final Screen parent;
protected EcranGastinel(String titre, @Nullable Screen parent) {
super(Component.literal(titre));
this.parent = parent;
}
protected int marge() { return Math.max(16, this.width / 16); }
protected int colonne() { return Math.min(240, Math.max(170, (int) (this.width * 0.36f))); }
protected Bouton lien(int x, int y, String texte, Runnable action) {
int l = this.font.width(Charte.txt(texte));
return this.addRenderableWidget(new Bouton(x, y, l, 12, texte, Bouton.Genre.LIEN, action));
}
@Override
public void renderBackground(GuiGraphics g, int mx, int my, float pt) {
if (this.minecraft != null && this.minecraft.level != null) {
// En partie : voile de papier (pas de flou), le monde reste deviné derrière.
g.fill(0, 0, this.width, this.height, 0xF0F2F0E6);
} else {
Charte.fond(g, this.width, this.height);
}
}
/** En-tête : petit libellé orange + titre. Renvoie le y sous l'en-tête. */
protected int entete(GuiGraphics g, int x, int y, String surtitre, String titre) {
Charte.texte(g, this.font, Charte.gras(surtitre.toUpperCase()), x, y, Charte.ORANGE);
Charte.grandTitre(g, this.font, titre, x, y + 14, 2f, Charte.ENCRE);
Charte.filet(g, x, x + colonne(), y + 38, Charte.ENCRE);
return y + 46;
}
protected void piedDePage(GuiGraphics g) {
int m = marge(), y = this.height - 18;
Charte.filet(g, m, this.width - m, y - 5, Charte.FILET);
String v = ModList.get().getModContainerById("gastinelclient")
.map(c -> c.getModInfo().getVersion().toString()).orElse("?");
Charte.texte(g, this.font, Charte.txt("Minecraft " + SharedConstants.getCurrentVersion().getName()
+ " · GastinelClient " + v), m, y, Charte.DOUX);
}
@Override
public void onClose() {
this.minecraft.setScreen(this.parent);
}
}
+130
Voir le fichier
@@ -0,0 +1,130 @@
package com.gastinelclient.ecrans;
import com.gastinelclient.core.Libelles;
import com.gastinelclient.ui.Bouton;
import com.gastinelclient.ui.Charte;
import net.minecraft.client.OptionInstance;
import net.minecraft.client.Options;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.options.OptionsScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundSource;
import java.util.ArrayList;
import java.util.List;
import java.util.function.IntFunction;
import java.util.function.Supplier;
/**
* Options essentielles sur un seul écran (image, son, souris), avec des pas − / + au lieu
* des curseurs vanilla. « Toutes les options » ouvre l'écran complet de Minecraft.
*/
public class OptionsSimplesScreen extends EcranGastinel {
private record Ligne(String nom, Supplier<String> valeur, int x, int y, int l) {}
private record Rubrique(String nom, int x, int y) {}
private final List<Ligne> lignes = new ArrayList<>();
private final List<Rubrique> rubriques = new ArrayList<>();
public OptionsSimplesScreen(Screen parent) {
super("Options", parent);
}
private Options o() { return this.minecraft.options; }
@Override
protected void init() {
lignes.clear();
rubriques.clear();
int m = marge();
int l = Math.min(colonne(), (this.width - 2 * m - 24) / 2);
int x1 = m, x2 = m + l + 24;
int y0 = 16 + 46;
int y = rubrique("Image", x1, y0);
y = pas(x1, y, l, "Distance d'affichage", o().renderDistance(), 1, v -> v + " tronçons");
y = pas(x1, y, l, "Champ de vision", o().fov(), 5, v -> v + "°");
y = pasDouble(x1, y, l, "Luminosité", o().gamma(), 0.1);
y = pas(x1, y, l, "Taille de l'interface", o().guiScale(), 1, v -> v == 0 ? "Auto" : "×" + v);
y = bascule(x1, y, l, "Plein écran", o().fullscreen());
bascule(x1, y, l, "Synchro verticale", o().enableVsync());
y = rubrique("Son et souris", x2, y0);
y = pasDouble(x2, y, l, "Volume général", o().getSoundSourceOptionInstance(SoundSource.MASTER), 0.05);
y = pasDouble(x2, y, l, "Musique", o().getSoundSourceOptionInstance(SoundSource.MUSIC), 0.05);
y = pasDouble(x2, y, l, "Blocs et ambiance", o().getSoundSourceOptionInstance(SoundSource.BLOCKS), 0.05);
pasDouble(x2, y, l, "Sensibilité de la souris", o().sensitivity(), 0.05);
lien(m, this.height - 20, "← Retour", this::onClose);
String tout = "Toutes les options de Minecraft";
lien(this.width - m - this.font.width(Charte.txt(tout)), this.height - 20, tout,
() -> this.minecraft.setScreen(new OptionsScreen(this, o())));
}
private int rubrique(String nom, int x, int y) {
rubriques.add(new Rubrique(nom, x, y));
return y + 14;
}
/** Pas entier, borné sur les limites de l'option (une valeur hors bornes serait remise par défaut). */
private int pas(int x, int y, int l, String nom, OptionInstance<Integer> opt, int pas, IntFunction<String> format) {
Runnable apres = opt == o().guiScale() ? () -> this.minecraft.resizeDisplay() : () -> {};
ajouterPas(x, y, l, nom, () -> format.apply(opt.get()),
() -> { opt.set(borner(opt, opt.get() - pas)); apres.run(); },
() -> { opt.set(borner(opt, opt.get() + pas)); apres.run(); });
return y + 20;
}
private static int borner(OptionInstance<Integer> opt, int v) {
if (opt.values() instanceof OptionInstance.IntRange r) return Libelles.borne(v, r.minInclusive(), r.maxInclusive());
if (opt.values() instanceof OptionInstance.ClampingLazyMaxIntRange r) return Libelles.borne(v, r.minInclusive(), r.maxInclusive());
return v;
}
private int pasDouble(int x, int y, int l, String nom, OptionInstance<Double> opt, double pas) {
ajouterPas(x, y, l, nom, () -> Libelles.pourcent(opt.get()),
() -> opt.set(Libelles.pas01(opt.get(), -pas)),
() -> opt.set(Libelles.pas01(opt.get(), pas)));
return y + 20;
}
private void ajouterPas(int x, int y, int l, String nom, Supplier<String> valeur, Runnable moins, Runnable plus) {
lignes.add(new Ligne(nom, valeur, x, y, l - 42));
addRenderableWidget(new Bouton(x + l - 38, y + 2, 17, 15, "−", Bouton.Genre.CADRE, moins));
addRenderableWidget(new Bouton(x + l - 17, y + 2, 17, 15, "+", Bouton.Genre.CADRE, plus));
}
private int bascule(int x, int y, int l, String nom, OptionInstance<Boolean> opt) {
lignes.add(new Ligne(nom, () -> "", x, y, l - 42));
Bouton[] b = new Bouton[1];
b[0] = addRenderableWidget(new Bouton(x + l - 38, y + 2, 38, 15, opt.get() ? "Oui" : "Non", Bouton.Genre.CADRE, () -> {
opt.set(!opt.get());
b[0].setMessage(Component.literal(opt.get() ? "Oui" : "Non"));
}));
return y + 20;
}
@Override
public void render(GuiGraphics g, int mx, int my, float pt) {
super.render(g, mx, my, pt);
entete(g, marge(), 16, "Réglages", "Options");
for (Rubrique r : rubriques) {
Charte.texte(g, this.font, Charte.gras(r.nom().toUpperCase()), r.x(), r.y(), Charte.DOUX);
}
for (Ligne li : lignes) {
Charte.texte(g, this.font, Charte.txt(li.nom()), li.x(), li.y() + 6, Charte.ENCRE);
String v = li.valeur().get();
if (!v.isEmpty()) {
int w = this.font.width(Charte.gras(v));
Charte.texte(g, this.font, Charte.gras(v), li.x() + li.l() - w, li.y() + 6, Charte.ENCRE);
}
Charte.filet(g, li.x(), li.x() + li.l() + 42, li.y() + 19, Charte.FILET);
}
}
@Override
public void removed() {
this.minecraft.options.save();
}
}
+112
Voir le fichier
@@ -0,0 +1,112 @@
package com.gastinelclient.ecrans;
import com.gastinelclient.ui.Bouton;
import com.gastinelclient.ui.Charte;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.GenericMessageScreen;
import net.minecraft.client.gui.screens.ShareToLanScreen;
import net.minecraft.client.gui.screens.achievement.StatsScreen;
import net.minecraft.client.gui.screens.advancements.AdvancementsScreen;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.network.chat.Component;
import net.neoforged.neoforge.client.gui.ModListScreen;
/**
* Menu pause simplifié : un panneau de papier à gauche, le monde visible à droite (sans flou).
* Reprendre, Options, Progrès, Statistiques, (Ouvrir en réseau local), Mods, Quitter.
*/
public class PauseGastinel extends EcranGastinel {
private static final Component SAUVEGARDE = Component.translatable("menu.savingLevel");
public PauseGastinel() {
super("Pause", null);
}
private int panneau() { return Math.min(this.width, colonne() + 2 * marge()); }
private int haut() {
int n = 5 + (lanPossible() ? 1 : 0);
return Math.max(14, (this.height - (46 + 30 + n * 20 + 12 + 20)) / 2);
}
@Override
protected void init() {
int m = marge(), l = colonne();
boolean solo = this.minecraft.isLocalServer();
int y = haut() + 46;
addRenderableWidget(new Bouton(m, y, l, 30, "Reprendre", Bouton.Genre.PRIMAIRE, this::reprendre)
.sousTitre(this::lieu, () -> Charte.DOUX));
y += 30;
addRenderableWidget(new Bouton(m, y, l, 20, "Options", Bouton.Genre.MENU,
() -> this.minecraft.setScreen(new OptionsSimplesScreen(this))));
y += 20;
addRenderableWidget(new Bouton(m, y, l, 20, "Progrès", Bouton.Genre.MENU,
() -> this.minecraft.setScreen(new AdvancementsScreen(this.minecraft.player.connection.getAdvancements(), this))));
y += 20;
addRenderableWidget(new Bouton(m, y, l, 20, "Statistiques", Bouton.Genre.MENU,
() -> this.minecraft.setScreen(new StatsScreen(this, this.minecraft.player.getStats()))));
y += 20;
if (lanPossible()) {
addRenderableWidget(new Bouton(m, y, l, 20, "Ouvrir en réseau local", Bouton.Genre.MENU,
() -> this.minecraft.setScreen(new ShareToLanScreen(this))));
y += 20;
}
addRenderableWidget(new Bouton(m, y, l, 20, "Mods", Bouton.Genre.MENU,
() -> this.minecraft.setScreen(new ModListScreen(this))));
y += 20 + 12;
addRenderableWidget(new Bouton(m, y, l, 20, solo ? "Sauvegarder et quitter" : "Se déconnecter",
Bouton.Genre.PRIMAIRE, this::quitter).accent(Charte.ROUGE));
}
private boolean lanPossible() {
return this.minecraft.hasSingleplayerServer() && !this.minecraft.getSingleplayerServer().isPublished();
}
private String lieu() {
if (this.minecraft.hasSingleplayerServer()) {
return "Monde : " + this.minecraft.getSingleplayerServer().getWorldData().getLevelName();
}
ServerData d = this.minecraft.getCurrentServer();
return d != null ? d.name : "Multijoueur";
}
private void reprendre() {
this.minecraft.setScreen(null);
this.minecraft.mouseHandler.grabMouse();
}
/** Même suite que PauseScreen#onDisconnect, puis retour à l'accueil Gastinel. */
private void quitter() {
boolean local = this.minecraft.isLocalServer();
this.minecraft.level.disconnect();
if (local) {
this.minecraft.disconnect(new GenericMessageScreen(SAUVEGARDE));
} else {
this.minecraft.disconnect();
}
this.minecraft.setScreen(new AccueilScreen());
}
@Override
public void onClose() {
reprendre();
}
@Override
public void renderBackground(GuiGraphics g, int mx, int my, float pt) {
int p = panneau();
g.fill(0, 0, this.width, this.height, 0x33000000); // monde légèrement assombri, sans flou
g.fill(0, 0, p, this.height, 0xF2F2F0E6);
g.fill(p, 0, p + 1, this.height, Charte.ENCRE);
}
@Override
public void render(GuiGraphics g, int mx, int my, float pt) {
super.render(g, mx, my, pt);
int m = marge(), l = colonne(), y = haut();
Charte.texte(g, this.font, Charte.gras("GASTINEL"), m, y, Charte.ORANGE);
Charte.grandTitre(g, this.font, "Pause", m - 1, y + 12, 3f, Charte.ENCRE);
Charte.filet(g, m, m + l, y + 45, Charte.ENCRE);
}
}
+156
Voir le fichier
@@ -0,0 +1,156 @@
package com.gastinelclient.ecrans;
import com.gastinelclient.Config;
import com.gastinelclient.core.Libelles;
import com.gastinelclient.ui.Bouton;
import com.gastinelclient.ui.Charte;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.screens.ConnectScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.multiplayer.ServerList;
import net.minecraft.client.multiplayer.resolver.ServerAddress;
import net.minecraft.network.chat.Component;
import net.minecraft.util.FormattedCharSequence;
import java.util.ArrayList;
import java.util.List;
/**
* « Autres serveurs », version simple : une case d'adresse (Rejoindre / Enregistrer) et la liste
* des serveurs enregistrés, un clic pour rejoindre. La liste vanilla complète reste accessible.
*/
public class ServeursScreen extends EcranGastinel {
private EditBox adresse;
private String saisie = "";
private String message = "";
private int page = 0;
public ServeursScreen(Screen parent) {
super("Autres serveurs", parent);
}
@Override
protected void init() {
int m = marge(), l = colonne();
int y = 16 + 46;
adresse = new EditBox(this.font, m + 5, y + 7, l - 10, 12, Component.literal("Adresse"));
adresse.setBordered(false);
adresse.setTextShadow(false);
adresse.setTextColor(Charte.ENCRE);
adresse.setMaxLength(255);
adresse.setHint(Charte.txt("Adresse, ex. play.exemple.fr").withColor(Charte.DOUX));
adresse.setFormatter((s, i) -> FormattedCharSequence.forward(s, Charte.txt("").getStyle()));
adresse.setValue(saisie);
adresse.setResponder(s -> saisie = s);
addRenderableWidget(adresse);
setInitialFocus(adresse);
y += 26;
int lb = (l - 6) / 2;
addRenderableWidget(new Bouton(m, y, lb, 18, "Rejoindre", Bouton.Genre.CADRE, this::rejoindreSaisie));
addRenderableWidget(new Bouton(m + lb + 6, y, l - lb - 6, 18, "Enregistrer", Bouton.Genre.CADRE, this::enregistrer));
y += 30;
// Liste enregistrée (sans le serveur Gastinel, déjà sur l'accueil)
List<ServerData> serveurs = new ArrayList<>();
ServerList liste = new ServerList(this.minecraft);
liste.load();
String gastinel = Libelles.adresseCourte(Config.adresse());
for (int i = 0; i < liste.size(); i++) {
ServerData d = liste.get(i);
if (!Libelles.adresseCourte(d.ip).equalsIgnoreCase(gastinel)) serveurs.add(d);
}
int bas = this.height - 46;
int parPage = Math.max(1, (bas - y - 14) / 20);
int pages = Math.max(1, (serveurs.size() + parPage - 1) / parPage);
page = Math.min(page, pages - 1);
int ligneY = y + 14;
if (serveurs.isEmpty()) {
message = message.isEmpty() ? "Aucun serveur enregistré pour l'instant." : message;
}
for (int i = page * parPage; i < Math.min(serveurs.size(), (page + 1) * parPage); i++) {
ServerData d = serveurs.get(i);
addRenderableWidget(new Bouton(m, ligneY, l, 20, d.name, Bouton.Genre.MENU, () -> rejoindre(d))
.droite(Libelles.adresseCourte(d.ip)));
ligneY += 20;
}
if (pages > 1) {
if (page > 0) lien(m, bas, "← Précédents", () -> { page--; rebuildWidgets(); });
if (page < pages - 1) {
String s = "Suivants →";
lien(m + l - this.font.width(Charte.txt(s)), bas, s, () -> { page++; rebuildWidgets(); });
}
}
lien(m, this.height - 20, "← Retour", this::onClose);
String complet = "Liste complète de Minecraft (modifier, supprimer)";
lien(this.width - m - this.font.width(Charte.txt(complet)), this.height - 20, complet,
() -> this.minecraft.setScreen(new JoinMultiplayerScreen(this)));
}
private void rejoindreSaisie() {
String a = Libelles.nettoyerAdresse(saisie);
if (!ServerAddress.isValidAddress(a)) {
message = "Adresse invalide.";
return;
}
rejoindre(new ServerData(a, a, ServerData.Type.OTHER));
}
private void enregistrer() {
String a = Libelles.nettoyerAdresse(saisie);
if (!ServerAddress.isValidAddress(a)) {
message = "Adresse invalide.";
return;
}
ServerList liste = new ServerList(this.minecraft);
liste.load();
if (liste.get(a) == null) {
liste.add(new ServerData(a, a, ServerData.Type.OTHER), false);
liste.save();
message = "Enregistré : " + a;
} else {
message = "Déjà dans la liste.";
}
saisie = "";
rebuildWidgets();
}
private void rejoindre(ServerData d) {
ConnectScreen.startConnecting(this, this.minecraft, ServerAddress.parseString(d.ip), d, false, null);
}
@Override
public boolean keyPressed(int key, int scan, int mods) {
if ((key == 257 || key == 335) && adresse != null && adresse.isFocused()) { // Entrée
rejoindreSaisie();
return true;
}
return super.keyPressed(key, scan, mods);
}
@Override
public void render(GuiGraphics g, int mx, int my, float pt) {
super.render(g, mx, my, pt);
int m = marge(), l = colonne();
int y = entete(g, m, 16, "Multijoueur", "Autres serveurs");
// Case d'adresse : cadre fin dessiné par nous (pas de bordure vanilla)
g.renderOutline(m, y, l, 22, adresse != null && adresse.isFocused() ? Charte.ENCRE : Charte.FILET_FORT);
int ly = y + 26 + 30;
Charte.texte(g, this.font, Charte.gras("ENREGISTRÉS"), m, ly, Charte.DOUX);
if (!message.isEmpty()) {
Charte.texte(g, this.font, Charte.txt(message), m + this.font.width(Charte.gras("ENREGISTRÉS")) + 10, ly, Charte.DOUX);
}
}
@Override
public void renderBackground(GuiGraphics g, int mx, int my, float pt) {
super.renderBackground(g, mx, my, pt);
int m = marge(), l = colonne();
g.fill(m, 16 + 46, m + l, 16 + 46 + 22, Charte.CARTE);
}
}
+92
Voir le fichier
@@ -0,0 +1,92 @@
package com.gastinelclient.ui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractButton;
import net.minecraft.client.gui.narration.NarrationElementOutput;
import net.minecraft.network.chat.Component;
import java.util.function.Supplier;
/**
* Bouton plat de la charte : angles droits, filets fins, pas de texture.
* MENU : ligne de liste alignée à gauche ; PRIMAIRE : comme MENU avec barre d'accent et sous-titre ;
* CADRE : petit bouton encadré centré ; LIEN : texte seul souligné au survol.
*/
public class Bouton extends AbstractButton {
public enum Genre { MENU, PRIMAIRE, CADRE, LIEN }
private final Genre genre;
private final Runnable action;
private Supplier<String> sousTitre = null;
private Supplier<Integer> couleurSousTitre = () -> Charte.DOUX;
private int accent = Charte.ORANGE;
private String droite = null;
public Bouton(int x, int y, int l, int h, String texte, Genre genre, Runnable action) {
super(x, y, l, h, Component.literal(texte));
this.genre = genre;
this.action = action;
}
public Bouton sousTitre(Supplier<String> s, Supplier<Integer> couleur) {
this.sousTitre = s;
this.couleurSousTitre = couleur;
return this;
}
public Bouton accent(int c) { this.accent = c; return this; }
/** Petit texte gris aligné à droite (ex. adresse d'un serveur). */
public Bouton droite(String s) { this.droite = s; return this; }
@Override
public void onPress() { action.run(); }
@Override
protected void renderWidget(GuiGraphics g, int mx, int my, float pt) {
Font f = Minecraft.getInstance().font;
boolean s = this.active && this.isHoveredOrFocused();
int x = getX(), y = getY(), l = getWidth(), h = getHeight();
int encre = this.active ? Charte.ENCRE : Charte.FILET_FORT;
String t = getMessage().getString();
switch (genre) {
case MENU, PRIMAIRE -> {
if (s) g.fill(x, y, x + l, y + h, Charte.SURVOL);
boolean prim = genre == Genre.PRIMAIRE;
if (prim || s) g.fill(x, y, x + (prim ? 3 : 2), y + h, prim ? accent : Charte.ENCRE);
int tx = x + 12;
if (sousTitre != null) {
Charte.texte(g, f, Charte.gras(t), tx, y + h / 2 - 10, encre);
Charte.texte(g, f, Charte.txt(sousTitre.get()), tx, y + h / 2 + 2, couleurSousTitre.get());
} else {
Charte.texte(g, f, prim ? Charte.gras(t) : Charte.txt(t), tx, y + (h - 8) / 2, encre);
}
if (droite != null) {
Component d = Charte.txt(droite);
Charte.texte(g, f, d, x + l - 22 - f.width(d), y + (h - 8) / 2, Charte.DOUX);
}
if (s) Charte.texte(g, f, Charte.txt("→"), x + l - 14, y + (h - 8) / 2, Charte.ENCRE);
Charte.filet(g, x, x + l, y + h - 1, Charte.FILET);
}
case CADRE -> {
if (s) g.fill(x, y, x + l, y + h, Charte.ENCRE);
else g.fill(x, y, x + l, y + h, Charte.CARTE);
g.renderOutline(x, y, l, h, s ? Charte.ENCRE : Charte.FILET_FORT);
Component c = Charte.txt(t);
Charte.texte(g, f, c, x + (l - f.width(c)) / 2, y + (h - 8) / 2, s ? Charte.PAPIER : encre);
}
case LIEN -> {
Component c = Charte.txt(t);
Charte.texte(g, f, c, x, y + (h - 8) / 2, s ? Charte.ENCRE : Charte.DOUX);
if (s) Charte.filet(g, x, x + f.width(c), y + (h - 8) / 2 + 9, Charte.ENCRE);
}
}
}
@Override
protected void updateWidgetNarration(NarrationElementOutput out) {
this.defaultButtonNarrationText(out);
}
}
+78
Voir le fichier
@@ -0,0 +1,78 @@
package com.gastinelclient.ui;
import com.gastinelclient.GastinelClient;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceLocation;
/**
* Charte Gastinel : papier réchauffé, encre presque noire, filets fins, aucun arrondi,
* police Inter, et quelques couleurs franches réservées aux éléments clés.
*/
public final class Charte {
private Charte() {}
// Couleurs (ARGB)
public static final int PAPIER = 0xFFF2F0E6;
public static final int CARTE = 0xFFF8F7F1;
public static final int SURVOL = 0xFFE9E5D9;
public static final int ENCRE = 0xFF2D2A26;
public static final int DOUX = 0xFF6F6A61;
public static final int FILET = 0xFFDAD5C8;
public static final int FILET_FORT = 0xFFB9B1A0;
// Accents francs (avec retenue)
public static final int ORANGE = 0xFFE8590C;
public static final int VERT = 0xFF2B8A3E;
public static final int ROUGE = 0xFFC92A2A;
public static final ResourceLocation INTER = rl("inter");
public static final ResourceLocation INTER_GRAS = rl("inter_gras");
public static final ResourceLocation INTER_TITRE = rl("inter_titre");
public static final ResourceLocation FOND = rl("textures/gui/fond.png");
private static final int FOND_L = 1920, FOND_H = 1080;
private static ResourceLocation rl(String p) {
return ResourceLocation.fromNamespaceAndPath(GastinelClient.MODID, p);
}
public static MutableComponent txt(String s) {
return Component.literal(s).withStyle(st -> st.withFont(INTER));
}
public static MutableComponent gras(String s) {
return Component.literal(s).withStyle(st -> st.withFont(INTER_GRAS));
}
public static MutableComponent titre(String s) {
return Component.literal(s).withStyle(st -> st.withFont(INTER_TITRE));
}
/** Texte sans ombre (l'ombre vanilla salit un fond clair). */
public static void texte(GuiGraphics g, Font f, Component c, int x, int y, int couleur) {
g.drawString(f, c, x, y, couleur, false);
}
/** Grand titre : police Inter suréchantillonnée, agrandie d'un facteur {@code echelle}. */
public static void grandTitre(GuiGraphics g, Font f, String s, int x, int y, float echelle, int couleur) {
g.pose().pushPose();
g.pose().translate(x, y, 0);
g.pose().scale(echelle, echelle, 1f);
g.drawString(f, titre(s), 0, 0, couleur, false);
g.pose().popPose();
}
/** Arrière-plan « à lui » : papier + courbes de niveau, calé à droite, recouvrant tout l'écran. */
public static void fond(GuiGraphics g, int w, int h) {
g.fill(0, 0, w, h, PAPIER);
float k = Math.max(w / (float) FOND_L, h / (float) FOND_H);
int dw = Math.round(FOND_L * k), dh = Math.round(FOND_H * k);
g.blit(FOND, w - dw, (h - dh) / 2, dw, dh, 0f, 0f, FOND_L, FOND_H, FOND_L, FOND_H);
}
/** Filet horizontal fin. */
public static void filet(GuiGraphics g, int x1, int x2, int y, int couleur) {
g.fill(x1, y, x2, y + 1, couleur);
}
}
+92
Voir le fichier
@@ -0,0 +1,92 @@
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION AND CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+6
Voir le fichier
@@ -0,0 +1,6 @@
{
"providers": [
{ "type": "ttf", "file": "gastinelclient:inter-regular.ttf", "size": 9.0, "oversample": 4.0, "shift": [0.0, 1.0] },
{ "type": "reference", "id": "minecraft:default" }
]
}
+6
Voir le fichier
@@ -0,0 +1,6 @@
{
"providers": [
{ "type": "ttf", "file": "gastinelclient:inter-semibold.ttf", "size": 9.0, "oversample": 4.0, "shift": [0.0, 1.0] },
{ "type": "reference", "id": "minecraft:default" }
]
}
+6
Voir le fichier
@@ -0,0 +1,6 @@
{
"providers": [
{ "type": "ttf", "file": "gastinelclient:inter-semibold.ttf", "size": 9.0, "oversample": 12.0, "shift": [0.0, 1.0] },
{ "type": "reference", "id": "minecraft:default" }
]
}
Fichier binaire non affiché.

Après

Largeur:  |  Hauteur:  |  Taille: 438 KiB

+30
Voir le fichier
@@ -0,0 +1,30 @@
package com.gastinelclient.core;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class LibellesTest {
@Test void enLigne() {
assertEquals("En ligne · 3/20 joueurs · 12 ms", Libelles.enLigne(3, 20, 12));
assertEquals("En ligne · 1/20 joueur · 9 ms", Libelles.enLigne(1, 20, 9));
assertEquals("En ligne · 0 joueur", Libelles.enLigne(0, 0, -1));
}
@Test void adresses() {
assertEquals("gastinel.me:25565", Libelles.nettoyerAdresse(" minecraft://gastinel.me:25565/ "));
assertEquals("play.exemple.fr", Libelles.nettoyerAdresse("play. exemple.fr"));
assertEquals("", Libelles.nettoyerAdresse(null));
assertEquals("gastinel.me", Libelles.adresseCourte("gastinel.me:25565"));
assertEquals("gastinel.me:25570", Libelles.adresseCourte("gastinel.me:25570"));
}
@Test void nombres() {
assertEquals("46 %", Libelles.pourcent(0.456));
assertEquals("100 %", Libelles.pourcent(1.4));
assertEquals(0.3, Libelles.pas01(0.2, 0.1));
assertEquals(1.0, Libelles.pas01(0.98, 0.05));
assertEquals(0.0, Libelles.pas01(0.02, -0.05));
assertEquals(32, Libelles.borne(40, 2, 32));
}
}