v5.0
This commit is contained in:
1 parent
09ed268576
commit
b2bc2b36ab
9 files changed
+132
-148
No files matched your search
+3
-10
@@ -1,22 +1,15 @@
|
||||
# v4.9
|
||||
# v5.0!!!
|
||||
|
||||
## novedades
|
||||
|
||||
### adiciones
|
||||
|
||||
- panel para gestionar los amigos, y la habilidad de añadirles motes
|
||||
- panel individual para cada categoría de módulos
|
||||
|
||||
#### módulos nuevos:
|
||||
|
||||
- notificaciones: te avisa de ciertos eventos mediante notificaciones
|
||||
|
||||
### arreglos / mejoras
|
||||
|
||||
- `puntos de desconexión` ya renderiza la caja correctamente
|
||||
- movido `aviso de baja durabilidad` a `notificaciones`
|
||||
|
||||
## problemas reconocidos
|
||||
|
||||
- lo de siempre, además de:
|
||||
- `inventario plus` no funciona en creativo
|
||||
- `RPC de Discord` no funciona e incluso puede provocar crashes
|
||||
- lo de siempre.
|
||||
+1
-1
@@ -10,6 +10,6 @@ discord_rpc_version=1.0.3
|
||||
neutrino_version=1.1.0
|
||||
jdk_version=25
|
||||
|
||||
mod_version=4.9
|
||||
mod_version=5.0
|
||||
maven_group=me.retucio
|
||||
archives_base_name=sputnik
|
||||
@@ -97,25 +97,25 @@ public class ClientConfig {
|
||||
|
||||
@EventListener
|
||||
public void onExtendModulePanel(ModulePanelEvent.Extend event) {
|
||||
extendablePanels.put("M", new PanelData(
|
||||
ClickGui.INSTANCE.getModulesPanel().getX(),
|
||||
ClickGui.INSTANCE.getModulesPanel().getY(),
|
||||
ClickGui.INSTANCE.getModulesPanel().extended));
|
||||
extendablePanels.put(event.getPanel().category.toString(), new PanelData(
|
||||
event.getPanel().getX(),
|
||||
event.getPanel().getY(),
|
||||
event.getPanel().extended));
|
||||
ConfigManager.save();
|
||||
}
|
||||
|
||||
@EventListener
|
||||
public void onMoveModulePanel(ModulePanelEvent.Move event) {
|
||||
extendablePanels.replace("M", new PanelData(
|
||||
ClickGui.INSTANCE.getModulesPanel().getX(),
|
||||
ClickGui.INSTANCE.getModulesPanel().getY(),
|
||||
ClickGui.INSTANCE.getModulesPanel().extended));
|
||||
extendablePanels.replace(event.getPanel().category.toString(), new PanelData(
|
||||
event.getPanel().getX(),
|
||||
event.getPanel().getY(),
|
||||
event.getPanel().extended));
|
||||
ConfigManager.save();
|
||||
}
|
||||
|
||||
@EventListener
|
||||
public void onExtendClientSettingsPanel(ClientSettingsPanelEvent.Extend event) {
|
||||
extendablePanels.put("S", new PanelData(
|
||||
extendablePanels.put("ajustes", new PanelData(
|
||||
ClickGui.INSTANCE.getClientSettingsPanel().getX(),
|
||||
ClickGui.INSTANCE.getClientSettingsPanel().getY(),
|
||||
ClickGui.INSTANCE.getClientSettingsPanel().extended));
|
||||
@@ -124,7 +124,7 @@ public class ClientConfig {
|
||||
|
||||
@EventListener
|
||||
public void onMoveClientSettingsPanel(ClientSettingsPanelEvent.Move event) {
|
||||
extendablePanels.replace("S", new PanelData(
|
||||
extendablePanels.replace("ajustes", new PanelData(
|
||||
ClickGui.INSTANCE.getClientSettingsPanel().getX(),
|
||||
ClickGui.INSTANCE.getClientSettingsPanel().getY(),
|
||||
ClickGui.INSTANCE.getClientSettingsPanel().extended));
|
||||
@@ -133,7 +133,7 @@ public class ClientConfig {
|
||||
|
||||
@EventListener
|
||||
public void onExtendFriendsPanel(FriendPanelEvent.Extend event) {
|
||||
extendablePanels.put("F", new PanelData(
|
||||
extendablePanels.put("amigos", new PanelData(
|
||||
ClickGui.INSTANCE.getFriendsPanel().getX(),
|
||||
ClickGui.INSTANCE.getFriendsPanel().getY(),
|
||||
ClickGui.INSTANCE.getFriendsPanel().extended));
|
||||
@@ -142,7 +142,7 @@ public class ClientConfig {
|
||||
|
||||
@EventListener
|
||||
public void onMoveFriendsPanel(FriendPanelEvent.Move event) {
|
||||
extendablePanels.replace("F", new PanelData(
|
||||
extendablePanels.replace("amigos", new PanelData(
|
||||
ClickGui.INSTANCE.getFriendsPanel().getX(),
|
||||
ClickGui.INSTANCE.getFriendsPanel().getY(),
|
||||
ClickGui.INSTANCE.getFriendsPanel().extended));
|
||||
|
||||
@@ -230,7 +230,9 @@ public class ConfigManager {
|
||||
}
|
||||
|
||||
private static void applyExtendablePanels() {
|
||||
applyExtendablePanel(ClickGui.INSTANCE.getModulesPanel());
|
||||
for (ModulePanel panel : ClickGui.INSTANCE.getModulePanels()) {
|
||||
applyExtendablePanel(panel);
|
||||
}
|
||||
applyExtendablePanel(ClickGui.INSTANCE.getClientSettingsPanel());
|
||||
applyExtendablePanel(ClickGui.INSTANCE.getFriendsPanel());
|
||||
|
||||
@@ -241,8 +243,8 @@ public class ConfigManager {
|
||||
private static void applyExtendablePanel(Panel<?> panel) {
|
||||
ClientConfig.PanelData panelData = null;
|
||||
|
||||
if (panel instanceof ModulePanel) {
|
||||
panelData = config.extendablePanels.get("M");
|
||||
if (panel instanceof ModulePanel mp) {
|
||||
panelData = config.extendablePanels.get(mp.category.toString());
|
||||
}
|
||||
if (panel instanceof ClientSettingsPanel) {
|
||||
panelData = config.extendablePanels.get("S");
|
||||
|
||||
@@ -1,10 +1,28 @@
|
||||
package me.retucio.sputnik.event.sputnik;
|
||||
|
||||
import com.github.retucio.neutrino.Event;
|
||||
import me.retucio.sputnik.ui.widgets.panels.ModulePanel;
|
||||
|
||||
// se genera cada que se interactúa con el marco de módulos
|
||||
public class ModulePanelEvent {
|
||||
// se genera cada que se interactúa con un panel de módulos
|
||||
public class ModulePanelEvent extends Event {
|
||||
|
||||
public static class Extend extends Event {} // al extenderlo / contraerlo
|
||||
public static class Move extends Event {} // al cambiarlo de posición
|
||||
protected ModulePanel panel;
|
||||
|
||||
public ModulePanel getPanel() {
|
||||
return panel;
|
||||
}
|
||||
|
||||
// al extenderlo / contraerlo
|
||||
public static class Extend extends ModulePanelEvent {
|
||||
public Extend(ModulePanel panel) {
|
||||
this.panel = panel;
|
||||
}
|
||||
}
|
||||
|
||||
// al cambiarlo de posición
|
||||
public static class Move extends ModulePanelEvent {
|
||||
public Move(ModulePanel panel) {
|
||||
this.panel = panel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,9 +15,7 @@ public enum Category {
|
||||
INVENTORY("inventario"),
|
||||
|
||||
CLIENT("cliente"),
|
||||
MISC("misc."),
|
||||
|
||||
ALL("todos");
|
||||
MISC("misc.");
|
||||
|
||||
private final String name;
|
||||
Category(String name) { this.name = name; }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.retucio.sputnik.ui.screen;
|
||||
|
||||
import com.github.retucio.neutrino.EventListener;
|
||||
|
||||
import me.retucio.sputnik.Sputnik;
|
||||
import me.retucio.sputnik.event.input.KeyEvent;
|
||||
import me.retucio.sputnik.event.input.MouseClickEvent;
|
||||
@@ -15,7 +16,6 @@ import me.retucio.sputnik.ui.widgets.buttons.FriendButton;
|
||||
import me.retucio.sputnik.ui.widgets.buttons.settings.ListButton;
|
||||
import me.retucio.sputnik.ui.widgets.buttons.ModuleButton;
|
||||
import me.retucio.sputnik.ui.widgets.buttons.SettingButton;
|
||||
import me.retucio.sputnik.ui.widgets.misc.NotificationWidget;
|
||||
import me.retucio.sputnik.ui.widgets.panels.FriendsPanel;
|
||||
import me.retucio.sputnik.ui.widgets.panels.settings.ClientSettingsPanel;
|
||||
import me.retucio.sputnik.ui.widgets.panels.settings.ColorPickerPanel;
|
||||
@@ -27,6 +27,7 @@ import me.retucio.sputnik.ui.widgets.Widget;
|
||||
import me.retucio.sputnik.ui.widgets.misc.ScrollBarWidget;
|
||||
import me.retucio.sputnik.ui.widgets.misc.SearchBarWidget;
|
||||
import me.retucio.sputnik.ui.widgets.panels.settings.FriendSettingsPanel;
|
||||
import me.retucio.sputnik.util.ChatUtil;
|
||||
import me.retucio.sputnik.util.KeyUtil;
|
||||
|
||||
import me.retucio.sputnik.util.MiscUtil;
|
||||
@@ -36,6 +37,7 @@ import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.input.MouseButtonEvent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
@@ -48,7 +50,11 @@ import java.util.Optional;
|
||||
import static me.retucio.sputnik.ui.widgets.panels.settings.ClientSettingsPanel.clientSettings;
|
||||
|
||||
|
||||
// interfaz gráfica, se abre con el shift derecho por defecto. aquí se encuentran los módulos y sus ajustes
|
||||
/**
|
||||
* interfaz gráfica, Screen que se abre con el shift derecho por defecto. aquí se encuentran los módulos y sus ajustes.
|
||||
* @author retucio
|
||||
*/
|
||||
|
||||
public class ClickGui extends Screen {
|
||||
|
||||
private final Minecraft mc = Minecraft.getInstance();
|
||||
@@ -57,21 +63,26 @@ public class ClickGui extends Screen {
|
||||
private boolean anyFocused;
|
||||
private @Nullable Widget selected = null;
|
||||
|
||||
private Category categoryFilter = Category.ALL;
|
||||
|
||||
private final ModulePanel modulesPanel = new ModulePanel(20, 30, 100, 20);
|
||||
private final List<ModulePanel> modulePanels = new ArrayList<>();
|
||||
private final List<SettingsPanel> settingsPanels = new ArrayList<>();
|
||||
private final ClientSettingsPanel clientSettingsPanel = new ClientSettingsPanel(200, 30, 100, 20);
|
||||
private final FriendsPanel friendsPanel = new FriendsPanel(770, 30, 100, 20);
|
||||
private final ClientSettingsPanel clientSettingsPanel = new ClientSettingsPanel(620, 280, 100, 20);
|
||||
private final FriendsPanel friendsPanel = new FriendsPanel(40, 280, 100, 20);
|
||||
|
||||
private final ScrollBarWidget scrollBar = new ScrollBarWidget();
|
||||
private final SearchBarWidget searchBar = new SearchBarWidget(500, 30, 320, 20);
|
||||
private final List<Widget> miscWidgets = Arrays.asList(scrollBar, searchBar);
|
||||
private final SearchBarWidget searchBar = new SearchBarWidget(320, 10, 320, 20);
|
||||
private final List<Widget> miscWidgets = List.of(scrollBar, searchBar);
|
||||
|
||||
public ClickGui() {
|
||||
super(Component.nullToEmpty("interfaz"));
|
||||
settingsPanels.add(clientSettingsPanel);
|
||||
super(Component.literal("interfaz"));
|
||||
Sputnik.EVENT_BUS.subscribe(this);
|
||||
|
||||
settingsPanels.add(clientSettingsPanel);
|
||||
|
||||
int x = 4;
|
||||
for (Category category : Category.values()) {
|
||||
modulePanels.add(new ModulePanel(category, x, 40, 100, 20));
|
||||
x += 88;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,21 +97,26 @@ public class ClickGui extends Screen {
|
||||
searchBar.render(gui, mouseX, mouseY, delta);
|
||||
searchBar.updatePosition(mouseX, mouseY);
|
||||
|
||||
// actualizar la posición de renderizado vertical de los marcos cada tick
|
||||
modulesPanel.updateRenderY(scrollOffset);
|
||||
// actualizar la posición de renderizado vertical de los paneles cada tick
|
||||
friendsPanel.updateRenderY(scrollOffset);
|
||||
for (SettingsPanel sp : settingsPanels)
|
||||
for (ModulePanel mp : modulePanels) {
|
||||
mp.updateRenderY(scrollOffset);
|
||||
}
|
||||
for (SettingsPanel sp : settingsPanels) {
|
||||
sp.updateRenderY(scrollOffset);
|
||||
}
|
||||
|
||||
// renderizar el marco de los ajustes de cada módulo que lo tenga abierto. se abre haciendo clic derecho sobre el módulo
|
||||
// renderizar el panel de los ajustes de cada módulo que lo tenga abierto. se abre haciendo clic derecho sobre el módulo.
|
||||
for (SettingsPanel sp : settingsPanels.reversed()) {
|
||||
sp.render(gui, mouseX, mouseY, delta);
|
||||
sp.updatePosition(mouseX, mouseY);
|
||||
}
|
||||
|
||||
// renderizar el marco de los módulos
|
||||
modulesPanel.render(gui, mouseX, mouseY, delta);
|
||||
modulesPanel.updatePosition(mouseX, mouseY);
|
||||
// renderizar los paneles de los módulos
|
||||
for (ModulePanel mp : modulePanels) {
|
||||
mp.render(gui, mouseX, mouseY, delta);
|
||||
mp.updatePosition(mouseX, mouseY);
|
||||
}
|
||||
|
||||
for (SettingsPanel sp : settingsPanels) {
|
||||
sp.drawTooltips(gui, mouseX, mouseY);
|
||||
@@ -135,9 +151,13 @@ public class ClickGui extends Screen {
|
||||
}
|
||||
|
||||
private int calculateContentHeight() {
|
||||
int bottom = modulesPanel.getY() + modulesPanel.getH() + modulesPanel.getTotalHeight();
|
||||
for (SettingsPanel panel : settingsPanels)
|
||||
bottom = Math.max(bottom, panel.getY() + panel.getH() + panel.getTotalHeight());
|
||||
int bottom = mc.getWindow().getGuiScaledHeight();
|
||||
for (ModulePanel mp : modulePanels) {
|
||||
bottom = mp.getY() + mp.getH() + mp.getTotalHeight();
|
||||
}
|
||||
for (SettingsPanel sp : settingsPanels) {
|
||||
bottom = Math.max(bottom, sp.getY() + sp.getH() + sp.getTotalHeight());
|
||||
}
|
||||
|
||||
return bottom + 20; // padding
|
||||
}
|
||||
@@ -147,13 +167,17 @@ public class ClickGui extends Screen {
|
||||
int x = (int) click.x();
|
||||
int y = (int) click.y();
|
||||
|
||||
ChatUtil.info(x + " " + y);
|
||||
|
||||
miscWidgets.forEach(w -> w.mouseClicked(
|
||||
x, y, click.button()
|
||||
));
|
||||
|
||||
// detectar clics sobre los marcos
|
||||
modulesPanel.mouseClicked(x, y, click.button());
|
||||
friendsPanel.mouseClicked(x, y, click.button());
|
||||
for (ModulePanel mp : new ArrayList<>(modulePanels)) {
|
||||
mp.mouseClicked(x, y, click.button());
|
||||
}
|
||||
for (SettingsPanel sp : new ArrayList<>(settingsPanels)) {
|
||||
sp.mouseClicked(x, y, click.button());
|
||||
}
|
||||
@@ -170,8 +194,10 @@ public class ClickGui extends Screen {
|
||||
x, y, click.button()));
|
||||
|
||||
// registrar cuándo se suelta el clic, en cada marco respectivamente
|
||||
modulesPanel.mouseReleased(x, y, click.button());
|
||||
friendsPanel.mouseReleased(x, y, click.button());
|
||||
for (ModulePanel mp : new ArrayList<>(modulePanels)) {
|
||||
mp.mouseReleased(x, y, click.button());
|
||||
}
|
||||
for (SettingsPanel sp : new ArrayList<>(settingsPanels)) {
|
||||
sp.mouseReleased(x, y, click.button());
|
||||
}
|
||||
@@ -208,12 +234,12 @@ public class ClickGui extends Screen {
|
||||
if (Sputnik.mc.screen != this || event.getButton() != 2 || !KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) return;
|
||||
|
||||
int h = Sputnik.mc.getWindow().getGuiScaledHeight();
|
||||
int minY = Math.min(modulesPanel.getY(), settingsPanels.stream().mapToInt(Panel::getY).min().orElse(modulesPanel.getY()));
|
||||
int maxY = Math.max(modulesPanel.getY() + modulesPanel.getH(), settingsPanels.stream().mapToInt(sp -> sp.getY() + sp.getH()).max().orElse(modulesPanel.getY() + modulesPanel.getH()));
|
||||
int minY = Math.min(modulePanels.stream().mapToInt(Panel::getY).min().getAsInt(), settingsPanels.stream().mapToInt(Panel::getY).min().getAsInt());
|
||||
int maxY = Math.max(modulePanels.stream().mapToInt(mp -> mp.getY() + mp.getH()).max().getAsInt(), settingsPanels.stream().mapToInt(sp -> sp.getY() + sp.getH()).max().getAsInt());
|
||||
int correction = minY < 0 ? -minY + 4 : (maxY > h ? h - maxY - 4 : 0);
|
||||
|
||||
if (correction != 0) {
|
||||
modulesPanel.setY(modulesPanel.getY() + correction);
|
||||
modulePanels.forEach(mp -> mp.setY(mp.getY() + correction));
|
||||
settingsPanels.forEach(sp -> sp.setY(sp.getY() + correction));
|
||||
}
|
||||
}
|
||||
@@ -223,34 +249,31 @@ public class ClickGui extends Screen {
|
||||
String searchInput = searchBar.getSearchInput().trim();
|
||||
if (!clientSettings.matchCase.getValue()) searchInput = searchInput.toLowerCase();
|
||||
|
||||
for (Button b : modulesPanel.getButtons()) {
|
||||
if (!(b instanceof ModuleButton mb)) continue;
|
||||
Module module = mb.getModule();
|
||||
|
||||
if (getCategoryFilter() != Category.ALL) {
|
||||
module.setSearchMatch(getCategoryFilter() == module.getCategory());
|
||||
} else {
|
||||
module.setSearchMatch(true);
|
||||
for (ModulePanel mp : modulePanels) {
|
||||
for (Button b : mp.getButtons()) {
|
||||
if (!(b instanceof ModuleButton mb)) continue;
|
||||
Module module = mb.getModule();
|
||||
|
||||
if (searchInput.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = MiscUtil.removeAccentMarks(module.getName());
|
||||
String description = MiscUtil.removeAccentMarks(module.getDescription());
|
||||
String category = MiscUtil.removeAccentMarks(module.getCategory().toString());
|
||||
|
||||
if (!clientSettings.matchCase.getValue()) {
|
||||
name = name.toLowerCase();
|
||||
description = description.toLowerCase();
|
||||
category = category.toLowerCase();
|
||||
}
|
||||
|
||||
module.setSearchMatch(
|
||||
name.contains(searchInput)
|
||||
|| description.contains(searchInput)
|
||||
|| category.contains(searchInput));
|
||||
}
|
||||
|
||||
if (searchInput.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = MiscUtil.removeAccentMarks(module.getName());
|
||||
String description = MiscUtil.removeAccentMarks(module.getDescription());
|
||||
String category = MiscUtil.removeAccentMarks(module.getCategory().toString());
|
||||
|
||||
if (!clientSettings.matchCase.getValue()) {
|
||||
name = name.toLowerCase();
|
||||
description = description.toLowerCase();
|
||||
category = category.toLowerCase();
|
||||
}
|
||||
|
||||
module.setSearchMatch(
|
||||
name.contains(searchInput)
|
||||
|| description.contains(searchInput)
|
||||
|| category.contains(searchInput));
|
||||
}
|
||||
|
||||
for (SettingsPanel sp : settingsPanels) {
|
||||
@@ -408,19 +431,11 @@ public class ClickGui extends Screen {
|
||||
lb.refreshDummy();
|
||||
}
|
||||
|
||||
public void setCategoryFilter(Category category) {
|
||||
this.categoryFilter = category;
|
||||
}
|
||||
|
||||
public Category getCategoryFilter() {
|
||||
return categoryFilter;
|
||||
}
|
||||
|
||||
// métodos del súper
|
||||
|
||||
@Override
|
||||
public void onClose() { // evitar que al reabrir la interfaz sin previamente haber soltado el clic, se sigan arrastrando objetos
|
||||
modulesPanel.mouseReleased(0, 0, 0);
|
||||
modulePanels.forEach(mp -> mp.mouseReleased(0, 0, 0));
|
||||
settingsPanels.forEach(sp -> sp.mouseReleased(0, 0, 0));
|
||||
scrollBar.mouseReleased(0, 0, 0);
|
||||
searchBar.mouseReleased(0, 0, 0);
|
||||
@@ -448,8 +463,8 @@ public class ClickGui extends Screen {
|
||||
|
||||
// getters y setters de widgets
|
||||
|
||||
public ModulePanel getModulesPanel() {
|
||||
return modulesPanel;
|
||||
public List<ModulePanel> getModulePanels() {
|
||||
return modulePanels;
|
||||
}
|
||||
|
||||
public ClientSettingsPanel getClientSettingsPanel() {
|
||||
|
||||
@@ -32,27 +32,8 @@ public class SearchBarWidget extends Widget {
|
||||
private boolean focused;
|
||||
private final StringBuilder buffer = new StringBuilder();
|
||||
|
||||
// simular un módulo
|
||||
private final Module dummy = new Module("", "", Category.ALL);
|
||||
private final OptionSetting<Category> categories = dummy.getSgGeneral().add(
|
||||
new OptionSetting<>(
|
||||
"filtrar",
|
||||
"filtrar módulos por categoría",
|
||||
List.of(Category.values()),
|
||||
Category.ALL
|
||||
)
|
||||
);
|
||||
private final ChooseButton<Category> dummyButton = new ChooseButton<>(
|
||||
categories, new SettingsPanel(dummy, 0, 0, 50, 50), 0
|
||||
);
|
||||
|
||||
|
||||
public SearchBarWidget(int x, int y, int w, int h) {
|
||||
super(x, y, w, h);
|
||||
|
||||
categories.onUpdate(v -> {
|
||||
if (ClickGui.INSTANCE != null) ClickGui.INSTANCE.setCategoryFilter(v);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,14 +54,6 @@ public class SearchBarWidget extends Widget {
|
||||
|
||||
gui.fill(x + 20, renderY + 2, x + w - 20, renderY + h - 2, textFieldColor.getRGB());
|
||||
|
||||
gui.blit(RenderPipelines.GUI_TEXTURED, Textures.SEARCH_BAR_FILTER,
|
||||
x + w - 35, renderY + h / 2 - 6,
|
||||
0, 0, 12, 12, 12, 12,
|
||||
isFilterButtonHovered(mouseX, mouseY)
|
||||
? Colors.SILVER.getRGB()
|
||||
: Colors.WHITE.getRGB()
|
||||
);
|
||||
|
||||
// dibujar líneas en la parte agarrable, para indicárselo al usuario
|
||||
for (int i = 0; i < 4; i++) {
|
||||
gui.horizontalLine(x + 4, x + 16, renderY + 3 * i + 5, Color.LIGHT_GRAY.getRGB());
|
||||
@@ -95,10 +68,6 @@ public class SearchBarWidget extends Widget {
|
||||
// botón para borrar búsqueda actual
|
||||
gui.text(mc.font, "×", x + w - mc.font.width("×") - 6, renderY + (h / 2) - mc.font.lineHeight / 2,
|
||||
isClearButtonHovered(mouseX, mouseY) ? Color.RED.getRGB() : -1, true);
|
||||
|
||||
if (isFilterButtonHovered(mouseX, mouseY)) {
|
||||
gui.setTooltipForNextFrame(mc.font, Component.literal("filtrar por categoría"), mouseX + 7, mouseY + 20);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -110,8 +79,6 @@ public class SearchBarWidget extends Widget {
|
||||
dragY = mouseY - y;
|
||||
} else if (isClearButtonHovered(mouseX, mouseY)) {
|
||||
buffer.setLength(0);
|
||||
} else if (isFilterButtonHovered(mouseX, mouseY)) {
|
||||
openFilterPanel(mouseX, mouseY);
|
||||
}
|
||||
focused = isTextFieldHovered(mouseX, mouseY) && ClickGui.INSTANCE.trySelect(this);
|
||||
}
|
||||
@@ -183,8 +150,7 @@ public class SearchBarWidget extends Widget {
|
||||
public boolean isTextFieldHovered(int mouseX, int mouseY) {
|
||||
return ClickGui.INSTANCE.canSelect(this)
|
||||
&& mouseX > x + 20 && mouseX < x + w - 20
|
||||
&& mouseY > renderY + 2 && mouseY < renderY + h - 2
|
||||
&& !isFilterButtonHovered(mouseX, mouseY);
|
||||
&& mouseY > renderY + 2 && mouseY < renderY + h - 2;
|
||||
}
|
||||
|
||||
public boolean isClearButtonHovered(int mouseX, int mouseY) {
|
||||
@@ -193,12 +159,6 @@ public class SearchBarWidget extends Widget {
|
||||
&& mouseY > renderY + 3 && mouseY < renderY + h - 5;
|
||||
}
|
||||
|
||||
public boolean isFilterButtonHovered(int mouseX, int mouseY) {
|
||||
return ClickGui.INSTANCE.canSelect(this)
|
||||
&& mouseX > x + w - 37 && mouseX < x + w - 21
|
||||
&& mouseY > renderY + h / 2 - 8 && mouseY < renderY + h / 2 + 8;
|
||||
}
|
||||
|
||||
public boolean isFocused() {
|
||||
return focused && ClientSettingsPanel.clientSettings.searchBar.getValue();
|
||||
}
|
||||
@@ -219,10 +179,4 @@ public class SearchBarWidget extends Widget {
|
||||
ConfigManager.setSearchBarPosition(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
private void openFilterPanel(int mouseX, int mouseY) {
|
||||
dummyButton.getParent().setX(mouseX);
|
||||
dummyButton.getParent().setY(mouseY);
|
||||
dummyButton.openPanel();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package me.retucio.sputnik.ui.widgets.panels;
|
||||
|
||||
import me.retucio.sputnik.Sputnik;
|
||||
import me.retucio.sputnik.event.sputnik.ModulePanelEvent;
|
||||
import me.retucio.sputnik.module.Category;
|
||||
import me.retucio.sputnik.module.Module;
|
||||
import me.retucio.sputnik.module.ModuleManager;
|
||||
import me.retucio.sputnik.ui.screen.ClickGui;
|
||||
@@ -20,15 +21,18 @@ import java.util.List;
|
||||
public class ModulePanel extends Panel<ModuleButton> {
|
||||
|
||||
public boolean extended;
|
||||
public final Category category;
|
||||
|
||||
public ModulePanel(int x, int y, int w, int h) {
|
||||
super("módulos", x, y, w, h);
|
||||
public ModulePanel(Category category, int x, int y, int w, int h) {
|
||||
super(category.toString(), x, y, w, h);
|
||||
this.category = category;
|
||||
dragging = false;
|
||||
extended = true;
|
||||
|
||||
// determinar el saliente para cada botón de módulo
|
||||
int offset = h;
|
||||
for (Module module : ModuleManager.INSTANCE.getModules()) {
|
||||
if (!module.getCategory().equals(this.category)) continue;
|
||||
buttons.add(new ModuleButton(module, this, offset));
|
||||
offset += h;
|
||||
}
|
||||
@@ -53,7 +57,7 @@ public class ModulePanel extends Panel<ModuleButton> {
|
||||
gui.fill(x, renderY, x + w, renderY + h, Colors.mainColor.getRGB()); // cabeza del marco
|
||||
|
||||
// título del marco
|
||||
gui.text(mc.font, Component.literal(ChatFormatting.BOLD + title),
|
||||
gui.text(mc.font, Component.literal(title),
|
||||
x + 8,
|
||||
renderY + (h / 2) - (mc.font.lineHeight / 2),
|
||||
-1, true);
|
||||
@@ -97,7 +101,7 @@ public class ModulePanel extends Panel<ModuleButton> {
|
||||
dragY = mouseY - y;
|
||||
} else if (button == 1) { // clic derecho para extenderlo
|
||||
extended = !extended;
|
||||
Sputnik.EVENT_BUS.post(new ModulePanelEvent.Extend());
|
||||
Sputnik.EVENT_BUS.post(new ModulePanelEvent.Extend(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +135,7 @@ public class ModulePanel extends Panel<ModuleButton> {
|
||||
}
|
||||
|
||||
if (isHovered(mouseX, mouseY)) {
|
||||
Sputnik.EVENT_BUS.post(new ModulePanelEvent.Move());
|
||||
Sputnik.EVENT_BUS.post(new ModulePanelEvent.Move(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user