Drop mappings declaration for unobfuscated 26.2
Some checks failed
continuous-integration/drone/push Build is failing
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ org.gradle.configuration-cache=false
|
||||
|
||||
# Minecraft 26.2 released on 2026-06-16.
|
||||
minecraft_version=26.2
|
||||
yarn_mappings=26.2+build.3
|
||||
loader_version=0.19.3
|
||||
fabric_version=0.152.2+26.2
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.message.v1.ClientSendMessageEvents;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -49,8 +49,8 @@ public final class ClientIrcMod implements ClientModInitializer {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
IrcService.DisplayLine line;
|
||||
while ((line = service.pollLine()) != null) {
|
||||
Formatting color = line.system() ? Formatting.GRAY : Formatting.AQUA;
|
||||
pushClientChat(client, Text.literal(line.text()).formatted(color));
|
||||
ChatFormatting color = line.system() ? ChatFormatting.GRAY : ChatFormatting.AQUA;
|
||||
pushClientChat(client, Component.literal(line.text()).withStyle(color));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -63,17 +63,17 @@ public final class ClientIrcMod implements ClientModInitializer {
|
||||
return false;
|
||||
}
|
||||
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
Minecraft client = Minecraft.getInstance();
|
||||
String argument = trimmed.length() == COMMAND_PREFIX.length() ? "" : trimmed.substring(COMMAND_PREFIX.length()).trim();
|
||||
|
||||
if (argument.isBlank()) {
|
||||
pushClientChat(client, Text.literal("[IRC] Usage: .irc <message> | .irc status | .irc reconnect | .irc reload").formatted(Formatting.YELLOW));
|
||||
pushClientChat(client, Component.literal("[IRC] Usage: .irc <message> | .irc status | .irc reconnect | .irc reload").withStyle(ChatFormatting.YELLOW));
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("status".equalsIgnoreCase(argument)) {
|
||||
String status = service.isConnected() ? "connected" : "disconnected";
|
||||
pushClientChat(client, Text.literal("[IRC] " + status + " | " + config.host + ":" + config.port + " | clientName=" + config.clientName).formatted(Formatting.YELLOW));
|
||||
pushClientChat(client, Component.literal("[IRC] " + status + " | " + config.host + ":" + config.port + " | clientName=" + config.clientName).withStyle(ChatFormatting.YELLOW));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,8 +81,8 @@ public final class ClientIrcMod implements ClientModInitializer {
|
||||
String playerName = resolvePlayerName(client);
|
||||
IO_EXECUTOR.execute(() -> {
|
||||
boolean connected = service.reconnect(playerName);
|
||||
Formatting color = connected ? Formatting.GREEN : Formatting.RED;
|
||||
pushClientChat(client, Text.literal("[IRC] reconnect " + (connected ? "ok" : "failed")).formatted(color));
|
||||
ChatFormatting color = connected ? ChatFormatting.GREEN : ChatFormatting.RED;
|
||||
pushClientChat(client, Component.literal("[IRC] reconnect " + (connected ? "ok" : "failed")).withStyle(color));
|
||||
});
|
||||
return true;
|
||||
}
|
||||
@@ -90,40 +90,40 @@ public final class ClientIrcMod implements ClientModInitializer {
|
||||
if ("reload".equalsIgnoreCase(argument)) {
|
||||
config = IrcConfig.load(FabricLoader.getInstance().getConfigDir().resolve("clientirc.json"));
|
||||
service.updateConfig(config);
|
||||
pushClientChat(client, Text.literal("[IRC] config reloaded").formatted(Formatting.YELLOW));
|
||||
pushClientChat(client, Component.literal("[IRC] config reloaded").withStyle(ChatFormatting.YELLOW));
|
||||
return true;
|
||||
}
|
||||
|
||||
String playerName = resolvePlayerName(client);
|
||||
IO_EXECUTOR.execute(() -> {
|
||||
if (!service.ensureConnected(playerName)) {
|
||||
pushClientChat(client, Text.literal("[IRC] server is offline or config is wrong").formatted(Formatting.RED));
|
||||
pushClientChat(client, Component.literal("[IRC] server is offline or config is wrong").withStyle(ChatFormatting.RED));
|
||||
return;
|
||||
}
|
||||
if (!service.sendChat(playerName, argument)) {
|
||||
pushClientChat(client, Text.literal("[IRC] send failed").formatted(Formatting.RED));
|
||||
pushClientChat(client, Component.literal("[IRC] send failed").withStyle(ChatFormatting.RED));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void pushClientChat(MinecraftClient client, Text text) {
|
||||
private static void pushClientChat(Minecraft client, Component text) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
client.execute(() -> {
|
||||
if (client.inGameHud != null && client.inGameHud.getChatHud() != null) {
|
||||
client.inGameHud.getChatHud().addMessage(text);
|
||||
if (client.gui != null && client.gui.getChat() != null) {
|
||||
client.gui.getChat().addMessage(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static String resolvePlayerName(MinecraftClient client) {
|
||||
private static String resolvePlayerName(Minecraft client) {
|
||||
if (client != null && client.player != null) {
|
||||
return client.player.getGameProfile().getName();
|
||||
}
|
||||
if (client != null && client.getSession() != null) {
|
||||
return client.getSession().getUsername();
|
||||
if (client != null && client.getUser() != null) {
|
||||
return client.getUser().getName();
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user