Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
67939a1
Add our own custom translation system
Wide-Cat Nov 2, 2025
49a2a44
Add a method for addons to provide their own language files to be use…
Wide-Cat Nov 3, 2025
e5afd00
Fix loading addon translations and add more documentation
Wide-Cat Nov 3, 2025
f4035ea
Extract command descriptions into translatable components
Wide-Cat Nov 3, 2025
5634110
Add a text component for Meteor translations.
Wide-Cat Nov 3, 2025
ffca0cb
Assorted fixes and new additions
Wide-Cat Nov 6, 2025
c329468
Moved more strings from commands into the translation files
Wide-Cat Nov 13, 2025
ed00828
add error message when IOExcepting during en_us
crosby-moe Nov 18, 2025
08a8d6b
always use utf8 for translations
crosby-moe Nov 18, 2025
cc08c57
set default lang as a constant
crosby-moe Nov 18, 2025
bd68d2d
add id field to `MeteorAddon`
crosby-moe Nov 18, 2025
e1eef18
compute map of localized languages
crosby-moe Nov 18, 2025
6bb4151
add right-to-left support
crosby-moe Nov 18, 2025
083f0d8
flatten translation maps
crosby-moe Nov 18, 2025
f05923e
these are actually case sensitive
crosby-moe Nov 18, 2025
d380320
automatic addon language registration
crosby-moe Nov 18, 2025
5848a9f
oops turns out you dont have those during `@PreInit`
crosby-moe Nov 18, 2025
0d02a2b
fix command descriptions
crosby-moe Nov 18, 2025
4df0c08
sadly cant use these
crosby-moe Nov 18, 2025
eec45e4
dont have like all of the languages
crosby-moe Nov 18, 2025
ad3c0b3
fix wasp target info
crosby-moe Nov 18, 2025
8521529
Merge branch 'refs/heads/master' into translations
Wide-Cat Jan 2, 2026
00b66fc
Merge remote-tracking branch 'origin/translations' into translations
Wide-Cat Jan 2, 2026
8a22141
fix issues
Wide-Cat Jan 2, 2026
6f108f7
define `Settings` base keys
crosby-moe Jan 3, 2026
66e1294
throw on internal settings usage
crosby-moe Jan 3, 2026
bd99ca2
add supplier fallback translate function
crosby-moe Jan 3, 2026
fffeba8
ignore setting group case when loading nbt
crosby-moe Jan 3, 2026
a38282c
map modules
crosby-moe Jan 3, 2026
514469b
max excavator & infinity miner
crosby-moe Jan 4, 2026
0de9676
solve setting name conflicts
crosby-moe Jan 4, 2026
3362d81
map commands
crosby-moe Jan 4, 2026
6791cf4
map shared module settings
crosby-moe Jan 4, 2026
7801131
remove empty descriptions
crosby-moe Jan 4, 2026
6ffa4a8
dont load empty entries in lang
crosby-moe Jan 4, 2026
320ccad
support renaming settinggroups without losing data
crosby-moe Jan 4, 2026
ef654fe
rename 'Render' setting groups to 'Visual'
crosby-moe Jan 4, 2026
b28b049
dont put setting groups in their module's namespace
crosby-moe Jan 6, 2026
bd3850d
Revert "rename 'Render' setting groups to 'Visual'"
crosby-moe Jan 6, 2026
97cfd45
map categories
crosby-moe Jan 6, 2026
4c517a9
warn on missing keys
crosby-moe Jan 6, 2026
e81bb30
Revert "support renaming settinggroups without losing data"
crosby-moe Jan 6, 2026
e63d3e5
finishing touches
crosby-moe Jan 6, 2026
2d7e9cf
when did i touch this :sob:
crosby-moe Jan 6, 2026
38f0300
error checking n shit
crosby-moe Jan 6, 2026
479f21d
fix typo + clean up duplicates in the lang file
Wide-Cat Jan 6, 2026
720f178
copy en_us over to en_gb
Wide-Cat Jan 6, 2026
e028a5b
add the remaining missing strings to the language file
Wide-Cat Jan 7, 2026
a3fc6e6
support the entire utf 16 plane in font rendering
crosby-moe Jan 13, 2026
b536421
dont invalidate existing char data when updating glyph atlas
crosby-moe Jan 13, 2026
108369f
weakref the file buffer
crosby-moe Jan 13, 2026
4cd2c95
slight optimization
crosby-moe Jan 14, 2026
4c42509
correctly handle surrogate pairs
crosby-moe Jan 14, 2026
9c69bea
use `NativeImage` for font atlas
crosby-moe Jan 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/main/java/meteordevelopment/meteorclient/MeteorClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import meteordevelopment.meteorclient.utils.misc.Version;
import meteordevelopment.meteorclient.utils.misc.input.KeyAction;
import meteordevelopment.meteorclient.utils.misc.input.KeyBinds;
import meteordevelopment.meteorclient.utils.misc.text.MeteorTranslatableTextComponent;
import meteordevelopment.meteorclient.utils.network.OnlinePlayers;
import meteordevelopment.orbit.EventBus;
import meteordevelopment.orbit.EventHandler;
Expand All @@ -37,6 +38,7 @@
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.text.MutableText;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -197,4 +199,12 @@ private void onOpenScreen(OpenScreenEvent event) {
public static Identifier identifier(String path) {
return Identifier.of(MeteorClient.MOD_ID, path);
}

public static MutableText translatable(String key, Object... args) {
return MutableText.of(new MeteorTranslatableTextComponent(key, args));
}

public static MutableText translatable(String key, String fallback, Object... args) {
return MutableText.of(new MeteorTranslatableTextComponent(key, fallback, args));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public String getCommit() {

ModMetadata metadata = FabricLoader.getInstance().getModContainer(MeteorClient.MOD_ID).get().getMetadata();

MeteorClient.ADDON.id = metadata.getId();
MeteorClient.ADDON.name = metadata.getName();
MeteorClient.ADDON.authors = new String[metadata.getAuthors().size()];
if (metadata.containsCustomValue(MeteorClient.MOD_ID + ":color")) {
Expand All @@ -72,6 +73,7 @@ public String getCommit() {
throw new RuntimeException("Exception during addon init \"%s\".".formatted(metadata.getName()), throwable);
}

addon.id = metadata.getId();
addon.name = metadata.getName();

if (metadata.getAuthors().isEmpty()) throw new RuntimeException("Addon \"%s\" requires at least 1 author to be defined in it's fabric.mod.json. See https://fabricmc.net/wiki/documentation:fabric_mod_json_spec".formatted(addon.name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import meteordevelopment.meteorclient.utils.render.color.Color;

public abstract class MeteorAddon {
/** This field is automatically assigned from fabric.mod.json file.
* @since 1.21.11 */ // todo replace with exact version when released
public String id;

/** This field is automatically assigned from fabric.mod.json file. */
public String name;

Expand Down
30 changes: 20 additions & 10 deletions src/main/java/meteordevelopment/meteorclient/commands/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.systems.config.Config;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.misc.MeteorTranslations;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import net.minecraft.client.MinecraftClient;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.command.CommandSource;
import net.minecraft.registry.BuiltinRegistries;
import net.minecraft.server.command.CommandManager;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;

import java.util.List;
Expand All @@ -29,14 +31,18 @@ public abstract class Command {

private final String name;
private final String title;
private final String description;
private final List<String> aliases;
public final String translationKey;

public Command(String name, String description, String... aliases) {
public Command(String name, String... aliases) {
this.name = name;
this.title = Utils.nameToTitle(name);
this.description = description;
this.aliases = List.of(aliases);
this.translationKey = "command." + name;
}

public Command(String name) {
this(name, new String[0]);
}

// Helper methods to painlessly infer the CommandSource generic type argument
Expand Down Expand Up @@ -65,10 +71,6 @@ public String getName() {
return name;
}

public String getDescription() {
return description;
}

public List<String> getAliases() {
return aliases;
}
Expand All @@ -90,16 +92,24 @@ public void info(Text message) {

public void info(String message, Object... args) {
ChatUtils.forceNextPrefixClass(getClass());
ChatUtils.infoPrefix(title, message, args);
ChatUtils.infoPrefix(title, MeteorTranslations.translate(translationKey + ".info." + message, message, args));
}

public void warning(String message, Object... args) {
ChatUtils.forceNextPrefixClass(getClass());
ChatUtils.warningPrefix(title, message, args);
ChatUtils.warningPrefix(title, MeteorTranslations.translate(translationKey + ".warning." + message, message, args));
}

public void error(String message, Object... args) {
ChatUtils.forceNextPrefixClass(getClass());
ChatUtils.errorPrefix(title, message, args);
ChatUtils.errorPrefix(title, MeteorTranslations.translate(translationKey + ".error." + message, message, args));
}

public MutableText translatable(String string, Object... args) {
return MeteorClient.translatable(translationKey + "." + string, args);
}

public MutableText translatable(String string, String fallback, Object... args) {
return MeteorClient.translatable(translationKey + "." + string, fallback, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class BindCommand extends Command {
public BindCommand() {
super("bind", "Binds a specified module to the next pressed key.");
super("bind");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import meteordevelopment.meteorclient.commands.Command;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import net.minecraft.command.CommandSource;
import net.minecraft.text.HoverEvent;
Expand All @@ -21,7 +20,7 @@

public class BindsCommand extends Command {
public BindsCommand() {
super("binds", "List of all bound modules.");
super("binds");
}

@Override
Expand All @@ -37,7 +36,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
for (Module module : modules) {
HoverEvent hoverEvent = new HoverEvent.ShowText(getTooltip(module));

MutableText text = Text.literal(module.title).formatted(Formatting.WHITE);
MutableText text = module.getTitleText().formatted(Formatting.WHITE);
text.setStyle(text.getStyle().withHoverEvent(hoverEvent));

MutableText sep = Text.literal(" - ");
Expand All @@ -56,8 +55,8 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
}

private MutableText getTooltip(Module module) {
MutableText tooltip = Text.literal(Utils.nameToTitle(module.title)).formatted(Formatting.BLUE, Formatting.BOLD).append("\n\n");
tooltip.append(Text.literal(module.description).formatted(Formatting.WHITE));
MutableText tooltip = module.getTitleText().formatted(Formatting.BLUE, Formatting.BOLD).append("\n\n");
tooltip.append(module.getDescriptionText().formatted(Formatting.WHITE));
return tooltip;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public class CommandsCommand extends Command {
public CommandsCommand() {
super("commands", "List of all commands.", "help");
super("commands", "help");
}

@Override
Expand Down Expand Up @@ -53,7 +53,7 @@ private MutableText getCommandText(Command command) {
}
tooltip.append(aliases.formatted(Formatting.GRAY)).append("\n\n");

tooltip.append(Text.literal(command.getDescription()).formatted(Formatting.WHITE));
tooltip.append(command.translatable("description")).formatted(Formatting.WHITE);

// Text
MutableText text = Text.literal(Utils.nameToTitle(command.getName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class DamageCommand extends Command {
private final static SimpleCommandExceptionType INVULNERABLE = new SimpleCommandExceptionType(Text.literal("You are invulnerable."));

public DamageCommand() {
super("damage", "Damages self", "dmg");
super("damage", "dmg");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

public class DisconnectCommand extends Command {
public DisconnectCommand() {
super("disconnect", "Disconnect from the server", "dc");
super("disconnect", "dc");
}

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(Text.literal("%s[%sDisconnectCommand%s] Disconnected by user.".formatted(Formatting.GRAY, Formatting.BLUE, Formatting.GRAY))));
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(translatable("disconnection_message", Formatting.GRAY, Formatting.BLUE, Formatting.GRAY)));
return SINGLE_SUCCESS;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public class DismountCommand extends Command {
public DismountCommand() {
super("dismount", "Dismounts you from entity you are riding.");
super("dismount");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.commands.Command;
import meteordevelopment.meteorclient.utils.player.InvUtils;
import net.minecraft.client.network.ClientPlayerEntity;
Expand All @@ -19,14 +20,13 @@
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.text.Text;

public class DropCommand extends Command {
private static final SimpleCommandExceptionType NOT_SPECTATOR = new SimpleCommandExceptionType(Text.literal("Can't drop items while in spectator."));
private static final SimpleCommandExceptionType NO_SUCH_ITEM = new SimpleCommandExceptionType(Text.literal("Could not find an item with that name!"));
private static final SimpleCommandExceptionType NOT_SPECTATOR = new SimpleCommandExceptionType(MeteorClient.translatable("meteor.command.drop.exception.not_spectator"));
private static final SimpleCommandExceptionType NO_SUCH_ITEM = new SimpleCommandExceptionType(MeteorClient.translatable("meteor.command.drop.exception.no_such_item"));

public DropCommand() {
super("drop", "Automatically drops specified items.");
super("drop");
}

@Override
Expand Down Expand Up @@ -70,9 +70,9 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {

// Specific item
builder.then(argument("item", ItemStackArgumentType.itemStack(REGISTRY_ACCESS))
.executes(context -> drop(player -> {
dropItem(player, context, Integer.MAX_VALUE);
}))
.executes(context -> drop(player ->
dropItem(player, context, Integer.MAX_VALUE)
))
.then(argument("amount", IntegerArgumentType.integer(1))
.executes(context -> drop(player -> {
int amount = IntegerArgumentType.getInteger(context, "amount");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.commands.Command;
import meteordevelopment.meteorclient.commands.arguments.RegistryEntryReferenceArgumentType;
import meteordevelopment.meteorclient.utils.Utils;
Expand All @@ -19,16 +20,15 @@
import net.minecraft.item.ItemStack;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.text.Text;

import java.util.function.ToIntFunction;

public class EnchantCommand extends Command {
private static final SimpleCommandExceptionType NOT_IN_CREATIVE = new SimpleCommandExceptionType(Text.literal("You must be in creative mode to use this."));
private static final SimpleCommandExceptionType NOT_HOLDING_ITEM = new SimpleCommandExceptionType(Text.literal("You need to hold some item to enchant."));
private static final SimpleCommandExceptionType NOT_IN_CREATIVE = new SimpleCommandExceptionType(MeteorClient.translatable("meteor.command.enchant.exception.not_in_creative"));
private static final SimpleCommandExceptionType NOT_HOLDING_ITEM = new SimpleCommandExceptionType(MeteorClient.translatable("meteor.command.enchant.exception.not_holding_item"));

public EnchantCommand() {
super("enchant", "Enchants the item in your hand. REQUIRES Creative mode.");
super("enchant");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class EnderChestCommand extends Command {
public EnderChestCommand() {
super("ender-chest", "Allows you to preview memory of your ender chest.", "ec", "echest");
super("ender-chest", "ec", "echest");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
import meteordevelopment.meteorclient.systems.modules.player.FakePlayer;
import meteordevelopment.meteorclient.utils.entity.fakeplayer.FakePlayerEntity;
import meteordevelopment.meteorclient.utils.entity.fakeplayer.FakePlayerManager;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import net.minecraft.command.CommandSource;

public class FakePlayerCommand extends Command {
public FakePlayerCommand() {
super("fake-player", "Manages fake players that you can use for testing.");
super("fake-player");
}

@Override
Expand All @@ -43,12 +42,12 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
.executes(context -> {
FakePlayerEntity fp = FakePlayerArgumentType.get(context);
if (fp == null || !FakePlayerManager.contains(fp)) {
error("Couldn't find a Fake Player with that name.");
error("not_found");
return SINGLE_SUCCESS;
}

FakePlayerManager.remove(fp);
info("Removed Fake Player %s.".formatted(fp.getName().getString()));
info("removed", fp.getName().getString());

return SINGLE_SUCCESS;
})
Expand All @@ -65,7 +64,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(literal("list")
.executes(context -> {
info("--- Fake Players ((highlight)%s(default)) ---", FakePlayerManager.count());
FakePlayerManager.forEach(fp -> ChatUtils.info("(highlight)%s".formatted(fp.getName().getString())));
FakePlayerManager.forEach(fp -> info("(highlight)%s".formatted(fp.getName().getString())));
return SINGLE_SUCCESS;
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public class FovCommand extends Command {
public FovCommand() {
super("fov", "Changes your fov.");
super("fov");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

public class FriendsCommand extends Command {
public FriendsCommand() {
super("friends", "Manages friends.");
super("friends");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public class GamemodeCommand extends Command {
public GamemodeCommand() {
super("gamemode", "Changes your gamemode client-side.", "gm");
super("gamemode", "gm");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.commands.Command;
import meteordevelopment.meteorclient.utils.player.FindItemResult;
import meteordevelopment.meteorclient.utils.player.InvUtils;
import net.minecraft.command.CommandSource;
import net.minecraft.command.argument.ItemStackArgumentType;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.text.Text;

public class GiveCommand extends Command {
private final static SimpleCommandExceptionType NOT_IN_CREATIVE = new SimpleCommandExceptionType(Text.literal("You must be in creative mode to use this."));
private final static SimpleCommandExceptionType NO_SPACE = new SimpleCommandExceptionType(Text.literal("No space in hotbar."));
private final static SimpleCommandExceptionType NOT_IN_CREATIVE = new SimpleCommandExceptionType(MeteorClient.translatable("meteor.command.give.exception.not_in_creative"));
private final static SimpleCommandExceptionType NO_SPACE = new SimpleCommandExceptionType(MeteorClient.translatable("meteor.command.give.exception.no_space"));

public GiveCommand() {
super("give", "Gives you any item.");
super("give");
}

@Override
Expand Down
Loading