Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4307b0a479 | ||
|
|
ab191a9016 | ||
|
|
629d03ff92 | ||
|
|
c1a03f3ddb | ||
|
|
44494830be | ||
|
|
73682cb85d | ||
|
|
ac7de7a07a | ||
|
|
0bd31971a0 | ||
|
|
3010b164ab | ||
|
|
6cb4656365 |
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.3 mod that adds some "QOL" features, mostly related to the camera.
|
||||||
|
|
||||||
|
## installation
|
||||||
|
|
||||||
|
### for normal people:
|
||||||
|
1. go to [releases](https://git.retucio.me/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.3`; Fabric `0.19.5`)
|
||||||
|
|
||||||
|
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://git.retucio.me/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,23 +1,28 @@
|
|||||||
|
<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.1.2 que añade algunas cosas QOL, mayormente relacionadas a la cámara.
|
> mod para Minecraft Fabric 26.3 que añade algunas cosas "QOL", mayormente relacionadas a la cámara.
|
||||||
|
|
||||||
## instalación
|
## instalación
|
||||||
|
|
||||||
### para gente normal:
|
### para gente normal:
|
||||||
1. ir a [lanzamientos](https://github.com/retuci0/sputnik/releases)
|
1. ir a [lanzamientos](https://git.retucio.me/retucio/sputnik/releases)
|
||||||
2. selecionar la versión más reciente
|
2. seleccionar la versión más reciente
|
||||||
3. descargar el .jar
|
3. descargar el .jar
|
||||||
4. moverlo a tu directorio de mods (probablemente `%appdata%/.minecraft/mods`)
|
4. moverlo a tu directorio de mods (probablemente `%appdata%/.minecraft/mods`)
|
||||||
|
|
||||||
asegúrate de tener una version de Minecraft y Fabric compatibles con el mod (MC `26.1.2`; Fabric `0.19.2`)
|
asegúrate de tener una version de Minecraft y Fabric compatibles con el mod (MC `26.3`; Fabric `0.19.5`)
|
||||||
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://git.retucio.me/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,55 +38,42 @@ 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">
|
||||||
|
|
||||||
## contibuciones
|
## contribuciones
|
||||||
|
|
||||||
sí por favor
|
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,32 +1,17 @@
|
|||||||
# v5.7
|
# v6.7
|
||||||
|
|
||||||
## novedades
|
## novedades
|
||||||
|
|
||||||
actualización a gradle 9.7.0
|
- SIC SEBEN
|
||||||
|
- migrado de Codeberg a mi propia instancia de Gitea
|
||||||
interfaz reorganizada en pestañas: módulos, hud, perfiles y macros
|
|
||||||
|
|
||||||
perfiles de configuración: guarda varias configs con nombre y cambia entre ellas sin reiniciar
|
|
||||||
|
|
||||||
macros: asigna una tecla a una lista de comandos o mensajes
|
|
||||||
|
|
||||||
### adiciones
|
### adiciones
|
||||||
|
|
||||||
#### módulos nuevos:
|
|
||||||
|
|
||||||
- cancelador de paquetes: evita que se envíen o reciban ciertos paquetes
|
|
||||||
|
|
||||||
#### comandos nuevos:
|
|
||||||
|
|
||||||
- `$?`: muestra los comandos disponibles y los describe
|
|
||||||
- `$perfil`: gestiona los perfiles de configuración
|
|
||||||
- `$macro`: gestiona las macros
|
|
||||||
|
|
||||||
### arreglos / mejoras
|
### arreglos / mejoras
|
||||||
|
|
||||||
- las rotaciones de los módulos se reparten por prioridad en vez de pisarse entre ellas
|
|
||||||
- el editor del hud ya es una pestaña más de la interfaz, además de su propia pantalla
|
|
||||||
|
|
||||||
## problemas reconocidos
|
## problemas reconocidos
|
||||||
|
|
||||||
- lo de siempre.
|
- `reponer` no funciona
|
||||||
|
- `copiar` tras sacar una captura con `capturas` no funciona correctamente
|
||||||
|
- `manos` no funciona del todo
|
||||||
|
- \+ lo de siempre.
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
org.gradle.jvmargs=-Xmx2G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
minecraft_version=26.2
|
minecraft_version=26.3
|
||||||
loader_version=0.19.3
|
loader_version=0.19.5
|
||||||
loom_version=1.17-SNAPSHOT
|
loom_version=1.18-SNAPSHOT
|
||||||
|
|
||||||
fabric_api_version=0.154.0+26.2
|
fabric_api_version=0.160.7+26.3
|
||||||
discord_rpc_version=1.0.3
|
discord_rpc_version=1.0.3
|
||||||
neutrino_version=1.1.0
|
neutrino_version=1.1.0
|
||||||
jdk_version=25
|
jdk_version=25
|
||||||
|
|
||||||
mod_version=5.7
|
mod_version=6.7
|
||||||
maven_group=me.retucio
|
maven_group=me.retucio
|
||||||
archives_base_name=sputnik
|
archives_base_name=sputnik
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
|
#Sat Aug 29 22:10:52 CEST 2026
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.0-bin.zip
|
||||||
networkTimeout=10000
|
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
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 |
@@ -2,6 +2,7 @@ package me.retucio.sputnik;
|
|||||||
|
|
||||||
import com.github.retucio.neutrino.EventBus;
|
import com.github.retucio.neutrino.EventBus;
|
||||||
import com.github.retucio.neutrino.EventListener;
|
import com.github.retucio.neutrino.EventListener;
|
||||||
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import me.retucio.sputnik.cape.CapeManager;
|
import me.retucio.sputnik.cape.CapeManager;
|
||||||
import me.retucio.sputnik.command.CommandManager;
|
import me.retucio.sputnik.command.CommandManager;
|
||||||
import me.retucio.sputnik.command.commands.BindCommand;
|
import me.retucio.sputnik.command.commands.BindCommand;
|
||||||
@@ -26,6 +27,7 @@ import me.retucio.sputnik.ui.hud.HudEditorScreen;
|
|||||||
import me.retucio.sputnik.ui.screen.UpdateScreen;
|
import me.retucio.sputnik.ui.screen.UpdateScreen;
|
||||||
import me.retucio.sputnik.ui.widgets.buttons.settings.BindButton;
|
import me.retucio.sputnik.ui.widgets.buttons.settings.BindButton;
|
||||||
import me.retucio.sputnik.ui.widgets.buttons.SettingButton;
|
import me.retucio.sputnik.ui.widgets.buttons.SettingButton;
|
||||||
|
import me.retucio.sputnik.ui.widgets.buttons.settings.FileButton;
|
||||||
import me.retucio.sputnik.ui.widgets.buttons.settings.TextButton;
|
import me.retucio.sputnik.ui.widgets.buttons.settings.TextButton;
|
||||||
import me.retucio.sputnik.ui.widgets.panels.settings.ClientSettingsPanel;
|
import me.retucio.sputnik.ui.widgets.panels.settings.ClientSettingsPanel;
|
||||||
import me.retucio.sputnik.ui.widgets.panels.SettingsPanel;
|
import me.retucio.sputnik.ui.widgets.panels.SettingsPanel;
|
||||||
@@ -54,8 +56,6 @@ import net.minecraft.network.chat.Component;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
|
||||||
|
|
||||||
|
|
||||||
public class Sputnik implements ClientModInitializer {
|
public class Sputnik implements ClientModInitializer {
|
||||||
|
|
||||||
@@ -156,35 +156,72 @@ public class Sputnik implements ClientModInitializer {
|
|||||||
|
|
||||||
// se ejecuta cada vez que se presiona una tecla
|
// se ejecuta cada vez que se presiona una tecla
|
||||||
public void onInput(int key, int action) {
|
public void onInput(int key, int action) {
|
||||||
|
// En SDL el valor 0 es UNKNOWN (y los botones del ratón empiezan en 1).
|
||||||
|
if (key == InputConstants.UNKNOWN.getValue() || key == -1) return;
|
||||||
// prevenir interrumpir combos de F3
|
// prevenir interrumpir combos de F3
|
||||||
if (key == GLFW.GLFW_KEY_F3) return;
|
if (key == InputConstants.KEY_F3) return;
|
||||||
|
|
||||||
boolean anyFocused = isAnySettingButtonFocused() || ClickGui.INSTANCE.isCapturingInput();
|
boolean anyFocused = isAnySettingButtonFocused() || ClickGui.INSTANCE.isCapturingInput();
|
||||||
ClickGui.INSTANCE.setAnyFocused(anyFocused);
|
ClickGui.INSTANCE.setAnyFocused(anyFocused);
|
||||||
|
|
||||||
if (action != GLFW.GLFW_RELEASE) {
|
// Las KeySetting y los campos de texto reciben el mismo código SDL scancode que
|
||||||
|
// guardan sus valores; procesarlos antes evita que el bind capturado dispare un módulo.
|
||||||
|
if (anyFocused) handleSettingButtonsKey(key, action);
|
||||||
|
|
||||||
|
if (action != InputConstants.RELEASE) {
|
||||||
if (BindCommand.onKeyPress(key)) return;
|
if (BindCommand.onKeyPress(key)) return;
|
||||||
if (action == GLFW.GLFW_PRESS && MacroManager.INSTANCE.onKeyPress(key)) return;
|
if (action == InputConstants.PRESS && MacroManager.INSTANCE.onKeyPress(key)) return;
|
||||||
if (action == GLFW.GLFW_PRESS) {
|
if (action == InputConstants.PRESS) {
|
||||||
handleModuleToggle(key, anyFocused);
|
handleModuleToggle(key, anyFocused);
|
||||||
handleClickGuiKey(key, anyFocused);
|
handleClickGuiKey(key, anyFocused);
|
||||||
handleHudEditorKey(key, anyFocused);
|
handleHudEditorKey(key, anyFocused);
|
||||||
}
|
}
|
||||||
// solo reenviar teclas del teclado
|
|
||||||
if (key >= 32) {
|
|
||||||
handleSettingButtonsKey(key, action);
|
|
||||||
}
|
|
||||||
} else if (!anyFocused) {
|
} else if (!anyFocused) {
|
||||||
handleModuleRelease(key);
|
handleModuleRelease(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean onMouseInput(int button, int action) {
|
||||||
|
KeyUtil.setMouseButtonDown(button, action == InputConstants.PRESS);
|
||||||
|
|
||||||
|
boolean captured = false;
|
||||||
|
for (Button settingButton : ClickGui.INSTANCE.getClientSettingsPanel().getButtons()) {
|
||||||
|
if (settingButton instanceof BindButton bindButton && bindButton.isFocused()) {
|
||||||
|
bindButton.onMouse(button, action);
|
||||||
|
captured = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (SettingsPanel panel : ClickGui.INSTANCE.getSettingsPanels()) {
|
||||||
|
for (Button settingButton : panel.getButtons()) {
|
||||||
|
if (settingButton instanceof BindButton bindButton && bindButton.isFocused()) {
|
||||||
|
bindButton.onMouse(button, action);
|
||||||
|
captured = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (captured) return true;
|
||||||
|
onInput(KeyUtil.encodeMouseButton(button), action);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// verifica si algún botón de ajustes está escuchando
|
// verifica si algún botón de ajustes está escuchando
|
||||||
private boolean isAnySettingButtonFocused() {
|
private boolean isAnySettingButtonFocused() {
|
||||||
|
if (ClickGui.INSTANCE == null) return false;
|
||||||
|
for (Button button : ClickGui.INSTANCE.getClientSettingsPanel().getButtons())
|
||||||
|
if ((button instanceof BindButton bindButton && bindButton.isFocused())
|
||||||
|
|| (button instanceof TextButton textButton && textButton.isFocused())
|
||||||
|
|| (button instanceof FileButton fileButton && fileButton.isFocused())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
for (SettingsPanel sf : ClickGui.INSTANCE.getSettingsPanels())
|
for (SettingsPanel sf : ClickGui.INSTANCE.getSettingsPanels())
|
||||||
for (Button sb : sf.getButtons())
|
for (Button sb : sf.getButtons())
|
||||||
if ((sb instanceof BindButton b && b.isFocused()) || (sb instanceof TextButton t && t.isFocused()))
|
if ((sb instanceof BindButton b && b.isFocused())
|
||||||
|
|| (sb instanceof TextButton t && t.isFocused())
|
||||||
|
|| (sb instanceof FileButton f && f.isFocused())
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +231,7 @@ public class Sputnik implements ClientModInitializer {
|
|||||||
|
|
||||||
for (Module module : ModuleManager.INSTANCE.getModules()) {
|
for (Module module : ModuleManager.INSTANCE.getModules()) {
|
||||||
// evitar interrumpir combinaciones de teclas del F3
|
// evitar interrumpir combinaciones de teclas del F3
|
||||||
if (key != module.getKey() || anyFocused || KeyUtil.isKeyDown(GLFW.GLFW_KEY_F3)) continue;
|
if (key != module.getKey() || anyFocused || KeyUtil.isKeyDown(InputConstants.KEY_F3)) continue;
|
||||||
|
|
||||||
if (module.shouldToggleOnBindRelease() && !module.isEnabled())
|
if (module.shouldToggleOnBindRelease() && !module.isEnabled())
|
||||||
module.setEnabled(true);
|
module.setEnabled(true);
|
||||||
@@ -205,9 +242,11 @@ public class Sputnik implements ClientModInitializer {
|
|||||||
|
|
||||||
// se ocupa de hacer los botones de ajustes que lo necesiten escuchar teclas
|
// se ocupa de hacer los botones de ajustes que lo necesiten escuchar teclas
|
||||||
private void handleSettingButtonsKey(int key, int action) {
|
private void handleSettingButtonsKey(int key, int action) {
|
||||||
|
ClickGui.INSTANCE.getClientSettingsPanel().onKey(key, action);
|
||||||
for (SettingsPanel sf : ClickGui.INSTANCE.getSettingsPanels()) {
|
for (SettingsPanel sf : ClickGui.INSTANCE.getSettingsPanels()) {
|
||||||
for (SettingButton<?> sb : sf.getButtons()) {
|
for (SettingButton<?> sb : sf.getButtons()) {
|
||||||
if (sb instanceof BindButton bb) bb.onKey(key, action);
|
if (sb instanceof BindButton bb) bb.onKey(key, action);
|
||||||
|
if (sb instanceof FileButton fb) fb.onKey(key, action);
|
||||||
if (sb instanceof TextButton tb) tb.onKey(key, action);
|
if (sb instanceof TextButton tb) tb.onKey(key, action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import java.util.List;
|
|||||||
public abstract class Command {
|
public abstract class Command {
|
||||||
|
|
||||||
// utilizar los "registries" ya existentes de Brigadier para el autocompletado
|
// utilizar los "registries" ya existentes de Brigadier para el autocompletado
|
||||||
protected static final CommandBuildContext REGISTRY_ACCESS = Commands.createValidationContext(VanillaRegistries.createLookup());
|
protected static final CommandBuildContext REGISTRY_ACCESS = Commands.createValidationContext(VanillaRegistries.createWorldLookup());
|
||||||
protected static final int SUCCESS = com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
protected static final int SUCCESS = com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||||
|
|
||||||
protected static final Minecraft mc = Minecraft.getInstance();
|
protected static final Minecraft mc = Minecraft.getInstance();
|
||||||
|
|||||||
@@ -36,11 +36,12 @@ public class MacroCommand extends Command {
|
|||||||
list();
|
list();
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}))
|
}))
|
||||||
|
// por ahora "add" solo crea macros de chat
|
||||||
.then(literal("add")
|
.then(literal("add")
|
||||||
.then(argument("nombre", StringArgumentType.word()).executes(ctx -> {
|
.then(argument("nombre", StringArgumentType.word()).executes(ctx -> {
|
||||||
String name = ctx.getArgument("nombre", String.class);
|
String name = ctx.getArgument("nombre", String.class);
|
||||||
|
|
||||||
if (MacroManager.INSTANCE.add(new Macro(name)))
|
if (MacroManager.INSTANCE.add(new Macro.Chat(name)))
|
||||||
ChatUtil.info(Component.translatable("sputnik.commands.macro.added",
|
ChatUtil.info(Component.translatable("sputnik.commands.macro.added",
|
||||||
ChatFormatting.AQUA + name));
|
ChatFormatting.AQUA + name));
|
||||||
else
|
else
|
||||||
@@ -60,7 +61,7 @@ public class MacroCommand extends Command {
|
|||||||
.then(literal("line")
|
.then(literal("line")
|
||||||
.then(argument("nombre", StringArgumentType.word()).suggests(MACROS)
|
.then(argument("nombre", StringArgumentType.word()).suggests(MACROS)
|
||||||
.then(argument("línea", StringArgumentType.greedyString()).executes(ctx -> {
|
.then(argument("línea", StringArgumentType.greedyString()).executes(ctx -> {
|
||||||
Macro macro = get(ctx.getArgument("nombre", String.class));
|
Macro.Chat macro = getChat(ctx.getArgument("nombre", String.class));
|
||||||
if (macro == null) return SUCCESS;
|
if (macro == null) return SUCCESS;
|
||||||
|
|
||||||
String line = ctx.getArgument("línea", String.class);
|
String line = ctx.getArgument("línea", String.class);
|
||||||
@@ -73,7 +74,7 @@ public class MacroCommand extends Command {
|
|||||||
}))))
|
}))))
|
||||||
.then(literal("clear")
|
.then(literal("clear")
|
||||||
.then(argument("nombre", StringArgumentType.word()).suggests(MACROS).executes(ctx -> {
|
.then(argument("nombre", StringArgumentType.word()).suggests(MACROS).executes(ctx -> {
|
||||||
Macro macro = get(ctx.getArgument("nombre", String.class));
|
Macro.Chat macro = getChat(ctx.getArgument("nombre", String.class));
|
||||||
if (macro == null) return SUCCESS;
|
if (macro == null) return SUCCESS;
|
||||||
|
|
||||||
macro.getLines().clear();
|
macro.getLines().clear();
|
||||||
@@ -97,6 +98,19 @@ public class MacroCommand extends Command {
|
|||||||
return macro;
|
return macro;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// para los subcomandos que solo tienen sentido con líneas de chat (line, clear): si la
|
||||||
|
// macro existe pero es de otro tipo, avisa y devuelve null
|
||||||
|
private static Macro.Chat getChat(String name) {
|
||||||
|
Macro macro = get(name);
|
||||||
|
if (macro == null) return null;
|
||||||
|
|
||||||
|
if (!(macro instanceof Macro.Chat chat)) {
|
||||||
|
ChatUtil.error(Component.translatable("sputnik.commands.macro.notchat", macro.getName()));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return chat;
|
||||||
|
}
|
||||||
|
|
||||||
private static void list() {
|
private static void list() {
|
||||||
List<Macro> macros = MacroManager.INSTANCE.getMacros();
|
List<Macro> macros = MacroManager.INSTANCE.getMacros();
|
||||||
|
|
||||||
@@ -106,9 +120,17 @@ public class MacroCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ChatUtil.info(Component.translatable("sputnik.commands.macro.list", macros.size()));
|
ChatUtil.info(Component.translatable("sputnik.commands.macro.list", macros.size()));
|
||||||
for (Macro macro : macros)
|
for (Macro macro : macros) {
|
||||||
|
// líneas en las de chat, teclas en las Keybind
|
||||||
|
int count = switch (macro) {
|
||||||
|
case Macro.Chat chat -> chat.getLines().size();
|
||||||
|
case Macro.Keybind keybind -> keybind.getKeys().size();
|
||||||
|
default -> 0;
|
||||||
|
};
|
||||||
|
|
||||||
ChatUtil.addMessage(ChatFormatting.GRAY + " - " + macro.getName()
|
ChatUtil.addMessage(ChatFormatting.GRAY + " - " + macro.getName()
|
||||||
+ ChatFormatting.DARK_GRAY + " [" + KeyUtil.getKeyName(macro.getKey()) + "] "
|
+ ChatFormatting.DARK_GRAY + " [" + KeyUtil.getKeyName(macro.getKey()) + "] "
|
||||||
+ macro.getLines().size());
|
+ count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,12 +3,11 @@ package me.retucio.sputnik.command.commands;
|
|||||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
import me.retucio.sputnik.command.Command;
|
import me.retucio.sputnik.command.Command;
|
||||||
import me.retucio.sputnik.util.interfaces.IChatComponent;
|
import me.retucio.sputnik.mixinterfaces.IChatComponent;
|
||||||
import net.minecraft.client.gui.components.ChatComponent;
|
import net.minecraft.client.gui.components.ChatComponent;
|
||||||
import net.minecraft.client.multiplayer.chat.GuiMessage;
|
import net.minecraft.client.multiplayer.chat.GuiMessage;
|
||||||
import net.minecraft.commands.SharedSuggestionProvider;
|
import net.minecraft.commands.SharedSuggestionProvider;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PurgeCommand extends Command {
|
public class PurgeCommand extends Command {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class SendCommand extends Command {
|
|||||||
message,
|
message,
|
||||||
instant,
|
instant,
|
||||||
salt,
|
salt,
|
||||||
messageSignature,
|
java.util.Optional.ofNullable(messageSignature),
|
||||||
lastSeenMessages.update()
|
lastSeenMessages.update()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import me.retucio.sputnik.event.input.KeyEvent;
|
|||||||
import me.retucio.sputnik.util.EntityUtil;
|
import me.retucio.sputnik.util.EntityUtil;
|
||||||
import net.minecraft.commands.SharedSuggestionProvider;
|
import net.minecraft.commands.SharedSuggestionProvider;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ public class SpectateCommand extends Command {
|
|||||||
@EventListener
|
@EventListener
|
||||||
public void onKey(KeyEvent event) {
|
public void onKey(KeyEvent event) {
|
||||||
if (mc.getCameraEntity() != mc.player && mc.gui.screen() == null
|
if (mc.getCameraEntity() != mc.player && mc.gui.screen() == null
|
||||||
&& event.getKey() == GLFW.GLFW_KEY_ESCAPE && event.getAction() != GLFW.GLFW_RELEASE ) {
|
&& event.getKey() == InputConstants.KEY_ESCAPE && event.getAction() != InputConstants.RELEASE ) {
|
||||||
event.cancel();
|
event.cancel();
|
||||||
mc.setCameraEntity(mc.player);
|
mc.setCameraEntity(mc.player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package me.retucio.sputnik.config;
|
package me.retucio.sputnik.config;
|
||||||
|
|
||||||
import me.retucio.sputnik.util.I18nUtil;
|
import me.retucio.sputnik.util.I18nUtil;
|
||||||
|
import me.retucio.sputnik.util.KeyUtil;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@@ -14,7 +15,7 @@ import java.util.Map;
|
|||||||
public class BinarySerializer {
|
public class BinarySerializer {
|
||||||
|
|
||||||
private static final int MAGIC_NUMBER = 0x53505554; // "SPUT"
|
private static final int MAGIC_NUMBER = 0x53505554; // "SPUT"
|
||||||
private static final int VERSION = 3;
|
private static final int VERSION = 6;
|
||||||
private static final int MIN_VERSION = 2;
|
private static final int MIN_VERSION = 2;
|
||||||
|
|
||||||
private static final byte TYPE_NULL = 0;
|
private static final byte TYPE_NULL = 0;
|
||||||
@@ -26,6 +27,9 @@ public class BinarySerializer {
|
|||||||
private static final byte TYPE_INT_ARRAY = 6;
|
private static final byte TYPE_INT_ARRAY = 6;
|
||||||
private static final byte TYPE_FRAME_DATA = 7;
|
private static final byte TYPE_FRAME_DATA = 7;
|
||||||
|
|
||||||
|
private static final byte MACRO_CHAT = 0;
|
||||||
|
private static final byte MACRO_KEYBIND = 1;
|
||||||
|
|
||||||
public static void writeConfig(ClientConfig config, File file) throws IOException {
|
public static void writeConfig(ClientConfig config, File file) throws IOException {
|
||||||
byte[] bytes = toBytes(config);
|
byte[] bytes = toBytes(config);
|
||||||
writeBytes(bytes, file);
|
writeBytes(bytes, file);
|
||||||
@@ -72,7 +76,7 @@ public class BinarySerializer {
|
|||||||
writeStringIntArrayMap(out, config.hudPositions);
|
writeStringIntArrayMap(out, config.hudPositions);
|
||||||
writeStringBooleanMap(out, config.hudVisibilities);
|
writeStringBooleanMap(out, config.hudVisibilities);
|
||||||
writeStringStringMap(out, config.hudImagePaths);
|
writeStringStringMap(out, config.hudImagePaths);
|
||||||
writeStringStringMap(out, config.friends);
|
writeFriendsMap(out, config.friends);
|
||||||
writeMacros(out, config.macros);
|
writeMacros(out, config.macros);
|
||||||
writeString(out, config.currentProfile);
|
writeString(out, config.currentProfile);
|
||||||
|
|
||||||
@@ -123,9 +127,16 @@ public class BinarySerializer {
|
|||||||
Map<String, int[]> hudPositions = readStringIntArrayMap(in);
|
Map<String, int[]> hudPositions = readStringIntArrayMap(in);
|
||||||
Map<String, Boolean> hudVisibilities = readStringBooleanMap(in);
|
Map<String, Boolean> hudVisibilities = readStringBooleanMap(in);
|
||||||
Map<String, String> hudImagePaths = readStringStringMap(in);
|
Map<String, String> hudImagePaths = readStringStringMap(in);
|
||||||
Map<String, String> friends = readStringStringMap(in);
|
Map<String, ClientConfig.FriendData> friends = version >= 4
|
||||||
|
? readFriendsMap(in)
|
||||||
|
: migrateFriendsMap(readStringStringMap(in));
|
||||||
|
|
||||||
|
// v3 y v4: macros sin tipo (todas eran de chat). v5+: con tipo
|
||||||
|
List<ClientConfig.MacroData> macros;
|
||||||
|
if (version >= 5) macros = readMacros(in);
|
||||||
|
else if (version >= 3) macros = readLegacyMacros(in);
|
||||||
|
else macros = new ArrayList<>();
|
||||||
|
|
||||||
List<ClientConfig.MacroData> macros = version >= 3 ? readMacros(in) : new ArrayList<>();
|
|
||||||
String currentProfile = version >= 3 ? readString(in) : "";
|
String currentProfile = version >= 3 ? readString(in) : "";
|
||||||
|
|
||||||
// leer pos. de la barra de búsqueda
|
// leer pos. de la barra de búsqueda
|
||||||
@@ -145,11 +156,22 @@ public class BinarySerializer {
|
|||||||
config.macros = macros;
|
config.macros = macros;
|
||||||
config.currentProfile = currentProfile == null ? "" : currentProfile;
|
config.currentProfile = currentProfile == null ? "" : currentProfile;
|
||||||
if (searchBarPosition != null) config.searchBarPosition = searchBarPosition;
|
if (searchBarPosition != null) config.searchBarPosition = searchBarPosition;
|
||||||
|
config.legacyKeyCodes = version < 6;
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void migrateLegacyKeyCodes(ClientConfig config) {
|
||||||
|
config.macros = config.macros.stream().map(macro -> {
|
||||||
|
int key = KeyUtil.fromLegacyGlfwKey(macro.key());
|
||||||
|
List<ClientConfig.KeyData> keys = macro.keys() == null ? List.of() : macro.keys().stream()
|
||||||
|
.map(entry -> new ClientConfig.KeyData(KeyUtil.fromLegacyGlfwKey(entry.key()), entry.action()))
|
||||||
|
.toList();
|
||||||
|
return new ClientConfig.MacroData(macro.type(), macro.name(), key, macro.lines(), keys);
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
private static void writeStringBooleanMap(DataOutputStream out, Map<String, Boolean> map)
|
private static void writeStringBooleanMap(DataOutputStream out, Map<String, Boolean> map)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
@@ -393,6 +415,9 @@ public class BinarySerializer {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// v5+: por macro va un id de tipo, luego nombre y tecla, y por último lo propio del tipo
|
||||||
|
// (líneas en las de chat, pares tecla/acción en las Keybind). los null (que pueden venir
|
||||||
|
// de un json antiguo) se tratan como chat / lista vacía
|
||||||
private static void writeMacros(DataOutputStream out, List<ClientConfig.MacroData> macros)
|
private static void writeMacros(DataOutputStream out, List<ClientConfig.MacroData> macros)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (macros == null) {
|
if (macros == null) {
|
||||||
@@ -401,14 +426,59 @@ public class BinarySerializer {
|
|||||||
}
|
}
|
||||||
out.writeInt(macros.size());
|
out.writeInt(macros.size());
|
||||||
for (ClientConfig.MacroData macro : macros) {
|
for (ClientConfig.MacroData macro : macros) {
|
||||||
|
boolean keybind = macro.type() == ClientConfig.MacroType.KEYBIND;
|
||||||
|
|
||||||
|
out.writeByte(keybind ? MACRO_KEYBIND : MACRO_CHAT);
|
||||||
writeString(out, macro.name());
|
writeString(out, macro.name());
|
||||||
out.writeInt(macro.key());
|
out.writeInt(macro.key());
|
||||||
out.writeInt(macro.lines().size());
|
|
||||||
for (String line : macro.lines()) writeString(out, line);
|
if (keybind) {
|
||||||
|
List<ClientConfig.KeyData> keys = macro.keys() == null ? List.of() : macro.keys();
|
||||||
|
out.writeInt(keys.size());
|
||||||
|
for (ClientConfig.KeyData k : keys) {
|
||||||
|
out.writeInt(k.key());
|
||||||
|
out.writeInt(k.action());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<String> lines = macro.lines() == null ? List.of() : macro.lines();
|
||||||
|
out.writeInt(lines.size());
|
||||||
|
for (String line : lines) writeString(out, line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ClientConfig.MacroData> readMacros(DataInputStream in) throws IOException {
|
private static List<ClientConfig.MacroData> readMacros(DataInputStream in) throws IOException {
|
||||||
|
int size = in.readInt();
|
||||||
|
List<ClientConfig.MacroData> macros = new ArrayList<>(size);
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
byte type = in.readByte();
|
||||||
|
String name = readString(in);
|
||||||
|
int key = in.readInt();
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case MACRO_CHAT -> {
|
||||||
|
int lineCount = in.readInt();
|
||||||
|
List<String> lines = new ArrayList<>(lineCount);
|
||||||
|
for (int j = 0; j < lineCount; j++) lines.add(readString(in));
|
||||||
|
macros.add(ClientConfig.MacroData.chat(name, key, lines));
|
||||||
|
}
|
||||||
|
case MACRO_KEYBIND -> {
|
||||||
|
int keyCount = in.readInt();
|
||||||
|
List<ClientConfig.KeyData> keys = new ArrayList<>(keyCount);
|
||||||
|
for (int j = 0; j < keyCount; j++) keys.add(new ClientConfig.KeyData(in.readInt(), in.readInt()));
|
||||||
|
macros.add(ClientConfig.MacroData.keybind(name, key, keys));
|
||||||
|
}
|
||||||
|
// no hay forma de saltarse una macro de un tipo que no conocemos (no se sabe
|
||||||
|
// cuánto ocupa), así que lo único seguro es fallar
|
||||||
|
default -> throw new IOException(I18nUtil.fmt("sputnik.config.error.invalidmacro",
|
||||||
|
"tipo de macro desconocido: %s", type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return macros;
|
||||||
|
}
|
||||||
|
|
||||||
|
// v3 y v4: formato de antes de que hubiera tipos (nombre, tecla, líneas). eran todas de chat
|
||||||
|
private static List<ClientConfig.MacroData> readLegacyMacros(DataInputStream in) throws IOException {
|
||||||
int size = in.readInt();
|
int size = in.readInt();
|
||||||
List<ClientConfig.MacroData> macros = new ArrayList<>(size);
|
List<ClientConfig.MacroData> macros = new ArrayList<>(size);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
@@ -417,11 +487,50 @@ public class BinarySerializer {
|
|||||||
int lineCount = in.readInt();
|
int lineCount = in.readInt();
|
||||||
List<String> lines = new ArrayList<>(lineCount);
|
List<String> lines = new ArrayList<>(lineCount);
|
||||||
for (int j = 0; j < lineCount; j++) lines.add(readString(in));
|
for (int j = 0; j < lineCount; j++) lines.add(readString(in));
|
||||||
macros.add(new ClientConfig.MacroData(name, key, lines));
|
macros.add(ClientConfig.MacroData.chat(name, key, lines));
|
||||||
}
|
}
|
||||||
return macros;
|
return macros;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void writeFriendsMap(DataOutputStream out, Map<String, ClientConfig.FriendData> map)
|
||||||
|
throws IOException {
|
||||||
|
if (map == null) {
|
||||||
|
out.writeInt(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
out.writeInt(map.size());
|
||||||
|
for (Map.Entry<String, ClientConfig.FriendData> entry : map.entrySet()) {
|
||||||
|
writeString(out, entry.getKey());
|
||||||
|
ClientConfig.FriendData data = entry.getValue();
|
||||||
|
writeString(out, data.name());
|
||||||
|
writeString(out, data.nick());
|
||||||
|
out.writeLong(data.befriendedAt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, ClientConfig.FriendData> readFriendsMap(DataInputStream in)
|
||||||
|
throws IOException {
|
||||||
|
int size = in.readInt();
|
||||||
|
Map<String, ClientConfig.FriendData> map = new HashMap<>(size);
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
String uuid = readString(in);
|
||||||
|
String name = readString(in);
|
||||||
|
String nick = readString(in);
|
||||||
|
long befriendedAt = in.readLong();
|
||||||
|
map.put(uuid, new ClientConfig.FriendData(name, nick, befriendedAt));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, ClientConfig.FriendData> migrateFriendsMap(Map<String, String> legacy) {
|
||||||
|
Map<String, ClientConfig.FriendData> map = new HashMap<>(legacy.size());
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
for (Map.Entry<String, String> entry : legacy.entrySet()) {
|
||||||
|
map.put(entry.getKey(), new ClientConfig.FriendData(entry.getValue(), entry.getValue(), now));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
private static void writeString(DataOutputStream out, String str) throws IOException {
|
private static void writeString(DataOutputStream out, String str) throws IOException {
|
||||||
if (str == null) {
|
if (str == null) {
|
||||||
out.writeInt(-1);
|
out.writeInt(-1);
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import com.github.retucio.neutrino.EventListener;
|
|||||||
import me.retucio.sputnik.event.sputnik.*;
|
import me.retucio.sputnik.event.sputnik.*;
|
||||||
import me.retucio.sputnik.module.setting.settings.*;
|
import me.retucio.sputnik.module.setting.settings.*;
|
||||||
import me.retucio.sputnik.ui.screen.ClickGui;
|
import me.retucio.sputnik.ui.screen.ClickGui;
|
||||||
import me.retucio.sputnik.ui.widgets.panels.FriendsPanel;
|
|
||||||
import me.retucio.sputnik.util.ChatUtil;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -44,14 +42,18 @@ public class ClientConfig {
|
|||||||
// posición de la barra de búsqueda (x, y)
|
// posición de la barra de búsqueda (x, y)
|
||||||
public int[] searchBarPosition = new int[] { 340, 16 };
|
public int[] searchBarPosition = new int[] { 340, 16 };
|
||||||
|
|
||||||
// amigos: uuid -> nombre
|
// amigos: uuid -> FriendData (nombre, apodo, fecha)
|
||||||
public Map<String, String> friends = new HashMap<>();
|
public Map<String, FriendData> friends = new HashMap<>();
|
||||||
|
|
||||||
|
// macros, de cualquier tipo (ver MacroData)
|
||||||
public List<MacroData> macros = new ArrayList<>();
|
public List<MacroData> macros = new ArrayList<>();
|
||||||
|
|
||||||
// perfil cargado actualmente, vacío si es la config. suelta
|
// perfil cargado actualmente, vacío si es la config. suelta
|
||||||
public String currentProfile = "";
|
public String currentProfile = "";
|
||||||
|
|
||||||
|
// Set only when loading a config written with GLFW keycodes (pre-26.3).
|
||||||
|
public transient boolean legacyKeyCodes;
|
||||||
|
|
||||||
public ClientConfig() {
|
public ClientConfig() {
|
||||||
EVENT_BUS.subscribe(this);
|
EVENT_BUS.subscribe(this);
|
||||||
}
|
}
|
||||||
@@ -84,6 +86,7 @@ public class ClientConfig {
|
|||||||
case ListSetting l: value = l.getConfigValues(); break;
|
case ListSetting l: value = l.getConfigValues(); break;
|
||||||
case ColorSetting c: value = c.getConfigValue(); break;
|
case ColorSetting c: value = c.getConfigValue(); break;
|
||||||
case OptionSetting o: value = o.getConfigName(); break;
|
case OptionSetting o: value = o.getConfigName(); break;
|
||||||
|
case FileSetting f: value = f.getValue(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,31 +148,15 @@ public class ClientConfig {
|
|||||||
ConfigManager.INSTANCE.markDirty();
|
ConfigManager.INSTANCE.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventListener
|
|
||||||
public void onExtendFriendsPanel(FriendPanelEvent.Extend event) {
|
|
||||||
extendablePanels.put("amigos", new PanelData(
|
|
||||||
ClickGui.INSTANCE.getFriendsPanel().getX(),
|
|
||||||
ClickGui.INSTANCE.getFriendsPanel().getY(),
|
|
||||||
ClickGui.INSTANCE.getFriendsPanel().isExtended()));
|
|
||||||
ConfigManager.INSTANCE.markDirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventListener
|
|
||||||
public void onMoveFriendsPanel(FriendPanelEvent.Move event) {
|
|
||||||
extendablePanels.put("amigos", new PanelData(
|
|
||||||
ClickGui.INSTANCE.getFriendsPanel().getX(),
|
|
||||||
ClickGui.INSTANCE.getFriendsPanel().getY(),
|
|
||||||
ClickGui.INSTANCE.getFriendsPanel().isExtended()));
|
|
||||||
ConfigManager.INSTANCE.markDirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
public void onAddFriend(FriendEvent.Add event) {
|
public void onAddFriend(FriendEvent.Add event) {
|
||||||
if (isApplying()) return;
|
if (isApplying()) return;
|
||||||
String uuid = event.getFriend().getUuid().toString();
|
String uuid = event.getFriend().getUuid().toString();
|
||||||
String name = event.getFriend().getName();
|
|
||||||
if (!friends.containsKey(uuid)) {
|
if (!friends.containsKey(uuid)) {
|
||||||
friends.put(uuid, name);
|
friends.put(uuid, new FriendData(
|
||||||
|
event.getFriend().getName(),
|
||||||
|
event.getFriend().getNick(),
|
||||||
|
event.getFriend().getBefriendedAt()));
|
||||||
}
|
}
|
||||||
ConfigManager.INSTANCE.markDirty();
|
ConfigManager.INSTANCE.markDirty();
|
||||||
}
|
}
|
||||||
@@ -181,11 +168,42 @@ public class ClientConfig {
|
|||||||
ConfigManager.INSTANCE.markDirty();
|
ConfigManager.INSTANCE.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventListener
|
||||||
|
public void onRenameFriend(FriendEvent.Rename event) {
|
||||||
|
if (isApplying()) return;
|
||||||
|
String uuid = event.getFriend().getUuid().toString();
|
||||||
|
FriendData existing = friends.get(uuid);
|
||||||
|
if (existing == null) return; // no debería pasar, pero porsiaca
|
||||||
|
|
||||||
|
friends.put(uuid, new FriendData(existing.name(), event.getFriend().getNick(), existing.befriendedAt()));
|
||||||
|
ConfigManager.INSTANCE.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
public record PanelData(int x, int y, boolean extended) implements Serializable {
|
public record PanelData(int x, int y, boolean extended) implements Serializable {
|
||||||
@Serial private static final long serialVersionUID = 1L;
|
@Serial private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public record MacroData(String name, int key, List<String> lines) implements Serializable {
|
public record FriendData(String name, String nick, long befriendedAt) implements Serializable {
|
||||||
@Serial private static final long serialVersionUID = 1L;
|
@Serial private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum MacroType { CHAT, KEYBIND }
|
||||||
|
|
||||||
|
public record KeyData(int key, int action) implements Serializable {
|
||||||
|
@Serial private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
|
|
||||||
|
public record MacroData(MacroType type, String name, int key,
|
||||||
|
List<String> lines, List<KeyData> keys
|
||||||
|
) implements Serializable {
|
||||||
|
@Serial private static final long serialVersionUID = 2L;
|
||||||
|
|
||||||
|
public static MacroData chat(String name, int key, List<String> lines) {
|
||||||
|
return new MacroData(MacroType.CHAT, name, key, List.copyOf(lines), List.of());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MacroData keybind(String name, int key, List<KeyData> keys) {
|
||||||
|
return new MacroData(MacroType.KEYBIND, name, key, List.of(), List.copyOf(keys));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,13 +16,12 @@ import me.retucio.sputnik.ui.hud.HudElement;
|
|||||||
import me.retucio.sputnik.ui.hud.HudRenderer;
|
import me.retucio.sputnik.ui.hud.HudRenderer;
|
||||||
import me.retucio.sputnik.ui.widgets.Panel;
|
import me.retucio.sputnik.ui.widgets.Panel;
|
||||||
import me.retucio.sputnik.ui.widgets.panels.ExtendablePanel;
|
import me.retucio.sputnik.ui.widgets.panels.ExtendablePanel;
|
||||||
import me.retucio.sputnik.ui.widgets.panels.FriendsPanel;
|
|
||||||
import me.retucio.sputnik.ui.widgets.panels.ModulePanel;
|
import me.retucio.sputnik.ui.widgets.panels.ModulePanel;
|
||||||
import me.retucio.sputnik.ui.screen.ClickGui;
|
import me.retucio.sputnik.ui.screen.ClickGui;
|
||||||
import me.retucio.sputnik.ui.widgets.panels.settings.ClientSettingsPanel;
|
import me.retucio.sputnik.ui.widgets.panels.settings.ClientSettingsPanel;
|
||||||
import me.retucio.sputnik.ui.widgets.panels.SettingsPanel;
|
import me.retucio.sputnik.ui.widgets.panels.SettingsPanel;
|
||||||
import me.retucio.sputnik.util.ChatUtil;
|
|
||||||
import me.retucio.sputnik.util.I18nUtil;
|
import me.retucio.sputnik.util.I18nUtil;
|
||||||
|
import me.retucio.sputnik.util.KeyUtil;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -153,6 +152,7 @@ public class ConfigManager {
|
|||||||
try (FileReader reader = new FileReader(LEGACY_JSON_FILE)) {
|
try (FileReader reader = new FileReader(LEGACY_JSON_FILE)) {
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
setConfig(gson.fromJson(reader, ClientConfig.class));
|
setConfig(gson.fromJson(reader, ClientConfig.class));
|
||||||
|
config.legacyKeyCodes = true;
|
||||||
Sputnik.LOGGER.info(I18nUtil.fmt("sputnik.config.info.json",
|
Sputnik.LOGGER.info(I18nUtil.fmt("sputnik.config.info.json",
|
||||||
"ajustes json cargados (migración)"));
|
"ajustes json cargados (migración)"));
|
||||||
|
|
||||||
@@ -177,7 +177,9 @@ public class ConfigManager {
|
|||||||
if (!shouldApply()) return false;
|
if (!shouldApply()) return false;
|
||||||
|
|
||||||
applying = true;
|
applying = true;
|
||||||
|
boolean migratedKeys = config.legacyKeyCodes;
|
||||||
try {
|
try {
|
||||||
|
migrateLegacyKeyCodes();
|
||||||
// los del mod primero: entre ellos está "teclas multimódulo", que decide si al
|
// los del mod primero: entre ellos está "teclas multimódulo", que decide si al
|
||||||
// asignar una tecla se le quita a los demás módulos. aplicándolos los últimos,
|
// asignar una tecla se le quita a los demás módulos. aplicándolos los últimos,
|
||||||
// las teclas de los módulos se cargaban con el valor por defecto de ese ajuste
|
// las teclas de los módulos se cargaban con el valor por defecto de ese ajuste
|
||||||
@@ -202,9 +204,32 @@ public class ConfigManager {
|
|||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (migratedKeys) writeSnapshot(true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void migrateLegacyKeyCodes() {
|
||||||
|
if (!config.legacyKeyCodes) return;
|
||||||
|
|
||||||
|
ClientSettingsPanel.clientSettings.getSettings().forEach(this::migrateLegacyKeySetting);
|
||||||
|
ModuleManager.INSTANCE.getModules().forEach(module ->
|
||||||
|
module.getSettings().forEach(this::migrateLegacyKeySetting));
|
||||||
|
BinarySerializer.migrateLegacyKeyCodes(config);
|
||||||
|
config.legacyKeyCodes = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void migrateLegacyKeySetting(Setting<?> setting) {
|
||||||
|
if (!(setting instanceof KeySetting)) return;
|
||||||
|
String key = getSettingKey(setting);
|
||||||
|
Object value = config.settings.get(key);
|
||||||
|
if (value instanceof Integer code) {
|
||||||
|
config.settings.put(key, KeyUtil.fromLegacyGlfwKey(code));
|
||||||
|
} else if (value instanceof Double code) {
|
||||||
|
config.settings.put(key, KeyUtil.fromLegacyGlfwKey(code.intValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// true mientras se está cargando la config. sobre los ajustes. lo mira KeySetting para no
|
// true mientras se está cargando la config. sobre los ajustes. lo mira KeySetting para no
|
||||||
// tratar las teclas guardadas como si el usuario las acabara de asignar, y ClientConfig
|
// tratar las teclas guardadas como si el usuario las acabara de asignar, y ClientConfig
|
||||||
// para no reescribir en la config. lo que se le está aplicando
|
// para no reescribir en la config. lo que se le está aplicando
|
||||||
@@ -301,7 +326,7 @@ public class ConfigManager {
|
|||||||
public void setMacros(List<Macro> macros) {
|
public void setMacros(List<Macro> macros) {
|
||||||
ensureConfig();
|
ensureConfig();
|
||||||
config.macros = macros.stream()
|
config.macros = macros.stream()
|
||||||
.map(macro -> new ClientConfig.MacroData(macro.getName(), macro.getKey(), List.copyOf(macro.getLines())))
|
.map(ConfigManager::toMacroData)
|
||||||
.toList();
|
.toList();
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
@@ -316,9 +341,10 @@ public class ConfigManager {
|
|||||||
// ------------------ APLICAR AJUSTES ------------------
|
// ------------------ APLICAR AJUSTES ------------------
|
||||||
|
|
||||||
public void applyFriends() {
|
public void applyFriends() {
|
||||||
config.friends.forEach((uuid, name) -> {
|
config.friends.forEach((uuid, data) -> {
|
||||||
Friend friend = new Friend(UUID.fromString(uuid));
|
Friend friend = new Friend(UUID.fromString(uuid), data.befriendedAt());
|
||||||
friend.setName(name);
|
friend.setName(data.name());
|
||||||
|
friend.setNick(data.nick());
|
||||||
FriendManager.INSTANCE.add(friend);
|
FriendManager.INSTANCE.add(friend);
|
||||||
});
|
});
|
||||||
Sputnik.LOGGER.info(I18nUtil.fmt("sputnik.config.info.friends",
|
Sputnik.LOGGER.info(I18nUtil.fmt("sputnik.config.info.friends",
|
||||||
@@ -327,10 +353,37 @@ public class ConfigManager {
|
|||||||
|
|
||||||
public void applyMacros() {
|
public void applyMacros() {
|
||||||
MacroManager.INSTANCE.setMacros(config.macros.stream()
|
MacroManager.INSTANCE.setMacros(config.macros.stream()
|
||||||
.map(data -> new Macro(data.name(), data.key(), data.lines()))
|
.map(ConfigManager::fromMacroData)
|
||||||
.toList());
|
.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ClientConfig.MacroData toMacroData(Macro macro) {
|
||||||
|
return switch (macro) {
|
||||||
|
case Macro.Chat chat -> ClientConfig.MacroData.chat(
|
||||||
|
chat.getName(), chat.getKey(), chat.getLines());
|
||||||
|
|
||||||
|
case Macro.Keybind keybind -> ClientConfig.MacroData.keybind(
|
||||||
|
keybind.getName(), keybind.getKey(),
|
||||||
|
keybind.getKeys().stream()
|
||||||
|
.map(k -> new ClientConfig.KeyData(k.key(), k.action()))
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
default -> throw new IllegalArgumentException(
|
||||||
|
"tipo de macro sin serializar: " + macro.getClass().getName());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Macro fromMacroData(ClientConfig.MacroData data) {
|
||||||
|
if (data.type() == ClientConfig.MacroType.KEYBIND) {
|
||||||
|
List<Macro.Keybind.Key> keys = data.keys() == null ? List.of() : data.keys().stream()
|
||||||
|
.map(k -> new Macro.Keybind.Key(k.key(), k.action()))
|
||||||
|
.toList();
|
||||||
|
return new Macro.Keybind(data.name(), data.key(), keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Macro.Chat(data.name(), data.key(), data.lines() == null ? List.of() : data.lines());
|
||||||
|
}
|
||||||
|
|
||||||
// el HudRenderer coloca sus elementos al construirse, pero al cambiar de perfil ya existen
|
// el HudRenderer coloca sus elementos al construirse, pero al cambiar de perfil ya existen
|
||||||
public void applyHudElements() {
|
public void applyHudElements() {
|
||||||
if (HudRenderer.INSTANCE == null) return;
|
if (HudRenderer.INSTANCE == null) return;
|
||||||
@@ -362,6 +415,7 @@ public class ConfigManager {
|
|||||||
case ListSetting listSetting -> applyListSetting(listSetting, value);
|
case ListSetting listSetting -> applyListSetting(listSetting, value);
|
||||||
case ColorSetting colorSetting -> applyColorSetting(colorSetting, value);
|
case ColorSetting colorSetting -> applyColorSetting(colorSetting, value);
|
||||||
case OptionSetting optionSetting -> applyOptionSetting(optionSetting, value);
|
case OptionSetting optionSetting -> applyOptionSetting(optionSetting, value);
|
||||||
|
case FileSetting fileSetting -> applyFileSetting(fileSetting, value);
|
||||||
default -> Sputnik.LOGGER.warn(I18nUtil.fmt("sputnik.config.warn.unknownsetting",
|
default -> Sputnik.LOGGER.warn(I18nUtil.fmt("sputnik.config.warn.unknownsetting",
|
||||||
"watafac queseso: %s", setting.getClass().getSimpleName()));
|
"watafac queseso: %s", setting.getClass().getSimpleName()));
|
||||||
}
|
}
|
||||||
@@ -423,7 +477,6 @@ public class ConfigManager {
|
|||||||
applyExtendablePanel(panel);
|
applyExtendablePanel(panel);
|
||||||
}
|
}
|
||||||
applyExtendablePanel(ClickGui.INSTANCE.getClientSettingsPanel());
|
applyExtendablePanel(ClickGui.INSTANCE.getClientSettingsPanel());
|
||||||
applyExtendablePanel(ClickGui.INSTANCE.getFriendsPanel());
|
|
||||||
|
|
||||||
Sputnik.LOGGER.info(I18nUtil.fmt("sputnik.config.info.extendablepanels",
|
Sputnik.LOGGER.info(I18nUtil.fmt("sputnik.config.info.extendablepanels",
|
||||||
"posiciones de marcos extendibles aplicadas"));
|
"posiciones de marcos extendibles aplicadas"));
|
||||||
@@ -439,9 +492,6 @@ public class ConfigManager {
|
|||||||
if (panel instanceof ClientSettingsPanel) {
|
if (panel instanceof ClientSettingsPanel) {
|
||||||
panelData = config.extendablePanels.get("ajustes");
|
panelData = config.extendablePanels.get("ajustes");
|
||||||
}
|
}
|
||||||
if (panel instanceof FriendsPanel) {
|
|
||||||
panelData = config.extendablePanels.get("amigos");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (panelData != null) {
|
if (panelData != null) {
|
||||||
panel.setX(panelData.x());
|
panel.setX(panelData.x());
|
||||||
@@ -477,8 +527,8 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void applyStringSetting(StringSetting setting, Object value) {
|
private static void applyStringSetting(StringSetting setting, Object value) {
|
||||||
if (value instanceof String) {
|
if (value instanceof String v) {
|
||||||
setting.setValue((String) value);
|
setting.setValue(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,6 +589,12 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void applyFileSetting(FileSetting setting, Object value) {
|
||||||
|
if (value instanceof String v) {
|
||||||
|
setting.setValue(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static <T> void applyOptionalProperty(Map<?, ?> map, String key, Class<T> type, Consumer<T> setter) {
|
private static <T> void applyOptionalProperty(Map<?, ?> map, String key, Class<T> type, Consumer<T> setter) {
|
||||||
Object value = map.get(key);
|
Object value = map.get(key);
|
||||||
if (type.isInstance(value)) {
|
if (type.isInstance(value)) {
|
||||||
@@ -591,8 +647,6 @@ public class ConfigManager {
|
|||||||
ClientSettingsModule settings = ClientSettingsPanel.clientSettings;
|
ClientSettingsModule settings = ClientSettingsPanel.clientSettings;
|
||||||
if (!settings.autosave.getValue()) return;
|
if (!settings.autosave.getValue()) return;
|
||||||
|
|
||||||
// desde el último guardado, no desde el último cambio: contando desde el cambio,
|
|
||||||
// tocando ajustes cada menos del intervalo no se autoguardaba nunca
|
|
||||||
long intervalMs = (long) (settings.autosaveInterval.getValue() * 1000);
|
long intervalMs = (long) (settings.autosaveInterval.getValue() * 1000);
|
||||||
if (System.currentTimeMillis() - lastSaveTime < intervalMs) return;
|
if (System.currentTimeMillis() - lastSaveTime < intervalMs) return;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package me.retucio.sputnik.event.interact;
|
||||||
|
|
||||||
|
import com.github.retucio.neutrino.Event;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class UpdateInventoryEvent extends Event {
|
||||||
|
|
||||||
|
private final List<ItemStack> prev;
|
||||||
|
|
||||||
|
public UpdateInventoryEvent(List<ItemStack> prev) {
|
||||||
|
this.prev = prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemStack> getPrev() {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package me.retucio.sputnik.event.render;
|
||||||
|
|
||||||
|
import com.github.retucio.neutrino.Event;
|
||||||
|
import net.minecraft.client.resources.model.cuboid.ItemTransform;
|
||||||
|
|
||||||
|
|
||||||
|
public class ApplyTransformationEvent extends Event {
|
||||||
|
|
||||||
|
private final ItemTransform transformation;
|
||||||
|
private final boolean leftHanded;
|
||||||
|
|
||||||
|
public ApplyTransformationEvent(ItemTransform transformation, boolean leftHanded) {
|
||||||
|
this.transformation = transformation;
|
||||||
|
this.leftHanded = leftHanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemTransform getTransformation() {
|
||||||
|
return transformation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLeftHanded() {
|
||||||
|
return leftHanded;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package me.retucio.sputnik.event.render;
|
||||||
|
|
||||||
|
import com.github.retucio.neutrino.Event;
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import me.retucio.sputnik.mixinterfaces.IEntityRenderState;
|
||||||
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||||
|
import net.minecraft.client.renderer.entity.state.ItemEntityRenderState;
|
||||||
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
|
|
||||||
|
public class RenderItemEntityEvent extends Event {
|
||||||
|
|
||||||
|
public final ItemEntity itemEntity;
|
||||||
|
public final ItemEntityRenderState renderState;
|
||||||
|
public final PoseStack matrixStack;
|
||||||
|
public final SubmitNodeCollector renderCommandQueue;
|
||||||
|
public final int light;
|
||||||
|
|
||||||
|
public RenderItemEntityEvent(ItemEntityRenderState renderState, PoseStack matrixStack, SubmitNodeCollector renderCommandQueue, int light) {
|
||||||
|
this.itemEntity = (ItemEntity) ((IEntityRenderState) renderState).sputnik$getEntity();
|
||||||
|
this.renderState = renderState;
|
||||||
|
this.matrixStack = matrixStack;
|
||||||
|
this.renderCommandQueue = renderCommandQueue;
|
||||||
|
this.light = light;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,8 @@ package me.retucio.sputnik.event.sputnik;
|
|||||||
import com.github.retucio.neutrino.Event;
|
import com.github.retucio.neutrino.Event;
|
||||||
import me.retucio.sputnik.friend.Friend;
|
import me.retucio.sputnik.friend.Friend;
|
||||||
|
|
||||||
// evento lanzado cuando se agrega o se elimina un amigo
|
|
||||||
|
// evento lanzado cuando se agrega, elimina o renombra un amigo
|
||||||
public class FriendEvent extends Event {
|
public class FriendEvent extends Event {
|
||||||
|
|
||||||
private final Friend friend;
|
private final Friend friend;
|
||||||
@@ -23,4 +24,8 @@ public class FriendEvent extends Event {
|
|||||||
public static class Remove extends FriendEvent {
|
public static class Remove extends FriendEvent {
|
||||||
public Remove(Friend friend) { super(friend); }
|
public Remove(Friend friend) { super(friend); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Rename extends FriendEvent {
|
||||||
|
public Rename(Friend friend) { super(friend); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package me.retucio.sputnik.event.sputnik;
|
|
||||||
|
|
||||||
import com.github.retucio.neutrino.Event;
|
|
||||||
|
|
||||||
public class FriendPanelEvent {
|
|
||||||
|
|
||||||
public static class Extend extends Event {} // al extenderlo / contraerlo
|
|
||||||
public static class Move extends Event {} // al cambiarlo de posición
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package me.retucio.sputnik.friend;
|
package me.retucio.sputnik.friend;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.multiplayer.PlayerInfo;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -13,12 +14,20 @@ public class Friend {
|
|||||||
private static final Minecraft mc = Minecraft.getInstance();
|
private static final Minecraft mc = Minecraft.getInstance();
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
private String nick;
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
|
private final long befriendedAt;
|
||||||
|
|
||||||
private boolean searchMatch;
|
private boolean searchMatch;
|
||||||
|
|
||||||
public Friend(UUID uuid) {
|
public Friend(UUID uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
|
this.befriendedAt = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Friend(UUID uuid, long befriendedAt) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.befriendedAt = befriendedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@@ -29,10 +38,27 @@ public class Friend {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNick() {
|
||||||
|
return nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNick(String nick) {
|
||||||
|
this.nick = nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
// apodo si existe, si no el nombre real
|
||||||
|
public String getDisplayName() {
|
||||||
|
return (nick == null || nick.isBlank()) ? name : nick;
|
||||||
|
}
|
||||||
|
|
||||||
public UUID getUuid() {
|
public UUID getUuid() {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getBefriendedAt() {
|
||||||
|
return befriendedAt;
|
||||||
|
}
|
||||||
|
|
||||||
public @Nullable Player getPlayer() {
|
public @Nullable Player getPlayer() {
|
||||||
if (mc.level == null) return null;
|
if (mc.level == null) return null;
|
||||||
Entity entity = mc.level.getEntity(uuid);
|
Entity entity = mc.level.getEntity(uuid);
|
||||||
@@ -40,6 +66,11 @@ public class Friend {
|
|||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public @Nullable PlayerInfo getPlayerInfo() {
|
||||||
|
if (mc.getConnection() == null) return null;
|
||||||
|
return mc.getConnection().getPlayerInfo(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSearchMatch() {
|
public boolean isSearchMatch() {
|
||||||
return searchMatch;
|
return searchMatch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class FriendManager {
|
|||||||
public void add(UUID uuid) {
|
public void add(UUID uuid) {
|
||||||
Friend friend = new Friend(uuid);
|
Friend friend = new Friend(uuid);
|
||||||
friend.setName(friend.getPlayer().getName().getString());
|
friend.setName(friend.getPlayer().getName().getString());
|
||||||
|
friend.setNick(friend.getName());
|
||||||
add(friend);
|
add(friend);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +62,11 @@ public class FriendManager {
|
|||||||
return Friend.Status.SUCCESS;
|
return Friend.Status.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void rename(Friend friend, String nick) {
|
||||||
|
friend.setNick(nick);
|
||||||
|
Sputnik.EVENT_BUS.post(new FriendEvent.Rename(friend));
|
||||||
|
}
|
||||||
|
|
||||||
public Friend get(UUID uuid) {
|
public Friend get(UUID uuid) {
|
||||||
for (Friend friend : friends) {
|
for (Friend friend : friends) {
|
||||||
if (friend.getUuid().equals(uuid)) {
|
if (friend.getUuid().equals(uuid)) {
|
||||||
|
|||||||
@@ -1,38 +1,22 @@
|
|||||||
package me.retucio.sputnik.macro;
|
package me.retucio.sputnik.macro;
|
||||||
|
|
||||||
import me.retucio.sputnik.util.ChatUtil;
|
import me.retucio.sputnik.util.ChatUtil;
|
||||||
|
import me.retucio.sputnik.util.KeyUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class Macro {
|
public abstract class Macro {
|
||||||
|
|
||||||
private String name;
|
protected String name;
|
||||||
private int key;
|
protected int key;
|
||||||
private final List<String> lines = new ArrayList<>();
|
|
||||||
|
|
||||||
private boolean searchMatch = true;
|
protected Macro(String name, int key) {
|
||||||
|
|
||||||
public Macro(String name) {
|
|
||||||
this(name, GLFW.GLFW_KEY_UNKNOWN, List.of());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Macro(String name, int key, List<String> lines) {
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.lines.addAll(lines);
|
|
||||||
}
|
|
||||||
|
|
||||||
// cada línea se manda como si el usuario la hubiera escrito en el chat, así que valen
|
|
||||||
// comandos del mod, comandos del servidor y mensajes normales
|
|
||||||
public void run() {
|
|
||||||
if (Minecraft.getInstance().player == null) return;
|
|
||||||
for (String line : lines) {
|
|
||||||
if (!line.isBlank()) ChatUtil.simulateChatMessage(line);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() { return name; }
|
public String getName() { return name; }
|
||||||
@@ -41,13 +25,80 @@ public class Macro {
|
|||||||
public int getKey() { return key; }
|
public int getKey() { return key; }
|
||||||
public void setKey(int key) { this.key = key; }
|
public void setKey(int key) { this.key = key; }
|
||||||
|
|
||||||
public List<String> getLines() { return lines; }
|
private boolean searchMatch = true;
|
||||||
|
public boolean isSearchMatch() { return searchMatch; }
|
||||||
|
public void setSearchMatch(boolean searchMatch) { this.searchMatch = searchMatch; }
|
||||||
|
|
||||||
|
public abstract void run();
|
||||||
|
|
||||||
|
|
||||||
|
// cada línea se manda como si el usuario la hubiera escrito en el chat, así que valen
|
||||||
|
// comandos del mod, comandos del servidor y mensajes normales
|
||||||
|
public static class Chat extends Macro {
|
||||||
|
|
||||||
|
private final List<String> lines = new ArrayList<>();
|
||||||
|
|
||||||
|
public Chat(String name) {
|
||||||
|
this(name, InputConstants.UNKNOWN.getValue(), List.of());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chat(String name, int key, List<String> lines) {
|
||||||
|
super(name, key);
|
||||||
|
this.lines.addAll(lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (Minecraft.getInstance().player == null) return;
|
||||||
|
for (String line : lines) {
|
||||||
|
if (!line.isBlank()) ChatUtil.simulateChatMessage(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getLines() {
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
public void setLines(List<String> lines) {
|
public void setLines(List<String> lines) {
|
||||||
this.lines.clear();
|
this.lines.clear();
|
||||||
this.lines.addAll(lines);
|
this.lines.addAll(lines);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSearchMatch() { return searchMatch; }
|
|
||||||
public void setSearchMatch(boolean searchMatch) { this.searchMatch = searchMatch; }
|
public static class Keybind extends Macro {
|
||||||
|
|
||||||
|
private final List<Key> keys = new ArrayList<>();
|
||||||
|
|
||||||
|
public Keybind(String name) {
|
||||||
|
this(name, InputConstants.UNKNOWN.getValue(), List.of());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Keybind(String name, int key, List<Key> keys) {
|
||||||
|
super(name, key);
|
||||||
|
this.keys.addAll(keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (Key k : keys) {
|
||||||
|
k.use();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Key> getKeys() {
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKeys(List<Key> keys) {
|
||||||
|
this.keys.clear();
|
||||||
|
this.keys.addAll(keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
public record Key(int key, int action) {
|
||||||
|
public void use() {
|
||||||
|
KeyUtil.pressKey(key, action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ package me.retucio.sputnik.macro;
|
|||||||
|
|
||||||
import me.retucio.sputnik.config.ConfigManager;
|
import me.retucio.sputnik.config.ConfigManager;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,6 +14,9 @@ public class MacroManager {
|
|||||||
|
|
||||||
private final List<Macro> macros = new ArrayList<>();
|
private final List<Macro> macros = new ArrayList<>();
|
||||||
|
|
||||||
|
// para evitar disparar un macro que presiona su propia tecla infinitamente
|
||||||
|
private boolean running = false;
|
||||||
|
|
||||||
public boolean add(Macro macro) {
|
public boolean add(Macro macro) {
|
||||||
if (getByName(macro.getName()) != null) return false;
|
if (getByName(macro.getName()) != null) return false;
|
||||||
macros.add(macro);
|
macros.add(macro);
|
||||||
@@ -34,8 +37,10 @@ public class MacroManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean onKeyPress(int key) {
|
public boolean onKeyPress(int key) {
|
||||||
if (key == GLFW.GLFW_KEY_UNKNOWN || Minecraft.getInstance().gui.screen() != null) return false;
|
if (running || key == InputConstants.UNKNOWN.getValue() || Minecraft.getInstance().gui.screen() != null) return false;
|
||||||
|
|
||||||
|
running = true;
|
||||||
|
try {
|
||||||
boolean ran = false;
|
boolean ran = false;
|
||||||
for (Macro macro : new ArrayList<>(macros)) {
|
for (Macro macro : new ArrayList<>(macros)) {
|
||||||
if (macro.getKey() != key) continue;
|
if (macro.getKey() != key) continue;
|
||||||
@@ -43,6 +48,9 @@ public class MacroManager {
|
|||||||
ran = true;
|
ran = true;
|
||||||
}
|
}
|
||||||
return ran;
|
return ran;
|
||||||
|
} finally {
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMacros(List<Macro> macros) {
|
public void setMacros(List<Macro> macros) {
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package me.retucio.sputnik.mixin.accessors;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(ItemStackRenderState.class)
|
||||||
|
public interface ItemStackRenderStateAccessor {
|
||||||
|
|
||||||
|
@Accessor("activeLayerCount")
|
||||||
|
int getActiveLayerCount();
|
||||||
|
|
||||||
|
@Accessor("layers")
|
||||||
|
ItemStackRenderState.LayerRenderState[] getLayers();
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package me.retucio.sputnik.mixin.accessors;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
||||||
|
import net.minecraft.client.resources.model.geometry.ItemQuads;
|
||||||
|
import net.minecraft.client.resources.model.cuboid.ItemTransform;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(ItemStackRenderState.LayerRenderState.class)
|
||||||
|
public interface LayerRenderStateAccessor {
|
||||||
|
|
||||||
|
@Accessor("itemTransform")
|
||||||
|
ItemTransform sputnik$getTransform();
|
||||||
|
|
||||||
|
@Accessor("quads")
|
||||||
|
ItemQuads sputnik$getQuads();
|
||||||
|
}
|
||||||
@@ -11,9 +11,7 @@ import me.retucio.sputnik.module.modules.misc.AntiInvis;
|
|||||||
import me.retucio.sputnik.module.modules.movement.BoatFly;
|
import me.retucio.sputnik.module.modules.movement.BoatFly;
|
||||||
import me.retucio.sputnik.module.modules.movement.Velocity;
|
import me.retucio.sputnik.module.modules.movement.Velocity;
|
||||||
import me.retucio.sputnik.module.modules.render.Nametags;
|
import me.retucio.sputnik.module.modules.render.Nametags;
|
||||||
import me.retucio.sputnik.util.interfaces.IVec3;
|
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
@@ -25,8 +23,6 @@ import net.minecraft.world.entity.player.Player;
|
|||||||
import net.minecraft.world.entity.projectile.arrow.AbstractArrow;
|
import net.minecraft.world.entity.projectile.arrow.AbstractArrow;
|
||||||
import net.minecraft.world.entity.vehicle.boat.AbstractBoat;
|
import net.minecraft.world.entity.vehicle.boat.AbstractBoat;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
|
||||||
import org.joml.Vector3d;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ import net.minecraft.client.renderer.entity.EntityRenderer;
|
|||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +33,7 @@ public abstract class EntityRendererMixin {
|
|||||||
|
|
||||||
@ModifyExpressionValue(method = "extractRenderState", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;getTeamColor()I"))
|
@ModifyExpressionValue(method = "extractRenderState", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;getTeamColor()I"))
|
||||||
private int setGlowESPColor(int original, @Local(argsOnly = true) Entity entity) {
|
private int setGlowESPColor(int original, @Local(argsOnly = true) Entity entity) {
|
||||||
if (esp.isEnabled() && esp.mode.is(EntityEsp.ESPMode.GLOW) && esp.entities.isEnabled(entity.getType())) return esp.glowColor.getRGB();
|
if (esp.isEnabled() && esp.mode.is(EntityEsp.ESPMode.GLOW) && esp.entities.isEnabled(entity.getType())) return esp.glowColor.getRgb();
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,10 +5,10 @@ import me.retucio.sputnik.event.network.ReceiveMessageEvent;
|
|||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.misc.ChatPlus;
|
import me.retucio.sputnik.module.modules.misc.ChatPlus;
|
||||||
|
|
||||||
import me.retucio.sputnik.util.interfaces.IChatComponent;
|
import me.retucio.sputnik.mixinterfaces.IChatComponent;
|
||||||
import me.retucio.sputnik.util.interfaces.IGuiMessage;
|
import me.retucio.sputnik.mixinterfaces.IGuiMessage;
|
||||||
import me.retucio.sputnik.util.interfaces.IGuiMessageLine;
|
import me.retucio.sputnik.mixinterfaces.IGuiMessageLine;
|
||||||
import me.retucio.sputnik.util.interfaces.IChatListener;
|
import me.retucio.sputnik.mixinterfaces.IChatListener;
|
||||||
|
|
||||||
import net.minecraft.client.gui.components.ChatComponent;
|
import net.minecraft.client.gui.components.ChatComponent;
|
||||||
import net.minecraft.client.multiplayer.chat.GuiMessage;
|
import net.minecraft.client.multiplayer.chat.GuiMessage;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package me.retucio.sputnik.mixin.mixins.hud;
|
package me.retucio.sputnik.mixin.mixins.hud;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import me.retucio.sputnik.util.interfaces.IGuiMessageLine;
|
import me.retucio.sputnik.mixinterfaces.IGuiMessageLine;
|
||||||
import net.minecraft.client.multiplayer.chat.GuiMessage;
|
import net.minecraft.client.multiplayer.chat.GuiMessage;
|
||||||
import net.minecraft.util.FormattedCharSequence;
|
import net.minecraft.util.FormattedCharSequence;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package me.retucio.sputnik.mixin.mixins.hud;
|
package me.retucio.sputnik.mixin.mixins.hud;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import me.retucio.sputnik.util.interfaces.IGuiMessage;
|
import me.retucio.sputnik.mixinterfaces.IGuiMessage;
|
||||||
import net.minecraft.client.multiplayer.chat.GuiMessage;
|
import net.minecraft.client.multiplayer.chat.GuiMessage;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package me.retucio.sputnik.mixin.mixins.hud;
|
package me.retucio.sputnik.mixin.mixins.hud;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
import com.mojang.renderpearl.api.pipeline.RenderPipeline;
|
||||||
import me.retucio.sputnik.Sputnik;
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.render.Render2DEvent;
|
import me.retucio.sputnik.event.render.Render2DEvent;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
@@ -79,12 +79,12 @@ public abstract class HudMixin {
|
|||||||
HudRenderer.INSTANCE.render(gui, dt);
|
HudRenderer.INSTANCE.render(gui, dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "extractCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphicsExtractor;blitSprite(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/Identifier;IIII)V", ordinal = 0))
|
@Redirect(method = "extractCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphicsExtractor;blitSprite(Lcom/mojang/renderpearl/api/pipeline/RenderPipeline;Lnet/minecraft/resources/Identifier;IIII)V", ordinal = 0))
|
||||||
private void onRenderCrosshair(GuiGraphicsExtractor gui, RenderPipeline pipeline, Identifier id, int x, int y, int width, int height) {
|
private void onRenderCrosshair(GuiGraphicsExtractor gui, RenderPipeline pipeline, Identifier id, int x, int y, int width, int height) {
|
||||||
// dangerous abbreviation
|
// dangerous abbreviation
|
||||||
CrosshairPlus cp = ModuleManager.INSTANCE.getModuleByClass(CrosshairPlus.class);
|
CrosshairPlus cp = ModuleManager.INSTANCE.getModuleByClass(CrosshairPlus.class);
|
||||||
|
|
||||||
int color = cp.isEnabled() ? cp.color.getRGB() : -1;
|
int color = cp.isEnabled() ? cp.color.getRgb() : -1;
|
||||||
int w = cp.isEnabled() ? cp.width.getIntValue() : width;
|
int w = cp.isEnabled() ? cp.width.getIntValue() : width;
|
||||||
int h = cp.isEnabled() ? cp.height.getIntValue() : height;
|
int h = cp.isEnabled() ? cp.height.getIntValue() : height;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package me.retucio.sputnik.mixin.mixins.io;
|
|||||||
|
|
||||||
import me.retucio.sputnik.Sputnik;
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.input.KeyEvent;
|
import me.retucio.sputnik.event.input.KeyEvent;
|
||||||
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import net.minecraft.client.KeyboardHandler;
|
import net.minecraft.client.KeyboardHandler;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -14,9 +15,9 @@ public abstract class KeyboardHandlerMixin {
|
|||||||
|
|
||||||
@Inject(method = "keyPress", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "keyPress", at = @At("HEAD"), cancellable = true)
|
||||||
private void onKeyPress(long handle, int action, net.minecraft.client.input.KeyEvent input, CallbackInfo ci) {
|
private void onKeyPress(long handle, int action, net.minecraft.client.input.KeyEvent input, CallbackInfo ci) {
|
||||||
if (input.key() == -1) return;
|
if (input.key() == InputConstants.UNKNOWN.getValue() || input.key() == -1) return;
|
||||||
Sputnik.INSTANCE.onInput(input.key(), action);
|
Sputnik.INSTANCE.onInput(input.key(), action);
|
||||||
KeyEvent event = Sputnik.EVENT_BUS.post(new KeyEvent(input.key(), input.scancode(), action));
|
KeyEvent event = Sputnik.EVENT_BUS.post(new KeyEvent(input.key(), input.keycode(), action));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,10 @@ public abstract class MouseHandlerMixin {
|
|||||||
|
|
||||||
@Inject(method = "onButton", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onButton", at = @At("HEAD"), cancellable = true)
|
||||||
private void onMouseButton(long handle, MouseButtonInfo input, int action, CallbackInfo ci) {
|
private void onMouseButton(long handle, MouseButtonInfo input, int action, CallbackInfo ci) {
|
||||||
Sputnik.INSTANCE.onInput(input.button(), action);
|
if (Sputnik.INSTANCE.onMouseInput(input.button(), action)) {
|
||||||
|
ci.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
MouseClickEvent event = Sputnik.EVENT_BUS.post(new MouseClickEvent(action, input.button()));
|
MouseClickEvent event = Sputnik.EVENT_BUS.post(new MouseClickEvent(action, input.button()));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package me.retucio.sputnik.mixin.mixins.item;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
|
import me.retucio.sputnik.event.render.RenderItemEntityEvent;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||||
|
import net.minecraft.client.renderer.entity.ItemEntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.entity.state.ItemEntityRenderState;
|
||||||
|
import net.minecraft.client.renderer.state.level.CameraRenderState;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(ItemEntityRenderer.class)
|
||||||
|
public class ItemEntityRendererMixin {
|
||||||
|
|
||||||
|
@Inject(method = "submit(Lnet/minecraft/client/renderer/entity/state/ItemEntityRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/state/level/CameraRenderState;)V", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void onSubmit(ItemEntityRenderState state, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState camera, CallbackInfo ci) {
|
||||||
|
RenderItemEntityEvent event = Sputnik.EVENT_BUS.post(
|
||||||
|
new RenderItemEntityEvent(
|
||||||
|
state,
|
||||||
|
poseStack,
|
||||||
|
submitNodeCollector,
|
||||||
|
state.lightCoords
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package me.retucio.sputnik.mixin.mixins.item;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
|
import me.retucio.sputnik.event.render.ApplyTransformationEvent;
|
||||||
|
import net.minecraft.client.resources.model.cuboid.ItemTransform;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(ItemTransform.class)
|
||||||
|
public abstract class ItemTransformMixin {
|
||||||
|
@Inject(method = "apply", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void onApply(boolean applyLeftHandFix, PoseStack.Pose pose, CallbackInfo ci) {
|
||||||
|
ApplyTransformationEvent event = Sputnik.EVENT_BUS.post(new ApplyTransformationEvent((ItemTransform) (Object) this, applyLeftHandFix));
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,16 +3,14 @@ package me.retucio.sputnik.mixin.mixins.misc;
|
|||||||
import com.llamalad7.mixinextras.sugar.Local;
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
import me.retucio.sputnik.Sputnik;
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.network.JoinWorldEvent;
|
import me.retucio.sputnik.event.network.JoinWorldEvent;
|
||||||
import me.retucio.sputnik.event.interact.OpenScreenEvent;
|
|
||||||
import me.retucio.sputnik.event.ShutdownEvent;
|
import me.retucio.sputnik.event.ShutdownEvent;
|
||||||
import me.retucio.sputnik.event.TickEvent;
|
import me.retucio.sputnik.event.TickEvent;
|
||||||
import me.retucio.sputnik.event.interact.UseItemEvent;
|
import me.retucio.sputnik.event.interact.UseItemEvent;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.camera.Freecam;
|
import me.retucio.sputnik.module.modules.camera.Freecam;
|
||||||
import me.retucio.sputnik.module.modules.player.FastUse;
|
import me.retucio.sputnik.module.modules.player.FastUse;
|
||||||
import me.retucio.sputnik.util.interfaces.IVec3;
|
import me.retucio.sputnik.mixinterfaces.IVec3;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package me.retucio.sputnik.mixin.mixins.misc;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.util.Lists;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.component.DataComponentMap;
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(Holder.Reference.class)
|
||||||
|
public abstract class ReferenceMixin<T> {
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private @Nullable DataComponentMap components;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private @Nullable T value;
|
||||||
|
|
||||||
|
@Inject(method = "bindComponents", at = @At("TAIL"))
|
||||||
|
private void onBindComponents(DataComponentMap components, CallbackInfo ci) {
|
||||||
|
if (this.components == null || !this.components.has(DataComponents.FOOD)) return;
|
||||||
|
if (!(this.value instanceof Item item)) return;
|
||||||
|
|
||||||
|
Lists.foodList.add(item);
|
||||||
|
Lists.foodNames.put(item, BuiltInRegistries.ITEM.getKey(item).toLanguageKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package me.retucio.sputnik.mixin.mixins.misc;
|
package me.retucio.sputnik.mixin.mixins.misc;
|
||||||
|
|
||||||
import me.retucio.sputnik.util.interfaces.IVec3;
|
import me.retucio.sputnik.mixinterfaces.IVec3;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package me.retucio.sputnik.mixin.mixins.network;
|
package me.retucio.sputnik.mixin.mixins.network;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import me.retucio.sputnik.util.interfaces.IChatListener;
|
import me.retucio.sputnik.mixinterfaces.IChatListener;
|
||||||
import net.minecraft.client.multiplayer.chat.ChatListener;
|
import net.minecraft.client.multiplayer.chat.ChatListener;
|
||||||
import net.minecraft.network.chat.ChatType;
|
import net.minecraft.network.chat.ChatType;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import me.retucio.sputnik.mixin.accessors.PackConfirmScreenAccessor;
|
|||||||
import me.retucio.sputnik.mixin.accessors.PendingRequestAccessor;
|
import me.retucio.sputnik.mixin.accessors.PendingRequestAccessor;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.network.RPackBypass;
|
import me.retucio.sputnik.module.modules.network.RPackBypass;
|
||||||
import me.retucio.sputnik.util.interfaces.IConfirmScreen;
|
import me.retucio.sputnik.mixinterfaces.IConfirmScreen;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
|
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
|
||||||
|
|||||||
@@ -3,18 +3,13 @@ package me.retucio.sputnik.mixin.mixins.network;
|
|||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import me.retucio.sputnik.command.CommandManager;
|
import me.retucio.sputnik.command.CommandManager;
|
||||||
import me.retucio.sputnik.event.network.SendMessageEvent;
|
import me.retucio.sputnik.event.network.SendMessageEvent;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
|
||||||
import me.retucio.sputnik.module.modules.render.NoRender;
|
|
||||||
import me.retucio.sputnik.util.ChatUtil;
|
import me.retucio.sputnik.util.ChatUtil;
|
||||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import static me.retucio.sputnik.Sputnik.*;
|
import static me.retucio.sputnik.Sputnik.*;
|
||||||
@@ -51,11 +46,4 @@ public abstract class ClientPacketListenerMixin {
|
|||||||
mc.gui.hud.getChat().addRecentChat(content);
|
mc.gui.hud.getChat().addRecentChat(content);
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "handleEntityEvent", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;displayItemActivation(Lnet/minecraft/world/item/ItemStack;)V"))
|
|
||||||
private void noRenderTotemPop(GameRenderer instance, ItemStack itemStack) {
|
|
||||||
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
|
||||||
if (!noRender.isEnabled() || noRender.totemPop.getValue())
|
|
||||||
mc.gameRenderer.displayItemActivation(itemStack);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
package me.retucio.sputnik.mixin.mixins.network;
|
package me.retucio.sputnik.mixin.mixins.network;
|
||||||
|
|
||||||
import com.mojang.authlib.yggdrasil.YggdrasilUserApiService;
|
import com.mojang.authlib.services.MinecraftServicesUserApiService;
|
||||||
import com.mojang.authlib.yggdrasil.response.UserAttributesResponse;
|
import com.mojang.authlib.services.response.UserAttributesResponse;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
// código robado de: https://github.com/kb-1000/no-telemetry
|
// código robado de: https://github.com/kb-1000/no-telemetry
|
||||||
|
|
||||||
@Mixin(YggdrasilUserApiService.class)
|
@Mixin(MinecraftServicesUserApiService.class)
|
||||||
public abstract class YggdrasilUserApiServiceMixin {
|
public abstract class YggdrasilUserApiServiceMixin {
|
||||||
|
|
||||||
@Redirect(method = "fetchProperties", at = @At(value = "INVOKE", target = "Lcom/mojang/authlib/yggdrasil/response/UserAttributesResponse$Privileges;getTelemetry()Z", remap = false), remap = false, require = 0)
|
@Redirect(method = "fetchProperties", at = @At(value = "INVOKE", target = "Lcom/mojang/authlib/services/response/UserAttributesResponse$Privileges;getTelemetry()Z", remap = false), remap = false, require = 0)
|
||||||
private boolean getTelemetry(UserAttributesResponse.Privileges instance) {
|
private boolean getTelemetry(UserAttributesResponse.Privileges instance) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package me.retucio.sputnik.mixin.mixins.player;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
|
import me.retucio.sputnik.event.interact.UpdateInventoryEvent;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(Inventory.class)
|
||||||
|
public abstract class InventoryMixin {
|
||||||
|
|
||||||
|
@Shadow @Final
|
||||||
|
private NonNullList<ItemStack> items;
|
||||||
|
|
||||||
|
@Inject(method = "setChanged", at = @At("HEAD"))
|
||||||
|
private void onChange(CallbackInfo ci) {
|
||||||
|
Sputnik.EVENT_BUS.post(new UpdateInventoryEvent(items));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ public abstract class EntityHitboxDebugRendererMixin {
|
|||||||
@ModifyVariable(method = "showHitboxes", at = @At("STORE"), name = "mainColor")
|
@ModifyVariable(method = "showHitboxes", at = @At("STORE"), name = "mainColor")
|
||||||
private int modifyHitboxColor(int original) {
|
private int modifyHitboxColor(int original) {
|
||||||
Hitboxes hitboxes = ModuleManager.INSTANCE.getModuleByClass(Hitboxes.class);
|
Hitboxes hitboxes = ModuleManager.INSTANCE.getModuleByClass(Hitboxes.class);
|
||||||
if (hitboxes.isEnabled()) return hitboxes.color.getRGB();
|
if (hitboxes.isEnabled()) return hitboxes.color.getRgb();
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package me.retucio.sputnik.mixin.mixins.render;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
import me.retucio.sputnik.mixinterfaces.IEntityRenderState;
|
||||||
|
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||||
|
import net.minecraft.client.renderer.entity.state.EntityRenderState;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(EntityRenderDispatcher.class)
|
||||||
|
public abstract class EntityRenderDispatcherMixin {
|
||||||
|
@ModifyExpressionValue(
|
||||||
|
method = "extractEntity(Lnet/minecraft/world/entity/Entity;F)Lnet/minecraft/client/renderer/entity/state/EntityRenderState;",
|
||||||
|
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderer;createRenderState(Lnet/minecraft/world/entity/Entity;F)Lnet/minecraft/client/renderer/entity/state/EntityRenderState;")
|
||||||
|
)
|
||||||
|
private <E extends Entity> EntityRenderState getAndUpdateRenderState$setEntity(EntityRenderState state, E entity, float partialTicks) {
|
||||||
|
((IEntityRenderState) state).sputnik$setEntity(entity);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package me.retucio.sputnik.mixin.mixins.render;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.mixinterfaces.IEntityRenderState;
|
||||||
|
import net.minecraft.client.renderer.entity.state.EntityRenderState;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(EntityRenderState.class)
|
||||||
|
public abstract class EntityRenderStateMixin implements IEntityRenderState {
|
||||||
|
@Unique
|
||||||
|
private Entity entity;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public Entity sputnik$getEntity() {
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sputnik$setEntity(Entity entity) {
|
||||||
|
this.entity = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import me.retucio.sputnik.module.ModuleManager;
|
|||||||
import me.retucio.sputnik.module.modules.render.GlintPlus;
|
import me.retucio.sputnik.module.modules.render.GlintPlus;
|
||||||
import net.minecraft.client.renderer.entity.layers.EquipmentLayerRenderer;
|
import net.minecraft.client.renderer.entity.layers.EquipmentLayerRenderer;
|
||||||
import net.minecraft.client.renderer.rendertype.RenderType;
|
import net.minecraft.client.renderer.rendertype.RenderType;
|
||||||
|
import net.minecraft.resources.Identifier;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
@@ -12,9 +13,9 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||||||
@Mixin(EquipmentLayerRenderer.class)
|
@Mixin(EquipmentLayerRenderer.class)
|
||||||
public abstract class EquipmentLayerRendererMixin {
|
public abstract class EquipmentLayerRendererMixin {
|
||||||
|
|
||||||
@Redirect(method = "renderLayers(Lnet/minecraft/client/resources/model/EquipmentClientInfo$LayerType;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lnet/minecraft/world/item/ItemStack;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/resources/Identifier;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/rendertype/RenderTypes;armorEntityGlint()Lnet/minecraft/client/renderer/rendertype/RenderType;"))
|
@Redirect(method = "renderLayers(Lnet/minecraft/client/resources/model/EquipmentClientInfo$LayerType;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lnet/minecraft/world/item/ItemStack;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/resources/Identifier;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/rendertype/RenderTypes;armorCutoutNoCullGlint(Lnet/minecraft/resources/Identifier;)Lnet/minecraft/client/renderer/rendertype/RenderType;"))
|
||||||
private RenderType redirectArmorEntityGlint() {
|
private RenderType redirectArmorEntityGlint(Identifier texture) {
|
||||||
GlintPlus glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
GlintPlus glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
||||||
return glintPlus.getArmorEntityGlint();
|
return glintPlus.getArmorEntityGlint(texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,8 +15,11 @@ import com.mojang.blaze3d.resource.CrossFrameResourcePool;
|
|||||||
import net.minecraft.client.DeltaTracker;
|
import net.minecraft.client.DeltaTracker;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import net.minecraft.client.renderer.ItemInHandRenderer;
|
import net.minecraft.client.renderer.FirstPersonHandsAndItemsRenderer;
|
||||||
import net.minecraft.client.renderer.state.level.CameraRenderState;
|
import net.minecraft.client.renderer.state.level.CameraRenderState;
|
||||||
|
import net.minecraft.client.renderer.state.level.PlayerRenderState;
|
||||||
|
import net.minecraft.client.renderer.item.ItemModelResolver;
|
||||||
|
import com.mojang.renderpearl.api.textures.GpuTextureView;
|
||||||
import net.minecraft.client.resources.model.ModelManager;
|
import net.minecraft.client.resources.model.ModelManager;
|
||||||
import org.joml.Matrix4fc;
|
import org.joml.Matrix4fc;
|
||||||
|
|
||||||
@@ -52,23 +55,20 @@ public abstract class GameRendererMixin {
|
|||||||
private CrossFrameResourcePool resourcePool;
|
private CrossFrameResourcePool resourcePool;
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
private void getModules(Minecraft minecraft, ItemInHandRenderer itemInHandRenderer, ModelManager modelManager, CallbackInfo ci) {
|
private void getModules(Minecraft minecraft, FirstPersonHandsAndItemsRenderer itemInHandRenderer, ModelManager modelManager, ItemModelResolver itemModelResolver, CallbackInfo ci) {
|
||||||
zoom = ModuleManager.INSTANCE.getModuleByClass(Zoom.class);;
|
zoom = ModuleManager.INSTANCE.getModuleByClass(Zoom.class);;
|
||||||
freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
||||||
noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||||
lsd = ModuleManager.INSTANCE.getModuleByClass(Lsd.class);
|
lsd = ModuleManager.INSTANCE.getModuleByClass(Lsd.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// se aplica justo donde vanilla mete sus efectos de post (nausea, etc.): el mundo ya está
|
@Inject(method = "render", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/client/renderer/LevelRenderer;blitEntityOutline()V"))
|
||||||
// en mainRenderTarget y el HUD todavía no, así que sólo distorsiona la escena 3D
|
private void applyLsd(CallbackInfo ci) {
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", shift = At.Shift.AFTER,
|
|
||||||
target = "Lnet/minecraft/client/renderer/LevelRenderer;doEntityOutline()V"))
|
|
||||||
private void applyLsd(DeltaTracker deltaTracker, boolean advanceGameTime, CallbackInfo ci) {
|
|
||||||
if (lsd.isEnabled()) lsd.apply(mainRenderTarget, resourcePool);
|
if (lsd.isEnabled()) lsd.apply(mainRenderTarget, resourcePool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
|
||||||
private void avoidRenderingUnfocusedCpu(DeltaTracker dt, boolean tick, CallbackInfo ci) {
|
private void avoidRenderingUnfocusedCpu(CallbackInfo ci) {
|
||||||
if (ModuleManager.INSTANCE.getModuleByClass(UnfocusedCpu.class).isEnabled() && !mc.isWindowActive()) {
|
if (ModuleManager.INSTANCE.getModuleByClass(UnfocusedCpu.class).isEnabled() && !mc.isWindowActive()) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ public abstract class GameRendererMixin {
|
|||||||
|
|
||||||
|
|
||||||
@Inject(method = "renderItemInHand", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "renderItemInHand", at = @At("HEAD"), cancellable = true)
|
||||||
private void renderHand(CameraRenderState cameraState, float deltaPartialTick, Matrix4fc modelViewMatrix, CallbackInfo ci) {
|
private void renderHand(CameraRenderState cameraState, PlayerRenderState playerRenderState, GpuTextureView texture, CallbackInfo ci) {
|
||||||
if ((zoom.isEnabled() && !zoom.showHands.getValue())
|
if ((zoom.isEnabled() && !zoom.showHands.getValue())
|
||||||
|| (freecam.isEnabled() && !freecam.renderHands.getValue()))
|
|| (freecam.isEnabled() && !freecam.renderHands.getValue()))
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ package me.retucio.sputnik.mixin.mixins.render;
|
|||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.render.GlintPlus;
|
import me.retucio.sputnik.module.modules.render.GlintPlus;
|
||||||
import net.minecraft.client.renderer.feature.ItemFeatureRenderer;
|
import net.minecraft.client.renderer.feature.ItemFeatureRenderer;
|
||||||
|
import net.minecraft.client.resources.model.geometry.BakedQuad;
|
||||||
import net.minecraft.client.renderer.rendertype.RenderType;
|
import net.minecraft.client.renderer.rendertype.RenderType;
|
||||||
import net.minecraft.client.renderer.rendertype.RenderTypes;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
|
|
||||||
|
|
||||||
@Mixin(ItemFeatureRenderer.class)
|
@Mixin(ItemFeatureRenderer.class)
|
||||||
@@ -15,17 +16,15 @@ public abstract class ItemFeatureRendererMixin {
|
|||||||
|
|
||||||
// obtener módulo en cada redirect, ya que tiene un inicializador estático
|
// obtener módulo en cada redirect, ya que tiene un inicializador estático
|
||||||
|
|
||||||
@Redirect(method = "getFoilBuffer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/rendertype/RenderTypes;glint()Lnet/minecraft/client/renderer/rendertype/RenderType;"))
|
@ModifyExpressionValue(method = "prepareMainSubmit", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/resources/model/geometry/BakedQuad$MaterialInfo;itemGlintRenderType()Lnet/minecraft/client/renderer/rendertype/RenderType;"))
|
||||||
private static RenderType redirectGlint() {
|
private RenderType sputnik$colorGlint(RenderType original, @Local BakedQuad.MaterialInfo materialInfo) {
|
||||||
GlintPlus glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
GlintPlus glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
||||||
if (glintPlus == null) return RenderTypes.glint();
|
return glintPlus == null ? original : glintPlus.getGlint(original, materialInfo);
|
||||||
return glintPlus.getGlint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "getFoilBuffer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/rendertype/RenderTypes;glintTranslucent()Lnet/minecraft/client/renderer/rendertype/RenderType;"))
|
@ModifyExpressionValue(method = "prepareMainSubmit", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/resources/model/geometry/BakedQuad$MaterialInfo;itemGlintSpecialRenderType()Lnet/minecraft/client/renderer/rendertype/RenderType;"))
|
||||||
private static RenderType redirectGlintTranslucent() {
|
private RenderType sputnik$colorSpecialGlint(RenderType original, @Local BakedQuad.MaterialInfo materialInfo) {
|
||||||
GlintPlus glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
GlintPlus glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
||||||
if (glintPlus == null) return RenderTypes.glintTranslucent();
|
return glintPlus == null ? original : glintPlus.getGlint(original, materialInfo);
|
||||||
return glintPlus.getGlintTranslucent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ import me.retucio.sputnik.event.render.RenderArmEvent;
|
|||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.render.HandView;
|
import me.retucio.sputnik.module.modules.render.HandView;
|
||||||
import net.minecraft.client.player.AbstractClientPlayer;
|
import net.minecraft.client.player.AbstractClientPlayer;
|
||||||
import net.minecraft.client.renderer.ItemInHandRenderer;
|
import net.minecraft.client.renderer.FirstPersonHandsAndItemsRenderer;
|
||||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.HumanoidArm;
|
import net.minecraft.world.entity.HumanoidArm;
|
||||||
@@ -23,7 +23,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
|
|
||||||
import static me.retucio.sputnik.Sputnik.*;
|
import static me.retucio.sputnik.Sputnik.*;
|
||||||
|
|
||||||
@Mixin(ItemInHandRenderer.class)
|
@Mixin(FirstPersonHandsAndItemsRenderer.class)
|
||||||
public abstract class ItemInHandRendererMixin {
|
public abstract class ItemInHandRendererMixin {
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
@@ -49,12 +49,12 @@ public abstract class ItemInHandRendererMixin {
|
|||||||
handView = ModuleManager.INSTANCE.getModuleByClass(HandView.class);
|
handView = ModuleManager.INSTANCE.getModuleByClass(HandView.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "submitArmWithItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/ItemInHandRenderer;renderItem(Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemDisplayContext;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;I)V", shift = At.Shift.BEFORE))
|
@Inject(method = "submitArmWithItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/FirstPersonHandsAndItemsRenderer;renderItem(Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemDisplayContext;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;I)V", shift = At.Shift.BEFORE))
|
||||||
private void onRenderItem(AbstractClientPlayer player, float frameInterp, float xRot, InteractionHand hand, float attack, ItemStack itemStack, float inverseArmHeight, PoseStack matrices, SubmitNodeCollector submitNodeCollector, int lightCoords, CallbackInfo ci) {
|
private void onRenderItem(AbstractClientPlayer player, float frameInterp, float xRot, InteractionHand hand, float attack, ItemStack itemStack, float inverseArmHeight, PoseStack matrices, SubmitNodeCollector submitNodeCollector, int lightCoords, CallbackInfo ci) {
|
||||||
EVENT_BUS.post(new RenderHeldItemEvent(matrices, hand));
|
EVENT_BUS.post(new RenderHeldItemEvent(matrices, hand));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "submitArmWithItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/ItemInHandRenderer;renderPlayerArm(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;IFFLnet/minecraft/world/entity/HumanoidArm;)V"))
|
@Inject(method = "submitArmWithItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/FirstPersonHandsAndItemsRenderer;renderPlayerArm(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;IFFLnet/minecraft/world/entity/HumanoidArm;)V"))
|
||||||
private void onRenderArm(AbstractClientPlayer player, float frameInterp, float xRot, InteractionHand hand, float attack, ItemStack itemStack, float inverseArmHeight, PoseStack matrices, SubmitNodeCollector submitNodeCollector, int lightCoords, CallbackInfo ci) {
|
private void onRenderArm(AbstractClientPlayer player, float frameInterp, float xRot, InteractionHand hand, float attack, ItemStack itemStack, float inverseArmHeight, PoseStack matrices, SubmitNodeCollector submitNodeCollector, int lightCoords, CallbackInfo ci) {
|
||||||
EVENT_BUS.post(new RenderArmEvent(matrices, hand));
|
EVENT_BUS.post(new RenderArmEvent(matrices, hand));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package me.retucio.sputnik.mixin.mixins.render;
|
package me.retucio.sputnik.mixin.mixins.render;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.sugar.Local;
|
import com.mojang.renderpearl.api.buffers.GpuBufferSlice;
|
||||||
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
|
||||||
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
|
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
@@ -10,16 +9,25 @@ import me.retucio.sputnik.event.render.Render3DEvent;
|
|||||||
import me.retucio.sputnik.event.render.RenderBlockOutlineEvent;
|
import me.retucio.sputnik.event.render.RenderBlockOutlineEvent;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.camera.Freecam;
|
import me.retucio.sputnik.module.modules.camera.Freecam;
|
||||||
|
import me.retucio.sputnik.module.modules.render.BreakingProgress;
|
||||||
import me.retucio.sputnik.util.render.SputnikBuffers;
|
import me.retucio.sputnik.util.render.SputnikBuffers;
|
||||||
import net.minecraft.client.DeltaTracker;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import net.minecraft.client.renderer.LevelRenderer;
|
import net.minecraft.client.renderer.LevelRenderer;
|
||||||
|
import net.minecraft.client.renderer.ShaderManager;
|
||||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||||
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
|
||||||
|
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||||
import net.minecraft.client.renderer.state.level.CameraRenderState;
|
import net.minecraft.client.renderer.state.level.CameraRenderState;
|
||||||
import net.minecraft.client.renderer.state.level.LevelRenderState;
|
import net.minecraft.client.renderer.state.level.LevelRenderState;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
import net.minecraft.client.resources.model.ModelManager;
|
||||||
|
import net.minecraft.client.resources.model.sprite.AtlasManager;
|
||||||
import net.minecraft.util.profiling.ProfilerFiller;
|
import net.minecraft.util.profiling.ProfilerFiller;
|
||||||
|
import net.minecraft.util.profiling.Profiler;
|
||||||
import org.joml.Matrix4fc;
|
import org.joml.Matrix4fc;
|
||||||
import org.joml.Vector4f;
|
import org.joml.Vector4f;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.*;
|
import org.spongepowered.asm.mixin.injection.*;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
|
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
|
||||||
@@ -31,18 +39,29 @@ import static me.retucio.sputnik.Sputnik.mc;
|
|||||||
@Mixin(LevelRenderer.class)
|
@Mixin(LevelRenderer.class)
|
||||||
public abstract class LevelRendererMixin {
|
public abstract class LevelRendererMixin {
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private BreakingProgress bp;
|
||||||
|
|
||||||
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
|
private void getModules(EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, ModelManager modelManager, TextureManager textureManager, AtlasManager atlasManager, ShaderManager shaderManager, GameRenderer gameRenderer, int width, int height, CallbackInfo ci) {
|
||||||
|
bp = ModuleManager.INSTANCE.getModuleByClass(BreakingProgress.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "render", at = @At("RETURN"))
|
@Inject(method = "render", at = @At("RETURN"))
|
||||||
private void render(GraphicsResourceAllocator resourceAllocator, DeltaTracker dt, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, CallbackInfo ci, @Local(name = "profiler") ProfilerFiller profiler) {
|
private void render(GraphicsResourceAllocator resourceAllocator, boolean renderOutline,
|
||||||
|
CameraRenderState cameraState, GpuBufferSlice terrainFog, Vector4f fogColor,
|
||||||
|
boolean shouldRenderSky, boolean shouldRenderWeather, CallbackInfo ci) {
|
||||||
if (mc == null || mc.level == null) return;
|
if (mc == null || mc.level == null) return;
|
||||||
|
ProfilerFiller profiler = Profiler.get();
|
||||||
|
|
||||||
PoseStack matrices = new PoseStack();
|
PoseStack matrices = new PoseStack();
|
||||||
matrices.pushPose();
|
matrices.pushPose();
|
||||||
|
|
||||||
matrices.mulPose(Axis.XP.rotationDegrees(cameraState.xRot));
|
matrices.rotate(Axis.XP.rotationDegrees(cameraState.xRot));
|
||||||
matrices.mulPose(Axis.YP.rotationDegrees(cameraState.yRot + 180f));
|
matrices.rotate(Axis.YP.rotationDegrees(cameraState.yRot + 180f));
|
||||||
|
|
||||||
profiler.push(Sputnik.MOD_ID + "-3d");
|
profiler.push(Sputnik.MOD_ID + "-3d");
|
||||||
EVENT_BUS.post(new Render3DEvent(matrices, dt, cameraState));
|
EVENT_BUS.post(new Render3DEvent(matrices, mc.getDeltaTracker(), cameraState));
|
||||||
SputnikBuffers.flush(); // antes de que empiece el hud
|
SputnikBuffers.flush(); // antes de que empiece el hud
|
||||||
|
|
||||||
profiler.pop();
|
profiler.pop();
|
||||||
@@ -55,13 +74,6 @@ public abstract class LevelRendererMixin {
|
|||||||
if (freecam.isEnabled() && !freecam.blockOutlines.getValue()) ci.cancel();
|
if (freecam.isEnabled() && !freecam.blockOutlines.getValue()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Inject(method = "hasBlindnessOrDarkness(Lnet/minecraft/client/extractRenderState/Camera;)Z", at = @At("HEAD"), cancellable = true)
|
|
||||||
// private void hasBlindnessOrDarkness(Camera camera, CallbackInfoReturnable<Boolean> cir) {
|
|
||||||
// NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
|
||||||
// if (!noRender.isEnabled()) return;
|
|
||||||
// if (!noRender.blindnessEffect.getValue() || !noRender.darknessEffect.getValue()) cir.setReturnValue(null);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// puto mojang con sus nombres confusos
|
// puto mojang con sus nombres confusos
|
||||||
@ModifyArgs(method = "submitBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;submitHitOutline(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/rendertype/RenderType;Lnet/minecraft/client/renderer/state/level/BlockOutlineRenderState;IFZ)V"))
|
@ModifyArgs(method = "submitBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;submitHitOutline(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/rendertype/RenderType;Lnet/minecraft/client/renderer/state/level/BlockOutlineRenderState;IFZ)V"))
|
||||||
private void modifyBlockOutline(Args args) {
|
private void modifyBlockOutline(Args args) {
|
||||||
@@ -72,4 +84,12 @@ public abstract class LevelRendererMixin {
|
|||||||
if (event.getLineWidth() != (float) args.get(5))
|
if (event.getLineWidth() != (float) args.get(5))
|
||||||
args.set(5, event.getLineWidth());
|
args.set(5, event.getLineWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "submitBlockDestroyAnimation", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void cancelBreakingAnim(PoseStack poseStack, SubmitNodeCollector submitNodeCollector, LevelRenderState levelRenderState, CallbackInfo ci) {
|
||||||
|
if (!bp.isEnabled()) return;
|
||||||
|
if (bp.cancelAnim.getValue()) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package me.retucio.sputnik.mixin.mixins.render;
|
package me.retucio.sputnik.mixin.mixins.render;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.textures.GpuTexture;
|
import com.mojang.renderpearl.api.textures.GpuTexture;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.camera.Fullbright;
|
import me.retucio.sputnik.module.modules.camera.Fullbright;
|
||||||
import net.minecraft.client.renderer.Lightmap;
|
import net.minecraft.client.renderer.Lightmap;
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import me.retucio.sputnik.module.modules.camera.Freecam;
|
|||||||
import me.retucio.sputnik.module.modules.render.Nametags;
|
import me.retucio.sputnik.module.modules.render.Nametags;
|
||||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraft.world.entity.EntityTypes;
|
import net.minecraft.world.entity.EntityTypes;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
@@ -16,6 +15,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@@ -49,19 +49,27 @@ public abstract class LivingEntityRendererMixin<T extends LivingEntity> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ModifyReturnValue(method = "shouldShowName(Lnet/minecraft/world/entity/LivingEntity;D)Z", at = @At("RETURN"))
|
@ModifyReturnValue(method = "shouldShowName(Lnet/minecraft/world/entity/LivingEntity;D)Z", at = @At("RETURN"))
|
||||||
private boolean shouldRenderPlayerNametag(boolean original, @Local(argsOnly = true) T livingEntity) {
|
private boolean shouldRenderPlayerNametag(boolean original, @Local(argsOnly = true, name = "entity") T entity) {
|
||||||
if (nametags.isEnabled() && livingEntity instanceof Player)
|
if (nametags.isEnabled() && entity instanceof Player)
|
||||||
return nametags.entities.isEnabled(EntityTypes.PLAYER) && original;
|
return nametags.entities.isEnabled(EntityTypes.PLAYER) && original;
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "shouldShowName(Lnet/minecraft/world/entity/LivingEntity;D)Z", at = @At("RETURN"), cancellable = true)
|
@Inject(method = "shouldShowName(Lnet/minecraft/world/entity/LivingEntity;D)Z", at = @At("RETURN"), cancellable = true)
|
||||||
private void renderSelfNametag(T livingEntity, double d, CallbackInfoReturnable<Boolean> cir) {
|
private void renderSelfNametag(T entity, double distanceToCameraSq, CallbackInfoReturnable<Boolean> cir) {
|
||||||
if (livingEntity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
if (player == mc.player && nametags.showSelf.getValue()) {
|
if (player == mc.player && nametags.showSelf.getValue()) {
|
||||||
cir.setReturnValue(true);
|
cir.setReturnValue(true);
|
||||||
cir.cancel();
|
cir.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ModifyArg(method = "extractNameTags(Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/client/renderer/entity/state/LivingEntityRenderState;F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderer;extractNameTags(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/client/renderer/entity/state/EntityRenderState;FDD)V"), index = 3)
|
||||||
|
private double modifyNametagRenderDistance(double original) {
|
||||||
|
if (nametags.isEnabled()) {
|
||||||
|
return nametags.distance.getValue();
|
||||||
|
}
|
||||||
|
return original;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,9 @@ package me.retucio.sputnik.mixin.mixins.render;
|
|||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.render.NoRender;
|
import me.retucio.sputnik.module.modules.render.NoRender;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.renderer.ScreenEffectRenderer;
|
import net.minecraft.client.renderer.ScreenEffectRenderer;
|
||||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||||
|
import net.minecraft.client.renderer.state.level.PlayerRenderState;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
@@ -31,7 +31,7 @@ public abstract class ScreenEffectRendererMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "submitWater", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "submitWater", at = @At("HEAD"), cancellable = true)
|
||||||
private static void noRenderUnderwaterOverlay(Minecraft minecraft, PoseStack matrices, SubmitNodeCollector collector, CallbackInfo ci) {
|
private static void noRenderUnderwaterOverlay(PlayerRenderState.WaterOverlay waterOverlay, PoseStack matrices, SubmitNodeCollector collector, CallbackInfo ci) {
|
||||||
if (noRender.isEnabled() && !noRender.fluidOverlay.getValue()) ci.cancel();
|
if (noRender.isEnabled() && !noRender.fluidOverlay.getValue()) ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,14 +6,23 @@ import net.minecraft.client.renderer.ShaderManager;
|
|||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
@Mixin(ShaderManager.class)
|
@Mixin(ShaderManager.class)
|
||||||
public abstract class ShaderManagerMixin {
|
public abstract class ShaderManagerMixin {
|
||||||
|
|
||||||
@Inject(method = "apply(Lnet/minecraft/client/renderer/ShaderManager$Configs;Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/util/profiling/ProfilerFiller;)V", at = @At("TAIL"))
|
@Inject(method = "reload", at = @At("RETURN"))
|
||||||
private void onReload(CallbackInfo ci) {
|
private void onReload(PreparableReloadListener.SharedState state, Executor preparationExecutor,
|
||||||
|
PreparableReloadListener.PreparationBarrier barrier, Executor applyExecutor,
|
||||||
|
CallbackInfoReturnable<CompletableFuture<Void>> cir) {
|
||||||
|
cir.getReturnValue().thenRun(() -> {
|
||||||
Pipelines.init();
|
Pipelines.init();
|
||||||
PostShaders.reload();
|
PostShaders.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package me.retucio.sputnik.mixin.mixins.render;
|
package me.retucio.sputnik.mixin.mixins.render;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import com.mojang.renderpearl.api.commands.RenderPass;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.render.NoRender;
|
import me.retucio.sputnik.module.modules.render.NoRender;
|
||||||
import me.retucio.sputnik.module.modules.world.TimeChanger;
|
import me.retucio.sputnik.module.modules.world.TimeChanger;
|
||||||
@@ -26,17 +27,17 @@ public abstract class SkyRendererMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderSun", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "renderSun", at = @At("HEAD"), cancellable = true)
|
||||||
private void onRenderSun(float rainBrightness, PoseStack poseStack, CallbackInfo ci) {
|
private void onRenderSun(RenderPass renderPass, float rainBrightness, PoseStack poseStack, CallbackInfo ci) {
|
||||||
if (timeChanger.isEnabled() && !timeChanger.renderSun.getValue()) ci.cancel();
|
if (timeChanger.isEnabled() && !timeChanger.renderSun.getValue()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderMoon", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "renderMoon", at = @At("HEAD"), cancellable = true)
|
||||||
private void onRenderMoon(MoonPhase moonPhase, float rainBrightness, PoseStack poseStack, CallbackInfo ci) {
|
private void onRenderMoon(RenderPass renderPass, MoonPhase moonPhase, float rainBrightness, PoseStack poseStack, CallbackInfo ci) {
|
||||||
if (!timeChanger.isEnabled()) return;
|
if (!timeChanger.isEnabled()) return;
|
||||||
if (!timeChanger.renderMoon.getValue()) ci.cancel();
|
if (!timeChanger.renderMoon.getValue()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyArg(method = "renderSunMoonAndStars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/SkyRenderer;renderMoon(Lnet/minecraft/world/level/MoonPhase;FLcom/mojang/blaze3d/vertex/PoseStack;)V"))
|
@ModifyArg(method = "renderSunMoonAndStars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/SkyRenderer;renderMoon(Lcom/mojang/renderpearl/api/commands/RenderPass;Lnet/minecraft/world/level/MoonPhase;FLcom/mojang/blaze3d/vertex/PoseStack;)V"))
|
||||||
private MoonPhase timeChangerMoonPhase(MoonPhase original) {
|
private MoonPhase timeChangerMoonPhase(MoonPhase original) {
|
||||||
if (!timeChanger.isEnabled() || timeChanger.moonPhase.is(TimeChanger.MoonPhases.DEFAULT)) return original;
|
if (!timeChanger.isEnabled() || timeChanger.moonPhase.is(TimeChanger.MoonPhases.DEFAULT)) return original;
|
||||||
int phase = timeChanger.moonPhase.getIndex();
|
int phase = timeChanger.moonPhase.getIndex();
|
||||||
@@ -45,12 +46,12 @@ public abstract class SkyRendererMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderStars", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "renderStars", at = @At("HEAD"), cancellable = true)
|
||||||
private void onRenderStars(float starBrightness, PoseStack poseStack, CallbackInfo ci) {
|
private void onRenderStars(RenderPass renderPass, float starBrightness, PoseStack poseStack, CallbackInfo ci) {
|
||||||
if (timeChanger.isEnabled() && !timeChanger.renderStars.getValue()) ci.cancel();
|
if (timeChanger.isEnabled() && !timeChanger.renderStars.getValue()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderEndFlash", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "renderEndFlash", at = @At("HEAD"), cancellable = true)
|
||||||
private void onEndFlash(PoseStack matrices, float intensity, float xAngle, float yAngle, CallbackInfo ci) {
|
private void onEndFlash(RenderPass renderPass, PoseStack poseStack, float intensity, float xAngle, float yAngle, CallbackInfo ci) {
|
||||||
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||||
if (noRender.isEnabled() && !noRender.endFlashes.getValue()) ci.cancel();
|
if (noRender.isEnabled() && !noRender.endFlashes.getValue()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import me.retucio.sputnik.module.ModuleManager;
|
|||||||
import me.retucio.sputnik.module.modules.render.NoRender;
|
import me.retucio.sputnik.module.modules.render.NoRender;
|
||||||
import net.minecraft.client.renderer.WeatherEffectRenderer;
|
import net.minecraft.client.renderer.WeatherEffectRenderer;
|
||||||
import net.minecraft.client.renderer.state.level.WeatherRenderState;
|
import net.minecraft.client.renderer.state.level.WeatherRenderState;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import com.mojang.renderpearl.api.commands.RenderPass;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -24,7 +24,7 @@ public abstract class WeatherEffectRendererMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "render", at = @At("HEAD"))
|
@Inject(method = "render", at = @At("HEAD"))
|
||||||
private void noRenderRainAndSnow(Vec3 cameraPos, WeatherRenderState renderState, CallbackInfo ci) {
|
private void noRenderRainAndSnow(WeatherRenderState renderState, RenderPass renderPass, CallbackInfo ci) {
|
||||||
if (noRender.isEnabled()) {
|
if (noRender.isEnabled()) {
|
||||||
if (!noRender.rain.getValue()) renderState.rainColumns.clear();
|
if (!noRender.rain.getValue()) renderState.rainColumns.clear();
|
||||||
if (!noRender.snow.getValue()) renderState.snowColumns.clear();
|
if (!noRender.snow.getValue()) renderState.snowColumns.clear();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package me.retucio.sputnik.mixin.mixins.screen;
|
|||||||
|
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.network.RPackBypass;
|
import me.retucio.sputnik.module.modules.network.RPackBypass;
|
||||||
import me.retucio.sputnik.util.interfaces.IConfirmScreen;
|
import me.retucio.sputnik.mixinterfaces.IConfirmScreen;
|
||||||
|
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.client.gui.layouts.LinearLayout;
|
import net.minecraft.client.gui.layouts.LinearLayout;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class ScreenMixin {
|
|||||||
if (watermark == null || watermark.isEmpty()) return;
|
if (watermark == null || watermark.isEmpty()) return;
|
||||||
gui.text(mc.font, watermark,
|
gui.text(mc.font, watermark,
|
||||||
mc.getWindow().getGuiScaledWidth() - mc.font.width(watermark) - 2, 2,
|
mc.getWindow().getGuiScaledWidth() - mc.font.width(watermark) - 2, 2,
|
||||||
ClientSettingsPanel.clientSettings.color.getRGB(), false
|
ClientSettingsPanel.clientSettings.color.getRgb(), false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package me.retucio.sputnik.util.interfaces;
|
package me.retucio.sputnik.mixinterfaces;
|
||||||
|
|
||||||
import net.minecraft.client.multiplayer.chat.GuiMessage;
|
import net.minecraft.client.multiplayer.chat.GuiMessage;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package me.retucio.sputnik.util.interfaces;
|
package me.retucio.sputnik.mixinterfaces;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package me.retucio.sputnik.util.interfaces;
|
package me.retucio.sputnik.mixinterfaces;
|
||||||
|
|
||||||
public interface IConfirmScreen {
|
public interface IConfirmScreen {
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package me.retucio.sputnik.mixinterfaces;
|
||||||
|
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IEntityRenderState {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
Entity sputnik$getEntity();
|
||||||
|
|
||||||
|
void sputnik$setEntity(Entity entity);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package me.retucio.sputnik.util.interfaces;
|
package me.retucio.sputnik.mixinterfaces;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package me.retucio.sputnik.util.interfaces;
|
package me.retucio.sputnik.mixinterfaces;
|
||||||
|
|
||||||
public interface IGuiMessageLine extends IGuiMessage {
|
public interface IGuiMessageLine extends IGuiMessage {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package me.retucio.sputnik.util.interfaces;
|
package me.retucio.sputnik.mixinterfaces;
|
||||||
|
|
||||||
import net.minecraft.core.Vec3i;
|
import net.minecraft.core.Vec3i;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/* code by meteorclient dev team */
|
/* code by meteorclient dev team */
|
||||||
|
|
||||||
package me.retucio.sputnik.util.interfaces;
|
package me.retucio.sputnik.mixinterfaces;
|
||||||
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
@@ -1,21 +1,24 @@
|
|||||||
package me.retucio.sputnik.module;
|
package me.retucio.sputnik.module;
|
||||||
|
|
||||||
import com.github.retucio.neutrino.EventListener;
|
import com.github.retucio.neutrino.EventListener;
|
||||||
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import me.retucio.sputnik.Sputnik;
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.config.ConfigManager;
|
import me.retucio.sputnik.config.ConfigManager;
|
||||||
import me.retucio.sputnik.event.sputnik.ToggleModuleEvent;
|
import me.retucio.sputnik.event.sputnik.ToggleModuleEvent;
|
||||||
import me.retucio.sputnik.module.setting.SettingGroup;
|
import me.retucio.sputnik.module.setting.SettingGroup;
|
||||||
import me.retucio.sputnik.module.setting.settings.BooleanSetting;
|
import me.retucio.sputnik.module.setting.settings.BooleanSetting;
|
||||||
|
import me.retucio.sputnik.module.setting.settings.ColorSetting;
|
||||||
import me.retucio.sputnik.module.setting.settings.EnumSetting;
|
import me.retucio.sputnik.module.setting.settings.EnumSetting;
|
||||||
import me.retucio.sputnik.module.setting.settings.KeySetting;
|
import me.retucio.sputnik.module.setting.settings.KeySetting;
|
||||||
import me.retucio.sputnik.module.setting.Setting;
|
import me.retucio.sputnik.module.setting.Setting;
|
||||||
import me.retucio.sputnik.ui.hud.HudRenderer;
|
import me.retucio.sputnik.ui.hud.HudRenderer;
|
||||||
import me.retucio.sputnik.util.ChatUtil;
|
import me.retucio.sputnik.util.ChatUtil;
|
||||||
|
import me.retucio.sputnik.util.Colors;
|
||||||
import me.retucio.sputnik.util.I18nUtil;
|
import me.retucio.sputnik.util.I18nUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import org.lwjgl.glfw.GLFW;
|
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -35,16 +38,14 @@ public class Module {
|
|||||||
|
|
||||||
// ajustes que están en todos los módulos
|
// ajustes que están en todos los módulos
|
||||||
|
|
||||||
// estos cuatro están en los 93 módulos, así que comparten clave en vez de derivar una por módulo
|
|
||||||
|
|
||||||
protected KeySetting bind = new KeySetting(
|
protected KeySetting bind = new KeySetting(
|
||||||
"tecla",
|
"tecla",
|
||||||
"tecla asignada al módulo, ESC para desactivar",
|
"tecla asignada al módulo, ESC para desactivar",
|
||||||
GLFW.GLFW_KEY_UNKNOWN
|
InputConstants.UNKNOWN.getValue()
|
||||||
).translationKey("sputnik.setting.common.bind");
|
).translationKey("sputnik.setting.common.bind");
|
||||||
|
|
||||||
// dejar al usuario elegir si el módulo debería apagarse tras soltar su tecla asignada, o si la tecla debería alternar su estado
|
// dejar al usuario elegir si el módulo debería apagarse tras soltar su tecla asignada, o si la tecla debería alternar su estado
|
||||||
protected EnumSetting<KeyMode> keyMode = new EnumSetting<KeyMode>(
|
protected EnumSetting<KeyMode> keyMode = new EnumSetting<>(
|
||||||
"modo de tecla",
|
"modo de tecla",
|
||||||
"cómo interpretar la tecla configurada",
|
"cómo interpretar la tecla configurada",
|
||||||
KeyMode.class, KeyMode.TOGGLE
|
KeyMode.class, KeyMode.TOGGLE
|
||||||
@@ -56,12 +57,26 @@ public class Module {
|
|||||||
true
|
true
|
||||||
).translationKey("sputnik.setting.common.notify");
|
).translationKey("sputnik.setting.common.notify");
|
||||||
|
|
||||||
protected EnumSetting<NotifyMode> notifyMode = new EnumSetting<NotifyMode>(
|
protected EnumSetting<NotifyMode> notifyMode = new EnumSetting<>(
|
||||||
"modo de notificación",
|
"modo de notificación",
|
||||||
"cómo notificar cuando se activa / desactiva",
|
"cómo notificar cuando se activa / desactiva",
|
||||||
NotifyMode.class, NotifyMode.WIDGET
|
NotifyMode.class, NotifyMode.WIDGET
|
||||||
).translationKey("sputnik.setting.common.notifymode");
|
).translationKey("sputnik.setting.common.notifymode");
|
||||||
|
|
||||||
|
protected BooleanSetting displayed = new BooleanSetting(
|
||||||
|
"visible",
|
||||||
|
"mostrar en el arraylist del HUD",
|
||||||
|
true
|
||||||
|
).translationKey("sputnik.setting.common.displayed");;
|
||||||
|
|
||||||
|
protected ColorSetting arraylistColor = new ColorSetting(
|
||||||
|
"color del arraylist",
|
||||||
|
"color a usar en el arraylist para el nombre del módulo",
|
||||||
|
new Color(Colors.red, Colors.green, Colors.blue, Colors.alpha),
|
||||||
|
true
|
||||||
|
).translationKey("sputnik.setting.common.arraylistcolor")
|
||||||
|
.visibility(displayed::getValue);
|
||||||
|
|
||||||
protected final List<SettingGroup> sgs = new ArrayList<>();
|
protected final List<SettingGroup> sgs = new ArrayList<>();
|
||||||
protected final SettingGroup sgModule = addSg(new SettingGroup("módulo", false, "sputnik.group.common.module"));
|
protected final SettingGroup sgModule = addSg(new SettingGroup("módulo", false, "sputnik.group.common.module"));
|
||||||
protected final SettingGroup sgGeneral = addSg(new SettingGroup("general", true, "sputnik.group.common.general"));
|
protected final SettingGroup sgGeneral = addSg(new SettingGroup("general", true, "sputnik.group.common.general"));
|
||||||
@@ -72,14 +87,11 @@ public class Module {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
sgModule.addAll(bind, keyMode, notify, notifyMode);
|
sgModule.addAll(bind, keyMode, notify, notifyMode, displayed, arraylistColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Module(String name, String description, Category category, int key) {
|
public Module(String name, String description, Category category, int key) {
|
||||||
this.name = name;
|
this(name, description, category);
|
||||||
this.description = description;
|
|
||||||
this.category = category;
|
|
||||||
sgModule.addAll(bind, keyMode, notify, notifyMode);
|
|
||||||
this.bind.setDefaultValue(key);
|
this.bind.setDefaultValue(key);
|
||||||
|
|
||||||
// puto marcos
|
// puto marcos
|
||||||
@@ -155,7 +167,6 @@ public class Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// onDisable no miraba notify.getValue(), así que avisaba aunque estuviera desactivado
|
|
||||||
private void notifyToggle(boolean on) {
|
private void notifyToggle(boolean on) {
|
||||||
if (!notify.getValue()) return;
|
if (!notify.getValue()) return;
|
||||||
if (ConfigManager.INSTANCE != null && ConfigManager.INSTANCE.isApplying()) return;
|
if (ConfigManager.INSTANCE != null && ConfigManager.INSTANCE.isApplying()) return;
|
||||||
@@ -174,8 +185,6 @@ public class Module {
|
|||||||
|
|
||||||
// getters y setters
|
// getters y setters
|
||||||
|
|
||||||
// OJO: nombre interno. es la clave de la config. (moduleStates, getSettingKey, settingsPanels)
|
|
||||||
// y no se traduce nunca. para mostrarlo al usuario usar getDisplayName()
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -250,6 +259,10 @@ public class Module {
|
|||||||
return bind;
|
return bind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isVisible() { return displayed.getValue(); }
|
||||||
|
|
||||||
|
public Color getArraylistColor() { return arraylistColor.getValue(); }
|
||||||
|
|
||||||
public boolean isSearchMatch() {
|
public boolean isSearchMatch() {
|
||||||
return searchMatch;
|
return searchMatch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import me.retucio.sputnik.module.modules.inventory.*;
|
|||||||
import me.retucio.sputnik.module.modules.misc.*;
|
import me.retucio.sputnik.module.modules.misc.*;
|
||||||
import me.retucio.sputnik.module.modules.movement.*;
|
import me.retucio.sputnik.module.modules.movement.*;
|
||||||
import me.retucio.sputnik.module.modules.network.*;
|
import me.retucio.sputnik.module.modules.network.*;
|
||||||
|
import me.retucio.sputnik.module.modules.network.PacketLogger;
|
||||||
import me.retucio.sputnik.module.modules.player.*;
|
import me.retucio.sputnik.module.modules.player.*;
|
||||||
import me.retucio.sputnik.module.modules.render.*;
|
import me.retucio.sputnik.module.modules.render.*;
|
||||||
import me.retucio.sputnik.module.modules.render.CritsPlus;
|
import me.retucio.sputnik.module.modules.render.CritsPlus;
|
||||||
@@ -90,6 +91,7 @@ public class ModuleManager {
|
|||||||
add(new ChestplateSwitch());
|
add(new ChestplateSwitch());
|
||||||
add(new CrystalAura());
|
add(new CrystalAura());
|
||||||
add(new HoldAttack());
|
add(new HoldAttack());
|
||||||
|
add(new KillAura());
|
||||||
add(new MaceKill());
|
add(new MaceKill());
|
||||||
add(new ProjectileTrajectories());
|
add(new ProjectileTrajectories());
|
||||||
add(new SpearKill());
|
add(new SpearKill());
|
||||||
@@ -128,6 +130,7 @@ public class ModuleManager {
|
|||||||
add(new Headhitters());
|
add(new Headhitters());
|
||||||
add(new HitboxDesync());
|
add(new HitboxDesync());
|
||||||
add(new InfiniteElytra());
|
add(new InfiniteElytra());
|
||||||
|
add(new ItemMagnet());
|
||||||
add(new Jesus());
|
add(new Jesus());
|
||||||
add(new Parkour());
|
add(new Parkour());
|
||||||
add(new ReverseStep());
|
add(new ReverseStep());
|
||||||
@@ -144,6 +147,7 @@ public class ModuleManager {
|
|||||||
add(new LogoutSpots());
|
add(new LogoutSpots());
|
||||||
add(new PacketCanceller());
|
add(new PacketCanceller());
|
||||||
add(new PacketDelay());
|
add(new PacketDelay());
|
||||||
|
add(new PacketLogger());
|
||||||
add(new PacketMine());
|
add(new PacketMine());
|
||||||
add(new Reconnect());
|
add(new Reconnect());
|
||||||
add(new RPackBypass());
|
add(new RPackBypass());
|
||||||
@@ -152,6 +156,7 @@ public class ModuleManager {
|
|||||||
private void addPlayer() {
|
private void addPlayer() {
|
||||||
add(new AirPlace());
|
add(new AirPlace());
|
||||||
add(new AntiHunger());
|
add(new AntiHunger());
|
||||||
|
add(new AutoEat());
|
||||||
add(new AutoFish());
|
add(new AutoFish());
|
||||||
add(new Capes());
|
add(new Capes());
|
||||||
add(new FastUse());
|
add(new FastUse());
|
||||||
@@ -172,14 +177,17 @@ public class ModuleManager {
|
|||||||
add(new Fonts());
|
add(new Fonts());
|
||||||
add(new GlintPlus());
|
add(new GlintPlus());
|
||||||
add(new Hitboxes());
|
add(new Hitboxes());
|
||||||
|
add(new ItemPhysics());
|
||||||
add(new Lsd());
|
add(new Lsd());
|
||||||
add(new Nametags());
|
add(new Nametags());
|
||||||
add(new NoRender());
|
add(new NoRender());
|
||||||
add(new Particles());
|
add(new Particles());
|
||||||
|
add(new Stylish());
|
||||||
add(new Tracers());
|
add(new Tracers());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addWorld() {
|
private void addWorld() {
|
||||||
|
add(new AutoMine());
|
||||||
add(new AutoSign());
|
add(new AutoSign());
|
||||||
add(new AutoTool());
|
add(new AutoTool());
|
||||||
add(new BlockInfo());
|
add(new BlockInfo());
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package me.retucio.sputnik.module.modules.camera;
|
package me.retucio.sputnik.module.modules.camera;
|
||||||
|
|
||||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
import com.mojang.renderpearl.api.pipeline.RenderPipeline;
|
||||||
import me.retucio.sputnik.module.Category;
|
import me.retucio.sputnik.module.Category;
|
||||||
import me.retucio.sputnik.module.Module;
|
import me.retucio.sputnik.module.Module;
|
||||||
import me.retucio.sputnik.module.setting.settings.ColorSetting;
|
import me.retucio.sputnik.module.setting.settings.ColorSetting;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import net.minecraft.network.protocol.game.*;
|
|||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
/** continúa en:
|
/** continúa en:
|
||||||
* @see CameraMixin
|
* @see CameraMixin
|
||||||
@@ -104,7 +104,7 @@ public class Freecam extends Module {
|
|||||||
private final KeySetting scrollKey = sgSpeed.add(new KeySetting(
|
private final KeySetting scrollKey = sgSpeed.add(new KeySetting(
|
||||||
"tecla del scroll",
|
"tecla del scroll",
|
||||||
"tecla a mantener pulsada para cambiar velocidad con el scroll",
|
"tecla a mantener pulsada para cambiar velocidad con el scroll",
|
||||||
GLFW.GLFW_KEY_LEFT_CONTROL
|
InputConstants.KEY_LCONTROL
|
||||||
));
|
));
|
||||||
|
|
||||||
private final NumberSetting scrollSens = sgSpeed.add(new NumberSetting(
|
private final NumberSetting scrollSens = sgSpeed.add(new NumberSetting(
|
||||||
@@ -128,7 +128,7 @@ public class Freecam extends Module {
|
|||||||
super("cámara libre",
|
super("cámara libre",
|
||||||
"permite a la cámara moverse independientemente del jugador. útil para explorar alrededores",
|
"permite a la cámara moverse independientemente del jugador. útil para explorar alrededores",
|
||||||
Category.CAMERA,
|
Category.CAMERA,
|
||||||
GLFW.GLFW_KEY_V);
|
InputConstants.KEY_V);
|
||||||
|
|
||||||
speedSetting.onUpdate(newSpeed -> speed = newSpeed);
|
speedSetting.onUpdate(newSpeed -> speed = newSpeed);
|
||||||
}
|
}
|
||||||
@@ -262,37 +262,36 @@ public class Freecam extends Module {
|
|||||||
Packet<?> packet = event.getPacket();
|
Packet<?> packet = event.getPacket();
|
||||||
if (packet instanceof ServerboundPlayerActionPacket
|
if (packet instanceof ServerboundPlayerActionPacket
|
||||||
|| packet instanceof ServerboundUseItemOnPacket
|
|| packet instanceof ServerboundUseItemOnPacket
|
||||||
|| packet instanceof ServerboundUseItemPacket
|
|| packet instanceof ServerboundUseItemPacket) {
|
||||||
|| packet instanceof ServerboundSwingPacket) {
|
|
||||||
event.cancel();
|
event.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
private void onKey(KeyEvent event) {
|
private void onKey(KeyEvent event) {
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_F3)) return;
|
if (KeyUtil.isKeyDown(InputConstants.KEY_F3)) return;
|
||||||
if (mc.gui.screen() != null) return;
|
if (mc.gui.screen() != null) return;
|
||||||
|
|
||||||
net.minecraft.client.input.KeyEvent key = new net.minecraft.client.input.KeyEvent(event.getKey(), event.getScancode(), 0);
|
net.minecraft.client.input.KeyEvent key = new net.minecraft.client.input.KeyEvent(event.getKey(), event.getScancode(), 0);
|
||||||
|
|
||||||
boolean shouldCancel = true;
|
boolean shouldCancel = true;
|
||||||
if (mc.options.keyUp.matches(key)) {
|
if (mc.options.keyUp.matches(key)) {
|
||||||
forward = event.getAction() != GLFW.GLFW_RELEASE;
|
forward = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyUp.setDown(false);
|
mc.options.keyUp.setDown(false);
|
||||||
} else if (mc.options.keyDown.matches(key)) {
|
} else if (mc.options.keyDown.matches(key)) {
|
||||||
backward = event.getAction() != GLFW.GLFW_RELEASE;
|
backward = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyDown.setDown(false);
|
mc.options.keyDown.setDown(false);
|
||||||
} else if (mc.options.keyRight.matches(key)) {
|
} else if (mc.options.keyRight.matches(key)) {
|
||||||
right = event.getAction() != GLFW.GLFW_RELEASE;
|
right = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyRight.setDown(false);
|
mc.options.keyRight.setDown(false);
|
||||||
} else if (mc.options.keyLeft.matches(key)) {
|
} else if (mc.options.keyLeft.matches(key)) {
|
||||||
left = event.getAction() != GLFW.GLFW_RELEASE;
|
left = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyLeft.setDown(false);
|
mc.options.keyLeft.setDown(false);
|
||||||
} else if (mc.options.keyJump.matches(key)) {
|
} else if (mc.options.keyJump.matches(key)) {
|
||||||
up = event.getAction() != GLFW.GLFW_RELEASE;
|
up = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyJump.setDown(false);
|
mc.options.keyJump.setDown(false);
|
||||||
} else if (mc.options.keyShift.matches(key)) {
|
} else if (mc.options.keyShift.matches(key)) {
|
||||||
down = event.getAction() != GLFW.GLFW_RELEASE;
|
down = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyShift.setDown(false);
|
mc.options.keyShift.setDown(false);
|
||||||
} else {
|
} else {
|
||||||
shouldCancel = false;
|
shouldCancel = false;
|
||||||
@@ -303,29 +302,29 @@ public class Freecam extends Module {
|
|||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
private void onMouseClick(MouseClickEvent event) { // por si el restrasado del usuario usa el ratón para moverse
|
private void onMouseClick(MouseClickEvent event) { // por si el restrasado del usuario usa el ratón para moverse
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_F3)) return;
|
if (KeyUtil.isKeyDown(InputConstants.KEY_F3)) return;
|
||||||
if (mc.gui.screen() != null) return;
|
if (mc.gui.screen() != null) return;
|
||||||
|
|
||||||
MouseButtonEvent click = new MouseButtonEvent(0, 0, new MouseButtonInfo(event.getButton(), 0));
|
MouseButtonEvent click = new MouseButtonEvent(0, 0, new MouseButtonInfo(event.getButton(), 0));
|
||||||
|
|
||||||
boolean shouldCancel = true;
|
boolean shouldCancel = true;
|
||||||
if (mc.options.keyUp.matchesMouse(click)) {
|
if (mc.options.keyUp.matchesMouse(click)) {
|
||||||
forward = event.getAction() != GLFW.GLFW_RELEASE;
|
forward = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyUp.setDown(false);
|
mc.options.keyUp.setDown(false);
|
||||||
} else if (mc.options.keyDown.matchesMouse(click)) {
|
} else if (mc.options.keyDown.matchesMouse(click)) {
|
||||||
backward = event.getAction() != GLFW.GLFW_RELEASE;
|
backward = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyDown.setDown(false);
|
mc.options.keyDown.setDown(false);
|
||||||
} else if (mc.options.keyRight.matchesMouse(click)) {
|
} else if (mc.options.keyRight.matchesMouse(click)) {
|
||||||
right = event.getAction() != GLFW.GLFW_RELEASE;
|
right = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyRight.setDown(false);
|
mc.options.keyRight.setDown(false);
|
||||||
} else if (mc.options.keyLeft.matchesMouse(click)) {
|
} else if (mc.options.keyLeft.matchesMouse(click)) {
|
||||||
left = event.getAction() != GLFW.GLFW_RELEASE;
|
left = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyLeft.setDown(false);
|
mc.options.keyLeft.setDown(false);
|
||||||
} else if (mc.options.keyJump.matchesMouse(click)) {
|
} else if (mc.options.keyJump.matchesMouse(click)) {
|
||||||
up = event.getAction() != GLFW.GLFW_RELEASE;
|
up = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyJump.setDown(false);
|
mc.options.keyJump.setDown(false);
|
||||||
} else if (mc.options.keyShift.matchesMouse(click)) {
|
} else if (mc.options.keyShift.matchesMouse(click)) {
|
||||||
down = event.getAction() != GLFW.GLFW_RELEASE;
|
down = event.getAction() != InputConstants.RELEASE;
|
||||||
mc.options.keyShift.setDown(false);
|
mc.options.keyShift.setDown(false);
|
||||||
} else {
|
} else {
|
||||||
shouldCancel = false;
|
shouldCancel = false;
|
||||||
@@ -358,8 +357,9 @@ public class Freecam extends Module {
|
|||||||
if (mc.player == null) return; // el jugador probablemente nunca sea nulo bajo estas circunstancias pero quién sabe
|
if (mc.player == null) return; // el jugador probablemente nunca sea nulo bajo estas circunstancias pero quién sabe
|
||||||
|
|
||||||
if (event.getPacket() instanceof ClientboundPlayerCombatKillPacket packet) {
|
if (event.getPacket() instanceof ClientboundPlayerCombatKillPacket packet) {
|
||||||
if (mc.player.getId() == packet.playerId())
|
if (mc.player.getId() == packet.playerId()) {
|
||||||
toggle();
|
toggle();
|
||||||
|
}
|
||||||
} else if (event.getPacket() instanceof ClientboundSetHealthPacket packet) {
|
} else if (event.getPacket() instanceof ClientboundSetHealthPacket packet) {
|
||||||
if (mc.player.getHealth() - packet.getHealth() > 0 && toggleOnDamage.getValue()) {
|
if (mc.player.getHealth() - packet.getHealth() > 0 && toggleOnDamage.getValue()) {
|
||||||
ChatUtil.info(Component.translatable("sputnik.module.freecam.damagedisable"));
|
ChatUtil.info(Component.translatable("sputnik.module.freecam.damagedisable"));
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import me.retucio.sputnik.module.setting.settings.NumberSetting;
|
|||||||
import me.retucio.sputnik.util.KeyUtil;
|
import me.retucio.sputnik.util.KeyUtil;
|
||||||
import net.minecraft.client.CameraType;
|
import net.minecraft.client.CameraType;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
/** continúa en:
|
/** continúa en:
|
||||||
* @see CameraMixin
|
* @see CameraMixin
|
||||||
@@ -37,7 +37,7 @@ public class Freelook extends Module {
|
|||||||
super("perspectiva libre",
|
super("perspectiva libre",
|
||||||
"te permite mover la cámara de la perspectiva sin mover la del jugador, o vice versa",
|
"te permite mover la cámara de la perspectiva sin mover la del jugador, o vice versa",
|
||||||
Category.CAMERA,
|
Category.CAMERA,
|
||||||
GLFW.GLFW_KEY_B);
|
InputConstants.KEY_B);
|
||||||
|
|
||||||
keyMode.setDefaultValue(KeyMode.HOLD);
|
keyMode.setDefaultValue(KeyMode.HOLD);
|
||||||
keyMode.setValue(KeyMode.HOLD);
|
keyMode.setValue(KeyMode.HOLD);
|
||||||
@@ -75,18 +75,18 @@ public class Freelook extends Module {
|
|||||||
for (int i = 0; i < (arrowSens.getValue() * 2); i++) {
|
for (int i = 0; i < (arrowSens.getValue() * 2); i++) {
|
||||||
switch (mode.getValue()) {
|
switch (mode.getValue()) {
|
||||||
case PLAYER -> {
|
case PLAYER -> {
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT)) yaw -= 0.5f;
|
if (KeyUtil.isKeyDown(InputConstants.KEY_LEFT)) yaw -= 0.5f;
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_RIGHT)) yaw += 0.5f;
|
if (KeyUtil.isKeyDown(InputConstants.KEY_RIGHT)) yaw += 0.5f;
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_UP)) pitch -= 0.5f;
|
if (KeyUtil.isKeyDown(InputConstants.KEY_UP)) pitch -= 0.5f;
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_DOWN)) pitch += 0.5f;
|
if (KeyUtil.isKeyDown(InputConstants.KEY_DOWN)) pitch += 0.5f;
|
||||||
} case CAMERA -> {
|
} case CAMERA -> {
|
||||||
float yaw = mc.player.getYRot();
|
float yaw = mc.player.getYRot();
|
||||||
float pitch = mc.player.getXRot();
|
float pitch = mc.player.getXRot();
|
||||||
|
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT)) yaw -= 0.5f;
|
if (KeyUtil.isKeyDown(InputConstants.KEY_LEFT)) yaw -= 0.5f;
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_RIGHT)) yaw += 0.5f;
|
if (KeyUtil.isKeyDown(InputConstants.KEY_RIGHT)) yaw += 0.5f;
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_UP)) pitch -= 0.5f;
|
if (KeyUtil.isKeyDown(InputConstants.KEY_UP)) pitch -= 0.5f;
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_DOWN)) pitch += 0.5f;
|
if (KeyUtil.isKeyDown(InputConstants.KEY_DOWN)) pitch += 0.5f;
|
||||||
|
|
||||||
mc.player.setYRot(yaw);
|
mc.player.setYRot(yaw);
|
||||||
mc.player.setXRot(pitch);
|
mc.player.setXRot(pitch);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import me.retucio.sputnik.module.setting.settings.EnumSetting;
|
|||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
import net.minecraft.world.effect.MobEffects;
|
import net.minecraft.world.effect.MobEffects;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public class Fullbright extends Module {
|
|||||||
super("brilli brilli",
|
super("brilli brilli",
|
||||||
"deshabilita la oscuridad (y aplica colores a los shaders)",
|
"deshabilita la oscuridad (y aplica colores a los shaders)",
|
||||||
Category.CAMERA,
|
Category.CAMERA,
|
||||||
GLFW.GLFW_KEY_K);
|
InputConstants.KEY_K);
|
||||||
|
|
||||||
mode.onUpdate(mode -> { if (mode != Modes.POTION) disableNightVision(); });
|
mode.onUpdate(mode -> { if (mode != Modes.POTION) disableNightVision(); });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import me.retucio.sputnik.module.setting.settings.BooleanSetting;
|
|||||||
import me.retucio.sputnik.module.setting.settings.KeySetting;
|
import me.retucio.sputnik.module.setting.settings.KeySetting;
|
||||||
import me.retucio.sputnik.module.setting.settings.NumberSetting;
|
import me.retucio.sputnik.module.setting.settings.NumberSetting;
|
||||||
import net.minecraft.client.CameraType;
|
import net.minecraft.client.CameraType;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
|
|
||||||
/** continúa en:
|
/** continúa en:
|
||||||
@@ -36,7 +36,7 @@ public class PerspectivePlus extends Module {
|
|||||||
1, 0, 8, 0.1));
|
1, 0, 8, 0.1));
|
||||||
|
|
||||||
private final KeySetting scrollKey = sgScroll.add(new KeySetting("tecla del scroll", "qué tecla mantener para usar la rueda del ratón",
|
private final KeySetting scrollKey = sgScroll.add(new KeySetting("tecla del scroll", "qué tecla mantener para usar la rueda del ratón",
|
||||||
GLFW.GLFW_KEY_LEFT_ALT));
|
InputConstants.KEY_LALT));
|
||||||
|
|
||||||
private double distance;
|
private double distance;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import me.retucio.sputnik.module.setting.SettingGroup;
|
|||||||
import me.retucio.sputnik.module.setting.settings.BooleanSetting;
|
import me.retucio.sputnik.module.setting.settings.BooleanSetting;
|
||||||
import me.retucio.sputnik.module.setting.settings.KeySetting;
|
import me.retucio.sputnik.module.setting.settings.KeySetting;
|
||||||
import me.retucio.sputnik.module.setting.settings.NumberSetting;
|
import me.retucio.sputnik.module.setting.settings.NumberSetting;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
|
|
||||||
/** continúa en:
|
/** continúa en:
|
||||||
@@ -33,7 +33,7 @@ public class Zoom extends Module {
|
|||||||
private final NumberSetting scrollSens = sgScroll.add(new NumberSetting("sensibilidad del scroll", "sensibilidad de la rueda del ratón (0 para desactivar)",
|
private final NumberSetting scrollSens = sgScroll.add(new NumberSetting("sensibilidad del scroll", "sensibilidad de la rueda del ratón (0 para desactivar)",
|
||||||
0.4, 0, 8, 0.1));
|
0.4, 0, 8, 0.1));
|
||||||
private final KeySetting scrollKey = sgScroll.add(new KeySetting("tecla del scroll", "qué tecla mantener para usar la rueda del ratón",
|
private final KeySetting scrollKey = sgScroll.add(new KeySetting("tecla del scroll", "qué tecla mantener para usar la rueda del ratón",
|
||||||
GLFW.GLFW_KEY_LEFT_CONTROL));
|
InputConstants.KEY_LCONTROL));
|
||||||
|
|
||||||
private final NumberSetting mouseSensMultiplier = sgCam.add(new NumberSetting("sensibilidad", "multiplicador de la sensibilidad del ratón",
|
private final NumberSetting mouseSensMultiplier = sgCam.add(new NumberSetting("sensibilidad", "multiplicador de la sensibilidad del ratón",
|
||||||
0.4, 0, 1, 0.05));
|
0.4, 0, 1, 0.05));
|
||||||
@@ -49,7 +49,7 @@ public class Zoom extends Module {
|
|||||||
super("zoom",
|
super("zoom",
|
||||||
"lupa",
|
"lupa",
|
||||||
Category.CAMERA,
|
Category.CAMERA,
|
||||||
GLFW.GLFW_KEY_F);
|
InputConstants.KEY_F);
|
||||||
|
|
||||||
keyMode.setDefaultValue(KeyMode.HOLD);
|
keyMode.setDefaultValue(KeyMode.HOLD);
|
||||||
keyMode.setValue(KeyMode.HOLD);
|
keyMode.setValue(KeyMode.HOLD);
|
||||||
@@ -103,7 +103,7 @@ public class Zoom extends Module {
|
|||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
private void onMouseScroll(MouseScrollEvent event) {
|
private void onMouseScroll(MouseScrollEvent event) {
|
||||||
boolean key = scrollKey.getValue() == GLFW.GLFW_KEY_UNKNOWN || scrollKey.isDown();
|
boolean key = scrollKey.getValue() == InputConstants.UNKNOWN.getValue() || scrollKey.isDown();
|
||||||
if (isEnabled() && scrollSens.getValue() > 0 && key) {
|
if (isEnabled() && scrollSens.getValue() > 0 && key) {
|
||||||
value += event.getVertical() * 0.25 * (scrollSens.getValue() * value);
|
value += event.getVertical() * 0.25 * (scrollSens.getValue() * value);
|
||||||
if (value < 1) value = 1;
|
if (value < 1) value = 1;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package me.retucio.sputnik.module.modules.client;
|
package me.retucio.sputnik.module.modules.client;
|
||||||
|
|
||||||
import com.github.retucio.neutrino.EventListener;
|
import com.github.retucio.neutrino.EventListener;
|
||||||
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import me.retucio.sputnik.Sputnik;
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.command.CommandManager;
|
import me.retucio.sputnik.command.CommandManager;
|
||||||
import me.retucio.sputnik.event.TickEvent;
|
import me.retucio.sputnik.event.TickEvent;
|
||||||
@@ -17,7 +18,6 @@ import me.retucio.sputnik.module.setting.settings.NumberSetting;
|
|||||||
import me.retucio.sputnik.module.setting.settings.StringSetting;
|
import me.retucio.sputnik.module.setting.settings.StringSetting;
|
||||||
import me.retucio.sputnik.util.ChatUtil;
|
import me.retucio.sputnik.util.ChatUtil;
|
||||||
import me.retucio.sputnik.util.Colors;
|
import me.retucio.sputnik.util.Colors;
|
||||||
import org.lwjgl.glfw.GLFW;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ public class ClientSettingsModule extends Module {
|
|||||||
super("interfaz",
|
super("interfaz",
|
||||||
"ajustes de la interfaz, y otros misceláneos",
|
"ajustes de la interfaz, y otros misceláneos",
|
||||||
Category.CLIENT,
|
Category.CLIENT,
|
||||||
GLFW.GLFW_KEY_RIGHT_SHIFT);
|
InputConstants.KEY_RSHIFT);
|
||||||
|
|
||||||
Sputnik.EVENT_BUS.subscribe(this);
|
Sputnik.EVENT_BUS.subscribe(this);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import me.retucio.sputnik.util.ChatUtil;
|
|||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
|
|
||||||
public class Friends extends Module {
|
public class Friends extends Module {
|
||||||
@@ -34,8 +34,8 @@ public class Friends extends Module {
|
|||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
public void onMouseClick(MouseClickEvent event) {
|
public void onMouseClick(MouseClickEvent event) {
|
||||||
if (event.getButton() == GLFW.GLFW_MOUSE_BUTTON_MIDDLE
|
if (event.getButton() == InputConstants.MOUSE_BUTTON_MIDDLE
|
||||||
&& event.getAction() == GLFW.GLFW_PRESS
|
&& event.getAction() == InputConstants.PRESS
|
||||||
&& middleClick.getValue())
|
&& middleClick.getValue())
|
||||||
{
|
{
|
||||||
Entity target = mc.crosshairPickEntity;
|
Entity target = mc.crosshairPickEntity;
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ import me.retucio.sputnik.module.setting.settings.*;
|
|||||||
import me.retucio.sputnik.ui.hud.HudElement;
|
import me.retucio.sputnik.ui.hud.HudElement;
|
||||||
import me.retucio.sputnik.ui.hud.HudRenderer;
|
import me.retucio.sputnik.ui.hud.HudRenderer;
|
||||||
import me.retucio.sputnik.ui.hud.HudEditorScreen;
|
import me.retucio.sputnik.ui.hud.HudEditorScreen;
|
||||||
|
import me.retucio.sputnik.ui.hud.elements.CustomImageElement;
|
||||||
import me.retucio.sputnik.ui.hud.elements.DynoElement;
|
import me.retucio.sputnik.ui.hud.elements.DynoElement;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ public class Hud extends Module {
|
|||||||
public KeySetting editorKey = sgEditor.add(new KeySetting(
|
public KeySetting editorKey = sgEditor.add(new KeySetting(
|
||||||
"tecla del editor",
|
"tecla del editor",
|
||||||
"tecla asignada al editor de elementos del hud",
|
"tecla asignada al editor de elementos del hud",
|
||||||
GLFW.GLFW_KEY_INSERT
|
InputConstants.KEY_INSERT
|
||||||
));
|
));
|
||||||
|
|
||||||
public BooleanSetting axialMovement = sgEditor.add(new BooleanSetting(
|
public BooleanSetting axialMovement = sgEditor.add(new BooleanSetting(
|
||||||
@@ -126,17 +127,35 @@ public class Hud extends Module {
|
|||||||
Dynosaurs.class, Dynosaurs.SPINOSAURUS
|
Dynosaurs.class, Dynosaurs.SPINOSAURUS
|
||||||
));
|
));
|
||||||
|
|
||||||
|
public FileSetting customImagePath = sgElements.add(new FileSetting(
|
||||||
|
"ruta de imagen",
|
||||||
|
"ruta de la imagen a renderizar en el elemento de imagen custom",
|
||||||
|
""
|
||||||
|
));
|
||||||
|
|
||||||
|
public EnumSetting<SpeedUnits> speedUnit = sgElements.add(new EnumSetting<>(
|
||||||
|
"velocidad",
|
||||||
|
"unidad a usar para la velocidad",
|
||||||
|
SpeedUnits.class,
|
||||||
|
SpeedUnits.BPS
|
||||||
|
));
|
||||||
|
|
||||||
public Hud() {
|
public Hud() {
|
||||||
super("HUD",
|
super("HUD",
|
||||||
"superposición de la pantalla con info. adicional",
|
"superposición de la pantalla con info. adicional",
|
||||||
Category.CLIENT,
|
Category.CLIENT,
|
||||||
GLFW.GLFW_KEY_F12
|
InputConstants.KEY_F12
|
||||||
);
|
);
|
||||||
|
|
||||||
dyno.onUpdate(v -> {
|
dyno.onUpdate(v -> {
|
||||||
DynoElement element = (DynoElement) HudRenderer.INSTANCE.getElement(DynoElement.class);
|
DynoElement element = (DynoElement) HudRenderer.INSTANCE.getElement(DynoElement.class);
|
||||||
if (element != null) element.reloadTexture();
|
if (element != null) element.reloadTexture();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
customImagePath.onUpdate(v -> {
|
||||||
|
CustomImageElement element = (CustomImageElement) HudRenderer.INSTANCE.getElement(CustomImageElement.class);
|
||||||
|
if (element != null) element.reloadTexture();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TimeFormat {
|
public enum TimeFormat {
|
||||||
@@ -171,4 +190,21 @@ public class Hud extends Module {
|
|||||||
@Override public String toString() { return name; }
|
@Override public String toString() { return name; }
|
||||||
public String toRealString() { return super.toString(); }
|
public String toRealString() { return super.toString(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum SpeedUnits {
|
||||||
|
BPT("bloques/tick", "b/t"),
|
||||||
|
BPS("bloques/segundo", "b/s"),
|
||||||
|
KBPH("kilobloques/hora", "kb/h");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final String symbol;
|
||||||
|
|
||||||
|
SpeedUnits(String name, String symbol) {
|
||||||
|
this.name = name;
|
||||||
|
this.symbol = symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public String toString() { return name; }
|
||||||
|
public String getSymbol() { return symbol; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package me.retucio.sputnik.module.modules.combat;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.module.Category;
|
||||||
|
import me.retucio.sputnik.module.Module;
|
||||||
|
import me.retucio.sputnik.module.setting.SettingGroup;
|
||||||
|
import me.retucio.sputnik.module.setting.settings.BooleanSetting;
|
||||||
|
import me.retucio.sputnik.module.setting.settings.EnumSetting;
|
||||||
|
import me.retucio.sputnik.module.setting.settings.ListSetting;
|
||||||
|
import me.retucio.sputnik.module.setting.settings.NumberSetting;
|
||||||
|
import me.retucio.sputnik.util.Lists;
|
||||||
|
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
|
||||||
|
|
||||||
|
public class KillAura extends Module {
|
||||||
|
|
||||||
|
private final SettingGroup sgEntities = addSg(new SettingGroup("entidades", true));
|
||||||
|
|
||||||
|
private final NumberSetting reach = sgGeneral.add(new NumberSetting(
|
||||||
|
"alcance", "qué tan lejos extender el brazo",
|
||||||
|
3.0f, 0.1f, 64.0f, 0.1f
|
||||||
|
));
|
||||||
|
|
||||||
|
private final EnumSetting<AttackMode> attackMode = sgGeneral.add(new EnumSetting<>(
|
||||||
|
"modo de ataque", "elige de qué manera atacar",
|
||||||
|
AttackMode.class, AttackMode.TIMED
|
||||||
|
));
|
||||||
|
|
||||||
|
private final NumberSetting cooldownPercentage = sgGeneral.add(new NumberSetting(
|
||||||
|
"porcentaje de cooldown", "cuánto esperar a que se llene la barrita de ataque",
|
||||||
|
100, 0, 100, 1
|
||||||
|
));
|
||||||
|
|
||||||
|
private final BooleanSetting swingHand = sgGeneral.add(new BooleanSetting(
|
||||||
|
"mover la mano", "mover la mano al atacar",
|
||||||
|
true
|
||||||
|
));
|
||||||
|
|
||||||
|
private final EnumSetting<ListMode> listMode = sgEntities.add(new EnumSetting<>(
|
||||||
|
"modo de lista", "cómo interpretar la lista",
|
||||||
|
ListMode.class, ListMode.WHITELIST
|
||||||
|
));
|
||||||
|
|
||||||
|
private final ListSetting<EntityType<? extends Entity>> whitelist = sgEntities.add(new ListSetting<>(
|
||||||
|
"entidades", "qué entidades atacar",
|
||||||
|
Lists.entityList, Lists.allFalse(Lists.entityList), Lists.entityNames
|
||||||
|
)).visibility(() -> listMode.is(ListMode.WHITELIST));
|
||||||
|
|
||||||
|
private final ListSetting<EntityType<? extends Entity>> blacklist = sgEntities.add(new ListSetting<>(
|
||||||
|
"entidades ", "qué entidades NO atacar",
|
||||||
|
Lists.entityList, Lists.allFalse(Lists.entityList), Lists.entityNames
|
||||||
|
)).visibility(() -> listMode.is(ListMode.BLACKLIST));
|
||||||
|
|
||||||
|
public KillAura() {
|
||||||
|
super("killaura", "si la violencia no funciona, es porque no has aplicado la suficiente", Category.COMBAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTick() {
|
||||||
|
if (mc.player == null || mc.level == null) return;
|
||||||
|
|
||||||
|
Entity target = findClosestTarget();
|
||||||
|
if (target != null) {
|
||||||
|
attack(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Entity findClosestTarget() {
|
||||||
|
Entity closest = null;
|
||||||
|
double closestDistSq = reach.getValue() * reach.getValue();
|
||||||
|
|
||||||
|
for (Entity entity : mc.level.getEntities().getAll()) {
|
||||||
|
if (!shouldAttack(entity)) continue;
|
||||||
|
|
||||||
|
double distSq = entity.distanceToSqr(mc.player);
|
||||||
|
if (distSq > closestDistSq) continue;
|
||||||
|
|
||||||
|
closest = entity;
|
||||||
|
closestDistSq = distSq;
|
||||||
|
}
|
||||||
|
return closest;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void attack(Entity entity) {
|
||||||
|
if (mc.player.getAttackStrengthScale(0) < cooldownPercentage.getNormalizedValue()
|
||||||
|
&& attackMode.is(AttackMode.TIMED)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mc.level.isTickingEntity(entity)) return;
|
||||||
|
|
||||||
|
if (swingHand.getValue()) {
|
||||||
|
mc.player.swing(InteractionHand.MAIN_HAND, net.minecraft.world.item.component.SwingAnimation.DEFAULT, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
mc.gameMode.attack(mc.player, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean shouldAttack(Entity entity) {
|
||||||
|
if (entity.is(mc.player)) return false;
|
||||||
|
if (!entity.isAlive()) return false;
|
||||||
|
if (entity.distanceToSqr(mc.player) > reach.getValue() * reach.getValue()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return switch (listMode.getValue()) {
|
||||||
|
case WHITELIST -> whitelist.isEnabled(entity.getType());
|
||||||
|
case BLACKLIST -> !blacklist.isEnabled(entity.getType());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum AttackMode {
|
||||||
|
TIMED("timeado"),
|
||||||
|
SPAM("spam");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
AttackMode(String name) { this.name = name; }
|
||||||
|
@Override public String toString() { return name; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum ListMode {
|
||||||
|
WHITELIST("lista blanca (incluir)"),
|
||||||
|
BLACKLIST("lista negra (excluir)");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
ListMode(String name) { this.name = name; }
|
||||||
|
@Override public String toString() { return name; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ import net.minecraft.world.Container;
|
|||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import org.jspecify.annotations.NonNull;
|
import org.jspecify.annotations.NonNull;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -31,19 +31,19 @@ public class Burglar extends Module {
|
|||||||
private final KeySetting triggerKey = sgKeys.add(new KeySetting(
|
private final KeySetting triggerKey = sgKeys.add(new KeySetting(
|
||||||
"tecla activadora",
|
"tecla activadora",
|
||||||
"tecla a mantener para que las otras teclas funcionen",
|
"tecla a mantener para que las otras teclas funcionen",
|
||||||
GLFW.GLFW_KEY_LEFT_CONTROL
|
InputConstants.KEY_LCONTROL
|
||||||
));
|
));
|
||||||
|
|
||||||
private final KeySetting stealKey = sgKeys.add(new KeySetting(
|
private final KeySetting stealKey = sgKeys.add(new KeySetting(
|
||||||
"robar",
|
"robar",
|
||||||
"tecla para robar todo",
|
"tecla para robar todo",
|
||||||
GLFW.GLFW_KEY_S
|
InputConstants.KEY_S
|
||||||
));
|
));
|
||||||
|
|
||||||
private final KeySetting dumpKey = sgKeys.add(new KeySetting(
|
private final KeySetting dumpKey = sgKeys.add(new KeySetting(
|
||||||
"dejar",
|
"dejar",
|
||||||
"tecla para dejar todo",
|
"tecla para dejar todo",
|
||||||
GLFW.GLFW_KEY_D
|
InputConstants.KEY_D
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public class Burglar extends Module {
|
|||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
private void onKey(KeyEvent event) {
|
private void onKey(KeyEvent event) {
|
||||||
if (!triggerKey.isDown() || event.getAction() != GLFW.GLFW_PRESS
|
if (!triggerKey.isDown() || event.getAction() != InputConstants.PRESS
|
||||||
|| !(mc.gui.screen() instanceof AbstractContainerScreen<?> container)) return;
|
|| !(mc.gui.screen() instanceof AbstractContainerScreen<?> container)) return;
|
||||||
if (event.getKey() == stealKey.getValue()) steal(container);
|
if (event.getKey() == stealKey.getValue()) steal(container);
|
||||||
if (event.getKey() == dumpKey.getValue()) dump(container);
|
if (event.getKey() == dumpKey.getValue()) dump(container);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import me.retucio.sputnik.util.InventoryUtil;
|
|||||||
import me.retucio.sputnik.util.KeyUtil;
|
import me.retucio.sputnik.util.KeyUtil;
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||||
import net.minecraft.world.inventory.Slot;
|
import net.minecraft.world.inventory.Slot;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,9 +21,9 @@ import org.lwjgl.glfw.GLFW;
|
|||||||
|
|
||||||
public class InventoryPlus extends Module {
|
public class InventoryPlus extends Module {
|
||||||
|
|
||||||
private final KeySetting row1key = sgGeneral.add(new KeySetting("fila 1", "tecla para mover items a la primera fila", GLFW.GLFW_KEY_A));
|
private final KeySetting row1key = sgGeneral.add(new KeySetting("fila 1", "tecla para mover items a la primera fila", InputConstants.KEY_A));
|
||||||
private final KeySetting row2key = sgGeneral.add(new KeySetting("fila 2", "tecla para mover items a la segunda fila", GLFW.GLFW_KEY_S));
|
private final KeySetting row2key = sgGeneral.add(new KeySetting("fila 2", "tecla para mover items a la segunda fila", InputConstants.KEY_S));
|
||||||
private final KeySetting row3key = sgGeneral.add(new KeySetting("fila 3", "tecla para mover items a la tercera fila", GLFW.GLFW_KEY_D));
|
private final KeySetting row3key = sgGeneral.add(new KeySetting("fila 3", "tecla para mover items a la tercera fila", InputConstants.KEY_D));
|
||||||
|
|
||||||
public InventoryPlus() {
|
public InventoryPlus() {
|
||||||
super("inventario plus",
|
super("inventario plus",
|
||||||
@@ -33,13 +33,13 @@ public class InventoryPlus extends Module {
|
|||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
private void onKey(KeyEvent event) {
|
private void onKey(KeyEvent event) {
|
||||||
if (event.getAction() == GLFW.GLFW_RELEASE) return;
|
if (event.getAction() == InputConstants.RELEASE) return;
|
||||||
processInput(event.getKey(), event);
|
processInput(event.getKey(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
private void onMouseButton(MouseClickEvent event) {
|
private void onMouseButton(MouseClickEvent event) {
|
||||||
if (event.getAction() == GLFW.GLFW_RELEASE) return;
|
if (event.getAction() == InputConstants.RELEASE) return;
|
||||||
processInput(event.getButton(), event);
|
processInput(event.getButton(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import net.minecraft.world.item.ItemStack;
|
|||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.component.ItemContainerContents;
|
import net.minecraft.world.item.component.ItemContainerContents;
|
||||||
import net.minecraft.world.level.block.ShulkerBoxBlock;
|
import net.minecraft.world.level.block.ShulkerBoxBlock;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -30,7 +30,7 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class ShulkerPeek extends Module {
|
public class ShulkerPeek extends Module {
|
||||||
|
|
||||||
public final KeySetting previewKey = sgGeneral.add(new KeySetting("tecla de previsualización", "tecla a mantener para previsualizar", GLFW.GLFW_KEY_LEFT_ALT));
|
public final KeySetting previewKey = sgGeneral.add(new KeySetting("tecla de previsualización", "tecla a mantener para previsualizar", InputConstants.KEY_LALT));
|
||||||
public final BooleanSetting showTooltips = sgGeneral.add(new BooleanSetting("mostrar tooltips", "añadir texto a los tooltips (cajas de texto) de los shulkers", true));
|
public final BooleanSetting showTooltips = sgGeneral.add(new BooleanSetting("mostrar tooltips", "añadir texto a los tooltips (cajas de texto) de los shulkers", true));
|
||||||
|
|
||||||
public static final HashMap<Item, Color> SHULKER_COLORS = new HashMap<>();
|
public static final HashMap<Item, Color> SHULKER_COLORS = new HashMap<>();
|
||||||
@@ -65,12 +65,12 @@ public class ShulkerPeek extends Module {
|
|||||||
if (mc.player == null) return;
|
if (mc.player == null) return;
|
||||||
if (event.getKey() != previewKey.getValue()) return;
|
if (event.getKey() != previewKey.getValue()) return;
|
||||||
|
|
||||||
if (event.getAction() == GLFW.GLFW_PRESS) {
|
if (event.getAction() == InputConstants.PRESS) {
|
||||||
openPreviewScreen();
|
openPreviewScreen();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getAction() == GLFW.GLFW_REPEAT) {
|
if (event.getAction() == InputConstants.REPEAT) {
|
||||||
if (mc.gui.screen() instanceof PreviewScreen preview) {
|
if (mc.gui.screen() instanceof PreviewScreen preview) {
|
||||||
if (preview.getType() != PreviewScreen.PreviewType.SHULKER)
|
if (preview.getType() != PreviewScreen.PreviewType.SHULKER)
|
||||||
openPreviewScreen();
|
openPreviewScreen();
|
||||||
@@ -78,7 +78,7 @@ public class ShulkerPeek extends Module {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getAction() == GLFW.GLFW_RELEASE) {
|
if (event.getAction() == InputConstants.RELEASE) {
|
||||||
if (mc.gui.screen() instanceof PreviewScreen preview)
|
if (mc.gui.screen() instanceof PreviewScreen preview)
|
||||||
preview.onClose();
|
preview.onClose();
|
||||||
}
|
}
|
||||||
@@ -117,6 +117,6 @@ public class ShulkerPeek extends Module {
|
|||||||
if (container == null) return true;
|
if (container == null) return true;
|
||||||
|
|
||||||
// .stream()?
|
// .stream()?
|
||||||
return container.allItemsCopyStream().allMatch(ItemStack::isEmpty);
|
return container.nonEmptyItemCopyStream().allMatch(ItemStack::isEmpty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||