Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1a03f3ddb |
No files matched your search
@@ -0,0 +1,82 @@
|
|||||||
|
<p align="center">
|
||||||
|
<a href="README.md"><img src="https://img.shields.io/badge/lang-Español-yellow.svg" alt="español"></a>
|
||||||
|
<a href="README.en.md"><img src="https://img.shields.io/badge/lang-English-blue.svg" alt="english"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
# jenny's mod 2 (100% real)
|
||||||
|
|
||||||
|
> Minecraft Fabric 26.2 mod that adds some "QOL" features, mostly related to the camera.
|
||||||
|
|
||||||
|
## installation
|
||||||
|
|
||||||
|
### for normal people:
|
||||||
|
1. go to [releases](https://codeberg.org/retucio/sputnik/releases)
|
||||||
|
2. choose the most recent version
|
||||||
|
3. download the .jar file
|
||||||
|
4. move it to your mods dir (prolly `%appdata%/.minecraft/mods`)
|
||||||
|
|
||||||
|
|
||||||
|
make sure to have a Minecraft and Fabric version compatible with the mod (MC `26.2`; Fabric `0.19.3`)
|
||||||
|
|
||||||
|
issues could arise when using it with other mods, especially other clients, since they could conflict
|
||||||
|
|
||||||
|
### for nerds
|
||||||
|
1. clone the repo (`git clone https://codeberg.org/retucio/sputnik`)
|
||||||
|
2. enter the repo dir (`cd sputnik`)
|
||||||
|
3. `gradlew build` for Windows (ew) or `chmod +x gradlew` + `./gradlew build` for Unix-likes (Linux & Mac)
|
||||||
|
4. the built .jar will be found in `/build/libs/sputnik-X.X.jar`
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
`rshift` by default to open the GUI
|
||||||
|
|
||||||
|
`insert` by default to open the HUD editor
|
||||||
|
|
||||||
|
`$` as prefix for commands (autocompleted)
|
||||||
|
|
||||||
|
some modules have keys assigned by default, assign them `ESC` to unbind them.
|
||||||
|
|
||||||
|
## ui
|
||||||
|
|
||||||
|
- left click to toggle modules
|
||||||
|
- right click to open its settings
|
||||||
|
- left click + drag to move a panel
|
||||||
|
- right click on a panel's header to expand/contract it, or to close it
|
||||||
|
- left click over settings to change them
|
||||||
|
- shift + right click on a setting to reset it to its default value
|
||||||
|
- place the mouse cursor over a module/setting to read its description
|
||||||
|
|
||||||
|
## screenshots
|
||||||
|
|
||||||
|
<img src="screenshots/automine.png" alt="auto mine">
|
||||||
|
<img src="screenshots/blockesp.png" alt="block ESP + light overlay">
|
||||||
|
<img src="screenshots/camtweaks.png" alt="perspective plus">
|
||||||
|
<img src="screenshots/chatplus.png" alt="chatplus + nametags + screenshots plus">
|
||||||
|
<img src="screenshots/clickgui.png" alt="click GUI">
|
||||||
|
<img src="screenshots/freecam.png" alt="freecam + tracers">
|
||||||
|
<img src="screenshots/hudeditor.png" alt="HUD editor">
|
||||||
|
<img src="screenshots/itemphysics.png" alt="item physics">
|
||||||
|
<img src="screenshots/lsd.png" alt="lsd module">
|
||||||
|
<img src="screenshots/macros.png" alt="macros tab">
|
||||||
|
<img src="screenshots/trajectories.png" alt="projectile trajectories">
|
||||||
|
|
||||||
|
|
||||||
|
## contribution
|
||||||
|
|
||||||
|
yes please (PRs are welcome)
|
||||||
|
|
||||||
|
## license
|
||||||
|
|
||||||
|
[CC0 license](LICENSE)
|
||||||
|
|
||||||
|
## disclaimer
|
||||||
|
|
||||||
|
i don't give a single fuck what happens to you when using this mod on servers where its features are bannable and such.
|
||||||
|
|
||||||
|
## deps
|
||||||
|
|
||||||
|
- [fabric api](https://modrinth.com/mod/fabric-api/)
|
||||||
|
|
||||||
|
## notes
|
||||||
|
|
||||||
|
this mod IS BUGGY. VERY BUGGY, i know. i started this project when i was 14 and the codebase is such a mess i refuse to fix it. i might rewrite it in a future, though.
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
|
<p align="center">
|
||||||
|
<a href="README.md"><img src="https://img.shields.io/badge/lang-Español-yellow.svg" alt="español"></a>
|
||||||
|
<a href="README.en.md"><img src="https://img.shields.io/badge/lang-English-blue.svg" alt="english"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
# jenny's mod 2 100% real
|
# jenny's mod 2 100% real
|
||||||
|
|
||||||
mod para Minecraft Fabric 26.2 que añade algunas cosas QOL, mayormente relacionadas a la cámara.
|
> mod para Minecraft Fabric 26.2 que añade algunas cosas "QOL", mayormente relacionadas a la cámara.
|
||||||
|
|
||||||
## instalación
|
## instalación
|
||||||
|
|
||||||
@@ -14,10 +19,10 @@ asegúrate de tener una version de Minecraft y Fabric compatibles con el mod (MC
|
|||||||
es posible que haya problemas al usarlo junto a otros mods, especialmente junto a otros clientes, pues pueden conflictar entre ellos.
|
es posible que haya problemas al usarlo junto a otros mods, especialmente junto a otros clientes, pues pueden conflictar entre ellos.
|
||||||
|
|
||||||
### para frikis de 200 de iq
|
### para frikis de 200 de iq
|
||||||
1. clona el respositorio (`git clone https://github.com/retuci0/sputnik`)
|
1. clona el respositorio (`git clone https://codeberg.org/retucio/sputnik`)
|
||||||
2. entra al directorio del repositorio (`cd sputnik`)
|
2. entra al directorio del repositorio (`cd sputnik`)
|
||||||
3. `gradlew build` para Windows o `chmod +x gradlew` + `./gradlew build` para Linux (Mac es Linux)
|
3. `gradlew build` para Windows (ew) o `chmod +x gradlew` + `./gradlew build` para Unix-likes (Linux & Mac)
|
||||||
4. el resultado estará en `/build/libs/sputnik-X.X.jar` (el que no lleva "sources" en el nombre)
|
4. el resultado estará en `/build/libs/sputnik-X.X.jar`
|
||||||
|
|
||||||
## uso
|
## uso
|
||||||
|
|
||||||
@@ -33,28 +38,25 @@ algunos módulos tienen teclas asignadas por defecto, asígnales `ESC` para desa
|
|||||||
|
|
||||||
- clic izquierdo para activar / desactivar módulos
|
- clic izquierdo para activar / desactivar módulos
|
||||||
- clic derecho para abrir sus ajustes
|
- clic derecho para abrir sus ajustes
|
||||||
- clic izquierdo + arrastrar para mover marcos
|
- clic izquierdo + arrastrar para mover paneles
|
||||||
- clic derecho en la cabeza del marco para expandirlo / contraerlo o para cerrarlo
|
- clic derecho en la cabeza del marco para expandirlo / contraerlo o para cerrarlo
|
||||||
- clic izquierdo sobre ajustes para modificarlos
|
- clic izquierdo sobre ajustes para modificarlos
|
||||||
- shift + clic derecho sobre ajustes para restablecerlos
|
- shift + clic derecho sobre ajustes para restablecerlos
|
||||||
- posiciona el puntero del ratón sobre un módulo o ajuste para leer su descripción
|
- posiciona el puntero del ratón sobre un módulo o ajuste para leer su descripción
|
||||||
|
|
||||||
### protips
|
|
||||||
- shift mientras pasas el puntero por encima de un ajuste de modos para ver los modos disponibles
|
|
||||||
- clic derecho para ciclar hacia atrás en ajustes de modo
|
|
||||||
- usa la rueda del ratón para mover la interfaz verticalmente
|
|
||||||
- shift + rueda del ratón para mover todos los marcos a un rango visible en la pantalla
|
|
||||||
|
|
||||||
## capturas
|
## capturas
|
||||||
|
|
||||||
<img src="screenshots/ui.png" alt="interfaz">
|
<img src="screenshots/automine.png" alt="auto minado">
|
||||||
<img src="screenshots/nametags.png" alt="nametags mostrando daño de un tridente">
|
<img src="screenshots/blockesp.png" alt="resaltado de bloques + superposición de luz">
|
||||||
<img src="screenshots/chatplus.png" alt="chatplus y capturas en uso">
|
<img src="screenshots/camtweaks.png" alt="perspectiva plus">
|
||||||
<img src="screenshots/crits.png" alt="críticos">
|
<img src="screenshots/chatplus.png" alt="chatplus + nametags + capturas">
|
||||||
<img src="screenshots/fullbright.png" alt="fullbright en modo gamma cambiando el color de los shaders">
|
<img src="screenshots/clickgui.png" alt="interfaz">
|
||||||
<img src="screenshots/hud.png" alt="HUD">
|
<img src="screenshots/freecam.png" alt="cámara libre + trazos">
|
||||||
<img src="screenshots/hudeditor.png" alt="editor de HUD">
|
<img src="screenshots/hudeditor.png" alt="editor de HUD">
|
||||||
<img src="screenshots/colorpicker.png" alt="selector de colores">
|
<img src="screenshots/itemphysics.png" alt="físicas de items">
|
||||||
|
<img src="screenshots/lsd.png" alt="LSD">
|
||||||
|
<img src="screenshots/macros.png" alt="macros">
|
||||||
|
<img src="screenshots/trajectories.png" alt="trayectorias">
|
||||||
|
|
||||||
## contribuciones
|
## contribuciones
|
||||||
|
|
||||||
@@ -62,26 +64,16 @@ sí por favor
|
|||||||
|
|
||||||
## licencia
|
## licencia
|
||||||
|
|
||||||
no sé, haz lo que quieras con esto, es puta basura xd
|
[licencia CC0](LICENSE)
|
||||||
|
|
||||||
aunque estaría guay que acreditases
|
|
||||||
|
|
||||||
pero bueno
|
|
||||||
|
|
||||||
## descargo de responsabilidad
|
## descargo de responsabilidad
|
||||||
|
|
||||||
me importa una puta mierda lo que pase al usar este mod en servers donde es baneable y así.
|
me importa una puta mierda lo que pase al usar este mod en servers donde es baneable y así.
|
||||||
|
|
||||||
## mods recomendados
|
## dependencias
|
||||||
|
|
||||||
> mods que recomiendo usar junto a este:
|
- [fabric api](https://modrinth.com/mod/fabric-api/)
|
||||||
|
|
||||||
- [fabric api (necesario)](https://modrinth.com/mod/fabric-api/): necesario para el mod
|
## notas
|
||||||
- [sodium](https://modrinth.com/mod/sodium): mejora el rendimiento general del juego
|
|
||||||
- [viafabricplus](https://modrinth.com/mod/viafabricplus): te permite conectarte a servidores que tengan una versión distinta a la de tu cliente
|
este mod tiene MUCHOS bugs. empecé este proyecto cuando tenía 14 años y no sabía una mierda de programar. el código es un puto desastre y me niego a arreglarlo. puede que en un futuro reescriba el mod o algo. no sé.
|
||||||
- [xaero's world map](https://modrinth.com/mod/xaeros-world-map/) y [xaero's minimap](https://modrinth.com/mod/xaeros-minimap/): mapa chulo
|
|
||||||
- [mod menu](https://modrinth.com/mod/modmenu): lista de los mods instalados, y sus ajustes
|
|
||||||
- [iris](https://modrinth.com/mod/iris): shaders
|
|
||||||
- [lambdynamiclights](https://modrinth.com/mod/lambdynamiclights): iluminación dinámica
|
|
||||||
- [appleskin](https://modrinth.com/mod/appleskin/): información relacionada con la comida
|
|
||||||
- [baritone (desactualizado)](https://github.com/cabaletta/baritone): google maps para juego de cubos
|
|
||||||
@@ -1,22 +1,20 @@
|
|||||||
# v6.3
|
# v6.4
|
||||||
|
|
||||||
## novedades
|
## novedades
|
||||||
|
|
||||||
- actualizado a Gradle 9.7.1
|
- README en inglés
|
||||||
|
- capturas actualizadas (las de los README)
|
||||||
|
|
||||||
### adiciones
|
### adiciones
|
||||||
|
|
||||||
#### módulos nuevos:
|
#### módulos nuevos:
|
||||||
|
|
||||||
- autominado: mina automáticamente los bloques seleccionados, con distintos modos de selección
|
|
||||||
- estiloso: haz truquitos con el ítem que tienes en la mano
|
|
||||||
|
|
||||||
### arreglos / mejoras
|
### arreglos / mejoras
|
||||||
|
|
||||||
- mejoras varias a `puto gordo`
|
- ahora la detección de clics sobre cabezales de grupos de ajustes funciona correctamente
|
||||||
- ahora `trazos` con `uno mismo` solo te apunta en cámara libre
|
|
||||||
- nuevo ajuste de distancia máxima de renderizado para `nametags`
|
|
||||||
|
|
||||||
## problemas reconocidos
|
## problemas reconocidos
|
||||||
|
|
||||||
|
- `reponer` no funciona
|
||||||
|
- `copiar` tras sacar una captura con `capturas` no funciona correctamente
|
||||||
- lo de siempre.
|
- lo de siempre.
|
||||||
@@ -10,6 +10,6 @@ discord_rpc_version=1.0.3
|
|||||||
neutrino_version=1.1.0
|
neutrino_version=1.1.0
|
||||||
jdk_version=25
|
jdk_version=25
|
||||||
|
|
||||||
mod_version=6.3
|
mod_version=6.4
|
||||||
maven_group=me.retucio
|
maven_group=me.retucio
|
||||||
archives_base_name=sputnik
|
archives_base_name=sputnik
|
||||||
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 3.4 MiB |
|
Before Width: | Height: | Size: 864 KiB After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 796 KiB |
|
Before Width: | Height: | Size: 915 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 566 KiB |
|
Before Width: | Height: | Size: 469 KiB |
|
Before Width: | Height: | Size: 243 KiB After Width: | Height: | Size: 700 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 506 KiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 691 KiB |
@@ -3,6 +3,7 @@ package me.retucio.sputnik.module.modules.render;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import me.retucio.sputnik.Sputnik;
|
import me.retucio.sputnik.Sputnik;
|
||||||
|
import me.retucio.sputnik.config.ConfigManager;
|
||||||
import me.retucio.sputnik.mixin.mixins.entity.EntityMixin;
|
import me.retucio.sputnik.mixin.mixins.entity.EntityMixin;
|
||||||
import me.retucio.sputnik.mixin.mixins.entity.ItemEntityMixin;
|
import me.retucio.sputnik.mixin.mixins.entity.ItemEntityMixin;
|
||||||
import me.retucio.sputnik.mixin.mixins.player.PlayerMixin;
|
import me.retucio.sputnik.mixin.mixins.player.PlayerMixin;
|
||||||
@@ -90,7 +91,7 @@ public class Nametags extends Module {
|
|||||||
defaultEntities.replace(EntityTypes.TNT, true);
|
defaultEntities.replace(EntityTypes.TNT, true);
|
||||||
entities.setDefaultValue(defaultEntities);
|
entities.setDefaultValue(defaultEntities);
|
||||||
|
|
||||||
health.onUpdate(v -> healthMode.visibility(v));
|
health.onUpdate(healthMode::visibility);
|
||||||
|
|
||||||
entities.onUpdate(entities -> {
|
entities.onUpdate(entities -> {
|
||||||
items.visibility(entities.get(EntityTypes.ITEM));
|
items.visibility(entities.get(EntityTypes.ITEM));
|
||||||
@@ -131,7 +132,7 @@ public class Nametags extends Module {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public String getOwnerName(EntityReference<LivingEntity> owner) {
|
public String getOwnerName(EntityReference<LivingEntity> owner) {
|
||||||
// si el dueño está en línea (de manera segura)
|
// si el dueño está en línea (de manera segura)
|
||||||
if (mc.level instanceof UniquelyIdentifyable queriableWorld) { // UUIDLookup<?> ??
|
if (mc.level instanceof UniquelyIdentifyable queriableWorld) {
|
||||||
LivingEntity ownerEntity = owner.resolve(queriableWorld, LivingEntity.class);
|
LivingEntity ownerEntity = owner.resolve(queriableWorld, LivingEntity.class);
|
||||||
if (ownerEntity instanceof Player playerEntity) return playerEntity.getName().getString();
|
if (ownerEntity instanceof Player playerEntity) return playerEntity.getName().getString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ public class ClickGui extends Screen {
|
|||||||
private final ProfilesTab profilesTab = new ProfilesTab();
|
private final ProfilesTab profilesTab = new ProfilesTab();
|
||||||
private final MacrosTab macrosTab = new MacrosTab();
|
private final MacrosTab macrosTab = new MacrosTab();
|
||||||
|
|
||||||
|
private static final int PLACEMENT_SEARCH_STEP = 8;
|
||||||
|
|
||||||
public ClickGui() {
|
public ClickGui() {
|
||||||
super(Component.translatable("sputnik.ui.clickgui.title"));
|
super(Component.translatable("sputnik.ui.clickgui.title"));
|
||||||
Sputnik.EVENT_BUS.subscribe(this);
|
Sputnik.EVENT_BUS.subscribe(this);
|
||||||
@@ -202,6 +204,49 @@ public class ClickGui extends Screen {
|
|||||||
return bottom + 20; // padding
|
return bottom + 20; // padding
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int[] findEmptyPosition(int w, int h, int preferredX, int preferredY) {
|
||||||
|
int screenWidth = mc.getWindow().getGuiScaledWidth();
|
||||||
|
int maxX = Math.max(0, screenWidth - w);
|
||||||
|
int startX = Math.clamp(preferredX, 0, maxX);
|
||||||
|
int startY = Math.max(preferredY, 0);
|
||||||
|
|
||||||
|
int searchBottom = calculateContentHeight() + h;
|
||||||
|
|
||||||
|
for (int y = startY; y <= searchBottom; y += PLACEMENT_SEARCH_STEP) {
|
||||||
|
for (int candidateX = 0; candidateX <= maxX; candidateX += PLACEMENT_SEARCH_STEP) {
|
||||||
|
if (!overlapsAnything(candidateX, y, w, h)) {
|
||||||
|
return new int[]{candidateX, y};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no hay hueco: colocarlo debajo de todo lo demás, para llegar a él haciendo scroll
|
||||||
|
return new int[]{startX, calculateContentHeight()};
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean overlapsAnything(int x, int y, int w, int h) {
|
||||||
|
for (ModulePanel mp : modulePanels) {
|
||||||
|
int mpHeight = mp.getH() + (mp.isExtended() ? mp.getTotalHeight() : 0);
|
||||||
|
if (rectsOverlap(x, y, w, h, mp.getX(), mp.getY(), mp.getW(), mpHeight)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SettingsPanel sp : settingsPanels) {
|
||||||
|
int spHeight = sp.getH() + sp.getTotalHeight();
|
||||||
|
if (rectsOverlap(x, y, w, h, sp.getX(), sp.getY(), sp.getW(), spHeight)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int friendsHeight = friendsPanel.getH() + (friendsPanel.isExtended() ? friendsPanel.getTotalHeight() : 0);
|
||||||
|
if (rectsOverlap(x, y, w, h, friendsPanel.getX(), friendsPanel.getY(), friendsPanel.getW(), friendsHeight)) return true;
|
||||||
|
|
||||||
|
int clientHeight = clientSettingsPanel.getH() + (clientSettingsPanel.isExtended() ? clientSettingsPanel.getTotalHeight() : 0);
|
||||||
|
return rectsOverlap(x, y, w, h, clientSettingsPanel.getX(), clientSettingsPanel.getY(), clientSettingsPanel.getW(), clientHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean rectsOverlap(int ax, int ay, int aw, int ah, int bx, int by, int bw, int bh) {
|
||||||
|
return ax < bx + bw && ax + aw > bx
|
||||||
|
&& ay < by + bh && ay + ah > by;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseClicked(MouseButtonEvent click, boolean doubled) {
|
public boolean mouseClicked(MouseButtonEvent click, boolean doubled) {
|
||||||
int x = (int) click.x();
|
int x = (int) click.x();
|
||||||
@@ -433,12 +478,18 @@ public class ClickGui extends Screen {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// abrir un marco donde se encuentran los ajustes del módulo deseado
|
// abrir un marco donde se encuentran los ajustes del módulo deseado, buscando un
|
||||||
|
// hueco libre cerca de (x, y) para que no se solape con otros paneles ya abiertos
|
||||||
public void openSettingsPanel(Module module, int x, int y) {
|
public void openSettingsPanel(Module module, int x, int y) {
|
||||||
// asegurarse de que no se sale de la pantalla
|
SettingsPanel panel = new SettingsPanel(module, 0, 0, 100, 20);
|
||||||
x = Math.clamp(x, 0, mc.getWindow().getGuiScaledWidth() - 80);
|
panel.updateTotalHeight(); // altura real disponible ya tras el constructor
|
||||||
|
|
||||||
|
int panelHeight = panel.getH() + panel.getTotalHeight();
|
||||||
|
int[] position = findEmptyPosition(panel.getW(), panelHeight, x, y);
|
||||||
|
|
||||||
|
panel.setX(position[0]);
|
||||||
|
panel.setY(position[1]);
|
||||||
|
|
||||||
SettingsPanel panel = new SettingsPanel(module, x, y, 100, 20);
|
|
||||||
settingsPanels.add(panel);
|
settingsPanels.add(panel);
|
||||||
|
|
||||||
Sputnik.EVENT_BUS.post(new SettingsPanelEvent.Open(panel));
|
Sputnik.EVENT_BUS.post(new SettingsPanelEvent.Open(panel));
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ import java.util.function.Supplier;
|
|||||||
|
|
||||||
public abstract class Panel<B extends Button> extends Widget {
|
public abstract class Panel<B extends Button> extends Widget {
|
||||||
|
|
||||||
// el título se resuelve al pintarlo, no al construir el marco: los marcos se crean en
|
|
||||||
// la inicialización del mod, cuando el idioma todavía no ha cargado, así que guardar el
|
|
||||||
// texto ya traducido dejaba los títulos en español para siempre (y no cambiaban aunque
|
|
||||||
// se cambiara el idioma del juego en marcha)
|
|
||||||
private Supplier<String> title;
|
private Supplier<String> title;
|
||||||
|
|
||||||
protected final List<B> buttons = new ArrayList<>();
|
protected final List<B> buttons = new ArrayList<>();
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import me.retucio.sputnik.module.setting.settings.*;
|
|||||||
import me.retucio.sputnik.ui.widgets.buttons.settings.*;
|
import me.retucio.sputnik.ui.widgets.buttons.settings.*;
|
||||||
import me.retucio.sputnik.ui.screen.ClickGui;
|
import me.retucio.sputnik.ui.screen.ClickGui;
|
||||||
import me.retucio.sputnik.ui.widgets.buttons.*;
|
import me.retucio.sputnik.ui.widgets.buttons.*;
|
||||||
import me.retucio.sputnik.ui.widgets.Panel;
|
|
||||||
import me.retucio.sputnik.util.Colors;
|
import me.retucio.sputnik.util.Colors;
|
||||||
import me.retucio.sputnik.util.I18nUtil;
|
import me.retucio.sputnik.util.I18nUtil;
|
||||||
|
|
||||||
@@ -43,6 +42,7 @@ public class SettingsPanel extends CloseablePanel<SettingButton<? extends Settin
|
|||||||
@Override
|
@Override
|
||||||
public void render(GuiGraphicsExtractor gui, int mouseX, int mouseY, float delta) {
|
public void render(GuiGraphicsExtractor gui, int mouseX, int mouseY, float delta) {
|
||||||
updateWidth();
|
updateWidth();
|
||||||
|
updateTotalHeight();
|
||||||
|
|
||||||
int centerX = x + w / 2;
|
int centerX = x + w / 2;
|
||||||
int centerY = renderY + h / 2;
|
int centerY = renderY + h / 2;
|
||||||
@@ -77,31 +77,8 @@ public class SettingsPanel extends CloseablePanel<SettingButton<? extends Settin
|
|||||||
int descBoxTop = renderY + h + PADDING;
|
int descBoxTop = renderY + h + PADDING;
|
||||||
int descBoxBottom = descBoxTop + descHeight + PADDING * 2;
|
int descBoxBottom = descBoxTop + descHeight + PADDING * 2;
|
||||||
|
|
||||||
totalHeight = descHeight + 3 * PADDING;
|
|
||||||
int currentY;
|
int currentY;
|
||||||
|
|
||||||
// obtener valores de altura y tal
|
|
||||||
for (SettingGroup group : settingGroups) {
|
|
||||||
if (hasVisibleSettingsInGroup(group)) {
|
|
||||||
totalHeight += h + PADDING;
|
|
||||||
|
|
||||||
if (group.isExtended()) {
|
|
||||||
List<SettingButton<?>> groupButtons = getButtonsForGroup(group);
|
|
||||||
for (int j = 0; j < groupButtons.size(); j++) {
|
|
||||||
SettingButton<?> sb = groupButtons.get(j);
|
|
||||||
if (sb.getSetting().isVisible() && sb.getSetting().isSearchMatch()) {
|
|
||||||
if (j < groupButtons.size() - 1) {
|
|
||||||
totalHeight += (h - h / 4) + PADDING;
|
|
||||||
} else {
|
|
||||||
totalHeight += (h - h / 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
totalHeight += PADDING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// fondo del marco
|
// fondo del marco
|
||||||
gui.fill(x, descBoxTop - PADDING + 1, x + w, descBoxTop + totalHeight, Colors.panelBgColor.getRGB());
|
gui.fill(x, descBoxTop - PADDING + 1, x + w, descBoxTop + totalHeight, Colors.panelBgColor.getRGB());
|
||||||
|
|
||||||
@@ -112,10 +89,9 @@ public class SettingsPanel extends CloseablePanel<SettingButton<? extends Settin
|
|||||||
currentY = descBoxBottom + PADDING;
|
currentY = descBoxBottom + PADDING;
|
||||||
|
|
||||||
// dibujar botones y cabezales
|
// dibujar botones y cabezales
|
||||||
for (int i = 0; i < settingGroups.size(); i++) {
|
for (SettingGroup group : settingGroups) {
|
||||||
SettingGroup group = settingGroups.get(i);
|
|
||||||
if (hasVisibleSettingsInGroup(group)) {
|
if (hasVisibleSettingsInGroup(group)) {
|
||||||
int groupHeaderColor = isGroupHeaderHovered(mouseX, mouseY, i)
|
int groupHeaderColor = isGroupHeaderHovered(mouseX, mouseY, group)
|
||||||
? Colors.buttonColor.brighter().getRGB()
|
? Colors.buttonColor.brighter().getRGB()
|
||||||
: Colors.buttonColor.getRGB();
|
: Colors.buttonColor.getRGB();
|
||||||
|
|
||||||
@@ -176,9 +152,8 @@ public class SettingsPanel extends CloseablePanel<SettingButton<? extends Settin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < settingGroups.size(); i++) {
|
for (SettingGroup group : settingGroups) {
|
||||||
SettingGroup group = settingGroups.get(i);
|
if (hasVisibleSettingsInGroup(group) && isGroupHeaderHovered(mouseX, mouseY, group)) {
|
||||||
if (hasVisibleSettingsInGroup(group) && isGroupHeaderHovered(mouseX, mouseY, i)) {
|
|
||||||
group.setExtended(!group.isExtended());
|
group.setExtended(!group.isExtended());
|
||||||
updateVisibleButtonsForGroup(group);
|
updateVisibleButtonsForGroup(group);
|
||||||
return;
|
return;
|
||||||
@@ -239,6 +214,36 @@ public class SettingsPanel extends CloseablePanel<SettingButton<? extends Settin
|
|||||||
this.w = maxWidth + 30;
|
this.w = maxWidth + 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateTotalHeight() {
|
||||||
|
List<String> descLines = wrapDescription(module.getDisplayDescription(), w - 2 * PADDING);
|
||||||
|
int descHeight = descLines.size() * mc.font.lineHeight + (descLines.size() - 1) * 2;
|
||||||
|
|
||||||
|
int height = descHeight + 3 * PADDING;
|
||||||
|
|
||||||
|
for (SettingGroup group : settingGroups) {
|
||||||
|
if (!hasVisibleSettingsInGroup(group)) continue;
|
||||||
|
|
||||||
|
height += h + PADDING;
|
||||||
|
|
||||||
|
if (group.isExtended()) {
|
||||||
|
List<SettingButton<?>> groupButtons = getButtonsForGroup(group);
|
||||||
|
for (int j = 0; j < groupButtons.size(); j++) {
|
||||||
|
SettingButton<?> sb = groupButtons.get(j);
|
||||||
|
if (sb.getSetting().isVisible() && sb.getSetting().isSearchMatch()) {
|
||||||
|
if (j < groupButtons.size() - 1) {
|
||||||
|
height += (h - h / 4) + PADDING;
|
||||||
|
} else {
|
||||||
|
height += (h - h / 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
height += PADDING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
totalHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
public void updatePosition(double mouseX, double mouseY) {
|
public void updatePosition(double mouseX, double mouseY) {
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
x = (int) (mouseX - dragX);
|
x = (int) (mouseX - dragX);
|
||||||
@@ -246,44 +251,40 @@ public class SettingsPanel extends CloseablePanel<SettingButton<? extends Settin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getGroupHeaderY(int groupIndex) {
|
public int getGroupHeaderY(SettingGroup targetGroup) {
|
||||||
int currentY = renderY + h + PADDING;
|
int currentY = renderY + h + PADDING;
|
||||||
List<String> descLines = wrapDescription(module.getDisplayDescription(), w - 2 * PADDING);
|
List<String> descLines = wrapDescription(module.getDisplayDescription(), w - 2 * PADDING);
|
||||||
int descHeight = descLines.size() * mc.font.lineHeight + (descLines.size() - 1) * 2;
|
int descHeight = descLines.size() * mc.font.lineHeight + (descLines.size() - 1) * 2;
|
||||||
currentY += descHeight + 3 * PADDING; // descBoxBottom + padding
|
currentY += descHeight + 3 * PADDING; // descBoxBottom + padding
|
||||||
|
|
||||||
// iterar hasta llegar al grupo deseado
|
|
||||||
int currentIndex = 0;
|
|
||||||
for (SettingGroup group : settingGroups) {
|
for (SettingGroup group : settingGroups) {
|
||||||
if (hasVisibleSettingsInGroup(group)) {
|
if (!hasVisibleSettingsInGroup(group)) continue;
|
||||||
if (currentIndex == groupIndex) {
|
if (group == targetGroup) {
|
||||||
return currentY;
|
return currentY;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentY += h + PADDING;
|
currentY += h + PADDING;
|
||||||
|
|
||||||
if (group.isExtended()) {
|
if (group.isExtended()) {
|
||||||
List<SettingButton<?>> groupButtons = getButtonsForGroup(group);
|
List<SettingButton<?>> groupButtons = getButtonsForGroup(group);
|
||||||
for (int j = 0; j < groupButtons.size(); j++) {
|
for (int j = 0; j < groupButtons.size(); j++) {
|
||||||
SettingButton<?> sb = groupButtons.get(j);
|
SettingButton<?> sb = groupButtons.get(j);
|
||||||
if (sb.getSetting().isVisible() && sb.getSetting().isSearchMatch()) {
|
if (sb.getSetting().isVisible() && sb.getSetting().isSearchMatch()) {
|
||||||
if (j < groupButtons.size() - 1) {
|
if (j < groupButtons.size() - 1) {
|
||||||
currentY += (h - h / 4) + PADDING;
|
currentY += (h - h / 4) + PADDING;
|
||||||
} else {
|
} else {
|
||||||
currentY += (h - h / 4);
|
currentY += (h - h / 4);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentY += PADDING;
|
|
||||||
}
|
}
|
||||||
currentIndex++;
|
currentY += PADDING;
|
||||||
}
|
}
|
||||||
} // fallback
|
} // fallback
|
||||||
return currentY;
|
return currentY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGroupHeaderHovered(int mouseX, int mouseY, int groupIndex) {
|
public boolean isGroupHeaderHovered(int mouseX, int mouseY, SettingGroup group) {
|
||||||
int headerY = getGroupHeaderY(groupIndex);
|
int headerY = getGroupHeaderY(group);
|
||||||
|
|
||||||
return mouseX > x + PADDING && mouseX < x + w - PADDING &&
|
return mouseX > x + PADDING && mouseX < x + w - PADDING &&
|
||||||
mouseY > headerY && mouseY < headerY + h;
|
mouseY > headerY && mouseY < headerY + h;
|
||||||
|
|||||||