Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,15 @@ public abstract class Command {
private final List<String> aliases;
public final String translationKey;

// todo remove the description parameter in the next minecraft version update
@Deprecated(forRemoval = true)
public Command(String name, String description, String... aliases) {
public Command(String name, String... aliases) {
this.name = name;
this.title = Utils.nameToTitle(name);
this.aliases = List.of(aliases);
this.translationKey = "meteor.command." + name;
this.translationKey = "command." + name;
}

public Command(String name) {
this.name = name;
this.title = Utils.nameToTitle(name);
this.aliases = List.of();
this.translationKey = "meteor.command." + name;
this(name, new String[0]);
}

// Helper methods to painlessly infer the CommandSource generic type argument
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 Down Expand Up @@ -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
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,7 +15,7 @@

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

@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 @@ -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 @@ -14,7 +14,7 @@

public class InventoryCommand extends Command {
public InventoryCommand() {
super("inventory", "Allows you to see parts of another player's inventory.", "inv", "invsee");
super("inventory", "inv", "invsee");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class LocateCommand extends Command {
);

public LocateCommand() {
super("locate", "Locates structures", "loc");
super("locate", "loc");
}

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

public class ModulesCommand extends Command {
public ModulesCommand() {
super("modules", "Displays a list of all modules.", "features");
super("modules", "features");
}

@Override
Expand All @@ -29,7 +29,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
Modules.loopCategories().forEach(category -> {
MutableText categoryMessage = Text.literal("");
Modules.get().getGroup(category).forEach(module -> categoryMessage.append(getModuleText(module)));
ChatUtils.sendMsg(category.name, categoryMessage);
ChatUtils.sendMsg(category.getName(), categoryMessage); // todo
});

return SINGLE_SUCCESS;
Expand All @@ -40,11 +40,11 @@ private MutableText getModuleText(Module module) {
// Hover tooltip
MutableText tooltip = Text.literal("");

tooltip.append(Text.literal(module.title).formatted(Formatting.BLUE, Formatting.BOLD)).append("\n");
tooltip.append(module.getTitleText().formatted(Formatting.BLUE, Formatting.BOLD)).append("\n");
tooltip.append(Text.literal(module.name).formatted(Formatting.GRAY)).append("\n\n");
tooltip.append(Text.literal(module.description).formatted(Formatting.WHITE));
tooltip.append(module.getDescriptionText().formatted(Formatting.WHITE));

MutableText finalModule = Text.literal(module.title);
MutableText finalModule = module.getTitleText();
if (!module.isActive()) finalModule.formatted(Formatting.GRAY);
if (!module.equals(Modules.get().getGroup(module.category).getLast())) finalModule.append(Text.literal(", ").formatted(Formatting.GRAY));
finalModule.setStyle(finalModule.getStyle().withHoverEvent(new HoverEvent.ShowText(tooltip)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public class NameHistoryCommand extends Command {
public NameHistoryCommand() {
super("name-history", "Provides a list of a players previous names from the laby.net api.", "history", "names");
super("name-history", "history", "names");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class SaveMapCommand extends Command {
private final PointerBuffer filters;

public SaveMapCommand() {
super("save-map", "Saves a map to an image.", "sm");
super("save-map", "sm");

filters = BufferUtils.createPointerBuffer(1);

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

public class SettingCommand extends Command {
public SettingCommand() {
super("settings", "Allows you to view and change module settings.", "s");
super("settings", "s");
}

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

public class ToggleCommand extends Command {
public ToggleCommand() {
super("toggle", "Toggles a module.", "t");
super("toggle", "t");
}

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

public class WaypointCommand extends Command {
public WaypointCommand() {
super("waypoint", "Manages waypoints.", "wp");
super("waypoint", "wp");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import meteordevelopment.meteorclient.renderer.Fonts;
import meteordevelopment.meteorclient.settings.*;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.misc.MeteorTranslations;
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
import net.minecraft.client.resource.language.I18n;
import org.apache.commons.lang3.Strings;
Expand Down Expand Up @@ -81,7 +82,7 @@ public WWidget create(GuiTheme theme, Settings settings, String filter) {

// Add all settings
for (SettingGroup group : settings.groups) {
group(list, group, filter, removeInfoList);
group(list, group, filter, removeInfoList, settings.baseTranslationKey);
}

// Calculate width and set it as minimum width
Expand All @@ -101,16 +102,18 @@ protected double settingTitleTopMargin() {
return 6;
}

private void group(WVerticalList list, SettingGroup group, String filter, List<RemoveInfo> removeInfoList) {
WSection section = list.add(theme.section(group.name, group.sectionExpanded)).expandX().widget();
private void group(WVerticalList list, SettingGroup group, String filter, List<RemoveInfo> removeInfoList, String baseKey) {
WSection section = list.add(theme.section(MeteorTranslations.translate(group.translationKey), group.sectionExpanded)).expandX().widget();
section.action = () -> group.sectionExpanded = section.isExpanded();

WTable table = section.add(theme.table()).expandX().widget();

RemoveInfo removeInfo = null;

for (Setting<?> setting : group) {
if (!Strings.CI.contains(setting.title, filter)) continue;
String settingKey = baseKey + "." + group.name + "." + setting.name;
String title = MeteorTranslations.translate(settingKey);
if (!Strings.CI.contains(title, filter) && !Strings.CI.contains(setting.name, filter)) continue;

boolean visible = setting.isVisible();
setting.lastWasVisible = visible;
Expand All @@ -119,7 +122,7 @@ private void group(WVerticalList list, SettingGroup group, String filter, List<R
removeInfo.markRowForRemoval();
}

table.add(theme.label(setting.title)).top().marginTop(settingTitleTopMargin()).widget().tooltip = setting.description;
table.add(theme.label(title)).top().marginTop(settingTitleTopMargin()).widget().tooltip = MeteorTranslations.translate(settingKey + ".description");

Factory factory = getFactory(setting.getClass());
if (factory != null) factory.create(table, setting);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public abstract class GuiTheme implements ISerializable<GuiTheme> {
public static final double TITLE_TEXT_SCALE = 1.25;

public final String name;
public final Settings settings = new Settings();
public final Settings settings;

public boolean disableHoverColor;

Expand All @@ -50,6 +50,7 @@ public abstract class GuiTheme implements ISerializable<GuiTheme> {

public GuiTheme(String name) {
this.name = name;
this.settings = new Settings("theme." + name);
}

public void beforeRender() {
Expand Down Expand Up @@ -156,7 +157,7 @@ public WSection section(String title) {
public abstract WAccount account(WidgetScreen screen, Account<?> account);

public WWidget module(Module module) {
return module(module, module.title);
return module(module, module.getTitle());
}
public abstract WWidget module(Module module, String title);

Expand Down Expand Up @@ -213,6 +214,7 @@ public WKeybind keybind(Keybind keybind, Keybind defaultValue) {
}

public WWidget settings(Settings settings, String filter) {
if (settings.baseTranslationKey == null) throw new IllegalArgumentException("Cannot use internal Settings in a GuiTheme!");
return settingsFactory.create(this, settings, filter);
}
public WWidget settings(Settings settings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import meteordevelopment.meteorclient.gui.widgets.pressable.WFavorite;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.utils.misc.MeteorTranslations;
import meteordevelopment.meteorclient.utils.misc.NbtUtils;
import meteordevelopment.meteorclient.utils.render.prompts.OkPrompt;
import meteordevelopment.orbit.EventHandler;
Expand All @@ -40,7 +41,7 @@ public class ModuleScreen extends WindowScreen {
private WCheckbox active;

public ModuleScreen(GuiTheme theme, Module module) {
super(theme, theme.favorite(module.favorite), module.title);
super(theme, theme.favorite(module.favorite), module.getTitle());
((WFavorite) window.icon).action = () -> module.favorite = ((WFavorite) window.icon).checked;

this.module = module;
Expand All @@ -49,11 +50,11 @@ public ModuleScreen(GuiTheme theme, Module module) {
@Override
public void initWidgets() {
// Description
add(theme.label(module.description, getWindowWidth() / 2.0));
add(theme.label(module.getDescription(), getWindowWidth() / 2.0));

if (module.addon != null && module.addon != MeteorClient.ADDON) {
WHorizontalList addon = add(theme.horizontalList()).expandX().widget();
addon.add(theme.label("From: ").color(theme.textSecondaryColor())).widget();
addon.add(theme.label(MeteorTranslations.translate("module.base.from")).color(theme.textSecondaryColor())).widget();
addon.add(theme.label(module.addon.name).color(module.addon.color)).widget();
}

Expand All @@ -73,12 +74,12 @@ public void initWidgets() {
}

// Bind
WSection section = add(theme.section("Bind", true)).expandX().widget();
WSection section = add(theme.section(MeteorTranslations.translate("module.base.bind"), true)).expandX().widget();

// Keybind
WHorizontalList bind = section.add(theme.horizontalList()).expandX().widget();

bind.add(theme.label("Bind: "));
bind.add(theme.label(MeteorTranslations.translate("module.base.bind.bind")));
keybind = bind.add(theme.keybind(module.keybind)).expandX().widget();
keybind.actionOnSet = () -> Modules.get().setModuleToBind(module);

Expand All @@ -89,14 +90,14 @@ public void initWidgets() {
// Toggle on bind release
WHorizontalList tobr = section.add(theme.horizontalList()).widget();

tobr.add(theme.label("Toggle on bind release: "));
tobr.add(theme.label(MeteorTranslations.translate("module.base.bind.toggle-on-release")));
WCheckbox tobrC = tobr.add(theme.checkbox(module.toggleOnBindRelease)).widget();
tobrC.action = () -> module.toggleOnBindRelease = tobrC.checked;

// Chat feedback
WHorizontalList cf = section.add(theme.horizontalList()).widget();

cf.add(theme.label("Chat Feedback: "));
cf.add(theme.label(MeteorTranslations.translate("module.base.bind.chat-feedback")));
WCheckbox cfC = cf.add(theme.checkbox(module.chatFeedback)).widget();
cfC.action = () -> module.chatFeedback = cfC.checked;

Expand All @@ -106,7 +107,7 @@ public void initWidgets() {
WHorizontalList bottom = add(theme.horizontalList()).expandX().widget();

// Active
bottom.add(theme.label("Active: "));
bottom.add(theme.label(MeteorTranslations.translate("module.base.active")));
active = bottom.add(theme.checkbox(module.isActive())).expandCellX().widget();
active.action = () -> {
if (module.isActive() != active.checked) module.toggle();
Expand All @@ -126,11 +127,11 @@ public void initWidgets() {
.show();
}
};
copy.tooltip = "Copy config";
copy.tooltip = MeteorTranslations.translate("module.base.copy-config");

WButton paste = sharing.add(theme.button(GuiRenderer.PASTE)).widget();
paste.action = this::fromClipboard;
paste.tooltip = "Paste config";
paste.tooltip = MeteorTranslations.translate("module.base.paste-config");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected void init() {
// Category

protected WWindow createCategory(WContainer c, Category category, List<Module> moduleList) {
WWindow w = theme.window(category.name);
WWindow w = theme.window(category.getName());
w.id = category.name;
w.padding = 0;
w.spacing = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public ModuleListSettingScreen(GuiTheme theme, Setting<List<Module>> setting) {

@Override
protected WWidget getValueWidget(Module value) {
return theme.label(value.title);
return theme.label(value.getTitle());
}

@Override
protected String[] getValueNames(Module value) {
String[] names = new String[value.aliases.length + 1];
System.arraycopy(value.aliases, 0, names, 1, value.aliases.length);
names[0] = value.title;
names[0] = value.getTitle();
return names;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class WMeteorModule extends WPressable implements MeteorWidget {
public WMeteorModule(Module module, String title) {
this.module = module;
this.title = title;
this.tooltip = module.description;
this.tooltip = module.getDescription();

if (module.isActive()) {
animationProgress1 = 1;
Expand Down
Loading