Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f816381c3 | ||
|
|
36c38bdf02 | ||
|
|
a6a6f1261e | ||
|
|
8891a57c7c |
No files matched your search
@@ -39,6 +39,12 @@ replay_*.log
|
|||||||
*.hprof
|
*.hprof
|
||||||
*.jfr
|
*.jfr
|
||||||
|
|
||||||
|
# otros
|
||||||
|
|
||||||
todo.txt
|
todo.txt
|
||||||
test.java
|
test.java
|
||||||
cambios.md
|
cambios.md
|
||||||
|
# no está terminado
|
||||||
|
src/main/java/me/retucio/camtweaks/module/modules/TooltipsPlus.java
|
||||||
|
|
||||||
|
remappedSrc/
|
||||||
@@ -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,7 @@ 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
|
||||||
+8
-16
@@ -1,27 +1,19 @@
|
|||||||
# v1.3
|
# v1.5
|
||||||
|
|
||||||
## novedades
|
## novedades
|
||||||
|
|
||||||
|
sigo vivo (creo)
|
||||||
|
|
||||||
### adiciones
|
### adiciones
|
||||||
|
|
||||||
- barra de búsqueda: filtra los ajustes de todos los paneles de ajustes, por nombre y descripción
|
- editor de hud bastante básico pero por lo general funcional (`pág. arriba` por defecto). viene con muchos bugs, ojalá me caiga un rayo.
|
||||||
- barra de deslizamiento
|
|
||||||
- módulo de jugador falso: invoca una entidad de jugador falsa, por motivos de testeo
|
|
||||||
- HUD: mostrar información adicional en pantalla (ej.: hora, fps, coordenadas, ...)
|
|
||||||
|
|
||||||
### arreglos / mejoras
|
### arreglos / mejoras
|
||||||
|
|
||||||
- mejoras a la interfaz
|
- ya no salta un error al hacer una captura con los módulos `capturas de pantalla` y `chat plus` activos
|
||||||
- ahora el color de los widgets depende del color principal
|
- ahora la telemetría (abuso de privacidad al usuario de microshit) está desactivado por huevos. si quieres activarlo te jodes.
|
||||||
- ahora solo se puede seleccionar un objeto de la interfaz a la vez
|
- ahora ya no puedes abrir interfaces del mod si no estás en un mundo
|
||||||
- cambiada la posición de los títulos de los marcos
|
- mejorada la seguridad de algunas operaciones
|
||||||
|
|
||||||
- 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
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -4,15 +4,15 @@ org.gradle.parallel=true
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
minecraft_version=1.21.6
|
minecraft_version=1.21.10
|
||||||
yarn_mappings=1.21.6+build.1
|
yarn_mappings=1.21.10+build.2
|
||||||
loader_version=0.17.2
|
loader_version=0.17.3
|
||||||
loom_version=1.11-SNAPSHOT
|
loom_version=1.11-SNAPSHOT
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.3
|
mod_version=1.5
|
||||||
maven_group=me.retucio
|
maven_group=me.retucio
|
||||||
archives_base_name=camtweaks
|
archives_base_name=camtweaks
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.128.2+1.21.6
|
fabric_version=0.135.0+1.21.10
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 243 KiB |
@@ -16,7 +16,10 @@ 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.module.modules.HUD;
|
||||||
import me.retucio.camtweaks.ui.ClickGUI;
|
import me.retucio.camtweaks.ui.ClickGUI;
|
||||||
|
import me.retucio.camtweaks.ui.HudEditorScreen;
|
||||||
|
import me.retucio.camtweaks.ui.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;
|
||||||
@@ -64,6 +67,7 @@ public class CameraTweaks implements ClientModInitializer {
|
|||||||
EVENT_BUS.register(this);
|
EVENT_BUS.register(this);
|
||||||
EVENT_BUS.register(MiscUtil.class);
|
EVENT_BUS.register(MiscUtil.class);
|
||||||
EVENT_BUS.register(ChatUtil.class);
|
EVENT_BUS.register(ChatUtil.class);
|
||||||
|
EVENT_BUS.register(HudRenderer.class);
|
||||||
|
|
||||||
Lists.init();
|
Lists.init();
|
||||||
|
|
||||||
@@ -74,6 +78,7 @@ public class CameraTweaks implements ClientModInitializer {
|
|||||||
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();
|
ConfigManager.load();
|
||||||
@@ -99,17 +104,21 @@ public class CameraTweaks implements ClientModInitializer {
|
|||||||
|
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,10 +159,11 @@ 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) return;
|
||||||
|
if (!(mc != null && mc.world != null && mc.player != null)) 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 +172,20 @@ 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) {
|
||||||
|
if (key != ModuleManager.INSTANCE.getModuleByClass(HUD.class).editorKey.getKey() || anyFocused) return;
|
||||||
|
if (!(mc != null && mc.world != null && mc.player != null)) return;
|
||||||
|
|
||||||
|
if (mc.currentScreen != HudEditorScreen.INSTANCE) {
|
||||||
|
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;
|
||||||
|
|||||||
@@ -26,11 +26,16 @@ 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<>();
|
||||||
|
|
||||||
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());
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public class ConfigManager {
|
|||||||
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,6 +123,19 @@ 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public static void applySetting(Module parent, AbstractSetting setting) {
|
public static void applySetting(Module parent, AbstractSetting setting) {
|
||||||
String id = parent.getName() + ":" + setting.getName();
|
String id = parent.getName() + ":" + setting.getName();
|
||||||
|
|||||||
@@ -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,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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ 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 net.minecraft.client.particle.ParticleTextureSheet;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -14,9 +15,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,7 +26,7 @@ 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;
|
||||||
|
|||||||
@@ -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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@ import me.retucio.camtweaks.module.modules.AntiInvis;
|
|||||||
import me.retucio.camtweaks.module.modules.Freecam;
|
import me.retucio.camtweaks.module.modules.Freecam;
|
||||||
import me.retucio.camtweaks.module.modules.Freelook;
|
import me.retucio.camtweaks.module.modules.Freelook;
|
||||||
import me.retucio.camtweaks.module.modules.Nametags;
|
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 +13,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;
|
||||||
@@ -80,6 +78,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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ 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 org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
@@ -47,7 +48,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 +79,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 +92,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;
|
||||||
|
|||||||
@@ -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.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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ 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 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 +15,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);
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.camtweaks.mixin;
|
package me.retucio.camtweaks.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
import me.retucio.camtweaks.CameraTweaks;
|
import me.retucio.camtweaks.CameraTweaks;
|
||||||
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;
|
||||||
@@ -10,6 +11,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.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;
|
||||||
|
|
||||||
@@ -37,4 +39,9 @@ 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -24,12 +24,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,21 +3,43 @@ package me.retucio.camtweaks.mixin;
|
|||||||
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 me.retucio.camtweaks.module.modules.NoRender;
|
||||||
|
import net.minecraft.client.render.Camera;
|
||||||
|
import net.minecraft.client.render.Frustum;
|
||||||
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.WorldRenderer;
|
import net.minecraft.client.render.WorldRenderer;
|
||||||
|
import net.minecraft.client.render.state.WorldRenderState;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.math.ColorHelper;
|
import net.minecraft.util.math.ColorHelper;
|
||||||
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.*;
|
||||||
|
|
||||||
@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 = "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"))
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,8 +40,10 @@ public class ModuleManager {
|
|||||||
modules.add(new Nametags());
|
modules.add(new Nametags());
|
||||||
modules.add(new NoRender());
|
modules.add(new NoRender());
|
||||||
modules.add(new PerspectivePlus());
|
modules.add(new PerspectivePlus());
|
||||||
|
modules.add(new PortalGUI());
|
||||||
modules.add(new ScreenshotPlus());
|
modules.add(new ScreenshotPlus());
|
||||||
modules.add(new TimeChanger());
|
modules.add(new TimeChanger());
|
||||||
|
// modules.add(new TooltipsPlus());
|
||||||
modules.add(new Zoom());
|
modules.add(new Zoom());
|
||||||
|
|
||||||
modules.sort(Comparator.comparing(module -> module.getName().toLowerCase()));
|
modules.sort(Comparator.comparing(module -> module.getName().toLowerCase()));
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ public class ChatPlus extends Module {
|
|||||||
GameProfile sender = getSender(line, text);
|
GameProfile sender = getSender(line, text);
|
||||||
if (sender == null) return;
|
if (sender == null) return;
|
||||||
|
|
||||||
PlayerListEntry entry = mc.getNetworkHandler().getPlayerListEntry(sender.getId());
|
PlayerListEntry entry = mc.getNetworkHandler().getPlayerListEntry(sender.id());
|
||||||
if (entry == null) return;
|
if (entry == null) return;
|
||||||
|
|
||||||
PlayerSkinDrawer.draw(context, entry.getSkinTextures(), 0, y, 8);
|
PlayerSkinDrawer.draw(context, entry.getSkinTextures(), 0, y, 8);
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ import me.retucio.camtweaks.module.settings.NumberSetting;
|
|||||||
import me.retucio.camtweaks.util.ChatUtil;
|
import me.retucio.camtweaks.util.ChatUtil;
|
||||||
import me.retucio.camtweaks.util.KeyUtil;
|
import me.retucio.camtweaks.util.KeyUtil;
|
||||||
import me.retucio.camtweaks.util.MiscUtil;
|
import me.retucio.camtweaks.util.MiscUtil;
|
||||||
|
import net.minecraft.client.gui.Click;
|
||||||
|
import net.minecraft.client.input.KeyInput;
|
||||||
|
import net.minecraft.client.input.MouseInput;
|
||||||
|
import net.minecraft.client.option.KeyBinding;
|
||||||
import net.minecraft.client.option.Perspective;
|
import net.minecraft.client.option.Perspective;
|
||||||
import net.minecraft.network.packet.Packet;
|
import net.minecraft.network.packet.Packet;
|
||||||
import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket;
|
import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket;
|
||||||
@@ -44,6 +48,7 @@ public class Freecam extends Module {
|
|||||||
public BooleanSetting stayCrouching = addSetting(new BooleanSetting("mantenerse agachado", "mantener al jugador agachado tras entrar en el modo de cámara libre", false));
|
public BooleanSetting stayCrouching = addSetting(new BooleanSetting("mantenerse agachado", "mantener al jugador agachado tras entrar en el modo de cámara libre", false));
|
||||||
public BooleanSetting staticView = addSetting(new BooleanSetting("visión estática", "desactiva ajustes que muevan la cámara", true));
|
public BooleanSetting staticView = addSetting(new BooleanSetting("visión estática", "desactiva ajustes que muevan la cámara", true));
|
||||||
public BooleanSetting cancelActionPackets = addSetting(new BooleanSetting("cancelar paquetes", "evita flaggear el anticheat al interactuar con bloques / entidades", true));
|
public BooleanSetting cancelActionPackets = addSetting(new BooleanSetting("cancelar paquetes", "evita flaggear el anticheat al interactuar con bloques / entidades", true));
|
||||||
|
public BooleanSetting blockOutlines = addSetting(new BooleanSetting("contorno de bloques", "mostrar el contorno de los bloques estando en el modo de cámara libre", true));
|
||||||
|
|
||||||
public NumberSetting speedSetting = addSetting(new NumberSetting(
|
public NumberSetting speedSetting = addSetting(new NumberSetting(
|
||||||
"velocidad", "velocidad de movimiento de la cámara",
|
"velocidad", "velocidad de movimiento de la cámara",
|
||||||
@@ -141,9 +146,9 @@ public class Freecam extends Module {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick() {
|
public void onTick() {
|
||||||
if (mc.cameraEntity == null || perspective == null) return;
|
if (mc.getCameraEntity() == null || perspective == null) return;
|
||||||
|
|
||||||
mc.cameraEntity.noClip = mc.cameraEntity.isInsideWall();
|
mc.getCameraEntity().noClip = mc.getCameraEntity().isInsideWall();
|
||||||
if (!perspective.isFirstPerson()) mc.options.setPerspective(Perspective.FIRST_PERSON);
|
if (!perspective.isFirstPerson()) mc.options.setPerspective(Perspective.FIRST_PERSON);
|
||||||
|
|
||||||
Vec3d forward = Vec3d.fromPolar(0, yaw);
|
Vec3d forward = Vec3d.fromPolar(0, yaw);
|
||||||
@@ -204,24 +209,25 @@ public class Freecam extends Module {
|
|||||||
public void onKey(KeyEvent event) {
|
public void onKey(KeyEvent event) {
|
||||||
if (mc.currentScreen != null) return;
|
if (mc.currentScreen != null) return;
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_F3)) return;
|
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_F3)) return;
|
||||||
|
KeyInput key = new KeyInput(event.getKey(), event.getScancode(), 0);
|
||||||
|
|
||||||
boolean shouldCancel = true;
|
boolean shouldCancel = true;
|
||||||
if (mc.options.forwardKey.matchesKey(event.getKey(), event.getScancode())) {
|
if (mc.options.forwardKey.matchesKey(key)) {
|
||||||
forward = event.getAction() != GLFW.GLFW_RELEASE;
|
forward = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.forwardKey.setPressed(false);
|
mc.options.forwardKey.setPressed(false);
|
||||||
} else if (mc.options.backKey.matchesKey(event.getKey(), event.getScancode())) {
|
} else if (mc.options.backKey.matchesKey(key)) {
|
||||||
backward = event.getAction() != GLFW.GLFW_RELEASE;
|
backward = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.backKey.setPressed(false);
|
mc.options.backKey.setPressed(false);
|
||||||
} else if (mc.options.rightKey.matchesKey(event.getKey(), event.getScancode())) {
|
} else if (mc.options.rightKey.matchesKey(key)) {
|
||||||
right = event.getAction() != GLFW.GLFW_RELEASE;
|
right = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.rightKey.setPressed(false);
|
mc.options.rightKey.setPressed(false);
|
||||||
} else if (mc.options.leftKey.matchesKey(event.getKey(), event.getScancode())) {
|
} else if (mc.options.leftKey.matchesKey(key)) {
|
||||||
left = event.getAction() != GLFW.GLFW_RELEASE;
|
left = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.leftKey.setPressed(false);
|
mc.options.leftKey.setPressed(false);
|
||||||
} else if (mc.options.jumpKey.matchesKey(event.getKey(), event.getScancode())) {
|
} else if (mc.options.jumpKey.matchesKey(key)) {
|
||||||
up = event.getAction() != GLFW.GLFW_RELEASE;
|
up = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.jumpKey.setPressed(false);
|
mc.options.jumpKey.setPressed(false);
|
||||||
} else if (mc.options.sneakKey.matchesKey(event.getKey(), event.getScancode())) {
|
} else if (mc.options.sneakKey.matchesKey(key)) {
|
||||||
down = event.getAction() != GLFW.GLFW_RELEASE;
|
down = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.sneakKey.setPressed(false);
|
mc.options.sneakKey.setPressed(false);
|
||||||
} else {
|
} else {
|
||||||
@@ -234,24 +240,25 @@ public class Freecam extends Module {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onMouseClick(MouseClickEvent event) { // por si el restrasado del usuario usa el ratón para moverse
|
public void onMouseClick(MouseClickEvent event) { // por si el restrasado del usuario usa el ratón para moverse
|
||||||
if (mc.currentScreen != null) return;
|
if (mc.currentScreen != null) return;
|
||||||
|
Click click = new Click(0, 0, new MouseInput(event.getButton(), 0));
|
||||||
|
|
||||||
boolean shouldCancel = true;
|
boolean shouldCancel = true;
|
||||||
if (mc.options.forwardKey.matchesKey(event.getButton(), 0)) {
|
if (mc.options.forwardKey.matchesMouse(click)) {
|
||||||
forward = event.getAction() != GLFW.GLFW_RELEASE;
|
forward = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.forwardKey.setPressed(false);
|
mc.options.forwardKey.setPressed(false);
|
||||||
} else if (mc.options.backKey.matchesKey(event.getButton(), 0)) {
|
} else if (mc.options.backKey.matchesMouse(click)) {
|
||||||
backward = event.getAction() != GLFW.GLFW_RELEASE;
|
backward = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.backKey.setPressed(false);
|
mc.options.backKey.setPressed(false);
|
||||||
} else if (mc.options.rightKey.matchesKey(event.getButton(), 0)) {
|
} else if (mc.options.rightKey.matchesMouse(click)) {
|
||||||
right = event.getAction() != GLFW.GLFW_RELEASE;
|
right = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.rightKey.setPressed(false);
|
mc.options.rightKey.setPressed(false);
|
||||||
} else if (mc.options.leftKey.matchesKey(event.getButton(), 0)) {
|
} else if (mc.options.leftKey.matchesMouse(click)) {
|
||||||
left = event.getAction() != GLFW.GLFW_RELEASE;
|
left = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.leftKey.setPressed(false);
|
mc.options.leftKey.setPressed(false);
|
||||||
} else if (mc.options.jumpKey.matchesKey(event.getButton(), 0)) {
|
} else if (mc.options.jumpKey.matchesMouse(click)) {
|
||||||
up = event.getAction() != GLFW.GLFW_RELEASE;
|
up = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.jumpKey.setPressed(false);
|
mc.options.jumpKey.setPressed(false);
|
||||||
} else if (mc.options.sneakKey.matchesKey(event.getButton(), 0)) {
|
} else if (mc.options.sneakKey.matchesMouse(click)) {
|
||||||
down = event.getAction() != GLFW.GLFW_RELEASE;
|
down = event.getAction() != GLFW.GLFW_RELEASE;
|
||||||
mc.options.sneakKey.setPressed(false);
|
mc.options.sneakKey.setPressed(false);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ public class Fullbright extends Module {
|
|||||||
green.setVisible(v);
|
green.setVisible(v);
|
||||||
blue.setVisible(v);
|
blue.setVisible(v);
|
||||||
alpha.setVisible(v);
|
alpha.setVisible(v);
|
||||||
|
|
||||||
|
if (v) disableNightVision();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,21 @@
|
|||||||
package me.retucio.camtweaks.module.modules;
|
package me.retucio.camtweaks.module.modules;
|
||||||
|
|
||||||
import me.retucio.camtweaks.module.Module;
|
import me.retucio.camtweaks.module.Module;
|
||||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
import me.retucio.camtweaks.module.settings.*;
|
||||||
import me.retucio.camtweaks.module.settings.EnumSetting;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
|
||||||
import me.retucio.camtweaks.module.settings.StringSetting;
|
/** lógica del HUD manejada en:
|
||||||
|
* @see me.retucio.camtweaks.ui.HudRenderer
|
||||||
|
* @see me.retucio.camtweaks.ui.widgets.HudElement
|
||||||
|
* @see me.retucio.camtweaks.ui.HudEditorScreen
|
||||||
|
*/
|
||||||
|
|
||||||
public class HUD extends Module {
|
public class HUD extends Module {
|
||||||
|
|
||||||
|
// editor
|
||||||
|
public KeySetting editorKey = addSetting(new KeySetting("tecla del editor", "tecla asignada al editor de elementos del hud", GLFW.GLFW_KEY_PAGE_UP));
|
||||||
|
|
||||||
|
// colores
|
||||||
public NumberSetting red = addSetting(new NumberSetting("rojo", "cantidad de rojo", 255, 0, 255, 1));
|
public NumberSetting red = addSetting(new NumberSetting("rojo", "cantidad de rojo", 255, 0, 255, 1));
|
||||||
public NumberSetting green = addSetting(new NumberSetting("verde", "cantidad de verde", 255, 0, 255, 1));
|
public NumberSetting green = addSetting(new NumberSetting("verde", "cantidad de verde", 255, 0, 255, 1));
|
||||||
public NumberSetting blue = addSetting(new NumberSetting("azul", "cantidad de azul", 255, 0, 255, 1));
|
public NumberSetting blue = addSetting(new NumberSetting("azul", "cantidad de azul", 255, 0, 255, 1));
|
||||||
@@ -16,32 +24,22 @@ public class HUD extends Module {
|
|||||||
public NumberSetting rainbowSpeed = addSetting(new NumberSetting("velocidad del arcoíris", "velocidad del arcoíris", 1000, 0, 10000, 2));
|
public NumberSetting rainbowSpeed = addSetting(new NumberSetting("velocidad del arcoíris", "velocidad del arcoíris", 1000, 0, 10000, 2));
|
||||||
|
|
||||||
public NumberSetting alpha = addSetting(new NumberSetting("opacidad", "antitransparencia", 255, 0, 255, 1));
|
public NumberSetting alpha = addSetting(new NumberSetting("opacidad", "antitransparencia", 255, 0, 255, 1));
|
||||||
|
|
||||||
|
// ajustes
|
||||||
|
public BooleanSetting showOnF3 = addSetting(new BooleanSetting("mostrar en F3", "renderizar HUD en el menú de debug", false));
|
||||||
public BooleanSetting shadow = addSetting(new BooleanSetting("sombra", "texto con sombra", true));
|
public BooleanSetting shadow = addSetting(new BooleanSetting("sombra", "texto con sombra", true));
|
||||||
|
|
||||||
public BooleanSetting dontOverride = addSetting(new BooleanSetting("no sobreescribir", "evita dibujar por encima de otros elementos de la interfaz", true));
|
|
||||||
|
|
||||||
public EnumSetting<TimeFormat> timeFormat = addSetting(new EnumSetting<>("formato de la hora", "12h o 24h", TimeFormat.class, TimeFormat.TWENTY_FOUR_HOUR));
|
|
||||||
public NumberSetting timezone = addSetting(new NumberSetting("zona horaria", "zona horaria en UTC+n", 1, -6, 6, 1));
|
public NumberSetting timezone = addSetting(new NumberSetting("zona horaria", "zona horaria en UTC+n", 1, -6, 6, 1));
|
||||||
|
public EnumSetting<TimeFormat> timeFormat = addSetting(new EnumSetting<>("formato de la hora", "12h o 24h", TimeFormat.class, TimeFormat.TWENTY_FOUR_HOUR));
|
||||||
public BooleanSetting coords = addSetting(new BooleanSetting("coordenadas", "mostrar coordenadas", true));
|
public StringSetting customText = addSetting(new StringSetting("texto custom", "marca de agua (dejar vacío para quitar)", "adolf jitler inshtagram feishbuc twiter", 40));
|
||||||
public StringSetting customText = addSetting(new StringSetting("texto custom", "marca de agua (dejar vacío para quitar)", "ESCROTO", 40));
|
|
||||||
public BooleanSetting fps = addSetting(new BooleanSetting("fps", "mostrar frames por segundo", true));
|
|
||||||
public BooleanSetting tps = addSetting(new BooleanSetting("tps", "mostrar tasa de ticks por segundo del server", true));
|
|
||||||
public BooleanSetting time = addSetting(new BooleanSetting("hora", "mostrar hora actual", true));
|
|
||||||
|
|
||||||
public HUD() {
|
public HUD() {
|
||||||
super("HUD", "superposición de la pantalla con info. adicional");
|
super("HUD", "superposición de la pantalla con info. adicional");
|
||||||
|
|
||||||
rainbow.onUpdate(v -> {
|
rainbow.onUpdate(v -> {
|
||||||
rainbowSpeed.setVisible(v);
|
|
||||||
red.setVisible(!v);
|
red.setVisible(!v);
|
||||||
green.setVisible(!v);
|
green.setVisible(!v);
|
||||||
blue.setVisible(!v);
|
blue.setVisible(!v);
|
||||||
});
|
rainbowSpeed.setVisible(v);
|
||||||
|
|
||||||
time.onUpdate(v -> {
|
|
||||||
timeFormat.setVisible(v);
|
|
||||||
timezone.setVisible(v);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,11 @@ import net.minecraft.entity.LivingEntity;
|
|||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.projectile.PersistentProjectileEntity;
|
import net.minecraft.entity.projectile.PersistentProjectileEntity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.world.entity.EntityQueriable;
|
||||||
|
import net.minecraft.world.entity.UniquelyIdentifiable;
|
||||||
|
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
@@ -44,6 +47,8 @@ public class Nametags extends Module {
|
|||||||
public EnumSetting<HealthMode> healthMode = addSetting(new EnumSetting<>("mostrar vida en", "de qué manera mostrar la vida", HealthMode.class, HealthMode.POINTS));
|
public EnumSetting<HealthMode> healthMode = addSetting(new EnumSetting<>("mostrar vida en", "de qué manera mostrar la vida", HealthMode.class, HealthMode.POINTS));
|
||||||
|
|
||||||
public BooleanSetting countItems = addSetting(new BooleanSetting("contar items", "muestra cuánto de un item hay en un stack dropeado", true));
|
public BooleanSetting countItems = addSetting(new BooleanSetting("contar items", "muestra cuánto de un item hay en un stack dropeado", true));
|
||||||
|
public ListSetting<Item> items = addSetting(new ListSetting<>("items", "te permite elegir cuáles items tienen su nombre visible",
|
||||||
|
Lists.itemList, Lists.allTrue(Lists.itemList), Lists.itemNames));
|
||||||
public BooleanSetting showProjectileDamage = addSetting(new BooleanSetting("daño del proyectil", "muestra cuánto daño hace un proyectil en su nametag", true));
|
public BooleanSetting showProjectileDamage = addSetting(new BooleanSetting("daño del proyectil", "muestra cuánto daño hace un proyectil en su nametag", true));
|
||||||
|
|
||||||
public BooleanSetting distinguishBabies = addSetting(new BooleanSetting("distinguir bebés", "cambia el nametag cuando una entidad está en su fase bebé", false));
|
public BooleanSetting distinguishBabies = addSetting(new BooleanSetting("distinguir bebés", "cambia el nametag cuando una entidad está en su fase bebé", false));
|
||||||
@@ -64,6 +69,10 @@ public class Nametags extends Module {
|
|||||||
entities.setDefaultValues(entities.getValues());
|
entities.setDefaultValues(entities.getValues());
|
||||||
|
|
||||||
health.onUpdate(v -> healthMode.setVisible(v));
|
health.onUpdate(v -> healthMode.setVisible(v));
|
||||||
|
|
||||||
|
entities.onUpdate(entities -> {
|
||||||
|
items.setVisible(entities.get(EntityType.ITEM));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// literalmente cómo lo calcula Minecraft
|
// literalmente cómo lo calcula Minecraft
|
||||||
@@ -74,7 +83,7 @@ public class Nametags extends Module {
|
|||||||
double velocity = arrow.getVelocity().length();
|
double velocity = arrow.getVelocity().length();
|
||||||
DamageSource damageSource = arrow.getDamageSources().arrow(arrow, arrow.getOwner());
|
DamageSource damageSource = arrow.getDamageSources().arrow(arrow, arrow.getOwner());
|
||||||
|
|
||||||
if (arrow.getWeaponStack() != null && arrow.getWorld() instanceof ServerWorld world)
|
if (arrow.getWeaponStack() != null && arrow.getEntityWorld() instanceof ServerWorld world)
|
||||||
initialDamage = EnchantmentHelper.getDamage(world, arrow.getWeaponStack(), mc.player, damageSource, (float) initialDamage);
|
initialDamage = EnchantmentHelper.getDamage(world, arrow.getWeaponStack(), mc.player, damageSource, (float) initialDamage);
|
||||||
|
|
||||||
int finalDamage = MathHelper.ceil(MathHelper.clamp(velocity * initialDamage, 0, 2.147483647E9));
|
int finalDamage = MathHelper.ceil(MathHelper.clamp(velocity * initialDamage, 0, 2.147483647E9));
|
||||||
@@ -88,9 +97,11 @@ public class Nametags extends Module {
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public String getOwnerName(LazyEntityReference<LivingEntity> owner) {
|
public String getOwnerName(LazyEntityReference<LivingEntity> owner) {
|
||||||
// si el dueño está en línea
|
// si el dueño está en línea (de manera segura)
|
||||||
LivingEntity ownerEntity = owner.resolve(mc.world, LivingEntity.class);
|
if (mc.world instanceof EntityQueriable<?> queriableWorld) {
|
||||||
|
LivingEntity ownerEntity = owner.resolve(queriableWorld, LivingEntity.class);
|
||||||
if (ownerEntity instanceof PlayerEntity playerEntity) return playerEntity.getName().getString();
|
if (ownerEntity instanceof PlayerEntity playerEntity) return playerEntity.getName().getString();
|
||||||
|
}
|
||||||
|
|
||||||
// mirar si ya está en la caché
|
// mirar si ya está en la caché
|
||||||
UUID uuid = owner.getUuid();
|
UUID uuid = owner.getUuid();
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ public class NoRender extends Module {
|
|||||||
public BooleanSetting blindnessEffect = addSetting(new BooleanSetting("ceguera", "renderizar miopía", false));
|
public BooleanSetting blindnessEffect = addSetting(new BooleanSetting("ceguera", "renderizar miopía", false));
|
||||||
public BooleanSetting darknessEffect = addSetting(new BooleanSetting("oscuridad", "renderizar miedo a la oscuridad", false));
|
public BooleanSetting darknessEffect = addSetting(new BooleanSetting("oscuridad", "renderizar miedo a la oscuridad", false));
|
||||||
public BooleanSetting nightVisionEffect;
|
public BooleanSetting nightVisionEffect;
|
||||||
public NumberSetting potionParticleAlpha = addSetting(new NumberSetting("opacidad de burbujas", "opacidad de las partículas de pociones",
|
|
||||||
170, 0, 255, 1));
|
|
||||||
|
|
||||||
public BooleanSetting scoreboard = addSetting(new BooleanSetting("marcador", "mostrar marcador a la derecha", false));
|
public BooleanSetting scoreboard = addSetting(new BooleanSetting("marcador", "mostrar marcador a la derecha", false));
|
||||||
public BooleanSetting titles = addSetting(new BooleanSetting("títulos", "mostrar títulos (del comando /title)", false));
|
public BooleanSetting titles = addSetting(new BooleanSetting("títulos", "mostrar títulos (del comando /title)", false));
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package me.retucio.camtweaks.module.modules;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.Module;
|
||||||
|
|
||||||
|
/** continúa en:
|
||||||
|
* @see me.retucio.camtweaks.mixin.ClientPlayerEntityMixin
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PortalGUI extends Module {
|
||||||
|
|
||||||
|
public PortalGUI() {
|
||||||
|
super("interfaz en portales", "te permite abrir interfaces dentro de portales, como el chat o el inventario");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package me.retucio.camtweaks.module.modules;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.Module;
|
||||||
|
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||||
|
import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||||
|
import me.retucio.camtweaks.module.settings.KeySetting;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
public class TooltipsPlus extends Module {
|
||||||
|
|
||||||
|
public EnumSetting<DisplayModes> displayMode = addSetting(new EnumSetting<>(
|
||||||
|
"mostrar", "cúando mostrar la cajita de los huevos", DisplayModes.class, DisplayModes.ALWAYS));
|
||||||
|
|
||||||
|
public KeySetting displayKey = addSetting(new KeySetting(
|
||||||
|
"tecla de visualización", "tecla a presionar para mostrar la cajita", GLFW.GLFW_KEY_LEFT_CONTROL));
|
||||||
|
|
||||||
|
public BooleanSetting middleClickPreview = addSetting(new BooleanSetting("preview de middle click",
|
||||||
|
"abre una interfaz con los contenidos de un bloque de almacenamiento al presionar el middle click (la ruedita)", false));
|
||||||
|
|
||||||
|
public EnumSetting<SizeFormat> itemSize = addSetting(new EnumSetting<>(
|
||||||
|
"tamaño del ítem", "cómo mostrar el tamaño del ítem en memoria", SizeFormat.class, SizeFormat.NONE));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public TooltipsPlus() {
|
||||||
|
super("tooltips plus", "mejoras varias a las cajitas de descripción de items");
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DisplayModes {
|
||||||
|
ALWAYS("siempre"),
|
||||||
|
KEY("al presionar una tecla"),
|
||||||
|
NEVER("nunca");
|
||||||
|
|
||||||
|
final String name;
|
||||||
|
DisplayModes(String name) { this.name = name; }
|
||||||
|
@Override public String toString() { return name; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum SizeFormat {
|
||||||
|
NONE("no mostrar"),
|
||||||
|
BYTES("bytes"),
|
||||||
|
KB("kilobytes"),
|
||||||
|
MB("megabytes");
|
||||||
|
|
||||||
|
final String name;
|
||||||
|
SizeFormat(String name) { this.name = name; }
|
||||||
|
@Override public String toString() { return name; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,12 +15,14 @@ import me.retucio.camtweaks.ui.frames.ModuleFrame;
|
|||||||
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
||||||
import me.retucio.camtweaks.ui.widgets.ScrollBarWidget;
|
import me.retucio.camtweaks.ui.widgets.ScrollBarWidget;
|
||||||
import me.retucio.camtweaks.ui.widgets.SearchBarWidget;
|
import me.retucio.camtweaks.ui.widgets.SearchBarWidget;
|
||||||
import me.retucio.camtweaks.util.ChatUtil;
|
|
||||||
import me.retucio.camtweaks.util.KeyUtil;
|
import me.retucio.camtweaks.util.KeyUtil;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.Click;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -93,35 +95,35 @@ public class ClickGUI extends Screen {
|
|||||||
return bottom + 20; // padding
|
return bottom + 20; // padding
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
public boolean mouseClicked(Click click, boolean doubled) {
|
||||||
scrollBar.mouseClicked(mouseX, mouseY, button);
|
scrollBar.mouseClicked(click.x(), click.y(), click.button());
|
||||||
searchBar.mouseClicked(mouseX, mouseY, button);
|
searchBar.mouseClicked(click.x(), click.y(), click.button());
|
||||||
|
|
||||||
// detectar clics sobre los marcos
|
// detectar clics sobre los marcos
|
||||||
modulesFrame.mouseClicked(mouseX, mouseY, button);
|
modulesFrame.mouseClicked(click.x(), click.y(), click.button());
|
||||||
for (SettingsFrame sf : new ArrayList<>(settingsFrames))
|
for (SettingsFrame sf : new ArrayList<>(settingsFrames))
|
||||||
sf.mouseClicked(mouseX, mouseY, button);
|
sf.mouseClicked(click.x(), click.y(), click.button());
|
||||||
|
|
||||||
return super.mouseClicked(mouseX, mouseY, button);
|
return super.mouseClicked(click, doubled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
public boolean mouseReleased(Click click) {
|
||||||
scrollBar.mouseReleased(mouseX, mouseY, button);
|
scrollBar.mouseReleased(click.x(), click.y(), click.button());
|
||||||
searchBar.mouseReleased(mouseX, mouseY, button);
|
searchBar.mouseReleased(click.x(), click.y(), click.button());
|
||||||
|
|
||||||
// registrar cuándo se suelta el clic, en cada marco respectivamente
|
// registrar cuándo se suelta el clic, en cada marco respectivamente
|
||||||
modulesFrame.mouseReleased(mouseX, mouseY, button);
|
modulesFrame.mouseReleased(click.x(), click.y(), click.button());
|
||||||
for (SettingsFrame sf : new ArrayList<>(settingsFrames))
|
for (SettingsFrame sf : new ArrayList<>(settingsFrames))
|
||||||
sf.mouseRelease(mouseX, mouseY, button);
|
sf.mouseRelease(click.x(), click.y(), click.button());
|
||||||
return super.mouseReleased(mouseX, mouseY, button);
|
return super.mouseReleased(click);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
public boolean mouseDragged(Click click, double deltaX, double deltaY) {
|
||||||
scrollBar.mouseDragged(mouseY);
|
scrollBar.mouseDragged(click.y());
|
||||||
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
return super.mouseDragged(click, deltaX, deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -247,8 +249,8 @@ public class ClickGUI extends Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applyBlur(DrawContext context) {
|
protected void applyBlur(DrawContext ctx) {
|
||||||
if (guiSettings.blur.isEnabled()) super.applyBlur(context);
|
if (guiSettings.blur.isEnabled()) super.applyBlur(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,110 +0,0 @@
|
|||||||
package me.retucio.camtweaks.ui;
|
|
||||||
|
|
||||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
|
||||||
import me.retucio.camtweaks.event.events.PacketEvent;
|
|
||||||
import me.retucio.camtweaks.module.ModuleManager;
|
|
||||||
import me.retucio.camtweaks.module.modules.Freecam;
|
|
||||||
import me.retucio.camtweaks.module.modules.HUD.TimeFormat;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
|
||||||
import net.minecraft.client.gui.screen.ChatScreen;
|
|
||||||
import net.minecraft.client.render.RenderTickCounter;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.ZoneOffset;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
// en un principio esto iba a mostrar en pantalla los módulos activados, pero me parece innecesario. se queda aquí por si acaso
|
|
||||||
// igual lo uso para algo...
|
|
||||||
public class HUD {
|
|
||||||
|
|
||||||
private static final MinecraftClient mc = MinecraftClient.getInstance();
|
|
||||||
|
|
||||||
private long lastPacketTime = 0;
|
|
||||||
private static float estimatedTPS = 20f;
|
|
||||||
|
|
||||||
public static void render(DrawContext ctx, RenderTickCounter tc) {
|
|
||||||
if (ModuleManager.INSTANCE == null || mc.player == null || mc.cameraEntity == null) return;
|
|
||||||
me.retucio.camtweaks.module.modules.HUD hud = ModuleManager.INSTANCE.getModuleByClass(me.retucio.camtweaks.module.modules.HUD.class);
|
|
||||||
|
|
||||||
int width = mc.getWindow().getScaledWidth();
|
|
||||||
int height = mc.getWindow().getScaledHeight();
|
|
||||||
|
|
||||||
Color color;
|
|
||||||
if (hud.rainbow.isEnabled()) {
|
|
||||||
float speed = 10001 - hud.rainbowSpeed.getFloatValue();
|
|
||||||
float hue = (System.currentTimeMillis() % (int) speed) / speed;
|
|
||||||
Color gamning = Color.getHSBColor(hue, 1, 1);
|
|
||||||
color = new Color(gamning.getRed(), gamning.getGreen(), gamning.getBlue(), hud.alpha.getIntValue());
|
|
||||||
} else {
|
|
||||||
color = new Color(hud.red.getIntValue(), hud.green.getIntValue(), hud.blue.getIntValue(), hud.alpha.getIntValue());
|
|
||||||
}
|
|
||||||
boolean shadow = hud.shadow.isEnabled();
|
|
||||||
|
|
||||||
if (hud.isEnabled()) {
|
|
||||||
|
|
||||||
// coordenadas
|
|
||||||
if (hud.coords.isEnabled()) {
|
|
||||||
Vec3d coords;
|
|
||||||
Freecam freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
|
||||||
if (freecam.isEnabled())
|
|
||||||
coords = new Vec3d(
|
|
||||||
freecam.getX(tc.getDynamicDeltaTicks()),
|
|
||||||
freecam.getY(tc.getDynamicDeltaTicks()),
|
|
||||||
freecam.getZ(tc.getDynamicDeltaTicks())
|
|
||||||
);
|
|
||||||
else
|
|
||||||
coords = mc.player.getPos();
|
|
||||||
|
|
||||||
String text = (int) coords.x + " " + (int) coords.y + " " + (int) coords.z;
|
|
||||||
ctx.drawText(mc.textRenderer, text,
|
|
||||||
width - mc.textRenderer.getWidth(text) - 2,
|
|
||||||
height - mc.textRenderer.fontHeight - 2,
|
|
||||||
color.getRGB(), shadow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// fps y tps
|
|
||||||
if (hud.fps.isEnabled())
|
|
||||||
ctx.drawText(mc.textRenderer, "FPS: " + mc.getCurrentFps(), 2, 2, color.getRGB(), shadow);
|
|
||||||
|
|
||||||
if (hud.tps.isEnabled())
|
|
||||||
ctx.drawText(mc.textRenderer, "TPS: " + estimatedTPS, 2, 4 + mc.textRenderer.fontHeight, color.getRGB(), shadow);
|
|
||||||
|
|
||||||
// marca de agua
|
|
||||||
if (!hud.customText.getValue().isEmpty()) {
|
|
||||||
int y;
|
|
||||||
if (!mc.player.getActiveStatusEffects().isEmpty() && hud.dontOverride.isEnabled()) y = 26;
|
|
||||||
else y = 2;
|
|
||||||
ctx.drawText(mc.textRenderer, hud.customText.getValue(), width - mc.textRenderer.getWidth(hud.customText.getValue()) - 2, y, color.getRGB(), shadow);
|
|
||||||
}
|
|
||||||
|
|
||||||
// hora real
|
|
||||||
if (hud.time.isEnabled()) {
|
|
||||||
int y;
|
|
||||||
if (mc.currentScreen instanceof ChatScreen && hud.dontOverride.isEnabled()) y = height - mc.textRenderer.fontHeight - 14;
|
|
||||||
else y = height - mc.textRenderer.fontHeight - 2;
|
|
||||||
|
|
||||||
ZoneOffset offset = ZoneOffset.ofHours(hud.timezone.getIntValue());
|
|
||||||
LocalTime now = LocalTime.now(offset);
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(hud.timeFormat.is(TimeFormat.TWENTY_FOUR_HOUR) ? "HH:mm" : "hh:mm a");
|
|
||||||
String time = now.format(formatter);
|
|
||||||
|
|
||||||
ctx.drawText(mc.textRenderer, time, 2, y, color.getRGB(), shadow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onReceivePacket(PacketEvent.Receive event) {
|
|
||||||
// estimar el tps teniendo en cuenta el tiempo entre paquetes
|
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
if (lastPacketTime > 0) {
|
|
||||||
long diff = now - lastPacketTime; // ms entre paquetes
|
|
||||||
float tps = 1000f / diff;
|
|
||||||
estimatedTPS = Math.min(20.0f, tps);
|
|
||||||
}
|
|
||||||
lastPacketTime = now;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
package me.retucio.camtweaks.ui;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.config.ConfigManager;
|
||||||
|
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
||||||
|
import me.retucio.camtweaks.ui.widgets.HudElement;
|
||||||
|
import me.retucio.camtweaks.util.Colors;
|
||||||
|
import me.retucio.camtweaks.util.KeyUtil;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.Click;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.input.KeyInput;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class HudEditorScreen extends Screen {
|
||||||
|
|
||||||
|
public static HudEditorScreen INSTANCE;
|
||||||
|
private final MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
|
|
||||||
|
private final List<HudElement> elements = new ArrayList<>();
|
||||||
|
@Nullable private HudElement selected = null;
|
||||||
|
|
||||||
|
private boolean dragging = false;
|
||||||
|
private int dragOffsetX, dragOffsetY;
|
||||||
|
|
||||||
|
public HudEditorScreen() {
|
||||||
|
super(Text.literal("editor del hud"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setElements(List<HudElement> elements) {
|
||||||
|
this.elements.clear();
|
||||||
|
this.elements.addAll(elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(DrawContext ctx, int mouseX, int mouseY, float delta) {
|
||||||
|
ctx.fill(0, 0, this.width, this.height, Colors.hudEditorScreenBackgroundColor.getRGB());
|
||||||
|
|
||||||
|
// texto con instrucciones
|
||||||
|
ctx.drawCenteredTextWithShadow(mc.textRenderer, "EDITOR DEL HUD", this.width / 2, this.height / 2 - mc.textRenderer.fontHeight, -1);
|
||||||
|
ctx.drawCenteredTextWithShadow(mc.textRenderer,
|
||||||
|
Text.literal("arrastrar para mover · click derecho para alternar visibilidad · esc para guardar y salir · shift + click derecho para restablecer"),
|
||||||
|
this.width / 2, this.height / 2 + mc.textRenderer.fontHeight, Colors.instructionsTextColor.getRGB());
|
||||||
|
|
||||||
|
// dibujar elementos
|
||||||
|
for (HudElement element : elements)
|
||||||
|
element.renderPreview(ctx);
|
||||||
|
|
||||||
|
// tooltips con información sobre el elemento sobre el que está el puntero del ratón
|
||||||
|
if (!dragging) {
|
||||||
|
for (HudElement element : elements) {
|
||||||
|
if (!element.isVisible()) continue;
|
||||||
|
|
||||||
|
if (element.contains(mouseX, mouseY)) {
|
||||||
|
List<Text> tooltip = getTooltipFor(element);
|
||||||
|
if (!tooltip.isEmpty()) ctx.drawTooltip(mc.textRenderer, tooltip, mouseX + 7, mouseY + 20);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.render(ctx, mouseX, mouseY, delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseClicked(Click click, boolean doubled) {
|
||||||
|
int mouseX = (int) click.x();
|
||||||
|
int mouseY = (int) click.y();
|
||||||
|
|
||||||
|
// iterar de atrás a adelante para respetar el orden z
|
||||||
|
for (int i = elements.size() - 1; i >= 0; i--) {
|
||||||
|
HudElement element = elements.get(i);
|
||||||
|
if (element.contains(mouseX, mouseY)) {
|
||||||
|
selected = element;
|
||||||
|
|
||||||
|
if (click.button() == 0) {
|
||||||
|
dragging = true;
|
||||||
|
|
||||||
|
dragOffsetX = mouseX - element.getX();
|
||||||
|
dragOffsetY = mouseY - element.getY();
|
||||||
|
|
||||||
|
// traer el elemento seleccionado al frente
|
||||||
|
elements.remove(i);
|
||||||
|
elements.add(element);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else if (click.button() == 1) {
|
||||||
|
if (mc.isShiftPressed())
|
||||||
|
selected.resetPosition();
|
||||||
|
else
|
||||||
|
selected.setVisible(!selected.isVisible());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.mouseClicked(click, doubled);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseDragged(Click click, double deltaX, double deltaY) {
|
||||||
|
if (!dragging || selected == null || click.button() != 0)
|
||||||
|
return super.mouseDragged(click, deltaX, deltaY);
|
||||||
|
|
||||||
|
int mouseX = (int) click.x();
|
||||||
|
int mouseY = (int) click.y();
|
||||||
|
|
||||||
|
int newX = mouseX - dragOffsetX;
|
||||||
|
int newY = mouseY - dragOffsetY;
|
||||||
|
|
||||||
|
// clampear para evitar que los elementos se salgan de la pantalla
|
||||||
|
newX = Math.max(1, Math.min(newX, width - selected.getWidth() - 1));
|
||||||
|
newY = Math.max(1, Math.min(newY, height - selected.getHeight() - 1));
|
||||||
|
|
||||||
|
selected.setPosition(newX, newY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseReleased(Click click) {
|
||||||
|
if (dragging && click.button() == 0) {
|
||||||
|
dragging = false;
|
||||||
|
savePositionsToConfig(); // guardar inmediatamente al config
|
||||||
|
return true;
|
||||||
|
} else if (click.button() == 1 && selected != null) {
|
||||||
|
saveVisibilitiesToConfig();
|
||||||
|
selected = null;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
selected = null;
|
||||||
|
return super.mouseReleased(click);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyPressed(KeyInput input) {
|
||||||
|
// esc para guardar y salir
|
||||||
|
if (input.key() == GLFW.GLFW_KEY_ESCAPE) {
|
||||||
|
saveAndClose();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.keyPressed(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void savePositionsToConfig() {
|
||||||
|
for (HudElement element : elements)
|
||||||
|
ConfigManager.setHudPosition(element.getId(), element.getX(), element.getY());
|
||||||
|
|
||||||
|
ConfigManager.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveVisibilitiesToConfig() {
|
||||||
|
for (HudElement element : elements)
|
||||||
|
ConfigManager.setHudVisibility(element.getId(), element.isVisible());
|
||||||
|
|
||||||
|
ConfigManager.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveAndClose() {
|
||||||
|
savePositionsToConfig();
|
||||||
|
selected = null;
|
||||||
|
mc.setScreen(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyBlur(DrawContext ctx) {
|
||||||
|
if (ClientSettingsFrame.guiSettings.blur.isEnabled()) super.applyBlur(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSelected(HudElement element) {
|
||||||
|
return selected == element;
|
||||||
|
}
|
||||||
|
|
||||||
|
// para los tooltips
|
||||||
|
private List<Text> getTooltipFor(HudElement element) {
|
||||||
|
List<Text> list = new ArrayList<>();
|
||||||
|
|
||||||
|
switch (element.getId()) {
|
||||||
|
case "coords" -> {
|
||||||
|
list.add(Text.literal("coordenadas"));
|
||||||
|
list.add(Text.literal("te muestra tu posición en el mundo en coordenadas XYZ"));
|
||||||
|
}
|
||||||
|
case "fps" -> {
|
||||||
|
list.add(Text.literal("FPS"));
|
||||||
|
list.add(Text.literal("te muestra la tasa de fotogramas por segundo del juego"));
|
||||||
|
}
|
||||||
|
case "tps" -> {
|
||||||
|
list.add(Text.literal("tps"));
|
||||||
|
list.add(Text.literal("te muestra la tasa de ticks por segundo del servidor (0-20)"));
|
||||||
|
}
|
||||||
|
case "customText" -> {
|
||||||
|
list.add(Text.literal("texto custom"));
|
||||||
|
list.add(Text.literal("te permite renderizar texto al gusto"));
|
||||||
|
}
|
||||||
|
case "time" -> {
|
||||||
|
list.add(Text.literal("hora"));
|
||||||
|
list.add(Text.literal("te muestra la hora y los minutos de la zona horaria escogida"));
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
list.add(Text.literal(element.getId()));
|
||||||
|
list.add(Text.literal("."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
package me.retucio.camtweaks.ui;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.CameraTweaks;
|
||||||
|
import me.retucio.camtweaks.config.ConfigManager;
|
||||||
|
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||||
|
import me.retucio.camtweaks.event.events.PacketEvent;
|
||||||
|
import me.retucio.camtweaks.event.events.camtweaks.UpdateSettingEvent;
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.Freecam;
|
||||||
|
import me.retucio.camtweaks.module.modules.HUD;
|
||||||
|
import me.retucio.camtweaks.ui.widgets.HudElement;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.screen.TitleScreen;
|
||||||
|
import net.minecraft.client.render.RenderTickCounter;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class HudRenderer {
|
||||||
|
|
||||||
|
private static final MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
|
|
||||||
|
private static float estimatedTPS = 20f;
|
||||||
|
private long lastPacketTime = 0;
|
||||||
|
|
||||||
|
private static final Map<String, int[]> positions = ConfigManager.getConfig().hudPositions;
|
||||||
|
private static final Map<String, Boolean> visibilities = ConfigManager.getConfig().hudVisibilities;
|
||||||
|
private static final List<HudElement> elements = new ArrayList<>();
|
||||||
|
private static boolean initialized = false;
|
||||||
|
|
||||||
|
private static HudElement customTextElement = null;
|
||||||
|
|
||||||
|
public static void initElements() {
|
||||||
|
if (initialized) return;
|
||||||
|
initialized = true;
|
||||||
|
|
||||||
|
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||||
|
|
||||||
|
// coordenadas
|
||||||
|
addElement("coords", 2, mc.getWindow().getScaledHeight() - mc.textRenderer.fontHeight, (ctx, mx, my, delta) -> {
|
||||||
|
drawSnappedText(ctx, getElementText("coords", delta, hud), mx, my, getColor(hud).getRGB(), hud.shadow.isEnabled());
|
||||||
|
});
|
||||||
|
|
||||||
|
// FPS
|
||||||
|
addElement("fps", 2, 2, (ctx, mx, my, delta) -> {
|
||||||
|
drawSnappedText(ctx, getElementText("fps", 0, hud), mx, my, getColor(hud).getRGB(), hud.shadow.isEnabled());
|
||||||
|
});
|
||||||
|
|
||||||
|
// TPS
|
||||||
|
addElement("tps", 2, mc.textRenderer.fontHeight + 4, (ctx, mx, my, delta) -> {
|
||||||
|
drawSnappedText(ctx, getElementText("tps", delta, hud), mx, my, getColor(hud).getRGB(), hud.shadow.isEnabled());
|
||||||
|
});
|
||||||
|
|
||||||
|
// texto custom
|
||||||
|
addElement("customText", mc.getWindow().getScaledWidth() / 2 - mc.textRenderer.getWidth(getElementText("customText", 0, ModuleManager.INSTANCE.getModuleByClass(HUD.class))) / 2, 2, (ctx, mx, my, delta) -> {
|
||||||
|
drawSnappedText(ctx, getElementText("customText", delta, hud), mx, my, getColor(hud).getRGB(), hud.shadow.isEnabled());
|
||||||
|
});
|
||||||
|
|
||||||
|
customTextElement = elements.stream()
|
||||||
|
.filter(e -> e.getId().equals("customText"))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
// hora
|
||||||
|
addElement("time", mc.getWindow().getScaledWidth() - mc.textRenderer.getWidth("04:20"), mc.getWindow().getScaledHeight() - mc.textRenderer.fontHeight - 2, (ctx, mx, my, delta) -> {
|
||||||
|
drawSnappedText(ctx, getElementText("time", delta, hud), mx, my, getColor(hud).getRGB(), hud.shadow.isEnabled());
|
||||||
|
});
|
||||||
|
|
||||||
|
HudEditorScreen.INSTANCE.setElements(getElements());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addElement(String id, int defX, int defY, HudElement.Renderer renderer) {
|
||||||
|
int[] saved = positions.get(id);
|
||||||
|
Boolean visible = visibilities.get(id);
|
||||||
|
int x = saved == null ? defX : saved[0];
|
||||||
|
int y = saved == null ? defY : saved[1];
|
||||||
|
boolean v = visible == null || visible;
|
||||||
|
if (visibilities.isEmpty()) v = true;
|
||||||
|
|
||||||
|
elements.add(new HudElement(id, defX, defY, x, y, v) {
|
||||||
|
@Override public void render(DrawContext ctx, int mx, int my, float delta) {
|
||||||
|
renderer.render(ctx, x, y, delta);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color getColor(HUD hud) {
|
||||||
|
if (hud.rainbow.isEnabled()) {
|
||||||
|
float speed = 10001 - hud.rainbowSpeed.getFloatValue();
|
||||||
|
float hue = (System.currentTimeMillis() % (int) speed) / speed;
|
||||||
|
Color rgb = Color.getHSBColor(hue, 1, 1);
|
||||||
|
return new Color(rgb.getRed(), rgb.getGreen(), rgb.getBlue(), hud.alpha.getIntValue());
|
||||||
|
}
|
||||||
|
return new Color(hud.red.getIntValue(), hud.green.getIntValue(), hud.blue.getIntValue(), hud.alpha.getIntValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void drawSnappedText(DrawContext ctx, String text, int x, int y, int color, boolean shadow) {
|
||||||
|
int textWidth = mc.textRenderer.getWidth(text);
|
||||||
|
int screenWidth = mc.getWindow().getScaledWidth();
|
||||||
|
int screenHeight = mc.getWindow().getScaledHeight();
|
||||||
|
|
||||||
|
boolean snapRight = x > screenWidth / 2;
|
||||||
|
int drawX = snapRight ? x + (textWidth + 2) - textWidth : x;
|
||||||
|
|
||||||
|
// clampear y
|
||||||
|
y = Math.max(0, Math.min(y, screenHeight - mc.textRenderer.fontHeight));
|
||||||
|
|
||||||
|
// clampear x
|
||||||
|
drawX = Math.max(0, Math.min(drawX, screenWidth - textWidth));
|
||||||
|
|
||||||
|
ctx.drawText(mc.textRenderer, text, drawX, y, color, shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void render(DrawContext ctx, RenderTickCounter tc) {
|
||||||
|
if (ModuleManager.INSTANCE == null
|
||||||
|
|| mc.player == null
|
||||||
|
|| mc.getCameraEntity() == null
|
||||||
|
|| mc.currentScreen instanceof TitleScreen
|
||||||
|
|| mc.options.hudHidden)
|
||||||
|
return;
|
||||||
|
|
||||||
|
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||||
|
if (!hud.isEnabled()) return;
|
||||||
|
if (mc.getDebugHud().shouldShowDebugHud() && !hud.showOnF3.isEnabled()) return;
|
||||||
|
|
||||||
|
initElements();
|
||||||
|
|
||||||
|
if (mc.currentScreen instanceof HudEditorScreen) return;
|
||||||
|
|
||||||
|
float deltaTime = tc.getDynamicDeltaTicks();
|
||||||
|
for (HudElement element : elements)
|
||||||
|
if (element.isVisible()) element.render(ctx, 0, 0, deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<HudElement> getElements() {
|
||||||
|
return elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
// texto a dibujar por elemento
|
||||||
|
public static String getElementText(String id, float delta, HUD hud) {
|
||||||
|
switch (id) {
|
||||||
|
case "coords" -> {
|
||||||
|
Freecam freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
||||||
|
Vec3d pos = freecam.isEnabled()
|
||||||
|
? new Vec3d(freecam.getX(delta), freecam.getY(delta), freecam.getZ(delta))
|
||||||
|
: mc.player.getEntityPos();
|
||||||
|
|
||||||
|
return (int) pos.x + " " + (int) pos.y + " " + (int) pos.z;
|
||||||
|
}
|
||||||
|
case "fps" -> {
|
||||||
|
return "FPS: " + mc.getCurrentFps();
|
||||||
|
}
|
||||||
|
case "tps" -> {
|
||||||
|
return "TPS: " + estimatedTPS;
|
||||||
|
}
|
||||||
|
case "customText" -> {
|
||||||
|
return ModuleManager.INSTANCE.getModuleByClass(HUD.class).customText.getValue();
|
||||||
|
}
|
||||||
|
case "time" -> {
|
||||||
|
ZoneOffset offset = ZoneOffset.ofHours(hud.timezone.getIntValue());
|
||||||
|
LocalTime now = LocalTime.now(offset);
|
||||||
|
|
||||||
|
boolean is24 = hud.timeFormat.is(HUD.TimeFormat.TWENTY_FOUR_HOUR);
|
||||||
|
DateTimeFormatter format = DateTimeFormatter.ofPattern(is24 ? "HH:mm" : "hh:mm a");
|
||||||
|
return now.format(format);
|
||||||
|
}
|
||||||
|
default -> { return id; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onReceivePacket(PacketEvent.Receive event) {
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
if (lastPacketTime > 0) {
|
||||||
|
float tps = 1000f / (now - lastPacketTime);
|
||||||
|
estimatedTPS = Math.min(20f, tps);
|
||||||
|
}
|
||||||
|
lastPacketTime = now;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** para cuando se cambie el valor del texto custom */
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onUpdateSetting(UpdateSettingEvent event) {
|
||||||
|
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||||
|
|
||||||
|
if (event.getSetting() == hud.customText) {
|
||||||
|
if (customTextElement != null) {
|
||||||
|
int newX = mc.getWindow().getScaledWidth() / 2 - mc.textRenderer.getWidth(hud.customText.getValue()) / 2;
|
||||||
|
customTextElement.setX(newX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,14 +2,22 @@ package me.retucio.camtweaks.ui.buttons;
|
|||||||
|
|
||||||
import me.retucio.camtweaks.module.settings.KeySetting;
|
import me.retucio.camtweaks.module.settings.KeySetting;
|
||||||
import me.retucio.camtweaks.ui.ClickGUI;
|
import me.retucio.camtweaks.ui.ClickGUI;
|
||||||
|
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.Colors;
|
import me.retucio.camtweaks.util.Colors;
|
||||||
import me.retucio.camtweaks.util.KeyUtil;
|
import me.retucio.camtweaks.util.KeyUtil;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.input.KeyInput;
|
||||||
|
import net.minecraft.client.option.KeyBinding;
|
||||||
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
// botón para configurar la tecla asignada a un módulo. comienza a escuchar al hacerle clic
|
// botón para configurar la tecla asignada a un módulo. comienza a escuchar al hacerle clic
|
||||||
public class BindButton extends SettingButton {
|
public class BindButton extends SettingButton {
|
||||||
|
|
||||||
@@ -36,7 +44,7 @@ public class BindButton extends SettingButton {
|
|||||||
public void mouseClicked(double mouseX, double mouseY, int button) {
|
public void mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
if (isHovered((int) mouseX, (int) mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
|
if (isHovered((int) mouseX, (int) mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
|
||||||
if (button == 0) listening = !listening;
|
if (button == 0) listening = !listening;
|
||||||
else if (button == 1 && KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT))
|
else if (button == 1 && mc.isShiftPressed())
|
||||||
setting.reset();
|
setting.reset();
|
||||||
} else {
|
} else {
|
||||||
listening = false;
|
listening = false;
|
||||||
@@ -44,14 +52,28 @@ public class BindButton extends SettingButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onKey(int key, int action) {
|
public void onKey(int key, int action) {
|
||||||
if (listening && action == GLFW.GLFW_PRESS) {
|
if (!listening || action != GLFW.GLFW_PRESS) return;
|
||||||
if (key == GLFW.GLFW_KEY_ESCAPE)
|
|
||||||
|
if (key == GLFW.GLFW_KEY_ESCAPE) {
|
||||||
setting.setKey(GLFW.GLFW_KEY_UNKNOWN);
|
setting.setKey(GLFW.GLFW_KEY_UNKNOWN);
|
||||||
else
|
} else {
|
||||||
|
for (KeyBinding bind : mc.options.allKeys) {
|
||||||
|
boolean keyAlreadyBound = bind.matchesKey(new KeyInput(key, 0, 0));
|
||||||
|
boolean allowMultiple = ClientSettingsFrame.guiSettings.multipleKeybinds.isEnabled();
|
||||||
|
|
||||||
|
if (keyAlreadyBound && !allowMultiple) {
|
||||||
|
ChatUtil.warn("esa tecla ya está cogida por "
|
||||||
|
+ Formatting.GREEN + "\"" + I18n.translate(bind.getId()) + "\"");
|
||||||
|
listening = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
setting.setKey(key);
|
setting.setKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
listening = false;
|
listening = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFocused() {
|
public boolean isFocused() {
|
||||||
return listening;
|
return listening;
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import org.lwjgl.glfw.GLFW;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
// botón para los ajustes tipo EnumSetting (de modo)
|
// botón para los ajustes tipo EnumSetting (de modo)
|
||||||
public class CycleButton<E extends Enum<E>> extends SettingButton {
|
public class CycleButton<E extends Enum<E>> extends SettingButton {
|
||||||
|
|
||||||
@@ -42,7 +44,7 @@ public class CycleButton<E extends Enum<E>> extends SettingButton {
|
|||||||
if (isHovered((int) mouseX, (int) mouseY)) {
|
if (isHovered((int) mouseX, (int) mouseY)) {
|
||||||
Screen currentScreen = parent.mc.currentScreen;
|
Screen currentScreen = parent.mc.currentScreen;
|
||||||
if (currentScreen != null) {
|
if (currentScreen != null) {
|
||||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) {
|
if (mc.isShiftPressed()) {
|
||||||
List<Text> lines = new ArrayList<>();
|
List<Text> lines = new ArrayList<>();
|
||||||
lines.add(Text.literal("modos disponibles:"));
|
lines.add(Text.literal("modos disponibles:"));
|
||||||
for (Enum<?> val : setting.getValues()) {
|
for (Enum<?> val : setting.getValues()) {
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import org.lwjgl.glfw.GLFW;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
public class ListButton<T> extends SettingButton {
|
public class ListButton<T> extends SettingButton {
|
||||||
|
|
||||||
private final ListSetting<T> setting;
|
private final ListSetting<T> setting;
|
||||||
@@ -65,7 +67,7 @@ public class ListButton<T> extends SettingButton {
|
|||||||
public void mouseClicked(double mouseX, double mouseY, int button) {
|
public void mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
if (isHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
|
if (isHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
|
||||||
// click izquierdo / derecho: abrir marco
|
// click izquierdo / derecho: abrir marco
|
||||||
if (button <= 1 && !KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) {
|
if (button <= 1 && !mc.isShiftPressed()) {
|
||||||
if (ClickGUI.INSTANCE.isSettingsFrameOpen(dummy)) {
|
if (ClickGUI.INSTANCE.isSettingsFrameOpen(dummy)) {
|
||||||
ClickGUI.INSTANCE.closeSettingsFrame(dummy);
|
ClickGUI.INSTANCE.closeSettingsFrame(dummy);
|
||||||
return;
|
return;
|
||||||
@@ -74,7 +76,7 @@ public class ListButton<T> extends SettingButton {
|
|||||||
rebuildDummy();
|
rebuildDummy();
|
||||||
ClickGUI.INSTANCE.openListSettingsFrame(dummy, parent.x + 40, parent.y + 40);
|
ClickGUI.INSTANCE.openListSettingsFrame(dummy, parent.x + 40, parent.y + 40);
|
||||||
// shift + clic derecho: restablecer valores
|
// shift + clic derecho: restablecer valores
|
||||||
} else if (button == 1 && KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) {
|
} else if (button == 1 && mc.isShiftPressed()) {
|
||||||
setting.reset();
|
setting.reset();
|
||||||
refreshDummy();
|
refreshDummy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.awt.*;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
// slider (barrita) para los ajustes numéricos
|
// slider (barrita) para los ajustes numéricos
|
||||||
public class SliderButton extends SettingButton {
|
public class SliderButton extends SettingButton {
|
||||||
@@ -65,7 +66,7 @@ public class SliderButton extends SettingButton {
|
|||||||
public void mouseClicked(double mouseX, double mouseY, int button) {
|
public void mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
if (isHovered((int) mouseX, (int) mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
|
if (isHovered((int) mouseX, (int) mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
|
||||||
if (button == 0) dragging = true; // arrastrar con el clic izquierdo
|
if (button == 0) dragging = true; // arrastrar con el clic izquierdo
|
||||||
else if (button == 1 && KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) // restablecer al valor por defecto con shift izquerdo + clic derecho
|
else if (button == 1 && mc.isShiftPressed()) // restablecer al valor por defecto con shift izquerdo + clic derecho
|
||||||
setting.reset();
|
setting.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class TextButton extends SettingButton {
|
|||||||
typing = true;
|
typing = true;
|
||||||
buffer.setLength(0);
|
buffer.setLength(0);
|
||||||
buffer.append(setting.getValue()); // precargar valor anterior
|
buffer.append(setting.getValue()); // precargar valor anterior
|
||||||
} else if (button == 1 && KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) {
|
} else if (button == 1 && mc.isShiftPressed()) {
|
||||||
typing = false;
|
typing = false;
|
||||||
setting.reset();
|
setting.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import org.lwjgl.glfw.GLFW;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
|
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||||
|
|
||||||
// botón para los ajustes booleanos (funciona como un interruptor)
|
// botón para los ajustes booleanos (funciona como un interruptor)
|
||||||
public class ToggleButton extends SettingButton {
|
public class ToggleButton extends SettingButton {
|
||||||
|
|
||||||
@@ -39,7 +41,7 @@ public class ToggleButton extends SettingButton {
|
|||||||
public void mouseClicked(double mouseX, double mouseY, int button) {
|
public void mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
if (isHovered((int) mouseX, (int) mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
|
if (isHovered((int) mouseX, (int) mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
|
||||||
if (button == 0) setting.toggle(); // clic izquierdo para alternar
|
if (button == 0) setting.toggle(); // clic izquierdo para alternar
|
||||||
else if (button == 1 && KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) // shift izquierdo + clic derecho para restablecer al valor por defecto
|
else if (button == 1 && mc.isShiftPressed()) // shift izquierdo + clic derecho para restablecer al valor por defecto
|
||||||
setting.reset();
|
setting.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
package me.retucio.camtweaks.ui.widgets;
|
||||||
|
|
||||||
|
import me.retucio.camtweaks.module.ModuleManager;
|
||||||
|
import me.retucio.camtweaks.module.modules.HUD;
|
||||||
|
import me.retucio.camtweaks.ui.HudEditorScreen;
|
||||||
|
import me.retucio.camtweaks.ui.HudRenderer;
|
||||||
|
import me.retucio.camtweaks.util.Colors;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
|
||||||
|
public class HudElement {
|
||||||
|
|
||||||
|
protected final MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
|
|
||||||
|
private final String id;
|
||||||
|
protected boolean visible;
|
||||||
|
|
||||||
|
protected int x, y;
|
||||||
|
protected int defaultX, defaultY;
|
||||||
|
protected int width = 85, height = 14; // tamaño por defecto
|
||||||
|
|
||||||
|
public HudElement(String id, int defX, int defY, int x, int y, boolean visible) {
|
||||||
|
this.id = id;
|
||||||
|
this.visible = visible;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.defaultX = defX;
|
||||||
|
this.defaultY = defY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fallback
|
||||||
|
public void render(DrawContext ctx, int mouseX, int mouseY, float tickDelta) {
|
||||||
|
ctx.drawText(mc.textRenderer, Text.literal(getId()), x, y, -1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** renderizar previsualización del elemento para el editor */
|
||||||
|
public void renderPreview(DrawContext ctx) {
|
||||||
|
final HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||||
|
final String previewText = buildPreviewText(hud);
|
||||||
|
|
||||||
|
width = mc.textRenderer.getWidth(previewText);
|
||||||
|
height = mc.textRenderer.fontHeight;
|
||||||
|
|
||||||
|
drawBackground(ctx);
|
||||||
|
|
||||||
|
int color = -1;
|
||||||
|
boolean shadow = false;
|
||||||
|
if (hud != null) {
|
||||||
|
color = HudRenderer.getColor(hud).getRGB();
|
||||||
|
shadow = hud.shadow.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
HudRenderer.drawSnappedText(ctx, previewText, x, y, color, shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** construir texto para la previsualización */
|
||||||
|
private String buildPreviewText(HUD hud) {
|
||||||
|
float delta = mc.getRenderTickCounter().getDynamicDeltaTicks();
|
||||||
|
|
||||||
|
if ("coords".equals(id)) {
|
||||||
|
if (mc.player == null) return "X Y Z";
|
||||||
|
return HudRenderer.getElementText(id, delta, hud);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("fps".equals(id)) {
|
||||||
|
return HudRenderer.getElementText(id, delta, hud);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("tps".equals(id)) {
|
||||||
|
return HudRenderer.getElementText(id, delta, hud);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("customText".equals(id)) {
|
||||||
|
if (hud != null && hud.customText != null && !hud.customText.getValue().isEmpty())
|
||||||
|
return HudRenderer.getElementText(id, delta, hud);
|
||||||
|
return "texto custom";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("time".equals(id)) {
|
||||||
|
if (hud != null && hud.timeFormat != null)
|
||||||
|
return HudRenderer.getElementText(id, delta, hud);
|
||||||
|
return "4:20 PM";
|
||||||
|
}
|
||||||
|
|
||||||
|
return id; // fallback: id del elemento
|
||||||
|
}
|
||||||
|
|
||||||
|
/** fondo y contorno */
|
||||||
|
private void drawBackground(DrawContext ctx) {
|
||||||
|
int bg = visible ? Colors.visibleHudElementColor.getRGB() : Colors.disabledHudElementColor.getRGB();
|
||||||
|
int outline = HudEditorScreen.INSTANCE.isSelected(this) ? Colors.selectedHudElementOutlineColor.getRGB() : Colors.unselectedHudElementOutlineColor.getRGB();
|
||||||
|
|
||||||
|
// fondo
|
||||||
|
ctx.fill(x - 1, y - 1, x + width + 1, y + height + 1, bg);
|
||||||
|
|
||||||
|
// contorno
|
||||||
|
ctx.fill(x - 1, y - 1, x + width + 1, y, outline);
|
||||||
|
ctx.fill(x - 1, y + height, x + width + 1, y + height + 1, outline);
|
||||||
|
ctx.fill(x - 1, y, x, y + height, outline);
|
||||||
|
ctx.fill(x + width, y, x + width + 1, y + height, outline);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(int mouseX, int mouseY) {
|
||||||
|
return mouseX >= x && mouseX <= x + width
|
||||||
|
&& mouseY >= y && mouseY <= y + height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// getters y setters
|
||||||
|
public String getId() { return id; }
|
||||||
|
|
||||||
|
public int getX() { return x; }
|
||||||
|
public int getY() { return y; }
|
||||||
|
|
||||||
|
public void setX(int x) { this.x = x; }
|
||||||
|
public void setY(int y) { this.y = y; }
|
||||||
|
|
||||||
|
public int getWidth() { return width; }
|
||||||
|
public int getHeight() { return height; }
|
||||||
|
|
||||||
|
public boolean isVisible() { return visible; }
|
||||||
|
public void setVisible(boolean visible) { this.visible = visible; }
|
||||||
|
|
||||||
|
public void setPosition(int newX, int newY) {
|
||||||
|
this.x = newX;
|
||||||
|
this.y = newY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetPosition() {
|
||||||
|
this.x = defaultX;
|
||||||
|
this.y = defaultY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Renderer {
|
||||||
|
void render(DrawContext ctx, int x, int y, float delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,8 +19,14 @@ public class Colors {
|
|||||||
public static Color mainColor;
|
public static Color mainColor;
|
||||||
public static Color frameBGColor = new Color(40, 40, 40, 75);
|
public static Color frameBGColor = new Color(40, 40, 40, 75);
|
||||||
public static Color buttonColor = new Color(75, 75, 75, 100);
|
public static Color buttonColor = new Color(75, 75, 75, 100);
|
||||||
|
public static Color hudEditorScreenBackgroundColor = new Color(0, 0, 0, 120);
|
||||||
|
public static Color instructionsTextColor = new Color(190, 190, 190, 255);
|
||||||
public static Color enabledToggleButtonColor;
|
public static Color enabledToggleButtonColor;
|
||||||
public static Color disabledToggleButtonColor;
|
public static Color disabledToggleButtonColor;
|
||||||
|
public static Color visibleHudElementColor;
|
||||||
|
public static Color disabledHudElementColor;
|
||||||
|
public static Color selectedHudElementOutlineColor;
|
||||||
|
public static Color unselectedHudElementOutlineColor;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
updateAllColors(new Color(red, green, blue, alpha));
|
updateAllColors(new Color(red, green, blue, alpha));
|
||||||
@@ -31,6 +37,23 @@ public class Colors {
|
|||||||
enabledToggleButtonColor = mixWithMainColor(new Color(10, 150, 10), 0.8f);
|
enabledToggleButtonColor = mixWithMainColor(new Color(10, 150, 10), 0.8f);
|
||||||
disabledToggleButtonColor = mixWithMainColor(new Color(150, 10, 10), 0.8f);
|
disabledToggleButtonColor = mixWithMainColor(new Color(150, 10, 10), 0.8f);
|
||||||
|
|
||||||
|
selectedHudElementOutlineColor = color;
|
||||||
|
unselectedHudElementOutlineColor = color.darker().darker();
|
||||||
|
|
||||||
|
visibleHudElementColor = new Color(
|
||||||
|
enabledToggleButtonColor.getRed(),
|
||||||
|
enabledToggleButtonColor.getGreen(),
|
||||||
|
enabledToggleButtonColor.getBlue(),
|
||||||
|
enabledToggleButtonColor.getAlpha() / 2
|
||||||
|
);
|
||||||
|
|
||||||
|
disabledHudElementColor = new Color(
|
||||||
|
disabledToggleButtonColor.getRed(),
|
||||||
|
disabledToggleButtonColor.getGreen(),
|
||||||
|
disabledToggleButtonColor.getBlue(),
|
||||||
|
disabledToggleButtonColor.getAlpha() / 2
|
||||||
|
);
|
||||||
|
|
||||||
ChatUtil.updatePrefix(ChatUtil.getJustPrefix());
|
ChatUtil.updatePrefix(ChatUtil.getJustPrefix());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,12 @@ public class KeyUtil {
|
|||||||
case GLFW.GLFW_KEY_DOWN -> "abajo";
|
case GLFW.GLFW_KEY_DOWN -> "abajo";
|
||||||
case GLFW.GLFW_KEY_LEFT -> "izquierda";
|
case GLFW.GLFW_KEY_LEFT -> "izquierda";
|
||||||
case GLFW.GLFW_KEY_RIGHT -> "derecha";
|
case GLFW.GLFW_KEY_RIGHT -> "derecha";
|
||||||
default -> { // F1–F25
|
case GLFW.GLFW_KEY_PAGE_UP -> "pág. arriba";
|
||||||
|
case GLFW.GLFW_KEY_PAGE_DOWN -> "pág. abajo";
|
||||||
|
default -> {
|
||||||
if (key >= GLFW.GLFW_KEY_F1 && key <= GLFW.GLFW_KEY_F25)
|
if (key >= GLFW.GLFW_KEY_F1 && key <= GLFW.GLFW_KEY_F25)
|
||||||
yield "F" + (key - GLFW.GLFW_KEY_F1 + 1);
|
yield "F" + (key - GLFW.GLFW_KEY_F1 + 1); // F1–F25
|
||||||
yield "tecla " + key;
|
yield "tecla " + key; // fallback
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
|||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.particle.ParticleType;
|
import net.minecraft.particle.ParticleType;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
@@ -18,10 +19,12 @@ public class Lists {
|
|||||||
public static final List<EntityType<?>> entityList = Registries.ENTITY_TYPE.stream().toList();
|
public static final List<EntityType<?>> entityList = Registries.ENTITY_TYPE.stream().toList();
|
||||||
public static Map<EntityType<?>, String> entityNames;
|
public static Map<EntityType<?>, String> entityNames;
|
||||||
|
|
||||||
|
|
||||||
public static final List<ParticleType<?>> particleList = Registries.PARTICLE_TYPE.stream().toList();
|
public static final List<ParticleType<?>> particleList = Registries.PARTICLE_TYPE.stream().toList();
|
||||||
public static Map<ParticleType<?>, String> particleNames;
|
public static Map<ParticleType<?>, String> particleNames;
|
||||||
|
|
||||||
|
public static final List<Item> itemList = Registries.ITEM.stream().toList();
|
||||||
|
public static Map<Item, String> itemNames;
|
||||||
|
|
||||||
public static final List<Block> blockList = Registries.BLOCK.stream().toList();
|
public static final List<Block> blockList = Registries.BLOCK.stream().toList();
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
@@ -32,6 +35,9 @@ public class Lists {
|
|||||||
// no hay traducciones para nombres de partículas, y paso de hacerlas yo
|
// no hay traducciones para nombres de partículas, y paso de hacerlas yo
|
||||||
particleNames = getMapOfLists(particleList,
|
particleNames = getMapOfLists(particleList,
|
||||||
particleList.stream().map(particle -> Registries.PARTICLE_TYPE.getId(particle).toShortTranslationKey()).toList());
|
particleList.stream().map(particle -> Registries.PARTICLE_TYPE.getId(particle).toShortTranslationKey()).toList());
|
||||||
|
|
||||||
|
itemNames = getMapOfLists(itemList,
|
||||||
|
itemList.stream().map(item -> I18n.translate(item.getTranslationKey())).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Map<T, Boolean> allTrue(List<T> options) {
|
public static <T> Map<T, Boolean> allTrue(List<T> options) {
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ accessWidener v2 named
|
|||||||
|
|
||||||
accessible class net/minecraft/client/font/TextRenderer$Drawer
|
accessible class net/minecraft/client/font/TextRenderer$Drawer
|
||||||
|
|
||||||
accessible field net/minecraft/client/particle/Particle alpha F
|
accessible field net/minecraft/client/particle/BillboardParticle alpha F
|
||||||
accessible field net/minecraft/client/particle/BillboardParticle scale F
|
accessible field net/minecraft/client/particle/BillboardParticle scale F
|
||||||
accessible field net/minecraft/client/particle/Particle velocityMultiplier F
|
accessible field net/minecraft/client/particle/Particle velocityMultiplier F
|
||||||
accessible field net/minecraft/client/particle/Particle gravityStrength F
|
accessible field net/minecraft/client/particle/Particle gravityStrength F
|
||||||
accessible field net/minecraft/client/particle/Particle collidesWithWorld Z
|
accessible field net/minecraft/client/particle/Particle collidesWithWorld Z
|
||||||
|
|
||||||
|
accessible method net/minecraft/client/render/WorldRenderer method_74752 (Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/Frustum;Z)V
|
||||||
@@ -5,13 +5,13 @@
|
|||||||
"mixins": [
|
"mixins": [
|
||||||
"ClientConnectionMixin",
|
"ClientConnectionMixin",
|
||||||
"DimensionTypeMixin",
|
"DimensionTypeMixin",
|
||||||
"EntityEffectParticleEffectMixin",
|
|
||||||
"EntityMixin",
|
"EntityMixin",
|
||||||
"ItemEntityMixin",
|
"ItemEntityMixin",
|
||||||
"KeyInputMixin",
|
"KeyInputMixin",
|
||||||
"PlayerEntityMixin",
|
"PlayerEntityMixin",
|
||||||
"StringHelperMixin",
|
"StringHelperMixin",
|
||||||
"Vec3dMixin",
|
"Vec3dMixin",
|
||||||
|
"YggdrasilUserApiServiceMixin",
|
||||||
"accessor.StatusEffectInstanceAccessor"
|
"accessor.StatusEffectInstanceAccessor"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
@@ -30,10 +30,10 @@
|
|||||||
"ChatScreenMixin",
|
"ChatScreenMixin",
|
||||||
"ChunkBorderDebugRendererMixin",
|
"ChunkBorderDebugRendererMixin",
|
||||||
"ChunkOcclusionDataBuilderMixin",
|
"ChunkOcclusionDataBuilderMixin",
|
||||||
|
"ClientPlayerEntityMixin",
|
||||||
"ClientPlayerInteractionManagerMixin",
|
"ClientPlayerInteractionManagerMixin",
|
||||||
"ClientPlayNetworkHandlerMixin",
|
"ClientPlayNetworkHandlerMixin",
|
||||||
"ClientWorldPropertiesMixin",
|
"ClientWorldPropertiesMixin",
|
||||||
"CompassStateMixin",
|
|
||||||
"DamageParticleFactoryMixin",
|
"DamageParticleFactoryMixin",
|
||||||
"DamageParticleMixin",
|
"DamageParticleMixin",
|
||||||
"FogRendererMixin",
|
"FogRendererMixin",
|
||||||
@@ -54,7 +54,9 @@
|
|||||||
"ScreenshotRecorderMixin",
|
"ScreenshotRecorderMixin",
|
||||||
"SkyRendererMixin",
|
"SkyRendererMixin",
|
||||||
"StuckArrowsFeatureRendererMixin",
|
"StuckArrowsFeatureRendererMixin",
|
||||||
|
"TelemetryManagerMixin",
|
||||||
"TextRendererDrawerMixin",
|
"TextRendererDrawerMixin",
|
||||||
|
"TextRendererMixin",
|
||||||
"WeatherRenderingMixin",
|
"WeatherRenderingMixin",
|
||||||
"WorldRendererMixin",
|
"WorldRendererMixin",
|
||||||
"accessor.ClientPlayNetworkHandlerAccessor",
|
"accessor.ClientPlayNetworkHandlerAccessor",
|
||||||
|
|||||||
@@ -25,12 +25,10 @@
|
|||||||
],
|
],
|
||||||
"accessWidener": "camtweaks.accesswidener",
|
"accessWidener": "camtweaks.accesswidener",
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.16.14",
|
"fabricloader": ">=0.17.3",
|
||||||
"minecraft": "~1.21.6",
|
"minecraft": "~1.21.10",
|
||||||
"java": ">=21",
|
"java": ">=21",
|
||||||
"fabric-api": "*"
|
"fabric-api": "*"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {}
|
||||||
"another-mod": "*"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user