Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
347ec658bb | ||
|
|
a9cf6dd924 | ||
|
|
8e44dda9cf | ||
|
|
2329476fe4 | ||
|
|
6b2ec0e69a | ||
|
|
6fa409d60a | ||
|
|
4f816381c3 | ||
|
|
36c38bdf02 | ||
|
|
a6a6f1261e | ||
|
|
8891a57c7c |
No files matched your search
+5
-1
@@ -39,6 +39,10 @@ replay_*.log
|
|||||||
*.hprof
|
*.hprof
|
||||||
*.jfr
|
*.jfr
|
||||||
|
|
||||||
|
# otros
|
||||||
|
|
||||||
todo.txt
|
todo.txt
|
||||||
test.java
|
|
||||||
cambios.md
|
cambios.md
|
||||||
|
remappedSrc/
|
||||||
|
src/main/java/me/retucio/camtweaks/ui/widgets/Frame.java
|
||||||
|
src/main/java/me/retucio/camtweaks/ui/widgets/Button.java
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# jenny's mod 2 100% real
|
# jenny's mod 2 100% real
|
||||||
|
|
||||||
mod para Minecraft Fabric 1.21.6 que añade algunas cosas QOL, mayormente relacionadas a la cámara.
|
mod para Minecraft Fabric 1.21.10 que añade algunas cosas QOL, mayormente relacionadas a la cámara.
|
||||||
|
|
||||||
## instalación
|
## instalación
|
||||||
|
|
||||||
@@ -10,8 +10,8 @@ mod para Minecraft Fabric 1.21.6 que añade algunas cosas QOL, mayormente relaci
|
|||||||
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 1.21.6; Fabric 0.128.2)
|
asegúrate de tener una version de Minecraft y Fabric compatibles con el mod (MC `1.21.10`; Fabric `0.138.3`)
|
||||||
es posible que hayan problemas al usarlo junto a otros mods, especialmente otros clientes, pues pueden conflictar
|
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/camera-tweaks`)
|
1. clona el respositorio (`git clone https://github.com/retuci0/camera-tweaks`)
|
||||||
@@ -23,9 +23,11 @@ es posible que hayan problemas al usarlo junto a otros mods, especialmente otros
|
|||||||
|
|
||||||
`shift derecho` por defecto para abrir la interfaz
|
`shift derecho` por defecto para abrir la interfaz
|
||||||
|
|
||||||
|
`pág. arriba` por defecto para abrir el editor del hud
|
||||||
|
|
||||||
`$` como prefijo por defecto para comandos (se autocompletan)
|
`$` como prefijo por defecto para comandos (se autocompletan)
|
||||||
|
|
||||||
algunos módulos tienen teclas asignadas por defecto, asígnales `ESC` para desactivar sus teclas
|
algunos módulos tienen teclas asignadas por defecto, asígnales `ESC` para desactivar sus atajos de teclado
|
||||||
|
|
||||||
## interfaz
|
## interfaz
|
||||||
|
|
||||||
@@ -51,6 +53,7 @@ algunos módulos tienen teclas asignadas por defecto, asígnales `ESC` para desa
|
|||||||
<img src="screenshots/crits.png" alt="críticos">
|
<img src="screenshots/crits.png" alt="críticos">
|
||||||
<img src="screenshots/fullbright.png" alt="fullbright en modo gamma cambiando el color de los shaders">
|
<img src="screenshots/fullbright.png" alt="fullbright en modo gamma cambiando el color de los shaders">
|
||||||
<img src="screenshots/hud.png" alt="HUD">
|
<img src="screenshots/hud.png" alt="HUD">
|
||||||
|
<img src="screenshots/hudeditor.png" alt="editor de HUD">
|
||||||
|
|
||||||
## contibuciones
|
## contibuciones
|
||||||
|
|
||||||
@@ -59,3 +62,25 @@ sí por favor
|
|||||||
## licencia
|
## licencia
|
||||||
|
|
||||||
no sé, haz lo que quieras con esto, es puta basura xd
|
no sé, haz lo que quieras con esto, es puta basura xd
|
||||||
|
|
||||||
|
aunque estaría guay que acreditases
|
||||||
|
|
||||||
|
pero bueno
|
||||||
|
|
||||||
|
## descargo de responsabilidad
|
||||||
|
|
||||||
|
me importa una puta mierda lo que pase al usar este mod en servers donde es baneable y así.
|
||||||
|
|
||||||
|
## mods recomendados
|
||||||
|
|
||||||
|
> mods que recomiendo usar junto a este:
|
||||||
|
|
||||||
|
- [fabric api (necesario)](https://modrinth.com/mod/fabric-api/): necesario para el mod
|
||||||
|
- [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
|
||||||
|
- [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
|
||||||
@@ -24,7 +24,6 @@ dependencies {
|
|||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-16
@@ -1,27 +1,27 @@
|
|||||||
# v1.3
|
# v2.0
|
||||||
|
|
||||||
## novedades
|
## novedades
|
||||||
|
|
||||||
### adiciones
|
### adiciones
|
||||||
|
|
||||||
- barra de búsqueda: filtra los ajustes de todos los paneles de ajustes, por nombre y descripción
|
- ajuste de opción: similar a enumsetting, pero abre un marco de selección, igual que listsetting.
|
||||||
- barra de deslizamiento
|
|
||||||
- módulo de jugador falso: invoca una entidad de jugador falsa, por motivos de testeo
|
#### módulos nuevos:
|
||||||
- HUD: mostrar información adicional en pantalla (ej.: hora, fps, coordenadas, ...)
|
|
||||||
|
- resaltado de bloques: resalta bloques de cierto tipo renderizando una caja con su forma, visible a través de paredes
|
||||||
|
- delay de paquetes: simula un ping alto añadiendo delay a los paquetes
|
||||||
|
- inventario plus: te permite mover items a cualquier slot del inventario mediante teclas (ej.: d + tecla para slot 4);
|
||||||
|
- progreso de minado: muestra el progreso de minado de un bloque de una manera más visual, mediante cajas de color
|
||||||
|
- mano secundaria: equipa de manera automática un ítem en tu mano secundaria
|
||||||
|
- moverse en interfaz: te permite utilizar las teclas de movimiento con ciertas interfaces abiertas (configurable)
|
||||||
|
|
||||||
### arreglos / mejoras
|
### arreglos / mejoras
|
||||||
|
|
||||||
- mejoras a la interfaz
|
- ahora se pueden mostrar también las coordenadas del nether en el elemento del hud para coordenadas
|
||||||
- ahora el color de los widgets depende del color principal
|
- ahora ChatPlus utilizará los corchetes [] para mostrar la hora (antes era <>), además de también detectar cuando un jugador se une a la hora de dibujar las cabezas
|
||||||
- ahora solo se puede seleccionar un objeto de la interfaz a la vez
|
- ahora puedes elegir el sonido en aviso de baja dur., junto a la altura y volumen de este
|
||||||
- cambiada la posición de los títulos de los marcos
|
- ya no se pueden abrir interfaces del mod estando en pantallas donde se suele escribir (chat, carteles, etc.)
|
||||||
|
- arreglado algunos problemas con las configuraciones
|
||||||
- ahora los módulos están ordenados por orden alfabético
|
|
||||||
|
|
||||||
- ahora nametags también tiene en cuenta la absorción de un jugador al mostrar su vida
|
|
||||||
|
|
||||||
- el color del prefijo de las notificaciones por chat ahora depende de los ajustes de color
|
|
||||||
- ya no se muestra el prefijo equivocado en notificaciones por chat al meterse a un mundo por primera vez
|
|
||||||
|
|
||||||
## problemas reconocidos
|
## problemas reconocidos
|
||||||
|
|
||||||
|
|||||||
+11
-5
@@ -1,5 +1,11 @@
|
|||||||
meteor client dev team
|
Meteor Client: https://github.com/MeteorDevelopment/meteor-client | https://meteorclient.com
|
||||||
oyvey client (1.21 port by mioclient)
|
OyVey Port: https://github.com/mioclient/oyvey-ported/
|
||||||
lennyboi (youtube)
|
Lenny Boi: https://www.youtube.com/@lennyboi7195
|
||||||
packbar by cattyn on github
|
Shotify: https://modrinth.com/mod/shotify
|
||||||
shotify mod
|
No Telemetry: https://modrinth.com/mod/no-telemetry
|
||||||
|
Trouser Streak: https://github.com/etianl/Trouser-Streak
|
||||||
|
No More Purple: https://github.com/Pepperoni-Jabroni/NoMorePurple/
|
||||||
|
bypass-resource-pack: https://github.com/emilyy-dev/bypass-resource-pack
|
||||||
|
|
||||||
|
probablemente más pero como tengo demencia se me olvida
|
||||||
|
si quieres que te acredite o quite tu código de mi mod, mándame un mensaje en discord (username: retucio) y sin problemas :)
|
||||||
+5
-10
@@ -1,18 +1,13 @@
|
|||||||
# Done to increase the memory available to gradle.
|
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
# Fabric Properties
|
minecraft_version=1.21.10
|
||||||
# check these on https://fabricmc.net/develop
|
yarn_mappings=1.21.10+build.2
|
||||||
minecraft_version=1.21.6
|
loader_version=0.17.3
|
||||||
yarn_mappings=1.21.6+build.1
|
|
||||||
loader_version=0.17.2
|
|
||||||
loom_version=1.11-SNAPSHOT
|
loom_version=1.11-SNAPSHOT
|
||||||
|
|
||||||
# Mod Properties
|
mod_version=2.0
|
||||||
mod_version=1.3
|
|
||||||
maven_group=me.retucio
|
maven_group=me.retucio
|
||||||
archives_base_name=camtweaks
|
archives_base_name=camtweaks
|
||||||
|
|
||||||
# Dependencies
|
fabric_version=0.135.0+1.21.10
|
||||||
fabric_version=0.128.2+1.21.6
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 243 KiB |
@@ -16,25 +16,32 @@ import me.retucio.camtweaks.event.events.camtweaks.LoadModuleManagerEvent;
|
|||||||
import me.retucio.camtweaks.module.Module;
|
import me.retucio.camtweaks.module.Module;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
|
||||||
import me.retucio.camtweaks.ui.ClickGUI;
|
import me.retucio.camtweaks.module.modules.HUD;
|
||||||
|
import me.retucio.camtweaks.ui.screen.ClickGUI;
|
||||||
|
import me.retucio.camtweaks.ui.hud.HudEditorScreen;
|
||||||
|
import me.retucio.camtweaks.ui.hud.HudRenderer;
|
||||||
import me.retucio.camtweaks.ui.buttons.BindButton;
|
import me.retucio.camtweaks.ui.buttons.BindButton;
|
||||||
import me.retucio.camtweaks.ui.buttons.SettingButton;
|
import me.retucio.camtweaks.ui.buttons.SettingButton;
|
||||||
import me.retucio.camtweaks.ui.buttons.TextButton;
|
import me.retucio.camtweaks.ui.buttons.TextButton;
|
||||||
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
||||||
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
||||||
|
|
||||||
import me.retucio.camtweaks.util.ChatUtil;
|
import me.retucio.camtweaks.util.*;
|
||||||
import me.retucio.camtweaks.util.KeyUtil;
|
|
||||||
import me.retucio.camtweaks.util.Lists;
|
|
||||||
import me.retucio.camtweaks.util.MiscUtil;
|
|
||||||
|
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.util.render.DrawUtil;
|
||||||
|
import me.retucio.camtweaks.util.render.RenderUtil;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.screen.ChatScreen;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
||||||
import net.minecraft.client.gui.screen.TitleScreen;
|
import net.minecraft.client.gui.screen.ingame.AbstractCommandBlockScreen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.AnvilScreen;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@@ -45,14 +52,27 @@ import org.lwjgl.glfw.GLFW;
|
|||||||
public class CameraTweaks implements ClientModInitializer {
|
public class CameraTweaks implements ClientModInitializer {
|
||||||
|
|
||||||
// cosas necesarias
|
// cosas necesarias
|
||||||
public static final String MOD_ID = "camtweaks";
|
|
||||||
public static final CameraTweaks INSTANCE = new CameraTweaks();
|
public static final CameraTweaks INSTANCE = new CameraTweaks();
|
||||||
public static final Logger LOGGER = LogManager.getLogger(CameraTweaks.class);
|
|
||||||
public static final EventBus EVENT_BUS = new EventBus();
|
public static final EventBus EVENT_BUS = new EventBus();
|
||||||
|
public static final Logger LOGGER = LogManager.getLogger(CameraTweaks.class);
|
||||||
public static MinecraftClient mc;
|
public static MinecraftClient mc;
|
||||||
|
|
||||||
|
// id y versión
|
||||||
|
public static final String MOD_ID = "camtweaks";
|
||||||
|
public static final String MOD_VERSION;
|
||||||
|
|
||||||
|
static {
|
||||||
|
MOD_VERSION = FabricLoader.getInstance().getModContainer(MOD_ID)
|
||||||
|
.orElseThrow()
|
||||||
|
.getMetadata()
|
||||||
|
.getVersion()
|
||||||
|
.getFriendlyString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private Screen prevScreen;
|
private Screen prevScreen;
|
||||||
public boolean settingsApplied = false;
|
public static boolean settingsApplied = false;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
@@ -60,24 +80,32 @@ public class CameraTweaks implements ClientModInitializer {
|
|||||||
System.setProperty("java.awt.headless", "false");
|
System.setProperty("java.awt.headless", "false");
|
||||||
|
|
||||||
mc = MinecraftClient.getInstance();
|
mc = MinecraftClient.getInstance();
|
||||||
|
ConfigManager.load();
|
||||||
|
|
||||||
EVENT_BUS.register(this);
|
EVENT_BUS.register(this);
|
||||||
EVENT_BUS.register(MiscUtil.class);
|
|
||||||
|
EVENT_BUS.register(new HudRenderer());
|
||||||
|
|
||||||
EVENT_BUS.register(ChatUtil.class);
|
EVENT_BUS.register(ChatUtil.class);
|
||||||
|
EVENT_BUS.register(DrawUtil.class);
|
||||||
|
EVENT_BUS.register(EntityUtil.class);
|
||||||
|
EVENT_BUS.register(InventoryUtil.class);
|
||||||
|
EVENT_BUS.register(MiscUtil.class);
|
||||||
|
EVENT_BUS.register(NetworkUtil.class);
|
||||||
|
EVENT_BUS.register(RenderUtil.class);
|
||||||
|
|
||||||
Lists.init();
|
Lists.init();
|
||||||
|
|
||||||
ModuleManager.INSTANCE = new ModuleManager(EVENT_BUS);
|
ModuleManager.INSTANCE = new ModuleManager();
|
||||||
EVENT_BUS.post(new LoadModuleManagerEvent());
|
EVENT_BUS.post(new LoadModuleManagerEvent());
|
||||||
|
|
||||||
CommandManager.INSTANCE = new CommandManager();
|
CommandManager.INSTANCE = new CommandManager();
|
||||||
EVENT_BUS.post(new LoadCommandManagerEvent());
|
EVENT_BUS.post(new LoadCommandManagerEvent());
|
||||||
|
|
||||||
ClickGUI.INSTANCE = new ClickGUI();
|
ClickGUI.INSTANCE = new ClickGUI();
|
||||||
|
HudEditorScreen.INSTANCE = new HudEditorScreen();
|
||||||
EVENT_BUS.post(new LoadClickGUIEvent());
|
EVENT_BUS.post(new LoadClickGUIEvent());
|
||||||
|
|
||||||
ConfigManager.load();
|
|
||||||
|
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
ConfigManager.save();
|
ConfigManager.save();
|
||||||
EVENT_BUS.post(new ShutdownEvent());
|
EVENT_BUS.post(new ShutdownEvent());
|
||||||
@@ -86,30 +114,34 @@ public class CameraTweaks implements ClientModInitializer {
|
|||||||
|
|
||||||
// se ejecuta cada tick, es decir, 20 veces por segundo
|
// se ejecuta cada tick, es decir, 20 veces por segundo
|
||||||
public void onTick() {
|
public void onTick() {
|
||||||
ModuleManager.INSTANCE.getEnabledModules().forEach(Module::onTick);
|
|
||||||
|
|
||||||
if (!settingsApplied
|
if (!settingsApplied
|
||||||
&& ConfigManager.getConfig() != null
|
&& ConfigManager.getConfig() != null
|
||||||
&& mc.player != null && mc.world != null) {
|
&& !ConfigManager.hasLoaded()) {
|
||||||
ConfigManager.applyConfig();
|
ConfigManager.applyConfig();
|
||||||
settingsApplied = true;
|
settingsApplied = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ModuleManager.INSTANCE.getEnabledModules().forEach(Module::onTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// se ejecuta cada vez que se presiona una tecla
|
// se ejecuta cada vez que se presiona una tecla
|
||||||
public void onKeyPress(int key, int action) {
|
public void onKeyPress(int key, int action) {
|
||||||
|
if (key == GLFW.GLFW_KEY_F3) return; // prevenir activación de módulos al usar combinaciones de F3
|
||||||
ModuleManager.INSTANCE.getEnabledModules().forEach(module -> module.onKey(key, action));
|
ModuleManager.INSTANCE.getEnabledModules().forEach(module -> module.onKey(key, action));
|
||||||
|
|
||||||
boolean anyFocused = isAnySettingButtonFocused() || ClickGUI.INSTANCE.getSearchBar().isFocused();
|
boolean anyFocused = isAnySettingButtonFocused() || ClickGUI.INSTANCE.getSearchBar().isFocused();
|
||||||
ClickGUI.INSTANCE.setAnyFocused(anyFocused);
|
ClickGUI.INSTANCE.setAnyFocused(anyFocused);
|
||||||
|
|
||||||
if (action == GLFW.GLFW_PRESS) {
|
if (action != GLFW.GLFW_RELEASE) {
|
||||||
if (BindCommand.onKeyPress(key)) return;
|
if (BindCommand.onKeyPress(key)) return;
|
||||||
handleSettingButtonsKey(key, action);
|
if (action == GLFW.GLFW_PRESS) {
|
||||||
handleModuleToggle(key, anyFocused);
|
handleModuleToggle(key, anyFocused);
|
||||||
handleClickGUIKey(key, anyFocused);
|
handleClickGUIKey(key, anyFocused);
|
||||||
} else if (action == GLFW.GLFW_RELEASE && !anyFocused) {
|
handleHudEditorKey(key, anyFocused);
|
||||||
|
}
|
||||||
|
handleSettingButtonsKey(key, action);
|
||||||
|
} else if (!anyFocused) {
|
||||||
handleModuleRelease(key);
|
handleModuleRelease(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,11 +181,12 @@ public class CameraTweaks implements ClientModInitializer {
|
|||||||
|
|
||||||
// maneja la lógica de apertura de la interfaz
|
// maneja la lógica de apertura de la interfaz
|
||||||
private void handleClickGUIKey(int key, boolean anyFocused) {
|
private void handleClickGUIKey(int key, boolean anyFocused) {
|
||||||
if (key != ClientSettingsFrame.guiSettings.getKey() || anyFocused) return;
|
if (key != ClientSettingsFrame.guiSettings.getKey() || anyFocused || isOnTypingScreen())
|
||||||
|
return;
|
||||||
|
|
||||||
// al parecer esto hace que con la tecla de la interfaz puedas ir cambiando de splash text en la pantalla del título
|
// al parecer esto hace que con la tecla de la interfaz puedas ir cambiando de splash text en la pantalla del título
|
||||||
// pero me ha hecho gracia así que así se queda
|
// pero me ha hecho gracia así que así se queda
|
||||||
if (mc.currentScreen != ClickGUI.INSTANCE && !(mc.currentScreen instanceof TitleScreen)) {
|
if (mc.currentScreen != ClickGUI.INSTANCE) {
|
||||||
prevScreen = mc.currentScreen;
|
prevScreen = mc.currentScreen;
|
||||||
mc.setScreen(ClickGUI.INSTANCE);
|
mc.setScreen(ClickGUI.INSTANCE);
|
||||||
} else {
|
} else {
|
||||||
@@ -162,6 +195,24 @@ public class CameraTweaks implements ClientModInitializer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// manejar la lógica de apertura del editor de elementos del hud, con la misma lógica que handleClickGUIKey()
|
||||||
|
private void handleHudEditorKey(int key, boolean anyFocused) {
|
||||||
|
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||||
|
if (key != hud.editorKey.getKey() || anyFocused || isOnTypingScreen()) return;
|
||||||
|
|
||||||
|
if (mc.currentScreen != HudEditorScreen.INSTANCE) {
|
||||||
|
if (!hud.isEnabled()) {
|
||||||
|
ChatUtil.warn("HUD está desactivado, lumbreras");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prevScreen = mc.currentScreen;
|
||||||
|
mc.setScreen(HudEditorScreen.INSTANCE);
|
||||||
|
} else {
|
||||||
|
HudEditorScreen.INSTANCE.close();
|
||||||
|
mc.setScreen(prevScreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// se ocupa de apagar los módulos que tengan configurado hacerlo tras soltar su tecla
|
// se ocupa de apagar los módulos que tengan configurado hacerlo tras soltar su tecla
|
||||||
private void handleModuleRelease(int key) {
|
private void handleModuleRelease(int key) {
|
||||||
if (mc.currentScreen != null && mc.currentScreen != ClickGUI.INSTANCE) return;
|
if (mc.currentScreen != null && mc.currentScreen != ClickGUI.INSTANCE) return;
|
||||||
@@ -171,8 +222,19 @@ public class CameraTweaks implements ClientModInitializer {
|
|||||||
module.setEnabled(false);
|
module.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isOnTypingScreen() {
|
||||||
|
return mc.currentScreen instanceof ChatScreen
|
||||||
|
|| mc.currentScreen instanceof AnvilScreen
|
||||||
|
|| mc.currentScreen instanceof AbstractSignEditScreen
|
||||||
|
|| mc.currentScreen instanceof AbstractCommandBlockScreen;
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onStop(ShutdownEvent event) {
|
public void onStop(ShutdownEvent event) {
|
||||||
ConfigManager.save();
|
ConfigManager.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getVersionName() {
|
||||||
|
return MOD_ID + "_v" + MOD_VERSION + "_" + SharedConstants.getGameVersion().name();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,14 @@ package me.retucio.camtweaks.command;
|
|||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import me.retucio.camtweaks.CameraTweaks;
|
||||||
import me.retucio.camtweaks.command.commands.*;
|
import me.retucio.camtweaks.command.commands.*;
|
||||||
|
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||||
|
import me.retucio.camtweaks.module.Module;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@@ -30,15 +34,26 @@ public class CommandManager {
|
|||||||
public static void registerCommands() {
|
public static void registerCommands() {
|
||||||
addCommand(new BindCommand());
|
addCommand(new BindCommand());
|
||||||
addCommand(new CopyScreenshotCommand());
|
addCommand(new CopyScreenshotCommand());
|
||||||
// addCommand(new EnderChestCommand()); no funciona D:
|
addCommand(new EnderChestCommand());
|
||||||
|
addCommand(new GarbageCleanerCommand());
|
||||||
addCommand(new PeekCommand());
|
addCommand(new PeekCommand());
|
||||||
addCommand(new PrefixCommand());
|
addCommand(new PrefixCommand());
|
||||||
addCommand(new PurgeCommand());
|
addCommand(new PurgeCommand());
|
||||||
addCommand(new SaveScreenshotCommand());
|
addCommand(new SaveScreenshotCommand());
|
||||||
addCommand(new SendCommand());
|
addCommand(new SendCommand());
|
||||||
|
addCommand(new SpectateCommand());
|
||||||
addCommand(new ToggleCommand());
|
addCommand(new ToggleCommand());
|
||||||
|
|
||||||
commands.sort(Comparator.comparing(Command::getName));
|
commands.sort(Comparator.comparing(Command::getName));
|
||||||
|
|
||||||
|
for (Command command : commands) {
|
||||||
|
for (Method method : command.getClass().getDeclaredMethods()) {
|
||||||
|
if (method.isAnnotationPresent(SubscribeEvent.class)) {
|
||||||
|
CameraTweaks.EVENT_BUS.register(command);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addCommand(Command command) {
|
public static void addCommand(Command command) {
|
||||||
|
|||||||
@@ -0,0 +1,208 @@
|
|||||||
|
package me.retucio.camtweaks.command.args;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.StringReader;
|
||||||
|
import com.mojang.brigadier.arguments.ArgumentType;
|
||||||
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||||
|
import com.mojang.brigadier.suggestion.Suggestions;
|
||||||
|
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.util.EntityUtil;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
// para autocompletar entidades
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
|
public class EntityArgumentType implements ArgumentType<Entity> {
|
||||||
|
|
||||||
|
public static final EntityArgumentType INSTANCE = new EntityArgumentType();
|
||||||
|
private static final DynamicCommandExceptionType NO_SUCH_ENTITY = new DynamicCommandExceptionType(
|
||||||
|
name -> Text.literal("Entidad \"" + name + "\" no encontrada"));
|
||||||
|
|
||||||
|
private static final Collection<String> EXAMPLES = List.of(
|
||||||
|
"AdlerHitdolf",
|
||||||
|
"@p"
|
||||||
|
);
|
||||||
|
|
||||||
|
private static final Pattern UUID_PATTERN = Pattern.compile(
|
||||||
|
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
|
||||||
|
);
|
||||||
|
|
||||||
|
private EntityArgumentType() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity parse(StringReader reader) throws CommandSyntaxException {
|
||||||
|
String argument = reader.readString();
|
||||||
|
|
||||||
|
if (mc.world == null)
|
||||||
|
throw NO_SUCH_ENTITY.create(argument);
|
||||||
|
|
||||||
|
if (argument.startsWith("@"))
|
||||||
|
return parseSelector(argument);
|
||||||
|
|
||||||
|
if (isUUID(argument)) {
|
||||||
|
UUID uuid = UUID.fromString(argument);
|
||||||
|
return findEntityByUUID(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
return findPlayerByName(argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isUUID(String input) {
|
||||||
|
return UUID_PATTERN.matcher(input).matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Entity parseSelector(String selector) throws CommandSyntaxException {
|
||||||
|
if (mc.player == null) throw NO_SUCH_ENTITY.create(selector);
|
||||||
|
|
||||||
|
return switch (selector.toLowerCase()) {
|
||||||
|
case "@p" ->
|
||||||
|
findNearestPlayer();
|
||||||
|
case "@r" ->
|
||||||
|
findRandomPlayer();
|
||||||
|
case "@s" ->
|
||||||
|
mc.player;
|
||||||
|
case "@a" -> throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.dispatcherUnknownArgument()
|
||||||
|
.createWithContext(new StringReader(selector));
|
||||||
|
default -> {
|
||||||
|
if (selector.startsWith("@e"))
|
||||||
|
yield parseEntitySelector(selector);
|
||||||
|
else if (selector.startsWith("@p") && selector.length() > 2)
|
||||||
|
yield parsePlayerSelector(selector);
|
||||||
|
throw NO_SUCH_ENTITY.create(selector);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private Entity findNearestPlayer() throws CommandSyntaxException {
|
||||||
|
PlayerEntity nearest = null;
|
||||||
|
double nearestDistance = Double.MAX_VALUE;
|
||||||
|
|
||||||
|
for (PlayerEntity player : mc.world.getPlayers()) {
|
||||||
|
if (player == mc.player) continue;
|
||||||
|
|
||||||
|
double distance = mc.player.squaredDistanceTo(player);
|
||||||
|
if (distance < nearestDistance) {
|
||||||
|
nearestDistance = distance;
|
||||||
|
nearest = player;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nearest == null)
|
||||||
|
throw NO_SUCH_ENTITY.create("@p");
|
||||||
|
|
||||||
|
return nearest;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Entity findRandomPlayer() throws CommandSyntaxException {
|
||||||
|
List<PlayerEntity> players = new ArrayList<>(mc.world.getPlayers());
|
||||||
|
if (players.isEmpty()) throw NO_SUCH_ENTITY.create("@r");
|
||||||
|
|
||||||
|
players.remove(mc.player);
|
||||||
|
if (players.isEmpty()) return mc.player;
|
||||||
|
|
||||||
|
Random random = new Random();
|
||||||
|
return players.get(random.nextInt(players.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Entity parseEntitySelector(String selector) throws CommandSyntaxException {
|
||||||
|
if (selector.equals("@e")) {
|
||||||
|
List<Entity> entities = new ArrayList<>();
|
||||||
|
for (Entity entity : mc.world.getEntities())
|
||||||
|
if (!(entity instanceof PlayerEntity))
|
||||||
|
entities.add(entity);
|
||||||
|
|
||||||
|
if (entities.isEmpty()) throw NO_SUCH_ENTITY.create(selector);
|
||||||
|
|
||||||
|
Random random = new Random();
|
||||||
|
return entities.get(random.nextInt(entities.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selector.startsWith("@e[type=")) {
|
||||||
|
String type = selector.substring(8, selector.length() - 1);
|
||||||
|
return findEntityByType(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw NO_SUCH_ENTITY.create(selector);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Entity parsePlayerSelector(String selector) throws CommandSyntaxException {
|
||||||
|
return findNearestPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Entity findEntityByType(String type) throws CommandSyntaxException {
|
||||||
|
List<Entity> matchingEntities = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Entity entity : mc.world.getEntities()) {
|
||||||
|
String entityType = entity.getType().getTranslationKey();
|
||||||
|
if (entityType.contains(type.toLowerCase().replace("minecraft:", "")))
|
||||||
|
matchingEntities.add(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matchingEntities.isEmpty()) throw NO_SUCH_ENTITY.create(type);
|
||||||
|
|
||||||
|
Entity nearest = null;
|
||||||
|
double nearestDistance = Double.MAX_VALUE;
|
||||||
|
|
||||||
|
for (Entity entity : matchingEntities) {
|
||||||
|
double distance = mc.player.squaredDistanceTo(entity);
|
||||||
|
if (distance < nearestDistance) {
|
||||||
|
nearestDistance = distance;
|
||||||
|
nearest = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nearest;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Entity findEntityByUUID(UUID uuid) throws CommandSyntaxException {
|
||||||
|
for (Entity entity : mc.world.getEntities())
|
||||||
|
if (entity.getUuid().equals(uuid))
|
||||||
|
return entity;
|
||||||
|
|
||||||
|
throw NO_SUCH_ENTITY.create(uuid.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private PlayerEntity findPlayerByName(String name) throws CommandSyntaxException {
|
||||||
|
for (PlayerEntity player : mc.world.getPlayers())
|
||||||
|
if (player.getName().getString().equalsIgnoreCase(name))
|
||||||
|
return player;
|
||||||
|
|
||||||
|
throw NO_SUCH_ENTITY.create(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
||||||
|
if (mc.world != null)
|
||||||
|
for (PlayerEntity player : mc.world.getPlayers())
|
||||||
|
builder.suggest(player.getName().getString());
|
||||||
|
|
||||||
|
|
||||||
|
builder.suggest("@p");
|
||||||
|
builder.suggest("@r");
|
||||||
|
builder.suggest("@s");
|
||||||
|
|
||||||
|
Entity lookingAt = EntityUtil.getEntityPlayerIsLookingAt();
|
||||||
|
if (lookingAt != null)
|
||||||
|
builder.suggest(lookingAt.getUuid().toString());
|
||||||
|
|
||||||
|
return builder.buildFuture();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<String> getExamples() {
|
||||||
|
return EXAMPLES;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Entity get(CommandContext<?> context, String name) {
|
||||||
|
return context.getArgument(name, Entity.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
public class ModuleArgumentType implements ArgumentType<Module> {
|
public class ModuleArgumentType implements ArgumentType<Module> {
|
||||||
|
|
||||||
public static final ModuleArgumentType INSTANCE = new ModuleArgumentType();
|
public static final ModuleArgumentType INSTANCE = new ModuleArgumentType();
|
||||||
private static final DynamicCommandExceptionType unknownModuleE = new DynamicCommandExceptionType(
|
private static final DynamicCommandExceptionType UNKNOWN_MODULE = new DynamicCommandExceptionType(
|
||||||
name -> Text.literal("módulo \"" + name + "\" no encontrado"));
|
name -> Text.literal("módulo \"" + name + "\" no encontrado"));
|
||||||
|
|
||||||
private static final Collection<String> examples = ModuleManager.INSTANCE.getModules()
|
private static final Collection<String> examples = ModuleManager.INSTANCE.getModules()
|
||||||
@@ -29,7 +29,7 @@ public class ModuleArgumentType implements ArgumentType<Module> {
|
|||||||
public Module parse(StringReader reader) throws CommandSyntaxException {
|
public Module parse(StringReader reader) throws CommandSyntaxException {
|
||||||
String argument = reader.readString().replace("_", " ");
|
String argument = reader.readString().replace("_", " ");
|
||||||
Module module = ModuleManager.INSTANCE.getModuleByName(argument);
|
Module module = ModuleManager.INSTANCE.getModuleByName(argument);
|
||||||
if (module == null) throw unknownModuleE.create(argument);
|
if (module == null) throw UNKNOWN_MODULE.create(argument);
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ public class PlayerArgumentType implements ArgumentType<PlayerEntity> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
||||||
return CommandSource.suggestMatching(mc.world.getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getName().getString()), builder);
|
return CommandSource.suggestMatching(mc.world.getPlayers().stream().map(
|
||||||
|
abstractClientPlayerEntity -> abstractClientPlayerEntity.getName().getString()), builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ public class BindCommand extends Command {
|
|||||||
public static boolean onKeyPress(int key) {
|
public static boolean onKeyPress(int key) {
|
||||||
if (listeningModule == null) return false;
|
if (listeningModule == null) return false;
|
||||||
KeySetting bind = listeningModule.getBind();
|
KeySetting bind = listeningModule.getBind();
|
||||||
if (bind != null)
|
if (bind != null) bind.setKey(key);
|
||||||
bind.setKey(key);
|
|
||||||
|
|
||||||
ChatUtil.info(
|
ChatUtil.info(
|
||||||
Text.of("la tecla " + Formatting.AQUA + KeyUtil.getKeyName(key) + Formatting.RESET +
|
Text.of("la tecla " + Formatting.AQUA + KeyUtil.getKeyName(key) + Formatting.RESET +
|
||||||
|
|||||||
@@ -1,37 +1,47 @@
|
|||||||
package me.retucio.camtweaks.command.commands;
|
package me.retucio.camtweaks.command.commands;
|
||||||
|
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
import me.retucio.camtweaks.CameraTweaks;
|
||||||
import me.retucio.camtweaks.command.Command;
|
import me.retucio.camtweaks.command.Command;
|
||||||
import net.minecraft.client.gui.screen.ingame.GenericContainerScreen;
|
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||||
|
import me.retucio.camtweaks.event.events.TickEvent;
|
||||||
|
import me.retucio.camtweaks.ui.screen.PreviewScreen;
|
||||||
|
import me.retucio.camtweaks.util.ChatUtil;
|
||||||
|
import me.retucio.camtweaks.util.InventoryUtil;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.inventory.EnderChestInventory;
|
|
||||||
import net.minecraft.inventory.Inventories;
|
|
||||||
import net.minecraft.inventory.Inventory;
|
|
||||||
import net.minecraft.inventory.SimpleInventory;
|
|
||||||
import net.minecraft.screen.GenericContainerScreenHandler;
|
|
||||||
import net.minecraft.text.Text;
|
|
||||||
|
|
||||||
// accede a los contenidos de tu enderchest
|
// accede a los contenidos de tu enderchest
|
||||||
public class EnderChestCommand extends Command {
|
public class EnderChestCommand extends Command {
|
||||||
|
|
||||||
|
private boolean shouldOpenEchest = false;
|
||||||
|
|
||||||
public EnderChestCommand() {
|
public EnderChestCommand() {
|
||||||
super("echest", "muestra el contenido de tu enderchest", "ec", "enderchest");
|
super("echest", "muestra el contenido de tu enderchest (solo de ver)", "ec", "enderchest");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||||
builder.executes(ctx -> {
|
builder.executes(ctx -> {
|
||||||
mc.execute(() -> { // para evitar llamar setScreen desde el hilo equivocado, que causa crashes
|
mc.execute(() -> {
|
||||||
EnderChestInventory enderChestInv = mc.player.getEnderChestInventory();
|
if (mc.player == null) return;
|
||||||
|
if (InventoryUtil.getEchestInv() == null) {
|
||||||
|
ChatUtil.warn("necesitas abrir un enderchest una vez primero");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// llámame imbécil pero no tengo ni idea de por qué no se abre
|
shouldOpenEchest = true;
|
||||||
mc.setScreen(new GenericContainerScreen(
|
|
||||||
GenericContainerScreenHandler.createGeneric9x3(mc.player.currentScreenHandler.syncId + 1, mc.player.getInventory(), enderChestInv),
|
|
||||||
mc.player.getInventory(),
|
|
||||||
Text.translatable("container.enderchest")
|
|
||||||
));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onTick(TickEvent.Post event) {
|
||||||
|
if (shouldOpenEchest) {
|
||||||
|
shouldOpenEchest = false;
|
||||||
|
if (InventoryUtil.getEchestInv() != null)
|
||||||
|
mc.setScreen(new PreviewScreen(InventoryUtil.getEchestInv(), null));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package me.retucio.camtweaks.command.commands;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
import me.retucio.camtweaks.command.Command;
|
||||||
|
import me.retucio.camtweaks.util.ChatUtil;
|
||||||
|
import net.minecraft.command.CommandSource;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
public class GarbageCleanerCommand extends Command {
|
||||||
|
|
||||||
|
public GarbageCleanerCommand() {
|
||||||
|
super("gc", "limpia la ram mediante el recolector de basura (gc)", "garbagecollect");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||||
|
builder.executes(context -> {
|
||||||
|
System.gc();
|
||||||
|
ChatUtil.info(Text.of("basura recolectada"));
|
||||||
|
return SUCCESS;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package me.retucio.camtweaks.command.commands;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
import me.retucio.camtweaks.command.Command;
|
||||||
|
import me.retucio.camtweaks.command.args.EntityArgumentType;
|
||||||
|
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||||
|
import me.retucio.camtweaks.event.events.KeyEvent;
|
||||||
|
import me.retucio.camtweaks.util.EntityUtil;
|
||||||
|
import me.retucio.camtweaks.util.MiscUtil;
|
||||||
|
import net.minecraft.command.CommandSource;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
public class SpectateCommand extends Command {
|
||||||
|
|
||||||
|
public SpectateCommand() {
|
||||||
|
super("espectar", "te permite adquirir el punto de vista de una entidad", "spectate", "spec");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||||
|
builder
|
||||||
|
.executes(ctx -> { // If no argument, use the entity player is looking at
|
||||||
|
mc.execute(() -> {
|
||||||
|
Entity target = EntityUtil.getEntityPlayerIsLookingAt();
|
||||||
|
if (target != null)
|
||||||
|
mc.setCameraEntity(target);
|
||||||
|
});
|
||||||
|
return SUCCESS;
|
||||||
|
})
|
||||||
|
.then(argument("entidad", EntityArgumentType.INSTANCE)
|
||||||
|
.executes(ctx -> {
|
||||||
|
Entity entity = EntityArgumentType.get(ctx, "entidad");
|
||||||
|
if (mc.player != null && entity != null) {
|
||||||
|
mc.setCameraEntity(entity);
|
||||||
|
}
|
||||||
|
return SUCCESS;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onKey(KeyEvent event) {
|
||||||
|
if (mc.getCameraEntity() != mc.player && mc.currentScreen == null
|
||||||
|
&& event.getKey() == GLFW.GLFW_KEY_ESCAPE && event.getAction() != GLFW.GLFW_RELEASE ) {
|
||||||
|
event.cancel();
|
||||||
|
mc.setCameraEntity(mc.player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ package me.retucio.camtweaks.config;
|
|||||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||||
import me.retucio.camtweaks.event.events.camtweaks.*;
|
import me.retucio.camtweaks.event.events.camtweaks.*;
|
||||||
import me.retucio.camtweaks.module.settings.*;
|
import me.retucio.camtweaks.module.settings.*;
|
||||||
import me.retucio.camtweaks.ui.ClickGUI;
|
import me.retucio.camtweaks.ui.screen.ClickGUI;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -26,11 +26,19 @@ public class ClientConfig {
|
|||||||
// nombre del frame -> FrameData (que contiene extended, x & y)
|
// nombre del frame -> FrameData (que contiene extended, x & y)
|
||||||
public Map<String, FrameData> extendableFrames = new HashMap<>();
|
public Map<String, FrameData> extendableFrames = new HashMap<>();
|
||||||
|
|
||||||
|
// id del elemento del hud -> posición (x, y)
|
||||||
|
public Map<String, int[]> hudPositions = new HashMap<>();
|
||||||
|
|
||||||
|
// id del elemento del hud -> true: visible / false: no visible
|
||||||
|
public Map<String, Boolean> hudVisibilities = new HashMap<>();
|
||||||
|
|
||||||
|
// posición de la barra de búsqueda (x, y)
|
||||||
|
public int[] searchBarPosition = new int[]{340, 16};
|
||||||
|
|
||||||
public ClientConfig() {
|
public ClientConfig() {
|
||||||
EVENT_BUS.register(this);
|
EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onToggleModule(ToggleModuleEvent event) {
|
public void onToggleModule(ToggleModuleEvent event) {
|
||||||
ConfigManager.setModuleState(event.getModule());
|
ConfigManager.setModuleState(event.getModule());
|
||||||
@@ -49,7 +57,9 @@ public class ClientConfig {
|
|||||||
case KeySetting k: value = k.getKey(); break;
|
case KeySetting k: value = k.getKey(); break;
|
||||||
case NumberSetting n: value = n.getValue(); break;
|
case NumberSetting n: value = n.getValue(); break;
|
||||||
case StringSetting s: value = s.getValue(); break;
|
case StringSetting s: value = s.getValue(); break;
|
||||||
case ListSetting l: value = l.getValues(); break;
|
case ListSetting l: value = l.getConfigValues(); break;
|
||||||
|
case ColorSetting c: value = c.getConfigValue(); break;
|
||||||
|
case OptionSetting o: value = o.getIndex(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import me.retucio.camtweaks.CameraTweaks;
|
|||||||
import me.retucio.camtweaks.module.Module;
|
import me.retucio.camtweaks.module.Module;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
import me.retucio.camtweaks.module.settings.*;
|
import me.retucio.camtweaks.module.settings.*;
|
||||||
import me.retucio.camtweaks.ui.ClickGUI;
|
import me.retucio.camtweaks.ui.frames.ModuleFrame;
|
||||||
|
import me.retucio.camtweaks.ui.screen.ClickGUI;
|
||||||
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
||||||
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
||||||
|
|
||||||
@@ -24,22 +25,28 @@ public class ConfigManager {
|
|||||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||||
private static final File CONFIG_FILE = new File("camera_tweaks.json");
|
private static final File CONFIG_FILE = new File("camera_tweaks.json");
|
||||||
|
|
||||||
|
private static boolean loaded = false;
|
||||||
private static ClientConfig config = null;
|
private static ClientConfig config = null;
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------ MÉTODOS PRINCIPALES ------------------
|
||||||
|
|
||||||
// guardar configuraciones
|
// guardar configuraciones
|
||||||
public static void save() {
|
public static void save() {
|
||||||
ensureConfig();
|
ensureConfig();
|
||||||
|
|
||||||
try (FileWriter writer = new FileWriter(CONFIG_FILE)) {
|
try (FileWriter writer = new FileWriter(CONFIG_FILE)) {
|
||||||
GSON.toJson(config, writer);
|
GSON.toJson(config, writer);
|
||||||
CameraTweaks.LOGGER.info("ajustes guardados");
|
CameraTweaks.LOGGER.info("ajustes guardados");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
CameraTweaks.LOGGER.error("error al guardar ajustes", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// cargar configuraciones
|
// cargar configuraciones
|
||||||
public static void load() {
|
public static void load() {
|
||||||
CameraTweaks.LOGGER.info("ajustes cargados");
|
CameraTweaks.LOGGER.info("cargando ajustes...");
|
||||||
|
|
||||||
if (!CONFIG_FILE.exists()) {
|
if (!CONFIG_FILE.exists()) {
|
||||||
ensureConfig();
|
ensureConfig();
|
||||||
save();
|
save();
|
||||||
@@ -48,73 +55,53 @@ public class ConfigManager {
|
|||||||
|
|
||||||
try (FileReader reader = new FileReader(CONFIG_FILE)) {
|
try (FileReader reader = new FileReader(CONFIG_FILE)) {
|
||||||
config = GSON.fromJson(reader, ClientConfig.class);
|
config = GSON.fromJson(reader, ClientConfig.class);
|
||||||
|
CameraTweaks.LOGGER.info("ajustes cargados");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
CameraTweaks.LOGGER.error("no se pudieron cargar los ajustes, usando ajustes por defecto", e);
|
||||||
ensureConfig();
|
ensureConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// aplicar configuraciones cargadas
|
// aplicar configuraciones cargadas
|
||||||
public static void applyConfig() {
|
public static void applyConfig() {
|
||||||
if (CameraTweaks.mc == null || ModuleManager.INSTANCE == null || config == null)
|
if (!shouldApply()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
applyModuleStates();
|
||||||
if (config.moduleStates.containsKey(module.getName()))
|
applyModuleSettings();
|
||||||
module.setEnabled(config.moduleStates.get(module.getName())); // estados
|
applySettingsFrames();
|
||||||
|
applySearchBarPosition();
|
||||||
|
applyGuiSettings();
|
||||||
|
applyExtendableFrames();
|
||||||
|
|
||||||
module.getSettings().forEach(setting -> applySetting(module, setting));
|
loaded = true;
|
||||||
|
CameraTweaks.LOGGER.info("ajustes aplicados");
|
||||||
if (config.settingsFrames.containsKey(module.getName())) {
|
|
||||||
int[] position = config.settingsFrames.get(module.getName());
|
|
||||||
ClickGUI.INSTANCE.openSettingsFrame(module, position[0], position[1]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ClientSettingsFrame.guiSettings.setEnabled(true);
|
|
||||||
ClientSettingsFrame.guiSettings.getSettings().forEach(setting -> applySetting(ClientSettingsFrame.guiSettings, setting));
|
|
||||||
|
|
||||||
CameraTweaks.LOGGER.info("módulos encendidos cargados");
|
|
||||||
CameraTweaks.LOGGER.info("ajustes de módulos cargados");
|
|
||||||
|
|
||||||
ClientConfig.FrameData moduleFrameData = config.extendableFrames.get("M");
|
|
||||||
if (moduleFrameData != null) {
|
|
||||||
ClickGUI.INSTANCE.getModulesFrame().x = moduleFrameData.x();
|
|
||||||
ClickGUI.INSTANCE.getModulesFrame().y = moduleFrameData.y();
|
|
||||||
ClickGUI.INSTANCE.getModulesFrame().extended = moduleFrameData.extended();
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientConfig.FrameData guiSettingsData = config.extendableFrames.get("S");
|
|
||||||
if (guiSettingsData != null) {
|
|
||||||
ClickGUI.INSTANCE.getGuiSettingsFrame().x = guiSettingsData.x();
|
|
||||||
ClickGUI.INSTANCE.getGuiSettingsFrame().y = guiSettingsData.y();
|
|
||||||
ClickGUI.INSTANCE.getGuiSettingsFrame().extended = guiSettingsData.extended();
|
|
||||||
}
|
|
||||||
|
|
||||||
CameraTweaks.LOGGER.info("posiciones de frames cargadas");
|
|
||||||
ClickGUI.INSTANCE.refreshListButtons();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// obtener configuración actual
|
||||||
public static ClientConfig getConfig() {
|
public static ClientConfig getConfig() {
|
||||||
|
ensureConfig();
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------ GUARDAR VALORES INDIVIDUALES EN LA CONFIG. ------------------
|
||||||
|
|
||||||
public static void setModuleState(Module module) {
|
public static void setModuleState(Module module) {
|
||||||
ensureConfig();
|
ensureConfig();
|
||||||
config.moduleStates.put(module.getName(), module.isEnabled());
|
config.moduleStates.put(module.getName(), module.isEnabled());
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSetting(AbstractSetting setting, Object value) {
|
public static void setSetting(Setting setting, Object value) {
|
||||||
ensureConfig();
|
ensureConfig();
|
||||||
config.settings.put(setting.getModule().getName() + ":" + setting.getName(), value);
|
config.settings.put(getSettingKey(setting), value);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setFramePosition(SettingsFrame frame) {
|
public static void setFramePosition(SettingsFrame frame) {
|
||||||
ensureConfig();
|
ensureConfig();
|
||||||
config.settingsFrames.put(frame.module.getName(), new int[]{frame.x, frame.y});
|
config.settingsFrames.put(frame.module.getName(), new int[] {frame.x, frame.y});
|
||||||
ConfigManager.save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setExtendableFrame(String key, ClientConfig.FrameData data) {
|
public static void setExtendableFrame(String key, ClientConfig.FrameData data) {
|
||||||
@@ -123,34 +110,212 @@ public class ConfigManager {
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setHudPosition(String id, int x, int y) {
|
||||||
|
ensureConfig();
|
||||||
|
config.hudPositions.put(id, new int[] {x, y});
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setHudVisibility(String id, Boolean visible) {
|
||||||
|
ensureConfig();
|
||||||
|
config.hudVisibilities.put(id, visible);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setSearchBarPosition(int x, int y) {
|
||||||
|
ensureConfig();
|
||||||
|
config.searchBarPosition = new int[] {x, y};
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------ APLICAR AJUSTES ------------------
|
||||||
|
|
||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public static void applySetting(Module parent, AbstractSetting setting) {
|
public static void applySetting(Module parent, Setting setting) {
|
||||||
String id = parent.getName() + ":" + setting.getName();
|
String key = getSettingKey(setting);
|
||||||
if (config.settings.containsKey(id)) {
|
|
||||||
Object value = config.settings.get(id);
|
if (!config.settings.containsKey(key)) return;
|
||||||
|
|
||||||
|
Object value = config.settings.get(key);
|
||||||
|
|
||||||
switch (setting) {
|
switch (setting) {
|
||||||
case BooleanSetting b -> b.setEnabled((boolean) value);
|
case BooleanSetting booleanSetting -> applyBooleanSetting(booleanSetting, value);
|
||||||
case EnumSetting e -> e.setIndex(value instanceof Double val ? val.intValue() : (int) value);
|
case EnumSetting enumSetting -> applyEnumSetting(enumSetting, value);
|
||||||
case NumberSetting n -> n.setValue((double) value);
|
case NumberSetting numberSetting -> applyNumberSetting(numberSetting, value);
|
||||||
case StringSetting s -> s.setValue((String) value);
|
case StringSetting stringSetting -> applyStringSetting(stringSetting, value);
|
||||||
case KeySetting k -> k.setKey(value instanceof Double val ? val.intValue() : (int) value);
|
case KeySetting keySetting -> applyKeySetting(keySetting, value);
|
||||||
case ListSetting l -> {
|
case ListSetting listSetting -> applyListSetting(listSetting, value);
|
||||||
|
case ColorSetting colorSetting -> applyColorSetting(colorSetting, value);
|
||||||
|
case OptionSetting optionSetting -> applyOptionSetting(optionSetting, value);
|
||||||
|
default -> CameraTweaks.LOGGER.warn("watafac queseso: {}", setting.getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyModuleStates() {
|
||||||
|
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
||||||
|
if (config.moduleStates.containsKey(module.getName())) {
|
||||||
|
module.setEnabled(config.moduleStates.get(module.getName()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CameraTweaks.LOGGER.info("estados de módulos aplicados");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyModuleSettings() {
|
||||||
|
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
||||||
|
module.getSettings().forEach(setting -> applySetting(module, setting));
|
||||||
|
});
|
||||||
|
CameraTweaks.LOGGER.info("ajustes de módulos aplicados");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applySettingsFrames() {
|
||||||
|
config.settingsFrames.forEach((moduleName, position) -> {
|
||||||
|
Module module = ModuleManager.INSTANCE.getModuleByName(moduleName);
|
||||||
|
ClickGUI.INSTANCE.openSettingsFrame(module, position[0], position[1]);
|
||||||
|
});
|
||||||
|
CameraTweaks.LOGGER.info("estados de marcos de ajustes aplicados");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applySearchBarPosition() {
|
||||||
|
if (config.searchBarPosition != null && config.searchBarPosition.length == 2) {
|
||||||
|
ClickGUI.INSTANCE.getSearchBar().setX(config.searchBarPosition[0]);
|
||||||
|
ClickGUI.INSTANCE.getSearchBar().setY(config.searchBarPosition[1]);
|
||||||
|
}
|
||||||
|
CameraTweaks.LOGGER.info("posición de la barra de búsqueda aplicada");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyGuiSettings() {
|
||||||
|
ClientSettingsFrame.guiSettings.setEnabled(true);
|
||||||
|
ClientSettingsFrame.guiSettings.getSettings().forEach(setting -> {
|
||||||
|
applySetting(ClientSettingsFrame.guiSettings, setting);
|
||||||
|
});
|
||||||
|
CameraTweaks.LOGGER.info("ajustes del cliente aplicados");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyExtendableFrames() {
|
||||||
|
applyExtendableFrame(ClickGUI.INSTANCE.getModulesFrame());
|
||||||
|
applyExtendableFrame(ClickGUI.INSTANCE.getGuiSettingsFrame());
|
||||||
|
|
||||||
|
CameraTweaks.LOGGER.info("posiciones de marcos extendibles aplicadasa");
|
||||||
|
ClickGUI.INSTANCE.refreshListButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyExtendableFrame(ModuleFrame frame) {
|
||||||
|
ClientConfig.FrameData frameData = config.extendableFrames.get("M");
|
||||||
|
if (frameData != null) {
|
||||||
|
frame.x = frameData.x();
|
||||||
|
frame.y = frameData.y();
|
||||||
|
frame.extended = frameData.extended();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyExtendableFrame(ClientSettingsFrame frame) {
|
||||||
|
ClientConfig.FrameData frameData = config.extendableFrames.get("S");
|
||||||
|
if (frameData != null) {
|
||||||
|
frame.x = frameData.x();
|
||||||
|
frame.y = frameData.y();
|
||||||
|
frame.extended = frameData.extended();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ajustes de módulos
|
||||||
|
|
||||||
|
private static void applyBooleanSetting(BooleanSetting setting, Object value) {
|
||||||
|
if (value instanceof Boolean) {
|
||||||
|
setting.setEnabled((Boolean) value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T extends Enum<T>> void applyEnumSetting(EnumSetting<T> setting, Object value) {
|
||||||
|
if (value instanceof Double) {
|
||||||
|
setting.setIndex(((Double) value).intValue());
|
||||||
|
} else if (value instanceof Integer) {
|
||||||
|
setting.setIndex((Integer) value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyNumberSetting(NumberSetting setting, Object value) {
|
||||||
|
if (value instanceof Double) {
|
||||||
|
setting.setValue((Double) value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyStringSetting(StringSetting setting, Object value) {
|
||||||
|
if (value instanceof String) {
|
||||||
|
setting.setValue((String) value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyKeySetting(KeySetting setting, Object value) {
|
||||||
|
if (value instanceof Double) {
|
||||||
|
setting.setKey(((Double) value).intValue());
|
||||||
|
} else if (value instanceof Integer) {
|
||||||
|
setting.setKey((Integer) value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> void applyListSetting(ListSetting<T> setting, Object value) {
|
||||||
if (value instanceof Map<?, ?> map) {
|
if (value instanceof Map<?, ?> map) {
|
||||||
Map<Object, Boolean> converted = new HashMap<>();
|
Map<T, Boolean> convertedValues = new HashMap<>();
|
||||||
for (Object option : l.getOptions()) {
|
|
||||||
Object key = String.valueOf(option);
|
for (T option : setting.getOptions()) {
|
||||||
Object bv = map.get(key);
|
String key = setting.getDisplayName(option);
|
||||||
converted.put(option, bv instanceof Boolean b && b);
|
Object booleanValue = map.get(key);
|
||||||
|
convertedValues.put(option, booleanValue instanceof Boolean && (Boolean) booleanValue);
|
||||||
}
|
}
|
||||||
l.setValues(converted);
|
|
||||||
}
|
setting.setValues(convertedValues);
|
||||||
} default -> {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void applyColorSetting(ColorSetting setting, Object value) {
|
||||||
|
if (!(value instanceof Map<?, ?> map)) return;
|
||||||
|
|
||||||
|
Number r = (Number) map.get("r");
|
||||||
|
Number g = (Number) map.get("g");
|
||||||
|
Number b = (Number) map.get("b");
|
||||||
|
Number a = (Number) map.get("a");
|
||||||
|
|
||||||
|
if (r != null && g != null && b != null && a != null)
|
||||||
|
setting.setRGB(r.intValue(), g.intValue(), b.intValue(), a.intValue());
|
||||||
|
|
||||||
|
applyOptionalProperty(map, "rb", Boolean.class, setting::setRainbow);
|
||||||
|
applyOptionalProperty(map, "rs", Number.class, val -> setting.setRainbowSpeed(val.intValue()));
|
||||||
|
applyOptionalProperty(map, "sat", Number.class, val -> setting.setSaturation(val.floatValue()));
|
||||||
|
applyOptionalProperty(map, "bri", Number.class, val -> setting.setBrightness(val.floatValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T> void applyOptionSetting(OptionSetting<T> setting, Object value) {
|
||||||
|
if (value instanceof Double) {
|
||||||
|
int index = ((Double) value).intValue();
|
||||||
|
setting.setValue(setting.getOption(index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> void applyOptionalProperty(Map<?, ?> map, String key, Class<T> type, java.util.function.Consumer<T> setter) {
|
||||||
|
Object value = map.get(key);
|
||||||
|
if (type.isInstance(value)) {
|
||||||
|
setter.accept(type.cast(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------ MÉTODOS DE AYUDA ------------------
|
||||||
|
|
||||||
|
private static boolean shouldApply() {
|
||||||
|
return CameraTweaks.mc != null && ModuleManager.INSTANCE != null && config != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void ensureConfig() {
|
private static void ensureConfig() {
|
||||||
if (config == null) config = new ClientConfig();
|
if (config == null) config = new ClientConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getSettingKey(Setting setting) {
|
||||||
|
return setting.getModule().getName() + ":" + setting.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasLoaded() {
|
||||||
|
return loaded;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package me.retucio.camtweaks.event;
|
|||||||
|
|
||||||
// evento base, cancelable (usado en mixins)
|
// evento base, cancelable (usado en mixins)
|
||||||
public class Event {
|
public class Event {
|
||||||
|
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.*;
|
|||||||
|
|
||||||
// al llamar un evento, se guarda en el bus de eventos, de donde luego se puede detectar si ese evento ha sucedido
|
// al llamar un evento, se guarda en el bus de eventos, de donde luego se puede detectar si ese evento ha sucedido
|
||||||
public class EventBus {
|
public class EventBus {
|
||||||
|
|
||||||
private final Map<Class<?>, List<ListenerMethod>> listeners = new HashMap<>();
|
private final Map<Class<?>, List<ListenerMethod>> listeners = new HashMap<>();
|
||||||
|
|
||||||
private record ListenerMethod(Object instance, Method method) {}
|
private record ListenerMethod(Object instance, Method method) {}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package me.retucio.camtweaks.event;
|
||||||
|
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onJoinWorld
|
||||||
|
*/
|
||||||
|
public class JoinWorldEvent extends Event {
|
||||||
|
|
||||||
|
private final ClientWorld world;
|
||||||
|
|
||||||
|
public JoinWorldEvent(ClientWorld world) {
|
||||||
|
this.world = world;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientWorld getWorld() {
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.ClientWorldMixin#onAddEntity
|
||||||
|
*/
|
||||||
|
public class AddEntityEvent extends Event {
|
||||||
|
|
||||||
|
private final Entity entity;
|
||||||
|
|
||||||
|
public AddEntityEvent(Entity entity) {
|
||||||
|
this.entity = entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Entity getEntity() {
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.ClientPlayerInteractionManagerMixin#onAttackEntity
|
||||||
|
*/
|
||||||
|
public class AttackEntityEvent extends Event {
|
||||||
|
|
||||||
|
private final Entity entity;
|
||||||
|
|
||||||
|
public AttackEntityEvent(Entity entity) {
|
||||||
|
this.entity = entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Entity getEntity() {
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.ClientPlayerInteractionManagerMixin#onBlockBreak
|
||||||
|
*/
|
||||||
|
public class BreakBlockEvent extends Event {
|
||||||
|
|
||||||
|
private BlockPos pos;
|
||||||
|
|
||||||
|
public BreakBlockEvent(BlockPos pos) {
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockPos getPos() {
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPos(BlockPos pos) {
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.EntityMixin#onRotation
|
||||||
|
* @see me.retucio.camtweaks.mixin.EntityMixin#onChangeYaw
|
||||||
|
* @see me.retucio.camtweaks.mixin.EntityMixin#onChangePitch
|
||||||
|
*/
|
||||||
|
public class ChangeRotationEvent extends Event {
|
||||||
|
|
||||||
|
private float yaw;
|
||||||
|
private float pitch;
|
||||||
|
|
||||||
|
public ChangeRotationEvent(float yaw, float pitch) {
|
||||||
|
this.yaw = yaw;
|
||||||
|
this.pitch = pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getYaw() {
|
||||||
|
return yaw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYaw(float yaw) {
|
||||||
|
this.yaw = yaw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getPitch() {
|
||||||
|
return pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPitch(float pitch) {
|
||||||
|
this.pitch = pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,8 @@ package me.retucio.camtweaks.event.events;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.ChunkOcclusionDataBuilderMixin#onChunkOcclusion
|
* @see me.retucio.camtweaks.mixin.ChunkOcclusionDataBuilderMixin#onChunkOcclusion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ChunkOcclusionEvent extends Event {}
|
public class ChunkOcclusionEvent extends Event {}
|
||||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
|||||||
|
|
||||||
import net.minecraft.text.ClickEvent;
|
import net.minecraft.text.ClickEvent;
|
||||||
|
|
||||||
|
|
||||||
/** este evento es solo para asegurarse de que comandos del mod se puedan ejecutar solo desde el lado del cliente
|
/** este evento es solo para asegurarse de que comandos del mod se puedan ejecutar solo desde el lado del cliente
|
||||||
* @see me.retucio.camtweaks.module.modules.ChatPlus#getSendButton
|
* @see me.retucio.camtweaks.module.modules.ChatPlus#getSendButton
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ClientClickEvent implements ClickEvent {
|
public class ClientClickEvent implements ClickEvent {
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.ItemStackMixin#onDamage
|
||||||
|
*/
|
||||||
|
public class DamageItemEvent extends Event {
|
||||||
|
|
||||||
|
private final int amount;
|
||||||
|
private final ItemStack stack;
|
||||||
|
|
||||||
|
public DamageItemEvent(int amount, ItemStack stack) {
|
||||||
|
this.amount = amount;
|
||||||
|
this.stack = stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getStack() {
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,28 @@
|
|||||||
package me.retucio.camtweaks.event.events;
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
import net.minecraft.client.network.ServerInfo;
|
||||||
|
import net.minecraft.network.DisconnectionInfo;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onDisconnect
|
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onDisconnect
|
||||||
*/
|
*/
|
||||||
|
public class DisconnectEvent extends Event {
|
||||||
|
|
||||||
public class DisconnectEvent extends Event {}
|
private final DisconnectionInfo info;
|
||||||
|
private final ServerInfo server;
|
||||||
|
|
||||||
|
public DisconnectEvent(DisconnectionInfo info, ServerInfo server) {
|
||||||
|
this.info = info;
|
||||||
|
this.server = server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DisconnectionInfo getInfo() {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerInfo getServer() {
|
||||||
|
return server;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.GameRendererMixin#modifyFov
|
* @see me.retucio.camtweaks.mixin.GameRendererMixin#modifyFov
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class GetFOVEvent extends Event {
|
public class GetFOVEvent extends Event {
|
||||||
|
|
||||||
private float fov;
|
private float fov;
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.ClientPlayerInteractionManagerMixin#onEntityInteract
|
||||||
|
*/
|
||||||
|
public class InteractEntityEvent extends Event {
|
||||||
|
|
||||||
|
private final Entity entity;
|
||||||
|
private Hand hand;
|
||||||
|
|
||||||
|
public InteractEntityEvent(Entity entity, Hand hand) {
|
||||||
|
this.entity = entity;
|
||||||
|
this.hand = hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Entity getEntity() {
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Hand getHand() {
|
||||||
|
return hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHand(Hand hand) {
|
||||||
|
this.hand = hand;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.KeyboardMixin#onKeyPress
|
* @see me.retucio.camtweaks.mixin.KeyboardMixin#onKeyPress
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class KeyEvent extends Event {
|
public class KeyEvent extends Event {
|
||||||
|
|
||||||
private final int key, scancode, action;
|
private final int key, scancode, action;
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.MouseMixin#onMouseButton
|
* @see me.retucio.camtweaks.mixin.MouseMixin#onMouseButton
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MouseClickEvent extends Event {
|
public class MouseClickEvent extends Event {
|
||||||
|
|
||||||
private final int action, button;
|
private final int action, button;
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.MouseMixin#onMouseScroll
|
* @see me.retucio.camtweaks.mixin.MouseMixin#onMouseScroll
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MouseScrollEvent extends Event {
|
public class MouseScrollEvent extends Event {
|
||||||
|
|
||||||
private double horizontal, vertical;
|
private double horizontal, vertical;
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package me.retucio.camtweaks.event.events;
|
|||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onOpenScreen
|
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onOpenScreen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class OpenScreenEvent extends Event {
|
public class OpenScreenEvent extends Event {
|
||||||
|
|
||||||
private final Screen screen;
|
private final Screen screen;
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
package me.retucio.camtweaks.event.events;
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
import me.retucio.camtweaks.event.Stage;
|
import me.retucio.camtweaks.event.Stage;
|
||||||
import net.minecraft.network.packet.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onSendPacketPre
|
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onSendPacketPre
|
||||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onSendPacketPost
|
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onSendPacketPost
|
||||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onReceivePacket
|
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onReceivePacket
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PacketEvent {
|
public class PacketEvent {
|
||||||
|
|
||||||
public static class Send extends Event {
|
public static class Send extends Event {
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package me.retucio.camtweaks.event.events;
|
|||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
import net.minecraft.client.option.Perspective;
|
import net.minecraft.client.option.Perspective;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.GameOptionsMixin#changePerspective
|
* @see me.retucio.camtweaks.mixin.GameOptionsMixin#changePerspective
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PerspectiveChangeEvent extends Event {
|
public class PerspectiveChangeEvent extends Event {
|
||||||
|
|
||||||
private Perspective perspective;
|
private Perspective perspective;
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.ClientPlayerInteractionManagerMixin#onBlockPlace
|
||||||
|
*/
|
||||||
|
public class PlaceBlockEvent extends Event {
|
||||||
|
|
||||||
|
private Hand hand;
|
||||||
|
private BlockHitResult result;
|
||||||
|
|
||||||
|
public PlaceBlockEvent(Hand hand, BlockHitResult result) {
|
||||||
|
this.hand = hand;
|
||||||
|
this.result = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Hand getHand() {
|
||||||
|
return hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHand(Hand hand) {
|
||||||
|
this.hand = hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockHitResult getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResult(BlockHitResult result) {
|
||||||
|
this.result = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,6 @@ import net.minecraft.text.Text;
|
|||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.ChatHudMixin#onAddMessage
|
* @see me.retucio.camtweaks.mixin.ChatHudMixin#onAddMessage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ReceiveMessageEvent extends Event {
|
public class ReceiveMessageEvent extends Event {
|
||||||
|
|
||||||
private Text text;
|
private Text text;
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.ClientWorldMixin#onRemoveEntity
|
||||||
|
*/
|
||||||
|
public class RemoveEntityEvent extends Event {
|
||||||
|
|
||||||
|
private final Entity entity;
|
||||||
|
|
||||||
|
public RemoveEntityEvent(Entity entity) {
|
||||||
|
this.entity = entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Entity getEntity() {
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,10 +4,10 @@ import me.retucio.camtweaks.event.Event;
|
|||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.HeldItemRendererMixin#onRenderArm
|
* @see me.retucio.camtweaks.mixin.HeldItemRendererMixin#onRenderArm
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class RenderArmEvent extends Event {
|
public class RenderArmEvent extends Event {
|
||||||
|
|
||||||
private MatrixStack matrices;
|
private MatrixStack matrices;
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import net.minecraft.text.Text;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.BossBarHudMixin#modifyBossBarIterator
|
* @see me.retucio.camtweaks.mixin.BossBarHudMixin#modifyBossBarIterator
|
||||||
* @see me.retucio.camtweaks.mixin.BossBarHudMixin#modifyBossBarName
|
* @see me.retucio.camtweaks.mixin.BossBarHudMixin#modifyBossBarName
|
||||||
* @see me.retucio.camtweaks.mixin.BossBarHudMixin#modifySpacingConstant
|
* @see me.retucio.camtweaks.mixin.BossBarHudMixin#modifySpacingConstant
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class RenderBossbarEvent {
|
public class RenderBossbarEvent {
|
||||||
|
|
||||||
public static class BossText extends Event {
|
public static class BossText extends Event {
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import me.retucio.camtweaks.event.Event;
|
|||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.HeldItemRendererMixin#onRenderItem
|
* @see me.retucio.camtweaks.mixin.HeldItemRendererMixin#onRenderItem
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class RenderHeldItemEvent extends Event {
|
public class RenderHeldItemEvent extends Event {
|
||||||
|
|
||||||
private MatrixStack matrices;
|
private MatrixStack matrices;
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
import net.minecraft.client.render.Camera;
|
||||||
|
import net.minecraft.client.render.RenderTickCounter;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.WorldRendererMixin#render
|
||||||
|
*/
|
||||||
|
public class RenderWorldEvent extends Event {
|
||||||
|
|
||||||
|
private final MatrixStack matrices;
|
||||||
|
private final RenderTickCounter tc;
|
||||||
|
private final Camera camera;
|
||||||
|
|
||||||
|
public RenderWorldEvent(MatrixStack matrices, RenderTickCounter tc, Camera camera) {
|
||||||
|
this.matrices = matrices;
|
||||||
|
this.tc = tc;
|
||||||
|
this.camera = camera;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MatrixStack getMatrices() {
|
||||||
|
return matrices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RenderTickCounter getTickCounter() {
|
||||||
|
return tc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Camera getCamera() {
|
||||||
|
return camera;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.ClientPlayNetworkHandlerMixin#onSendMessage
|
* @see me.retucio.camtweaks.mixin.ClientPlayNetworkHandlerMixin#onSendMessage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class SendMessageEvent extends Event {
|
public class SendMessageEvent extends Event {
|
||||||
|
|
||||||
private String message;
|
private String message;
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onStop
|
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onStop
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ShutdownEvent extends Event {
|
public class ShutdownEvent extends Event {
|
||||||
|
|
||||||
public ShutdownEvent() {}
|
public ShutdownEvent() {}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package me.retucio.camtweaks.event.events;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onTickPre
|
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onTickPre
|
||||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onTickPost
|
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onTickPost
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TickEvent {
|
public class TickEvent {
|
||||||
|
|
||||||
public static class Pre extends Event {}
|
public static class Pre extends Event {}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package me.retucio.camtweaks.event.events;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onUseItem
|
||||||
|
*/
|
||||||
|
public class UseItemEvent extends Event {
|
||||||
|
|
||||||
|
private ItemStack stack;
|
||||||
|
private Hand hand;
|
||||||
|
|
||||||
|
public UseItemEvent(ItemStack stack, Hand hand) {
|
||||||
|
this.stack = stack;
|
||||||
|
this.hand = hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getStack() {
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStack(ItemStack stack) {
|
||||||
|
this.stack = stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Hand getHand() {
|
||||||
|
return hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHand(Hand hand) {
|
||||||
|
this.hand = hand;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,4 +2,5 @@ package me.retucio.camtweaks.event.events.camtweaks;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
// se genera cuando carga la interfaz del mod
|
||||||
public class LoadClickGUIEvent extends Event {}
|
public class LoadClickGUIEvent extends Event {}
|
||||||
@@ -2,4 +2,5 @@ package me.retucio.camtweaks.event.events.camtweaks;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
// se genera cuando carga el gestor de comandos
|
||||||
public class LoadCommandManagerEvent extends Event {}
|
public class LoadCommandManagerEvent extends Event {}
|
||||||
@@ -2,4 +2,5 @@ package me.retucio.camtweaks.event.events.camtweaks;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
|
|
||||||
|
// se genera cuando carga el gestor de módulos
|
||||||
public class LoadModuleManagerEvent extends Event {}
|
public class LoadModuleManagerEvent extends Event {}
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
package me.retucio.camtweaks.event.events.camtweaks;
|
package me.retucio.camtweaks.event.events.camtweaks;
|
||||||
|
|
||||||
import me.retucio.camtweaks.event.Event;
|
import me.retucio.camtweaks.event.Event;
|
||||||
import me.retucio.camtweaks.module.settings.AbstractSetting;
|
import me.retucio.camtweaks.module.settings.Setting;
|
||||||
|
|
||||||
// se genera cada que se cambia el valor de un ajuste
|
// se genera cada que se cambia el valor de un ajuste
|
||||||
public class UpdateSettingEvent extends Event {
|
public class UpdateSettingEvent extends Event {
|
||||||
|
|
||||||
private final AbstractSetting setting;
|
private final Setting setting;
|
||||||
private boolean shouldSave;
|
private boolean shouldSave;
|
||||||
|
|
||||||
public UpdateSettingEvent(AbstractSetting setting, boolean shouldSave) {
|
public UpdateSettingEvent(Setting setting, boolean shouldSave) {
|
||||||
this.setting = setting;
|
this.setting = setting;
|
||||||
this.shouldSave = shouldSave;
|
this.shouldSave = shouldSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractSetting getSetting() {
|
public Setting getSetting() {
|
||||||
return setting;
|
return setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import java.util.Iterator;
|
|||||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||||
|
|
||||||
@Mixin(BossBarHud.class)
|
@Mixin(BossBarHud.class)
|
||||||
public class BossBarHudMixin {
|
public abstract class BossBarHudMixin {
|
||||||
|
|
||||||
@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Ljava/util/Collection;iterator()Ljava/util/Iterator;"))
|
@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Ljava/util/Collection;iterator()Ljava/util/Iterator;"))
|
||||||
public Iterator<ClientBossBar> modifyBossBarIterator(Iterator<ClientBossBar> original) {
|
public Iterator<ClientBossBar> modifyBossBarIterator(Iterator<ClientBossBar> original) {
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
|
||||||
|
import me.retucio.camtweaks.util.render.GlintRenderLayer;
|
||||||
|
import net.minecraft.client.render.BufferBuilderStorage;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.client.util.BufferAllocator;
|
||||||
|
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(BufferBuilderStorage.class)
|
||||||
|
public abstract class BufferStorageMixin {
|
||||||
|
|
||||||
|
@Inject(method = "assignBufferBuilder", at = @At("HEAD"))
|
||||||
|
private static void addGlintTypes(Object2ObjectLinkedOpenHashMap<RenderLayer, BufferAllocator> builderStorage, RenderLayer layer, CallbackInfo ci) {
|
||||||
|
GlintRenderLayer.addGlintTypes(builderStorage);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -61,6 +61,7 @@ public abstract class ChatHudMixin implements IChatHud {
|
|||||||
chatPlus = ModuleManager.INSTANCE.getModuleByClass(ChatPlus.class);
|
chatPlus = ModuleManager.INSTANCE.getModuleByClass(ChatPlus.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// métodos relacionados a las interfaces IChatHud, IChatHudLine, IChadHudLineVisible y IMessageHandler
|
// métodos relacionados a las interfaces IChatHud, IChatHudLine, IChadHudLineVisible y IMessageHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -109,8 +110,8 @@ public abstract class ChatHudMixin implements IChatHud {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// modificar contenido del mensaje
|
// modificar contenido del mensaje
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", cancellable = true)
|
@Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", cancellable = true)
|
||||||
private void onAddMessage(Text message, MessageSignatureData signatureData, MessageIndicator indicator, CallbackInfo ci) {
|
private void onAddMessage(Text message, MessageSignatureData signatureData, MessageIndicator indicator, CallbackInfo ci) {
|
||||||
if (skipOnAddMessage) return;
|
if (skipOnAddMessage) return;
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.mixin.accessor.ConfirmServerResourcePackScreenAccessor;
|
||||||
|
import me.retucio.camtweaks.mixin.accessor.PackAccessor;
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.RPackBypass;
|
||||||
|
import me.retucio.camtweaks.util.interfaces.IConfirmScreen;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||||
|
import net.minecraft.client.network.ServerInfo;
|
||||||
|
import net.minecraft.client.option.ServerList;
|
||||||
|
import net.minecraft.network.ClientConnection;
|
||||||
|
import net.minecraft.network.packet.c2s.common.ResourcePackStatusC2SPacket;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(ClientCommonNetworkHandler.class)
|
||||||
|
public abstract class ClientCommonNetworkHandlerMixin {
|
||||||
|
|
||||||
|
@Shadow @Final protected MinecraftClient client;
|
||||||
|
@Shadow @Final protected ServerInfo serverInfo;
|
||||||
|
@Shadow @Final protected ClientConnection connection;
|
||||||
|
|
||||||
|
@Unique // tardar 3 segundos porque algunos servers detectar el tiempo entre que se acepta y se carga el pack
|
||||||
|
private final Executor DELAYED_EXECUTOR = CompletableFuture.delayedExecutor(3L, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
@Inject(method = "createConfirmServerResourcePackScreen", at = @At("TAIL"))
|
||||||
|
private void setScreenBypassAction(UUID id, URL url, String hash, boolean required, Text prompt, CallbackInfoReturnable<Screen> cir) {
|
||||||
|
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||||
|
if (!bypassPack.isEnabled()) return;
|
||||||
|
|
||||||
|
final Screen screen = cir.getReturnValue();
|
||||||
|
((IConfirmScreen) screen).smegma$setBypassAction(() -> {
|
||||||
|
client.setScreen(((ConfirmServerResourcePackScreenAccessor) screen).getParentScreen());
|
||||||
|
if (this.serverInfo != null) {
|
||||||
|
this.serverInfo.setResourcePackPolicy(bypassPack.getPolicy());
|
||||||
|
this.client.getServerResourcePackProvider().acceptAll();
|
||||||
|
ServerList.updateServerListEntry(this.serverInfo);
|
||||||
|
}
|
||||||
|
bypass(((ConfirmServerResourcePackScreenAccessor) screen).getRequests().stream().map(PackAccessor::callId).toList());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
public void bypass(List<UUID> ids) {
|
||||||
|
ids.forEach(id -> connection.send(new ResourcePackStatusC2SPacket(id, ResourcePackStatusC2SPacket.Status.ACCEPTED)));
|
||||||
|
ids.forEach(id -> connection.send(new ResourcePackStatusC2SPacket(id, ResourcePackStatusC2SPacket.Status.DOWNLOADED)));
|
||||||
|
DELAYED_EXECUTOR.execute(() ->
|
||||||
|
ids.forEach(id -> connection.send(new ResourcePackStatusC2SPacket(id, ResourcePackStatusC2SPacket.Status.SUCCESSFULLY_LOADED)))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
@Mixin(ClientConnection.class)
|
@Mixin(ClientConnection.class)
|
||||||
public abstract class ClientConnectionMixin {
|
public abstract class ClientConnectionMixin {
|
||||||
@@ -46,7 +47,7 @@ public abstract class ClientConnectionMixin {
|
|||||||
|
|
||||||
@Inject(method = "disconnect(Lnet/minecraft/network/DisconnectionInfo;)V", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "disconnect(Lnet/minecraft/network/DisconnectionInfo;)V", at = @At("HEAD"), cancellable = true)
|
||||||
private void onDisconnect(DisconnectionInfo disconnectionInfo, CallbackInfo ci) {
|
private void onDisconnect(DisconnectionInfo disconnectionInfo, CallbackInfo ci) {
|
||||||
DisconnectEvent event = EVENT_BUS.post(new DisconnectEvent());
|
DisconnectEvent event = EVENT_BUS.post(new DisconnectEvent(disconnectionInfo, mc.getCurrentServerEntry()));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,6 +56,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
|
|||||||
@Redirect(method = "onEntityStatus", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;showFloatingItem(Lnet/minecraft/item/ItemStack;)V"))
|
@Redirect(method = "onEntityStatus", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;showFloatingItem(Lnet/minecraft/item/ItemStack;)V"))
|
||||||
private void noRenderTotemPop(GameRenderer instance, ItemStack floatingItem) {
|
private void noRenderTotemPop(GameRenderer instance, ItemStack floatingItem) {
|
||||||
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||||
if (!noRender.isEnabled() || noRender.totemPop.isEnabled()) mc.gameRenderer.showFloatingItem(Items.TOTEM_OF_UNDYING.getDefaultStack());
|
if (!noRender.isEnabled() || noRender.totemPop.isEnabled())
|
||||||
|
mc.gameRenderer.showFloatingItem(floatingItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.PortalGUI;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
@Mixin(ClientPlayerEntity.class)
|
||||||
|
public abstract class ClientPlayerEntityMixin {
|
||||||
|
|
||||||
|
@ModifyExpressionValue(method = "tickNausea", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;"))
|
||||||
|
private Screen allowScreensInPortals(Screen original) {
|
||||||
|
if (ModuleManager.INSTANCE.getModuleByClass(PortalGUI.class).isEnabled()) return null;
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
|
import me.retucio.camtweaks.event.events.AttackEntityEvent;
|
||||||
|
import me.retucio.camtweaks.event.events.BreakBlockEvent;
|
||||||
|
import me.retucio.camtweaks.event.events.InteractEntityEvent;
|
||||||
|
import me.retucio.camtweaks.event.events.PlaceBlockEvent;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
import me.retucio.camtweaks.module.modules.Freecam;
|
import me.retucio.camtweaks.module.modules.Freecam;
|
||||||
|
import me.retucio.camtweaks.util.ChatUtil;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
@@ -12,16 +19,24 @@ import net.minecraft.util.ActionResult;
|
|||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
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.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;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
@Mixin(ClientPlayerInteractionManager.class)
|
@Mixin(ClientPlayerInteractionManager.class)
|
||||||
public abstract class ClientPlayerInteractionManagerMixin {
|
public abstract class ClientPlayerInteractionManagerMixin {
|
||||||
|
|
||||||
|
@Shadow @Final
|
||||||
|
private MinecraftClient client;
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
Freecam freecam;
|
Freecam freecam;
|
||||||
|
|
||||||
@@ -30,19 +45,31 @@ public abstract class ClientPlayerInteractionManagerMixin {
|
|||||||
freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// los paquetes ya se cancelan en la clase de Freecam, pero visualmente el bloque sigue apareciendo roto
|
|
||||||
@Inject(method = "breakBlock", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "breakBlock", at = @At("HEAD"), cancellable = true)
|
||||||
private void cancelBlockBreaking(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
|
private void onBlockBreak(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
|
||||||
if (freecam.isEnabled() && freecam.cancelActionPackets.isEnabled()) cir.setReturnValue(false);
|
BreakBlockEvent event = EVENT_BUS.post(new BreakBlockEvent(pos));
|
||||||
|
if (event.isCancelled()) cir.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true)
|
||||||
private void cancelBlockPlacement(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) {
|
private void onBlockPlace(ClientPlayerEntity player, Hand hand, BlockHitResult result, CallbackInfoReturnable<ActionResult> cir) {
|
||||||
if (freecam.isEnabled() && freecam.cancelActionPackets.isEnabled()) cir.setReturnValue(ActionResult.FAIL);
|
if (mc.player != player) return;
|
||||||
|
PlaceBlockEvent event = EVENT_BUS.post(new PlaceBlockEvent(hand, result));
|
||||||
|
if (event.isCancelled()) cir.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "interactEntity", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "interactEntity", at = @At("HEAD"), cancellable = true)
|
||||||
private void cancelEntityInteractions(PlayerEntity player, Entity entity, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
private void onEntityInteract(PlayerEntity player, Entity entity, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
||||||
if (freecam.isEnabled() && freecam.cancelActionPackets.isEnabled()) cir.setReturnValue(ActionResult.FAIL);
|
if (mc.player != player) return;
|
||||||
|
InteractEntityEvent event = EVENT_BUS.post(new InteractEntityEvent(entity, hand));
|
||||||
|
if (event.isCancelled()) cir.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "attackEntity", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void onAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) {
|
||||||
|
if (mc.player != player) return;
|
||||||
|
AttackEntityEvent event = EVENT_BUS.post(new AttackEntityEvent(target));
|
||||||
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.events.AddEntityEvent;
|
||||||
|
import me.retucio.camtweaks.event.events.RemoveEntityEvent;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import org.jetbrains.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;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||||
|
|
||||||
|
@Mixin(ClientWorld.class)
|
||||||
|
public abstract class ClientWorldMixin {
|
||||||
|
|
||||||
|
@Shadow @Nullable
|
||||||
|
public abstract Entity getEntityById(int id);
|
||||||
|
|
||||||
|
@Inject(method = "addEntity", at = @At("HEAD"))
|
||||||
|
private void onAddEntity(Entity entity, CallbackInfo ci) {
|
||||||
|
if (entity != null) EVENT_BUS.post(new AddEntityEvent(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "removeEntity", at = @At("HEAD"))
|
||||||
|
private void onRemoveEntity(int entityId, Entity.RemovalReason removalReason, CallbackInfo ci) {
|
||||||
|
Entity entity = getEntityById(entityId);
|
||||||
|
if (entity != null) EVENT_BUS.post(new RemoveEntityEvent(entity));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
|
||||||
import me.retucio.camtweaks.CameraTweaks;
|
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
|
||||||
import me.retucio.camtweaks.module.modules.Freecam;
|
|
||||||
import net.minecraft.client.render.Camera;
|
|
||||||
import net.minecraft.client.render.item.property.numeric.CompassState;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import static me.retucio.camtweaks.CameraTweaks.mc;
|
|
||||||
|
|
||||||
@Mixin(CompassState.class)
|
|
||||||
public abstract class CompassStateMixin {
|
|
||||||
|
|
||||||
@Unique
|
|
||||||
private static Freecam freecam;
|
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
|
||||||
private void getModules(boolean wobble, CompassState.Target target, CallbackInfo ci) {
|
|
||||||
freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModifyExpressionValue(method = "getBodyYaw", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getBodyYaw()F"))
|
|
||||||
private static float getBodyYaw(float original) {
|
|
||||||
if (freecam.isEnabled()) return mc.gameRenderer.getCamera().getYaw();
|
|
||||||
return original;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModifyReturnValue(method = "getAngleTo(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/BlockPos;)D", at = @At("RETURN"))
|
|
||||||
private static double getAngleTo(double original, Entity entity, BlockPos blockPos) {
|
|
||||||
if (freecam.isEnabled()) {
|
|
||||||
Vec3d vec3d = Vec3d.ofCenter(blockPos);
|
|
||||||
Camera camera = mc.gameRenderer.getCamera();
|
|
||||||
return Math.atan2(vec3d.getZ() - camera.getPos().z, vec3d.getX() - camera.getPos().x) / (float) (Math.PI * 2);
|
|
||||||
}
|
|
||||||
return original;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.RPackBypass;
|
||||||
|
import me.retucio.camtweaks.util.interfaces.IConfirmScreen;
|
||||||
|
import net.minecraft.client.gui.screen.ConfirmScreen;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
|
import net.minecraft.client.gui.widget.DirectionalLayoutWidget;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(ConfirmScreen.class)
|
||||||
|
public abstract class ConfirmScreenMixin extends Screen implements IConfirmScreen {
|
||||||
|
|
||||||
|
@Shadow protected DirectionalLayoutWidget layout;
|
||||||
|
@Unique private Runnable bypassAction = null;
|
||||||
|
|
||||||
|
protected ConfirmScreenMixin(final Text title) {
|
||||||
|
super(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ConfirmScreen;addButtons(Lnet/minecraft/client/gui/widget/DirectionalLayoutWidget;)V", shift = At.Shift.AFTER))
|
||||||
|
protected void addBypassButton(CallbackInfo ci) {
|
||||||
|
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||||
|
if (this.bypassAction != null && bypassPack.isEnabled())
|
||||||
|
this.layout.add(ButtonWidget.builder(bypassPack.BYPASS_TEXT, $ -> this.bypassAction.run()).build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void smegma$setBypassAction(Runnable bypass) {
|
||||||
|
this.bypassAction = bypass;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,8 @@ package me.retucio.camtweaks.mixin;
|
|||||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
import me.retucio.camtweaks.module.modules.CritsPlus;
|
import me.retucio.camtweaks.module.modules.CritsPlus;
|
||||||
|
import net.minecraft.client.particle.BillboardParticle;
|
||||||
import net.minecraft.client.particle.DamageParticle;
|
import net.minecraft.client.particle.DamageParticle;
|
||||||
import net.minecraft.client.particle.ParticleTextureSheet;
|
|
||||||
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;
|
||||||
@@ -14,9 +14,9 @@ import java.awt.*;
|
|||||||
@Mixin(DamageParticle.class)
|
@Mixin(DamageParticle.class)
|
||||||
public abstract class DamageParticleMixin {
|
public abstract class DamageParticleMixin {
|
||||||
|
|
||||||
@ModifyReturnValue(method = "getType", at = @At("RETURN"))
|
@ModifyReturnValue(method = "getRenderType", at = @At("RETURN"))
|
||||||
private ParticleTextureSheet makeCritsTranslucent(ParticleTextureSheet original) {
|
private BillboardParticle.RenderType makeCritsTranslucent(BillboardParticle.RenderType original) {
|
||||||
if (ModuleManager.INSTANCE.getModuleByClass(CritsPlus.class).isEnabled()) return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
|
if (ModuleManager.INSTANCE.getModuleByClass(CritsPlus.class).isEnabled()) return BillboardParticle.RenderType.PARTICLE_ATLAS_TRANSLUCENT;
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,27 +25,18 @@ public abstract class DamageParticleMixin {
|
|||||||
@Mixin(DamageParticle.Factory.class)
|
@Mixin(DamageParticle.Factory.class)
|
||||||
abstract class DamageParticleFactoryMixin {
|
abstract class DamageParticleFactoryMixin {
|
||||||
|
|
||||||
@ModifyVariable(method = "createParticle(Lnet/minecraft/particle/SimpleParticleType;Lnet/minecraft/client/world/ClientWorld;DDDDDD)Lnet/minecraft/client/particle/Particle;", at = @At(value = "STORE"))
|
@ModifyVariable(method = "createParticle(Lnet/minecraft/particle/SimpleParticleType;Lnet/minecraft/client/world/ClientWorld;DDDDDDLnet/minecraft/util/math/random/Random;)Lnet/minecraft/client/particle/Particle;", at = @At(value = "STORE"))
|
||||||
private DamageParticle modifyCritColor(DamageParticle original) {
|
private DamageParticle modifyCritColor(DamageParticle original) {
|
||||||
CritsPlus crits = ModuleManager.INSTANCE.getModuleByClass(CritsPlus.class);
|
CritsPlus crits = ModuleManager.INSTANCE.getModuleByClass(CritsPlus.class);
|
||||||
if (!crits.isEnabled()) return original;
|
if (!crits.isEnabled()) return original;
|
||||||
|
|
||||||
if (crits.rainbow.isEnabled()) {
|
|
||||||
float speed = 10001 - crits.rainbowSpeed.getFloatValue();
|
|
||||||
float hue = (System.currentTimeMillis() % (int) speed) / speed;
|
|
||||||
Color gamning = Color.getHSBColor(hue, 1, 1);
|
|
||||||
original.setColor(
|
original.setColor(
|
||||||
gamning.getRed() / 255f,
|
crits.color.getR() / 255f,
|
||||||
gamning.getGreen() / 255f,
|
crits.color.getG() / 255f,
|
||||||
gamning.getBlue() / 255f);
|
crits.color.getB() / 255f
|
||||||
} else {
|
);
|
||||||
original.setColor(
|
|
||||||
crits.red.getFloatValue() / 255f,
|
|
||||||
crits.green.getFloatValue() / 255f,
|
|
||||||
crits.blue.getFloatValue() / 255f);
|
|
||||||
}
|
|
||||||
|
|
||||||
original.alpha = crits.alpha.getFloatValue() / 255f;
|
original.alpha = crits.color.getA() / 255f;
|
||||||
original.scale *= crits.scale.getFloatValue();
|
original.scale *= crits.scale.getFloatValue();
|
||||||
original.velocityMultiplier *= crits.velocityMultipler.getFloatValue();
|
original.velocityMultiplier *= crits.velocityMultipler.getFloatValue();
|
||||||
original.gravityStrength *= crits.gravity.getFloatValue();
|
original.gravityStrength *= crits.gravity.getFloatValue();
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
import me.retucio.camtweaks.module.modules.TimeChanger;
|
import me.retucio.camtweaks.module.modules.TimeChanger;
|
||||||
|
import me.retucio.camtweaks.util.ChatUtil;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.world.dimension.DimensionType;
|
||||||
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;
|
||||||
@@ -12,11 +14,17 @@ import static me.retucio.camtweaks.CameraTweaks.mc;
|
|||||||
@Mixin(DimensionType.class)
|
@Mixin(DimensionType.class)
|
||||||
public abstract class DimensionTypeMixin {
|
public abstract class DimensionTypeMixin {
|
||||||
|
|
||||||
|
// no consigo arreglar lo de que la fase lunar por defecto siempre sea luna llena
|
||||||
@ModifyReturnValue(method = "getMoonPhase", at = @At("RETURN"))
|
@ModifyReturnValue(method = "getMoonPhase", at = @At("RETURN"))
|
||||||
private int overrideMoonPhase(int original) {
|
private int overrideMoonPhase(int original, @Local(argsOnly = true) long time) {
|
||||||
TimeChanger timeChanger = ModuleManager.INSTANCE.getModuleByClass(TimeChanger.class);
|
TimeChanger timeChanger = ModuleManager.INSTANCE.getModuleByClass(TimeChanger.class);
|
||||||
if (timeChanger.isEnabled() && mc.world != null && !timeChanger.moonPhase.is(TimeChanger.MoonPhases.DEFAULT))
|
if (timeChanger == null || !timeChanger.isEnabled() || mc.world == null) {
|
||||||
return timeChanger.getMoonPhase();
|
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timeChanger.moonPhase.is(TimeChanger.MoonPhases.DEFAULT))
|
||||||
|
return (int) (time / 24000L % 8L + 8L) % 8;
|
||||||
|
|
||||||
|
return timeChanger.getMoonPhase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.Reconnect;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screen.DisconnectedScreen;
|
||||||
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
|
import net.minecraft.client.gui.widget.DirectionalLayoutWidget;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
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(DisconnectedScreen.class)
|
||||||
|
public abstract class DisconnectedScreenMixin {
|
||||||
|
|
||||||
|
@Shadow @Final
|
||||||
|
private DirectionalLayoutWidget grid;
|
||||||
|
|
||||||
|
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/DirectionalLayoutWidget;add(Lnet/minecraft/client/gui/widget/Widget;)Lnet/minecraft/client/gui/widget/Widget;", ordinal = 2, shift = At.Shift.AFTER))
|
||||||
|
private void addReconnectButton(CallbackInfo ci) {
|
||||||
|
Reconnect reconnect = ModuleManager.INSTANCE.getModuleByClass(Reconnect.class);
|
||||||
|
if (reconnect == null || !reconnect.isEnabled()) return;
|
||||||
|
|
||||||
|
grid.add(ButtonWidget.builder(
|
||||||
|
Text.literal("reconectarse"),
|
||||||
|
button -> reconnect.reconnect()
|
||||||
|
).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
|
||||||
|
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
|
||||||
import me.retucio.camtweaks.module.modules.NoRender;
|
|
||||||
import net.minecraft.particle.EntityEffectParticleEffect;
|
|
||||||
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.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
@Mixin(EntityEffectParticleEffect.class)
|
|
||||||
public abstract class EntityEffectParticleEffectMixin {
|
|
||||||
|
|
||||||
@Inject(method = "getAlpha", at = @At("HEAD"), cancellable = true)
|
|
||||||
private void noRenderPotionParticles(CallbackInfoReturnable<Float> cir) {
|
|
||||||
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
|
||||||
if (noRender.isEnabled()) cir.setReturnValue(256 - noRender.potionParticleAlpha.getFloatValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +1,9 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
import me.retucio.camtweaks.event.events.ChangeRotationEvent;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
import me.retucio.camtweaks.module.modules.AntiInvis;
|
import me.retucio.camtweaks.module.modules.*;
|
||||||
import me.retucio.camtweaks.module.modules.Freecam;
|
|
||||||
import me.retucio.camtweaks.module.modules.Freelook;
|
|
||||||
import me.retucio.camtweaks.module.modules.Nametags;
|
|
||||||
import me.retucio.camtweaks.util.ChatUtil;
|
|
||||||
import net.minecraft.entity.*;
|
import net.minecraft.entity.*;
|
||||||
import net.minecraft.entity.passive.TameableEntity;
|
import net.minecraft.entity.passive.TameableEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
@@ -14,7 +11,6 @@ import net.minecraft.entity.projectile.PersistentProjectileEntity;
|
|||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
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;
|
||||||
@@ -23,25 +19,22 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
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;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||||
import static me.retucio.camtweaks.CameraTweaks.mc;
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
@Mixin(Entity.class)
|
@Mixin(Entity.class)
|
||||||
public abstract class EntityMixin {
|
public abstract class EntityMixin {
|
||||||
|
|
||||||
@Shadow
|
@Shadow public abstract Text getName();
|
||||||
public abstract Text getName();
|
@Shadow public abstract EntityType<?> getType();
|
||||||
|
|
||||||
@Shadow
|
@Shadow private float yaw;
|
||||||
public abstract EntityType<?> getType();
|
@Shadow private float pitch;
|
||||||
|
|
||||||
@Unique
|
@Unique Freecam freecam;
|
||||||
Freecam freecam;
|
@Unique Freelook freelook;
|
||||||
|
@Unique Nametags nametags;
|
||||||
@Unique
|
@Unique Rotations rotations;
|
||||||
Freelook freelook;
|
|
||||||
|
|
||||||
@Unique
|
|
||||||
Nametags nametags;
|
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
@@ -49,6 +42,7 @@ public abstract class EntityMixin {
|
|||||||
freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
||||||
freelook = ModuleManager.INSTANCE.getModuleByClass(Freelook.class);
|
freelook = ModuleManager.INSTANCE.getModuleByClass(Freelook.class);
|
||||||
nametags = ModuleManager.INSTANCE.getModuleByClass(Nametags.class);
|
nametags = ModuleManager.INSTANCE.getModuleByClass(Nametags.class);
|
||||||
|
rotations = ModuleManager.INSTANCE.getModuleByClass(Rotations.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -64,10 +58,10 @@ public abstract class EntityMixin {
|
|||||||
ci.cancel();
|
ci.cancel();
|
||||||
|
|
||||||
} else if (freelook.isEnabled() && freelook.mode.is(Freelook.CameraMode.CAMERA)) {
|
} else if (freelook.isEnabled() && freelook.mode.is(Freelook.CameraMode.CAMERA)) {
|
||||||
freelook.setYaw(freelook.getYaw() + (float) (cursorDeltaX / freelook.mouseSens.getFloatValue()));
|
freelook.setYaw(freelook.getYaw() + (float) (cursorDeltaX * freelook.mouseSens.getFloatValue()));
|
||||||
freelook.setPitch(freelook.getPitch() + (float) (cursorDeltaY / freelook.mouseSens.getFloatValue()));
|
freelook.setPitch(freelook.getPitch() + (float) (cursorDeltaY * freelook.mouseSens.getFloatValue()));
|
||||||
|
|
||||||
if (Math.abs(freelook.getPitch()) > 90.0F) freelook.setPitch(freelook.getPitch() > 0 ? 90 : -90);
|
if (Math.abs(freelook.getPitch()) > 90) freelook.setPitch(freelook.getPitch() > 0 ? 90 : -90);
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,6 +74,7 @@ public abstract class EntityMixin {
|
|||||||
private boolean renderEntityNametags(boolean original) {
|
private boolean renderEntityNametags(boolean original) {
|
||||||
if (!nametags.isEnabled()) return original;
|
if (!nametags.isEnabled()) return original;
|
||||||
if ((Object) this instanceof PersistentProjectileEntity p && p.isOnGround()) return false;
|
if ((Object) this instanceof PersistentProjectileEntity p && p.isOnGround()) return false;
|
||||||
|
if ((Object) this instanceof ItemEntity i && !nametags.items.isEnabled(i.getStack().getItem())) return false;
|
||||||
return nametags.entities.isEnabled((this.getType()));
|
return nametags.entities.isEnabled((this.getType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,6 +111,30 @@ public abstract class EntityMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// rotaciones
|
||||||
|
|
||||||
|
@Inject(method = "setRotation", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void onRotation(float yaw, float pitch, CallbackInfo ci) {
|
||||||
|
if ((Object) this != mc.player) return;
|
||||||
|
ChangeRotationEvent event = EVENT_BUS.post(new ChangeRotationEvent(yaw, pitch));
|
||||||
|
if (event.isCancelled()) ci.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "setYaw", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void onChangeYaw(float yaw, CallbackInfo ci) {
|
||||||
|
if ((Object) this != mc.player) return;
|
||||||
|
ChangeRotationEvent event = EVENT_BUS.post(new ChangeRotationEvent(yaw, this.pitch));
|
||||||
|
if (event.isCancelled()) ci.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "setPitch", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void onChangePitch(float pitch, CallbackInfo ci) {
|
||||||
|
if ((Object) this != mc.player) return;
|
||||||
|
ChangeRotationEvent event = EVENT_BUS.post(new ChangeRotationEvent(this.yaw, pitch));
|
||||||
|
if (event.isCancelled()) ci.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// otros
|
// otros
|
||||||
|
|
||||||
@Inject(method = "isInvisibleTo", at = @At("RETURN"), cancellable = true)
|
@Inject(method = "isInvisibleTo", at = @At("RETURN"), cancellable = true)
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.GlintPlus;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.client.render.entity.equipment.EquipmentRenderer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(EquipmentRenderer.class)
|
||||||
|
public abstract class EquipmentRendererMixin {
|
||||||
|
|
||||||
|
@Redirect(method = "render(Lnet/minecraft/client/render/entity/equipment/EquipmentModel$LayerType;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;ILnet/minecraft/util/Identifier;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayer;getArmorEntityGlint()Lnet/minecraft/client/render/RenderLayer;"))
|
||||||
|
private RenderLayer redirectArmorEntityGlint() {
|
||||||
|
GlintPlus glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
||||||
|
return glintPlus.getArmorEntityGlint();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,8 +36,7 @@ public abstract class FogRendererMixin {
|
|||||||
if ((className.equals("BlindnessEffectFogModifier") && !noRender.blindnessEffect.isEnabled())
|
if ((className.equals("BlindnessEffectFogModifier") && !noRender.blindnessEffect.isEnabled())
|
||||||
|| (className.equals("DarknessEffectFogModifier") && !noRender.darknessEffect.isEnabled())
|
|| (className.equals("DarknessEffectFogModifier") && !noRender.darknessEffect.isEnabled())
|
||||||
|| ((className.equals("LavaFogModifier") || className.equals("WaterFogModifier")
|
|| ((className.equals("LavaFogModifier") || className.equals("WaterFogModifier")
|
||||||
|| className.equals("PowederSnowFogModifier")) && !noRender.fluidOverlay.isEnabled())
|
|| className.equals("PowederSnowFogModifier")) && !noRender.fluidOverlay.isEnabled()))
|
||||||
|| (className.equals("DimensionOrBossFogModifier") && !noRender.dimensionFog.isEnabled()))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return instance.shouldApply(cameraSubmersionType, entity);
|
return instance.shouldApply(cameraSubmersionType, entity);
|
||||||
|
|||||||
@@ -1,19 +1,27 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
import me.retucio.camtweaks.event.events.GetFOVEvent;
|
import me.retucio.camtweaks.event.events.GetFOVEvent;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
import me.retucio.camtweaks.module.modules.Freecam;
|
import me.retucio.camtweaks.module.modules.Freecam;
|
||||||
|
import me.retucio.camtweaks.module.modules.NoMiningInterruptions;
|
||||||
import me.retucio.camtweaks.module.modules.NoRender;
|
import me.retucio.camtweaks.module.modules.NoRender;
|
||||||
import me.retucio.camtweaks.module.modules.Zoom;
|
import me.retucio.camtweaks.module.modules.Zoom;
|
||||||
import me.retucio.camtweaks.util.interfaces.IVec3d;
|
import me.retucio.camtweaks.util.interfaces.IVec3d;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.BufferBuilderStorage;
|
import net.minecraft.client.render.BufferBuilderStorage;
|
||||||
import net.minecraft.client.render.GameRenderer;
|
import net.minecraft.client.render.GameRenderer;
|
||||||
|
import net.minecraft.client.render.block.BlockRenderManager;
|
||||||
import net.minecraft.client.render.item.HeldItemRenderer;
|
import net.minecraft.client.render.item.HeldItemRenderer;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
import net.minecraft.util.hit.EntityHitResult;
|
||||||
|
import net.minecraft.util.hit.HitResult;
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -22,9 +30,11 @@ 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.ModifyVariable;
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
|
||||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||||
|
|
||||||
|
|
||||||
@Mixin(GameRenderer.class)
|
@Mixin(GameRenderer.class)
|
||||||
public abstract class GameRendererMixin {
|
public abstract class GameRendererMixin {
|
||||||
|
|
||||||
@@ -47,7 +57,7 @@ public abstract class GameRendererMixin {
|
|||||||
public abstract void updateCrosshairTarget(float tickDelta);
|
public abstract void updateCrosshairTarget(float tickDelta);
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
private void getModules(MinecraftClient client, HeldItemRenderer firstPersonHeldItemRenderer, BufferBuilderStorage buffers, CallbackInfo ci) {
|
private void getModules(MinecraftClient client, HeldItemRenderer firstPersonHeldItemRenderer, BufferBuilderStorage buffers, BlockRenderManager blockRenderManager, 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);
|
||||||
@@ -78,7 +88,7 @@ public abstract class GameRendererMixin {
|
|||||||
float lastYaw = cameraEntity.lastYaw;
|
float lastYaw = cameraEntity.lastYaw;
|
||||||
float lastPitch = cameraEntity.lastPitch;
|
float lastPitch = cameraEntity.lastPitch;
|
||||||
|
|
||||||
((IVec3d) cameraEntity.getPos()).smegma$set(pos.x, pos.y - cameraEntity.getEyeHeight(cameraEntity.getPose()), pos.z);
|
((IVec3d) cameraEntity.getEntityPos()).smegma$set(pos.x, pos.y - cameraEntity.getEyeHeight(cameraEntity.getPose()), pos.z);
|
||||||
cameraEntity.lastX = prevPos.x;
|
cameraEntity.lastX = prevPos.x;
|
||||||
cameraEntity.lastY = prevPos.y - cameraEntity.getEyeHeight(cameraEntity.getPose());
|
cameraEntity.lastY = prevPos.y - cameraEntity.getEyeHeight(cameraEntity.getPose());
|
||||||
cameraEntity.lastZ = prevPos.z;
|
cameraEntity.lastZ = prevPos.z;
|
||||||
@@ -91,7 +101,7 @@ public abstract class GameRendererMixin {
|
|||||||
updateCrosshairTarget(tickDelta);
|
updateCrosshairTarget(tickDelta);
|
||||||
freecamDone = false;
|
freecamDone = false;
|
||||||
|
|
||||||
((IVec3d) cameraEntity.getPos()).smegma$set(x, y, z);
|
((IVec3d) cameraEntity.getEntityPos()).smegma$set(x, y, z);
|
||||||
cameraEntity.lastX = lastX;
|
cameraEntity.lastX = lastX;
|
||||||
cameraEntity.lastY = lastY;
|
cameraEntity.lastY = lastY;
|
||||||
cameraEntity.lastZ = lastZ;
|
cameraEntity.lastZ = lastZ;
|
||||||
@@ -113,4 +123,15 @@ public abstract class GameRendererMixin {
|
|||||||
private float noRenderNauseaDistortion(float scaledNauseaEffectFactor) {
|
private float noRenderNauseaDistortion(float scaledNauseaEffectFactor) {
|
||||||
return (noRender.isEnabled() && !noRender.nauseaEffect.isEnabled()) ? 0 : scaledNauseaEffectFactor;
|
return (noRender.isEnabled() && !noRender.nauseaEffect.isEnabled()) ? 0 : scaledNauseaEffectFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ModifyReturnValue(method = "findCrosshairTarget", at = @At("RETURN"))
|
||||||
|
private HitResult onTargetEntity(HitResult original, @Local HitResult hitResult) {
|
||||||
|
NoMiningInterruptions nmi = ModuleManager.INSTANCE.getModuleByClass(NoMiningInterruptions.class);
|
||||||
|
|
||||||
|
Entity entity = original instanceof EntityHitResult result ? result.getEntity() : null;
|
||||||
|
if (nmi.shouldIgnoreEntity(entity) && hitResult.getType() == HitResult.Type.BLOCK)
|
||||||
|
return hitResult;
|
||||||
|
|
||||||
|
return original;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import me.retucio.camtweaks.CameraTweaks;
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.BungeecordSpoofer;
|
||||||
|
import net.minecraft.network.packet.c2s.handshake.ConnectionIntent;
|
||||||
|
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
|
||||||
|
import org.spongepowered.asm.mixin.*;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
|
@Mixin(HandshakeC2SPacket.class)
|
||||||
|
public abstract class HandshakeC2SPacketMixin {
|
||||||
|
|
||||||
|
@Shadow @Mutable @Final
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private final Gson gson = new Gson();
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public abstract ConnectionIntent intendedState();
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Inject(method = "<init>(ILjava/lang/String;ILnet/minecraft/network/packet/c2s/handshake/ConnectionIntent;)V", at = @At("RETURN"))
|
||||||
|
private void onHandshakeC2SPacket(int i, String string, int j, ConnectionIntent connectionIntent, CallbackInfo ci) {
|
||||||
|
BungeecordSpoofer spoofer = ModuleManager.INSTANCE.getModuleByClass(BungeecordSpoofer.class);
|
||||||
|
if (!spoofer.isEnabled()) return;
|
||||||
|
|
||||||
|
if (this.intendedState() != ConnectionIntent.LOGIN) return;
|
||||||
|
|
||||||
|
final String[] spoofedUUID = {CameraTweaks.mc.getSession().getUuidOrNull().toString()};
|
||||||
|
String URL = "https://api.mojang.com/users/profiles/minecraft/" + mc.getSession().getUsername();
|
||||||
|
|
||||||
|
executor.execute(() -> {
|
||||||
|
try {
|
||||||
|
HttpURLConnection req = (HttpURLConnection) new URL(URL).openConnection();
|
||||||
|
req.setRequestMethod("GET");
|
||||||
|
req.setConnectTimeout(5000);
|
||||||
|
req.setReadTimeout(5000);
|
||||||
|
|
||||||
|
if (req.getResponseCode() != 200) {
|
||||||
|
this.address += "\u0000" + spoofer.address.getValue() + "\u0000" + spoofedUUID[0];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonObject obj = JsonParser.parseReader(new InputStreamReader(req.getInputStream())).getAsJsonObject();
|
||||||
|
|
||||||
|
if (obj.has("id"))
|
||||||
|
spoofedUUID[0] = obj.get("id").getAsString();
|
||||||
|
|
||||||
|
this.address += "\u0000" + spoofer.address.getValue() + "\u0000" + spoofedUUID[0];
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
this.address += "\u0000" + spoofer.address.getValue() + "\u0000" + spoofedUUID[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,7 +9,8 @@ import net.minecraft.client.MinecraftClient;
|
|||||||
import net.minecraft.client.item.ItemModelManager;
|
import net.minecraft.client.item.ItemModelManager;
|
||||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
import net.minecraft.client.render.command.OrderedRenderCommandQueue;
|
||||||
|
import net.minecraft.client.render.entity.EntityRenderManager;
|
||||||
import net.minecraft.client.render.item.HeldItemRenderer;
|
import net.minecraft.client.render.item.HeldItemRenderer;
|
||||||
import net.minecraft.client.render.item.ItemRenderer;
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
@@ -49,17 +50,17 @@ public abstract class HeldItemRendererMixin {
|
|||||||
protected abstract boolean shouldSkipHandAnimationOnSwap(ItemStack from, ItemStack to);
|
protected abstract boolean shouldSkipHandAnimationOnSwap(ItemStack from, ItemStack to);
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
private void getModules(MinecraftClient client, EntityRenderDispatcher entityRenderDispatcher, ItemRenderer itemRenderer, ItemModelManager itemModelManager, CallbackInfo ci) {
|
private void getModules(MinecraftClient client, EntityRenderManager entityRenderDispatcher, ItemRenderer itemRenderer, ItemModelManager itemModelManager, CallbackInfo ci) {
|
||||||
handView = ModuleManager.INSTANCE.getModuleByClass(HandView.class);
|
handView = ModuleManager.INSTANCE.getModuleByClass(HandView.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemDisplayContext;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", shift = At.Shift.BEFORE))
|
@Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemDisplayContext;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;I)V", shift = At.Shift.BEFORE))
|
||||||
private void onRenderItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
|
private void onRenderItem(AbstractClientPlayerEntity player, float tickProgress, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, OrderedRenderCommandQueue orderedRenderCommandQueue, int light, CallbackInfo ci) {
|
||||||
EVENT_BUS.post(new RenderHeldItemEvent(matrices, hand));
|
EVENT_BUS.post(new RenderHeldItemEvent(matrices, hand));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderArmHoldingItem(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IFFLnet/minecraft/util/Arm;)V"))
|
@Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderArmHoldingItem(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;IFFLnet/minecraft/util/Arm;)V"))
|
||||||
private void onRenderArm(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
|
private void onRenderArm(AbstractClientPlayerEntity player, float tickProgress, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, OrderedRenderCommandQueue orderedRenderCommandQueue, int light, CallbackInfo ci) {
|
||||||
EVENT_BUS.post(new RenderArmEvent(matrices, hand));
|
EVENT_BUS.post(new RenderArmEvent(matrices, hand));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import me.retucio.camtweaks.module.ModuleManager;
|
|||||||
import me.retucio.camtweaks.module.modules.ChatPlus;
|
import me.retucio.camtweaks.module.modules.ChatPlus;
|
||||||
import me.retucio.camtweaks.module.modules.Freecam;
|
import me.retucio.camtweaks.module.modules.Freecam;
|
||||||
import me.retucio.camtweaks.module.modules.NoRender;
|
import me.retucio.camtweaks.module.modules.NoRender;
|
||||||
import me.retucio.camtweaks.ui.HUD;
|
import me.retucio.camtweaks.ui.hud.HudRenderer;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.hud.InGameHud;
|
import net.minecraft.client.gui.hud.InGameHud;
|
||||||
@@ -66,7 +66,7 @@ public abstract class InGameHudMixin {
|
|||||||
|
|
||||||
@Inject(method = "render", at = @At("RETURN"))
|
@Inject(method = "render", at = @At("RETURN"))
|
||||||
private void renderHUD(DrawContext ctx, RenderTickCounter tc, CallbackInfo ci) {
|
private void renderHUD(DrawContext ctx, RenderTickCounter tc, CallbackInfo ci) {
|
||||||
HUD.render(ctx, tc);
|
HudRenderer.render(ctx, tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyExpressionValue(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/Perspective;isFirstPerson()Z"))
|
@ModifyExpressionValue(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/Perspective;isFirstPerson()Z"))
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import me.retucio.camtweaks.module.modules.NoRender;
|
|||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.hud.InGameOverlayRenderer;
|
import net.minecraft.client.gui.hud.InGameOverlayRenderer;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
import net.minecraft.client.texture.Sprite;
|
||||||
|
import net.minecraft.client.texture.SpriteHolder;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
@@ -19,12 +21,12 @@ public abstract class InGameOverlayRendererMixin {
|
|||||||
private static NoRender noRender;
|
private static NoRender noRender;
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
private void getModules(MinecraftClient client, VertexConsumerProvider vertexConsumers, CallbackInfo ci) {
|
private void getModules(MinecraftClient client, SpriteHolder spriteHolder, VertexConsumerProvider vertexConsumers, CallbackInfo ci) {
|
||||||
noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderFireOverlay", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "renderFireOverlay", at = @At("HEAD"), cancellable = true)
|
||||||
private static void noRenderFireOverlay(MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo ci) {
|
private static void noRenderFireOverlay(MatrixStack matrices, VertexConsumerProvider vertexConsumers, Sprite sprite, CallbackInfo ci) {
|
||||||
if (noRender.isEnabled() && !noRender.fireOverlay.isEnabled()) ci.cancel();
|
if (noRender.isEnabled() && !noRender.fireOverlay.isEnabled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import me.retucio.camtweaks.module.ModuleManager;
|
|||||||
import me.retucio.camtweaks.module.modules.Nametags;
|
import me.retucio.camtweaks.module.modules.Nametags;
|
||||||
import net.minecraft.entity.ItemEntity;
|
import net.minecraft.entity.ItemEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
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.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -22,7 +24,15 @@ public abstract class ItemEntityMixin {
|
|||||||
if (!nametags.isEnabled()) return original;
|
if (!nametags.isEnabled()) return original;
|
||||||
|
|
||||||
int count = this.getStack().getCount();
|
int count = this.getStack().getCount();
|
||||||
if (nametags.countItems.isEnabled() && count > 1) return original.copy().append(" x" + count);
|
MutableText name = this.getStack().getCustomName() != null ? this.getStack().getCustomName().copyContentOnly() : original.copyContentOnly();
|
||||||
|
|
||||||
|
if (!name.equals(original)) name = name.formatted(Formatting.ITALIC);
|
||||||
|
|
||||||
|
if (nametags.countItems.isEnabled()) {
|
||||||
|
if (count > 1) return name.copy().append(" x" + count);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.ShulkerPeek;
|
||||||
|
import net.minecraft.block.ShulkerBoxBlock;
|
||||||
|
import net.minecraft.component.type.TooltipDisplayComponent;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.tooltip.TooltipType;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
@Mixin(Item.class)
|
||||||
|
public abstract class ItemMixin {
|
||||||
|
|
||||||
|
@Inject(method = "appendTooltip", at = @At("HEAD"))
|
||||||
|
private void onAppendTooltip(ItemStack stack, Item.TooltipContext context, TooltipDisplayComponent displayComponent, Consumer<Text> textConsumer, TooltipType type, CallbackInfo ci) {
|
||||||
|
ShulkerPeek shulkerPeek = ModuleManager.INSTANCE.getModuleByClass(ShulkerPeek.class);
|
||||||
|
if (!shulkerPeek.isEnabled() || !shulkerPeek.showTooltips.isEnabled()) return;
|
||||||
|
|
||||||
|
if (stack.getItem() instanceof BlockItem blockItem && blockItem.getBlock() instanceof ShulkerBoxBlock) {
|
||||||
|
if (ShulkerPeek.isShulkerEmpty(stack)) {
|
||||||
|
textConsumer.accept(Text.literal("vacío").formatted(Formatting.GRAY, Formatting.ITALIC));
|
||||||
|
} else {
|
||||||
|
textConsumer.accept(
|
||||||
|
Text.literal("mantén ")
|
||||||
|
.append(Text.literal(shulkerPeek.previewKey.getKeyName())
|
||||||
|
.formatted(Formatting.GOLD, Formatting.BOLD))
|
||||||
|
.append(" para previsualizar")
|
||||||
|
.formatted(Formatting.GRAY)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.GlintPlus;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(ItemRenderer.class)
|
||||||
|
public abstract class ItemRendererMixin {
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private static GlintPlus glintPlus;
|
||||||
|
|
||||||
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
|
private void getModules(CallbackInfo ci) {
|
||||||
|
glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "getItemGlintConsumer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayer;getGlint()Lnet/minecraft/client/render/RenderLayer;"))
|
||||||
|
private static RenderLayer getGlint() {
|
||||||
|
return glintPlus.getGlint();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "getItemGlintConsumer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayer;getEntityGlint()Lnet/minecraft/client/render/RenderLayer;"))
|
||||||
|
private static RenderLayer getEntityGlint() {
|
||||||
|
return glintPlus.getEntityGlint();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.event.events.DamageItemEvent;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||||
|
|
||||||
|
@Mixin(ItemStack.class)
|
||||||
|
public abstract class ItemStackMixin {
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public abstract int getDamage();
|
||||||
|
|
||||||
|
@Inject(method = "onDurabilityChange", at = @At("TAIL"))
|
||||||
|
private void onDamage(int damage, ServerPlayerEntity player, Consumer<Item> breakCallback, CallbackInfo ci) {
|
||||||
|
ItemStack stack = (ItemStack) (Object) this;
|
||||||
|
EVENT_BUS.post(new DamageItemEvent(getDamage(), stack));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,9 @@ package me.retucio.camtweaks.mixin;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.CameraTweaks;
|
import me.retucio.camtweaks.CameraTweaks;
|
||||||
import me.retucio.camtweaks.event.events.KeyEvent;
|
import me.retucio.camtweaks.event.events.KeyEvent;
|
||||||
|
import me.retucio.camtweaks.util.ChatUtil;
|
||||||
import net.minecraft.client.Keyboard;
|
import net.minecraft.client.Keyboard;
|
||||||
|
import net.minecraft.client.input.KeyInput;
|
||||||
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;
|
||||||
@@ -14,10 +16,10 @@ import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
|||||||
public abstract class KeyboardMixin {
|
public abstract class KeyboardMixin {
|
||||||
|
|
||||||
@Inject(method = "onKey", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onKey", at = @At("HEAD"), cancellable = true)
|
||||||
private void onKeyPress(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) {
|
private void onKeyPress(long window, int action, KeyInput input, CallbackInfo ci) {
|
||||||
CameraTweaks.INSTANCE.onKeyPress(key, action);
|
if (input.key() == -1) return;
|
||||||
|
CameraTweaks.INSTANCE.onKeyPress(input.key(), action);
|
||||||
KeyEvent event = EVENT_BUS.post(new KeyEvent(key, scancode, action));
|
KeyEvent event = EVENT_BUS.post(new KeyEvent(input.key(), input.scancode(), action));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,9 +5,11 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
|||||||
import com.mojang.blaze3d.textures.GpuTexture;
|
import com.mojang.blaze3d.textures.GpuTexture;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
import me.retucio.camtweaks.module.modules.Fullbright;
|
import me.retucio.camtweaks.module.modules.Fullbright;
|
||||||
|
import me.retucio.camtweaks.module.modules.NoRender;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.GameRenderer;
|
import net.minecraft.client.render.GameRenderer;
|
||||||
import net.minecraft.client.render.LightmapTextureManager;
|
import net.minecraft.client.render.LightmapTextureManager;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.math.ColorHelper;
|
import net.minecraft.util.math.ColorHelper;
|
||||||
import net.minecraft.util.profiler.Profiler;
|
import net.minecraft.util.profiler.Profiler;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
@@ -17,6 +19,7 @@ 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.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(LightmapTextureManager.class)
|
@Mixin(LightmapTextureManager.class)
|
||||||
public abstract class LightmapTextureManagerMixin {
|
public abstract class LightmapTextureManagerMixin {
|
||||||
@@ -24,25 +27,34 @@ public abstract class LightmapTextureManagerMixin {
|
|||||||
@Unique
|
@Unique
|
||||||
Fullbright fullbright;
|
Fullbright fullbright;
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
NoRender noRender;
|
||||||
|
|
||||||
@Shadow @Final
|
@Shadow @Final
|
||||||
private GpuTexture glTexture;
|
private GpuTexture glTexture;
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
private void getModules(GameRenderer renderer, MinecraftClient client, CallbackInfo ci) {
|
private void getModules(GameRenderer renderer, MinecraftClient client, CallbackInfo ci) {
|
||||||
fullbright = ModuleManager.INSTANCE.getModuleByClass(Fullbright.class);
|
fullbright = ModuleManager.INSTANCE.getModuleByClass(Fullbright.class);
|
||||||
|
noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V", shift = At.Shift.AFTER), cancellable = true)
|
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||||
private void update(float tickProgress, CallbackInfo ci, @Local Profiler profiler) {
|
private void update(float tickProgress, CallbackInfo ci, @Local Profiler profiler) {
|
||||||
if (fullbright.isEnabled() && fullbright.mode.is(Fullbright.Modes.GAMMA)) {
|
if (fullbright.isEnabled() && fullbright.mode.is(Fullbright.Modes.GAMMA)) {
|
||||||
RenderSystem.getDevice().createCommandEncoder().clearColorTexture(glTexture, ColorHelper.getArgb(
|
RenderSystem.getDevice().createCommandEncoder().clearColorTexture(glTexture, ColorHelper.getArgb(
|
||||||
fullbright.alpha.getIntValue(),
|
fullbright.color.getA(),
|
||||||
fullbright.red.getIntValue(),
|
fullbright.color.getR(),
|
||||||
fullbright.green.getIntValue(),
|
fullbright.color.getG(),
|
||||||
fullbright.blue.getIntValue()
|
fullbright.color.getB()
|
||||||
));
|
));
|
||||||
profiler.pop();
|
profiler.pop();
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "getDarkness", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void noRenderDarkness(LivingEntity entity, float factor, float tickProgress, CallbackInfoReturnable<Float> cir) {
|
||||||
|
if (noRender.isEnabled() && !noRender.darknessEffect.isEnabled()) cir.setReturnValue(0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,6 @@ import me.retucio.camtweaks.module.modules.Freecam;
|
|||||||
import me.retucio.camtweaks.module.modules.Nametags;
|
import me.retucio.camtweaks.module.modules.Nametags;
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||||
import net.minecraft.client.render.entity.PlayerEntityRenderer;
|
|
||||||
import net.minecraft.client.render.entity.model.EntityModel;
|
import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
@@ -19,6 +18,9 @@ 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.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
@Mixin(LivingEntityRenderer.class)
|
@Mixin(LivingEntityRenderer.class)
|
||||||
public abstract class LivingEntityRendererMixin<T extends LivingEntity> {
|
public abstract class LivingEntityRendererMixin<T extends LivingEntity> {
|
||||||
@@ -52,4 +54,14 @@ public abstract class LivingEntityRendererMixin<T extends LivingEntity> {
|
|||||||
if (nametags.isEnabled() && livingEntity instanceof PlayerEntity) return nametags.entities.isEnabled(EntityType.PLAYER) && original;
|
if (nametags.isEnabled() && livingEntity instanceof PlayerEntity) return nametags.entities.isEnabled(EntityType.PLAYER) && original;
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At("RETURN"), cancellable = true)
|
||||||
|
private void renderSelfNametag(T livingEntity, double d, CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
if (livingEntity instanceof PlayerEntity player) {
|
||||||
|
if (player == mc.player && nametags.showSelf.isEnabled()) {
|
||||||
|
cir.setReturnValue(true);
|
||||||
|
cir.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,37 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.ibm.icu.util.CodePointTrie;
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
import me.retucio.camtweaks.CameraTweaks;
|
import me.retucio.camtweaks.CameraTweaks;
|
||||||
|
import me.retucio.camtweaks.event.JoinWorldEvent;
|
||||||
import me.retucio.camtweaks.event.events.OpenScreenEvent;
|
import me.retucio.camtweaks.event.events.OpenScreenEvent;
|
||||||
import me.retucio.camtweaks.event.events.ShutdownEvent;
|
import me.retucio.camtweaks.event.events.ShutdownEvent;
|
||||||
import me.retucio.camtweaks.event.events.TickEvent;
|
import me.retucio.camtweaks.event.events.TickEvent;
|
||||||
|
import me.retucio.camtweaks.event.events.UseItemEvent;
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.FastUse;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
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.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.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
@Mixin(MinecraftClient.class)
|
@Mixin(MinecraftClient.class)
|
||||||
public abstract class MinecraftClientMixin {
|
public abstract class MinecraftClientMixin {
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private int itemUseCooldown;
|
||||||
|
|
||||||
@Inject(method = "tick", at = @At("HEAD"))
|
@Inject(method = "tick", at = @At("HEAD"))
|
||||||
private void onTickPre(CallbackInfo ci) {
|
private void onTickPre(CallbackInfo ci) {
|
||||||
CameraTweaks.INSTANCE.onTick();
|
CameraTweaks.INSTANCE.onTick();
|
||||||
@@ -37,4 +53,29 @@ public abstract class MinecraftClientMixin {
|
|||||||
OpenScreenEvent event = EVENT_BUS.post(new OpenScreenEvent(screen));
|
OpenScreenEvent event = EVENT_BUS.post(new OpenScreenEvent(screen));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "isTelemetryEnabledByApi", at = @At("RETURN"), cancellable = true)
|
||||||
|
private void disableMicropenisTelemetryShi(CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
cir.setReturnValue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;"), cancellable = true)
|
||||||
|
private void onUseItem(CallbackInfo ci, @Local Hand hand) {
|
||||||
|
if (mc.player == null) return;
|
||||||
|
UseItemEvent event = EVENT_BUS.post(new UseItemEvent(mc.player.getStackInHand(hand), hand));
|
||||||
|
if (event.isCancelled()) ci.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isItemEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z"))
|
||||||
|
private void modifyItemUseCooldown(CallbackInfo ci, @Local ItemStack stack) {
|
||||||
|
FastUse fastUse = ModuleManager.INSTANCE.getModuleByClass(FastUse.class);
|
||||||
|
if (!fastUse.isEnabled()) return;
|
||||||
|
itemUseCooldown = fastUse.getCooldown(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "joinWorld", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void onJoinWorld(ClientWorld world, CallbackInfo ci) {
|
||||||
|
JoinWorldEvent event = EVENT_BUS.post(new JoinWorldEvent(world));
|
||||||
|
if (event.isCancelled()) ci.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import me.retucio.camtweaks.CameraTweaks;
|
|||||||
import me.retucio.camtweaks.event.events.MouseClickEvent;
|
import me.retucio.camtweaks.event.events.MouseClickEvent;
|
||||||
import me.retucio.camtweaks.event.events.MouseScrollEvent;
|
import me.retucio.camtweaks.event.events.MouseScrollEvent;
|
||||||
import net.minecraft.client.Mouse;
|
import net.minecraft.client.Mouse;
|
||||||
|
import net.minecraft.client.input.MouseInput;
|
||||||
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;
|
||||||
@@ -15,8 +16,8 @@ import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
|||||||
public abstract class MouseMixin {
|
public abstract class MouseMixin {
|
||||||
|
|
||||||
@Inject(method = "onMouseButton", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onMouseButton", at = @At("HEAD"), cancellable = true)
|
||||||
private void onMouseButton(long window, int button, int action, int mods, CallbackInfo ci) {
|
private void onMouseButton(long window, MouseInput input, int action, CallbackInfo ci) {
|
||||||
MouseClickEvent event = EVENT_BUS.post(new MouseClickEvent(action, button));
|
MouseClickEvent event = EVENT_BUS.post(new MouseClickEvent(action, input.button()));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.RPackBypass;
|
||||||
|
import net.minecraft.client.network.ServerInfo;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Mixin(ServerInfo.ResourcePackPolicy.class)
|
||||||
|
public abstract class ResourcePackPolicyMixin {
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private static ServerInfo.ResourcePackPolicy BYPASS;
|
||||||
|
|
||||||
|
@Invoker("<init>")
|
||||||
|
public static ServerInfo.ResourcePackPolicy init(final String enumName, final int enumOrdinal, final String name) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "values", at = @At("TAIL"), cancellable = true)
|
||||||
|
private static void addVariant(CallbackInfoReturnable<ServerInfo.ResourcePackPolicy[]> cir) {
|
||||||
|
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||||
|
if (!bypassPack.isEnabled()) return;
|
||||||
|
|
||||||
|
ServerInfo.ResourcePackPolicy[] values = cir.getReturnValue();
|
||||||
|
final int ordinal = values.length;
|
||||||
|
cir.setReturnValue(values = Arrays.copyOfRange(values, 0, ordinal + 1));
|
||||||
|
values[ordinal] = BYPASS = init(bypassPack.ENUM_NAME, ordinal, "bypass");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "getName", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void addToGetName(final CallbackInfoReturnable<Text> cir) {
|
||||||
|
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||||
|
if (BYPASS == (Object) this && bypassPack.isEnabled())
|
||||||
|
cir.setReturnValue(bypassPack.BYPASS_TEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import me.retucio.camtweaks.CameraTweaks;
|
||||||
import me.retucio.camtweaks.command.CommandManager;
|
import me.retucio.camtweaks.command.CommandManager;
|
||||||
|
import me.retucio.camtweaks.config.ConfigManager;
|
||||||
import me.retucio.camtweaks.event.events.ClientClickEvent;
|
import me.retucio.camtweaks.event.events.ClientClickEvent;
|
||||||
|
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
||||||
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.text.ClickEvent;
|
import net.minecraft.text.ClickEvent;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -11,6 +16,11 @@ 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.CallbackInfo;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.getVersionName;
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
@Mixin(Screen.class)
|
@Mixin(Screen.class)
|
||||||
public class ScreenMixin {
|
public class ScreenMixin {
|
||||||
|
|
||||||
@@ -19,4 +29,15 @@ public class ScreenMixin {
|
|||||||
if (clickEvent instanceof ClientClickEvent event && event.getValue().startsWith(CommandManager.INSTANCE.getPrefix()))
|
if (clickEvent instanceof ClientClickEvent event && event.getValue().startsWith(CommandManager.INSTANCE.getPrefix()))
|
||||||
CommandManager.dispatch(event.getValue().substring(CommandManager.INSTANCE.getPrefix().length()));
|
CommandManager.dispatch(event.getValue().substring(CommandManager.INSTANCE.getPrefix().length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "render", at = @At("HEAD"))
|
||||||
|
private void renderWatermark(DrawContext context, int mouseX, int mouseY, float deltaTicks, CallbackInfo ci) {
|
||||||
|
if (!ConfigManager.hasLoaded()) return; // para evitar dibujar la marca de agua por defecto
|
||||||
|
String watermark = ClientSettingsFrame.guiSettings.watermark.getValue();
|
||||||
|
if (watermark == null || watermark.isEmpty()) return;
|
||||||
|
context.drawText(mc.textRenderer, watermark,
|
||||||
|
mc.getWindow().getScaledWidth() - mc.textRenderer.getWidth(watermark) - 2, 2,
|
||||||
|
ClientSettingsFrame.guiSettings.color.getRGB(), false
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,8 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
@Mixin(ScreenshotRecorder.class)
|
@Mixin(ScreenshotRecorder.class)
|
||||||
public abstract class ScreenshotRecorderMixin {
|
public abstract class ScreenshotRecorderMixin {
|
||||||
|
|
||||||
@@ -35,7 +37,8 @@ public abstract class ScreenshotRecorderMixin {
|
|||||||
|
|
||||||
if (!screenshotPlus.isEnabled()) return;
|
if (!screenshotPlus.isEnabled()) return;
|
||||||
|
|
||||||
screenshotPlus.sendScreenshotMessage();
|
// por los threads o lo que sea
|
||||||
|
mc.execute(screenshotPlus::sendScreenshotMessage);
|
||||||
|
|
||||||
switch (screenshotPlus.defaultAction.getValue()) {
|
switch (screenshotPlus.defaultAction.getValue()) {
|
||||||
case COPY -> screenshotPlus.copyScreenshot(nativeImage);
|
case COPY -> screenshotPlus.copyScreenshot(nativeImage);
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.RPackBypass;
|
||||||
|
import net.minecraft.client.network.ServerInfo;
|
||||||
|
import net.minecraft.client.resource.server.ServerResourcePackManager;
|
||||||
|
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.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(targets = "net.minecraft.client.gui.screen.multiplayer.ConnectScreen$1")
|
||||||
|
public abstract class ServerConnectorMixin {
|
||||||
|
|
||||||
|
@Inject(method = "toAcceptanceStatus", at = @At("HEAD"), cancellable = true)
|
||||||
|
private static void guardSwitchCase(ServerInfo.ResourcePackPolicy policy, CallbackInfoReturnable<ServerResourcePackManager.AcceptanceStatus> cir) {
|
||||||
|
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||||
|
if (!bypassPack.isEnabled()) return;
|
||||||
|
if (policy == bypassPack.getPolicy())
|
||||||
|
cir.setReturnValue(ServerResourcePackManager.AcceptanceStatus.ALLOWED);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.RPackBypass;
|
||||||
|
import net.minecraft.client.network.ServerInfo;
|
||||||
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(ServerInfo.class)
|
||||||
|
public abstract class ServerInfoMixin {
|
||||||
|
|
||||||
|
@Shadow private ServerInfo.ResourcePackPolicy resourcePackPolicy;
|
||||||
|
@Unique private boolean isBypassStatus;
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private static RPackBypass bypassPack;
|
||||||
|
|
||||||
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
|
private void getModules(String name, String address, ServerInfo.ServerType serverType, CallbackInfo ci) {
|
||||||
|
bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "fromNbt", at = @At("TAIL"))
|
||||||
|
private static void addToRead(NbtCompound root, CallbackInfoReturnable<ServerInfo> cir) {
|
||||||
|
if (!bypassPack.isEnabled()) return;
|
||||||
|
if (root.getBoolean(bypassPack.TAG_NAME, false))
|
||||||
|
cir.getReturnValue().setResourcePackPolicy(bypassPack.getPolicy());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "toNbt", at = @At("HEAD"))
|
||||||
|
private void preWrite(CallbackInfoReturnable<NbtCompound> cir) {
|
||||||
|
if (!bypassPack.isEnabled()) return;
|
||||||
|
if (this.resourcePackPolicy == bypassPack.getPolicy()) {
|
||||||
|
this.isBypassStatus = true;
|
||||||
|
this.resourcePackPolicy = ServerInfo.ResourcePackPolicy.PROMPT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "toNbt", at = @At("TAIL"))
|
||||||
|
private void addToWrite(CallbackInfoReturnable<NbtCompound> cir) {
|
||||||
|
if (!bypassPack.isEnabled()) return;
|
||||||
|
if (this.isBypassStatus) {
|
||||||
|
cir.getReturnValue().putBoolean(bypassPack.TAG_NAME, true);
|
||||||
|
this.resourcePackPolicy = bypassPack.getPolicy();
|
||||||
|
this.isBypassStatus = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.buffers.GpuBuffer;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.NoRender;
|
||||||
import me.retucio.camtweaks.module.modules.PerspectivePlus;
|
import me.retucio.camtweaks.module.modules.PerspectivePlus;
|
||||||
import me.retucio.camtweaks.module.modules.TimeChanger;
|
import me.retucio.camtweaks.module.modules.TimeChanger;
|
||||||
|
import me.retucio.camtweaks.util.ChatUtil;
|
||||||
import net.minecraft.client.render.SkyRendering;
|
import net.minecraft.client.render.SkyRendering;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
@@ -11,6 +14,7 @@ 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.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(SkyRendering.class)
|
@Mixin(SkyRendering.class)
|
||||||
public abstract class SkyRendererMixin {
|
public abstract class SkyRendererMixin {
|
||||||
@@ -24,12 +28,12 @@ public abstract class SkyRendererMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderSun", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "renderSun", at = @At("HEAD"), cancellable = true)
|
||||||
private void onRenderSun(float alpha, VertexConsumerProvider vertexConsumers, MatrixStack matrices, CallbackInfo ci) {
|
private void onRenderSun(float alpha, MatrixStack matrices, CallbackInfo ci) {
|
||||||
if (timeChanger.isEnabled() && !timeChanger.renderSun.isEnabled()) ci.cancel();
|
if (timeChanger.isEnabled() && !timeChanger.renderSun.isEnabled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderMoon", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "renderMoon", at = @At("HEAD"), cancellable = true)
|
||||||
private void onRenderMoon(int phase, float alpha, VertexConsumerProvider vertexConsumers, MatrixStack matrices, CallbackInfo ci) {
|
private void onRenderMoon(int phase, float alpha, MatrixStack matrixStack, CallbackInfo ci) {
|
||||||
if (timeChanger.isEnabled() && !timeChanger.renderMoon.isEnabled()) ci.cancel();
|
if (timeChanger.isEnabled() && !timeChanger.renderMoon.isEnabled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,4 +41,10 @@ public abstract class SkyRendererMixin {
|
|||||||
private void onRenderStars(float brightness, MatrixStack matrices, CallbackInfo ci) {
|
private void onRenderStars(float brightness, MatrixStack matrices, CallbackInfo ci) {
|
||||||
if (timeChanger.isEnabled() && !timeChanger.renderStars.isEnabled()) ci.cancel();
|
if (timeChanger.isEnabled() && !timeChanger.renderStars.isEnabled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "drawEndLightFlash", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void onEndFlash(MatrixStack matrixStack, float f, float skyFactor, float pitch, CallbackInfo ci) {
|
||||||
|
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||||
|
if (noRender.isEnabled() && !noRender.endFlashes.isEnabled()) ci.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.NoRender;
|
||||||
|
import net.minecraft.client.render.fog.StatusEffectFogModifier;
|
||||||
|
import net.minecraft.entity.effect.StatusEffect;
|
||||||
|
import net.minecraft.entity.effect.StatusEffects;
|
||||||
|
import net.minecraft.registry.entry.RegistryEntry;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
@Mixin(StatusEffectFogModifier.class)
|
||||||
|
public abstract class StatusEffectFogModifierMixin {
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public abstract RegistryEntry<StatusEffect> getStatusEffect();
|
||||||
|
|
||||||
|
@ModifyReturnValue(method = "shouldApply", at = @At("RETURN"))
|
||||||
|
public boolean noRenderBadEffects(boolean original) {
|
||||||
|
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||||
|
if (!noRender.isEnabled()) return original;
|
||||||
|
if (getStatusEffect() == StatusEffects.BLINDNESS && !noRender.blindnessEffect.isEnabled()) return false;
|
||||||
|
if (getStatusEffect() == StatusEffects.DARKNESS && !noRender.darknessEffect.isEnabled()) return false;
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.session.telemetry.TelemetryManager;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Coerce;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(TelemetryManager.class)
|
||||||
|
public class TelemetryManagerMixin {
|
||||||
|
|
||||||
|
@Redirect(method = "computeSender", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;isTelemetryEnabledByApi()Z"))
|
||||||
|
private boolean disableTelemetry(@Coerce Object minecraftClient) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,22 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
import me.retucio.camtweaks.module.modules.NoRender;
|
import me.retucio.camtweaks.module.modules.NoRender;
|
||||||
|
import net.minecraft.client.font.BakedGlyph;
|
||||||
|
import net.minecraft.client.font.GlyphProvider;
|
||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
import net.minecraft.text.Style;
|
import net.minecraft.text.Style;
|
||||||
import net.minecraft.text.TextColor;
|
import net.minecraft.text.TextColor;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
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.*;
|
import org.spongepowered.asm.mixin.injection.*;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
// falta italics pero no sé dónde se comprueba eso, no es aquí :P
|
// falta italics pero no sé dónde se comprueba eso, no es aquí :P
|
||||||
@Mixin(TextRenderer.Drawer.class)
|
@Mixin(TextRenderer.Drawer.class)
|
||||||
public abstract class TextRendererDrawerMixin {
|
public abstract class TextRendererDrawerMixin {
|
||||||
@@ -22,27 +29,22 @@ public abstract class TextRendererDrawerMixin {
|
|||||||
noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "accept", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isBold()Z"))
|
@Redirect(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isBold()Z"))
|
||||||
private boolean noRenderBold(Style style) {
|
private boolean noRenderBold(Style style) {
|
||||||
return !(noRender.isEnabled() && !noRender.bold.isEnabled()) && style.isBold();
|
return !(noRender.isEnabled() && !noRender.bold.isEnabled()) && style.isBold();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "accept", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isUnderlined()Z"))
|
@Redirect(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isUnderlined()Z"))
|
||||||
private boolean noRenderUnderlined(Style style) {
|
private boolean noRenderUnderlined(Style style) {
|
||||||
return !(noRender.isEnabled() && !noRender.underlined.isEnabled()) && style.isUnderlined();
|
return !(noRender.isEnabled() && !noRender.underlined.isEnabled()) && style.isUnderlined();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "accept", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isStrikethrough()Z"))
|
@Redirect(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isStrikethrough()Z"))
|
||||||
private boolean noRenderStrikethrough(Style style) {
|
private boolean noRenderStrikethrough(Style style) {
|
||||||
return !(noRender.isEnabled() && !noRender.strikethrough.isEnabled()) && style.isStrikethrough();
|
return !(noRender.isEnabled() && !noRender.strikethrough.isEnabled()) && style.isStrikethrough();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "accept", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isObfuscated()Z"))
|
@ModifyArg(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer$Drawer;getRenderColor(Lnet/minecraft/text/TextColor;)I"))
|
||||||
private boolean noRenderMTS(Style style) {
|
|
||||||
return !(noRender.isEnabled() && !noRender.scrambledText.isEnabled()) && style.isObfuscated();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModifyArg(method = "accept", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer$Drawer;getRenderColor(Lnet/minecraft/text/TextColor;)I"))
|
|
||||||
private TextColor noRenderColor(TextColor original) {
|
private TextColor noRenderColor(TextColor original) {
|
||||||
return !noRender.color.is(NoRender.Colors.DEFAULT) ? TextColor.fromFormatting(noRender.color.getValue().toFormatting()) : original;
|
return !noRender.color.is(NoRender.Colors.DEFAULT) ? TextColor.fromFormatting(noRender.color.getValue().toFormatting()) : original;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.NoRender;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
@Mixin(TextRenderer.class)
|
||||||
|
public abstract class TextRendererMixin {
|
||||||
|
|
||||||
|
@ModifyExpressionValue(method = "getGlyph", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isObfuscated()Z"))
|
||||||
|
private boolean noRenderMTS(boolean original) {
|
||||||
|
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||||
|
return (!noRender.isEnabled() || noRender.scrambledText.isEnabled()) && original;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import me.retucio.camtweaks.module.modules.NoRender;
|
|||||||
import net.minecraft.client.render.Camera;
|
import net.minecraft.client.render.Camera;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.WeatherRendering;
|
import net.minecraft.client.render.WeatherRendering;
|
||||||
|
import net.minecraft.client.render.state.WeatherRenderState;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.particle.ParticlesMode;
|
import net.minecraft.particle.ParticlesMode;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
@@ -33,11 +34,11 @@ public abstract class WeatherRenderingMixin {
|
|||||||
if (noRender.isEnabled() && !noRender.rain.isEnabled()) ci.cancel();
|
if (noRender.isEnabled() && !noRender.rain.isEnabled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderPrecipitation(Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/util/math/Vec3d;IFLjava/util/List;Ljava/util/List;)V", at = @At("HEAD"))
|
@Inject(method = "renderPrecipitation", at = @At("HEAD"))
|
||||||
private void noRenderRainAndSnow(VertexConsumerProvider vertexConsumers, Vec3d pos, int range, float gradient, List<?> rainPieces, List<?> snowPieces, CallbackInfo ci) {
|
private void noRenderRainAndSnow(VertexConsumerProvider vertexConsumers, Vec3d pos, WeatherRenderState weatherRenderState, CallbackInfo ci) {
|
||||||
if (noRender.isEnabled()) {
|
if (noRender.isEnabled()) {
|
||||||
if (!noRender.rain.isEnabled()) rainPieces.clear();
|
if (!noRender.rain.isEnabled()) weatherRenderState.rainPieces.clear();
|
||||||
if (!noRender.snow.isEnabled()) snowPieces.clear();
|
if (!noRender.snow.isEnabled()) weatherRenderState.snowPieces.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,75 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
|
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
||||||
|
import me.retucio.camtweaks.CameraTweaks;
|
||||||
|
import me.retucio.camtweaks.event.events.RenderWorldEvent;
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
import me.retucio.camtweaks.module.modules.BlockOutline;
|
import me.retucio.camtweaks.module.modules.BlockOutline;
|
||||||
import me.retucio.camtweaks.module.modules.Freecam;
|
import me.retucio.camtweaks.module.modules.Freecam;
|
||||||
import net.minecraft.client.render.WorldRenderer;
|
import me.retucio.camtweaks.module.modules.NoRender;
|
||||||
|
import me.retucio.camtweaks.util.Colors;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.render.*;
|
||||||
|
import net.minecraft.client.render.state.WorldRenderState;
|
||||||
|
import net.minecraft.client.util.ObjectAllocator;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.math.ColorHelper;
|
import net.minecraft.util.math.ColorHelper;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.RotationAxis;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.profiler.Profiler;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
import org.joml.Vector4f;
|
||||||
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.ModifyArg;
|
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
@Mixin(WorldRenderer.class)
|
@Mixin(WorldRenderer.class)
|
||||||
public abstract class WorldRendererMixin {
|
public abstract class WorldRendererMixin {
|
||||||
|
|
||||||
@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupTerrain(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/Frustum;ZZ)V"), index = 3)
|
@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;method_74752(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/Frustum;Z)V"), index = 2)
|
||||||
private boolean renderSetupTerrainModifyArg(boolean hasForcedFrustum) {
|
private boolean renderSetupTerrainModifyArg(boolean spectator) {
|
||||||
return ModuleManager.INSTANCE.getModuleByClass(Freecam.class).isEnabled() || hasForcedFrustum;
|
return ModuleManager.INSTANCE.getModuleByClass(Freecam.class).isEnabled() || spectator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "render", at = @At("RETURN"))
|
||||||
|
private void render(ObjectAllocator allocator, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix, GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky, CallbackInfo ci, @Local Profiler profiler) {
|
||||||
|
if (mc == null || mc.world == null) return;
|
||||||
|
|
||||||
|
MatrixStack matrices = new MatrixStack();
|
||||||
|
matrices.push();
|
||||||
|
|
||||||
|
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch()));
|
||||||
|
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180f));
|
||||||
|
|
||||||
|
profiler.push(CameraTweaks.MOD_ID + "-3d");
|
||||||
|
EVENT_BUS.post(new RenderWorldEvent(matrices, tickCounter, camera));
|
||||||
|
|
||||||
|
profiler.pop();
|
||||||
|
matrices.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "renderTargetBlockOutline", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void noRenderBlockOutlinesFreecam(VertexConsumerProvider.Immediate immediate, MatrixStack matrices, boolean renderBlockOutline, WorldRenderState renderStates, CallbackInfo ci) {
|
||||||
|
Freecam freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
||||||
|
if (freecam.isEnabled() && !freecam.blockOutlines.isEnabled()) ci.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "hasBlindnessOrDarkness(Lnet/minecraft/client/render/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.isEnabled() || !noRender.darknessEffect.isEnabled()) cir.setReturnValue(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "renderTargetBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/ColorHelper;withAlpha(II)I"))
|
@Redirect(method = "renderTargetBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/ColorHelper;withAlpha(II)I"))
|
||||||
@@ -25,24 +77,6 @@ public abstract class WorldRendererMixin {
|
|||||||
BlockOutline outline = ModuleManager.INSTANCE.getModuleByClass(BlockOutline.class);
|
BlockOutline outline = ModuleManager.INSTANCE.getModuleByClass(BlockOutline.class);
|
||||||
if (!outline.isEnabled()) return ColorHelper.withAlpha(alpha, rgb);
|
if (!outline.isEnabled()) return ColorHelper.withAlpha(alpha, rgb);
|
||||||
|
|
||||||
if (outline.rainbow.isEnabled()) {
|
return outline.color.getRGB();
|
||||||
float speed = 10001 - outline.rainbowSpeed.getFloatValue(); // 10001 para evitar divisiones por cero
|
|
||||||
float hue = (System.currentTimeMillis() % (int) speed) / speed;
|
|
||||||
Color gamingProMax = Color.getHSBColor(hue, 1, 1);
|
|
||||||
|
|
||||||
return new Color(
|
|
||||||
gamingProMax.getRed(),
|
|
||||||
gamingProMax.getGreen(),
|
|
||||||
gamingProMax.getBlue(),
|
|
||||||
outline.alpha.getIntValue()
|
|
||||||
).getRGB();
|
|
||||||
} else {
|
|
||||||
return new Color(
|
|
||||||
outline.red.getIntValue(),
|
|
||||||
outline.green.getIntValue(),
|
|
||||||
outline.blue.getIntValue(),
|
|
||||||
outline.alpha.getIntValue()
|
|
||||||
).getRGB();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.mojang.authlib.yggdrasil.YggdrasilUserApiService;
|
||||||
|
import com.mojang.authlib.yggdrasil.response.UserAttributesResponse;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
// código robado de: https://github.com/kb-1000/no-telemetry
|
||||||
|
|
||||||
|
@Mixin(YggdrasilUserApiService.class)
|
||||||
|
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)
|
||||||
|
private boolean getTelemetry(UserAttributesResponse.Privileges instance) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package me.retucio.camtweaks.mixin.accessor;
|
||||||
|
|
||||||
|
import net.minecraft.block.entity.SignBlockEntity;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(AbstractSignEditScreen.class)
|
||||||
|
public interface AbstractSignEditScreenAccessor {
|
||||||
|
|
||||||
|
@Accessor("blockEntity")
|
||||||
|
SignBlockEntity getBlockEntity();
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package me.retucio.camtweaks.mixin.accessor;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screen.ingame.AnvilScreen;
|
||||||
|
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(AnvilScreen.class)
|
||||||
|
public interface AnvilScreenAccessor {
|
||||||
|
|
||||||
|
@Accessor("nameField")
|
||||||
|
TextFieldWidget getNameField();
|
||||||
|
|
||||||
|
@Accessor("nameField")
|
||||||
|
void setNameField(TextFieldWidget nameField);
|
||||||
|
}
|
||||||
Loaded 100 of 240 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user