Compare commits

8 Commits

Author SHA1 Message Date
0112bde962 Publish jars as a Gitea release on tag push
All checks were successful
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is passing
Add a gitea-release step to the Drone pipeline that uploads everything
in build/libs/*.jar to a Gitea Release named after the pushed tag,
authenticating with a gitea_token secret. The step is guarded with
when.event tag, and tag was added to the pipeline trigger so the build
itself runs for tag events. Document the one-time token / secret setup
and the tag workflow in the README.
2026-06-21 16:18:23 +06:00
b3f24d9828 Switch to Entity.sendSystemMessage for chat output
All checks were successful
continuous-integration/drone/push Build is passing
displayClientMessage(Component, boolean) was removed from LocalPlayer
in 26.2. sendSystemMessage(Component) is inherited from Entity, has
been part of Mojang's public API since 1.19, and LocalPlayer overrides
it to route the message into the local chat hud, which is exactly the
behaviour we want.
2026-06-21 16:10:40 +06:00
0e6377fce1 Route chat output through LocalPlayer.displayClientMessage
Some checks failed
continuous-integration/drone/push Build is failing
Gui.chat is private in 26.2 and Gui.getChat() is gone, so the previous
direct-field access does not compile. Player.displayClientMessage is a
public, stable API for client-side chat output, so push everything
through it. When the player is null (e.g. on the title screen before
join, where the auto-connect "Connected to ..." line lands), fall back
to the logger so the message is not silently dropped.
2026-06-21 16:07:19 +06:00
b0501acfcd Update chat and GameProfile accessors for 26.2
Some checks failed
continuous-integration/drone/push Build is failing
In 26.2 Mojang dropped the getChat() wrapper on Gui in favour of the
public 'chat' field, and com.mojang.authlib.GameProfile is now a record
so its getter is name() rather than getName(). Reflect both changes in
the IRC chat dispatcher.
2026-06-21 16:03:52 +06:00
5f366792c3 Use plain implementation for Fabric deps under unobfuscated Loom
Some checks failed
continuous-integration/drone/push Build is failing
Loom 1.17 in unobfuscated mode does not register the modImplementation
configuration: there is no remapping step that would need it. Use plain
implementation for fabric-loader and fabric-api, matching the original
work in 19b6ea5 that I had rolled back.
2026-06-21 15:59:08 +06:00
8a969bc843 Drop mappings declaration for unobfuscated 26.2
Some checks failed
continuous-integration/drone/push Build is failing
Starting with 26.1 Mojang ships Minecraft unobfuscated, and Yarn /
Intermediary are no longer published past 1.21.11. Loom does not need
a mappings dependency in that mode: the Mojang-named source compiles
directly. Remove the mappings line, drop the yarn_mappings property,
revert the client entrypoint to Mojang names (Minecraft, Component,
ChatFormatting, gui.getChat(), getUser().getName()), and rewrite the
README note so it stops claiming Mojang mappings via Loom.
2026-06-21 15:57:22 +06:00
71dc665ef1 Switch to Yarn mappings 26.2+build.3
Some checks failed
continuous-integration/drone/push Build is failing
Loom rejected officialMojangMappings() with a non-obfuscated
environment error, and Mojang client_mappings are not published for
26.2 yet. Pin Yarn at 26.2+build.3 via the new yarn_mappings property
and rewrite the client entrypoint with Yarn names: MinecraftClient,
Text, Formatting, inGameHud.getChatHud(), getSession().getUsername().
2026-06-21 15:49:02 +06:00
fb233cee93 Pin Loom plugin version literally for Gradle 9
Some checks failed
continuous-integration/drone/push Build is failing
Gradle 9 rejects property interpolation inside plugins {} — the version
must be a literal String. Drop the now-unused loom_version key from
gradle.properties so it does not desync from the build script.
2026-06-21 15:41:43 +06:00
5 changed files with 47 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ trigger:
event:
- push
- pull_request
- tag
steps:
- name: gradle-build
@@ -15,3 +16,18 @@ steps:
commands:
- gradle --no-daemon clean build
- ls -la build/libs
- name: gitea-release
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_token
base_url: https://git.nevetime.ru
files:
- build/libs/*.jar
title: ${DRONE_TAG}
checksum:
- sha256
when:
event:
- tag

View File

@@ -30,7 +30,7 @@
Дата релиза `Minecraft 26.2`: `2026-06-16`.
Для этой версии я использую official Mojang mappings через Loom, потому что стандартный Yarn endpoint для `26.2` на момент правки ещё не отдавал mappings.
Начиная с `26.1` Mojang перестал обфусцировать клиент, а Yarn и Intermediary перестали публиковаться после `1.21.11`. Поэтому в `build.gradle` нет блока `mappings` вообще: исходники Minecraft уже в человекочитаемых именах Mojang, и Loom собирает мод напрямую против них.
Если в CI стоит старый Loom вроде `1.10.5`, сборка `26.2` упадёт с ошибкой `Unsupported class file major version 69`. Для `26.2` нужен новый Loom из актуальной ветки Fabric.
@@ -144,6 +144,27 @@ gradle build
- запуск Docker pipeline;
- `gradle clean build`;
- вывод содержимого `build/libs`.
- вывод содержимого `build/libs`;
- по тегу — публикует jar-ы из `build/libs/*.jar` как Gitea Release.
Для работы Drone runner должен иметь доступ в интернет, чтобы скачать зависимости Gradle/Fabric.
### Автоматический релиз по тегу
Чтобы Drone выложил собранный мод в раздел Releases репозитория, нужны две разовые настройки и одна команда на каждую новую версию.
**Один раз:**
1. В Gitea: `Settings → Applications → Generate New Token`. Дать токену права `write:repository`. Скопировать.
2. В Drone, на странице репозитория: `Settings → Secrets → New Secret`. Имя — `gitea_token`, значение — токен из шага 1. Поставить галку `Allow Pull Requests` снять (релизы только из push/tag).
**На каждую новую версию:**
```bash
git tag v1.0.0
git push origin v1.0.0
```
Drone поднимет тег как событие, соберёт мод и положит `client-irc-chat-<версия>.jar` в `https://git.nevetime.ru/Arkon/fdgdfg/releases/tag/v1.0.0`. Версия в имени jar-а берётся из `mod_version` в `gradle.properties` — обычно её стоит поднимать вместе с тегом, чтобы они совпадали.
Если что-то идёт не так, посмотреть лог конкретного шага `gitea-release` в Drone — плагин печатает HTTP-ответ Gitea, по нему сразу видно, проблема в токене, URL или путях к файлам.

View File

@@ -1,5 +1,5 @@
plugins {
id 'net.fabricmc.fabric-loom' version "${project.loom_version}"
id 'net.fabricmc.fabric-loom' version '1.17-SNAPSHOT'
id 'maven-publish'
}
@@ -30,9 +30,8 @@ repositories {
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
implementation "net.fabricmc:fabric-loader:${project.loader_version}"
implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}
processResources {

View File

@@ -6,7 +6,6 @@ org.gradle.configuration-cache=false
minecraft_version=26.2
loader_version=0.19.3
fabric_version=0.152.2+26.2
loom_version=1.17-SNAPSHOT
mod_version=1.0.0
maven_group=ru.nevetime

View File

@@ -112,15 +112,17 @@ public final class ClientIrcMod implements ClientModInitializer {
return;
}
client.execute(() -> {
if (client.gui != null && client.gui.getChat() != null) {
client.gui.getChat().addMessage(text);
if (client.player != null) {
client.player.sendSystemMessage(text);
} else {
LOGGER.info(text.getString());
}
});
}
private static String resolvePlayerName(Minecraft client) {
if (client != null && client.player != null) {
return client.player.getGameProfile().getName();
return client.player.getGameProfile().name();
}
if (client != null && client.getUser() != null) {
return client.getUser().getName();