Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94a9b1dade | ||
|
|
48899f85f9 | ||
|
|
347ec658bb | ||
|
|
a9cf6dd924 | ||
|
|
8e44dda9cf | ||
|
|
2329476fe4 | ||
|
|
6b2ec0e69a |
No files matched your search
@@ -42,10 +42,5 @@ replay_*.log
|
||||
# otros
|
||||
|
||||
todo.txt
|
||||
test.java
|
||||
cambios.md
|
||||
# no está terminado
|
||||
src/main/java/me/retucio/camtweaks/module/modules/TooltipsPlus.java
|
||||
src/main/java/me/retucio/camtweaks/util/RenderUtil.java
|
||||
src/main/java/me/retucio/camtweaks/util/Layers.java
|
||||
remappedSrc/
|
||||
@@ -54,6 +54,7 @@ algunos módulos tienen teclas asignadas por defecto, asígnales `ESC` para desa
|
||||
<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/hudeditor.png" alt="editor de HUD">
|
||||
<img src="screenshots/colorpicker.png" alt="selector de colores">
|
||||
|
||||
## contibuciones
|
||||
|
||||
@@ -65,4 +66,22 @@ no sé, haz lo que quieras con esto, es puta basura xd
|
||||
|
||||
aunque estaría guay que acreditases
|
||||
|
||||
pero bueno
|
||||
pero bueno
|
||||
|
||||
## descargo de responsabilidad
|
||||
|
||||
me importa una puta mierda lo que pase al usar este mod en servers donde es baneable y así.
|
||||
|
||||
## mods recomendados
|
||||
|
||||
> mods que recomiendo usar junto a este:
|
||||
|
||||
- [fabric api (necesario)](https://modrinth.com/mod/fabric-api/): necesario para el mod
|
||||
- [sodium](https://modrinth.com/mod/sodium): mejora el rendimiento general del juego
|
||||
- [viafabricplus](https://modrinth.com/mod/viafabricplus): te permite conectarte a servidores que tengan una versión distinta a la de tu cliente
|
||||
- [xaero's world map](https://modrinth.com/mod/xaeros-world-map/) y [xaero's minimap](https://modrinth.com/mod/xaeros-minimap/): mapa chulo
|
||||
- [mod menu](https://modrinth.com/mod/modmenu): lista de los mods instalados, y sus ajustes
|
||||
- [iris](https://modrinth.com/mod/iris): shaders
|
||||
- [lambdynamiclights](https://modrinth.com/mod/lambdynamiclights): iluminación dinámica
|
||||
- [appleskin](https://modrinth.com/mod/appleskin/): información relacionada con la comida
|
||||
- [baritone (desactualizado)](https://github.com/cabaletta/baritone): google maps para juego de cubos
|
||||
+1
-1
@@ -24,7 +24,7 @@ dependencies {
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
|
||||
|
||||
}
|
||||
|
||||
|
||||
+17
-10
@@ -1,22 +1,29 @@
|
||||
# v1.6
|
||||
# v2.1 (roto)
|
||||
|
||||
## novedades
|
||||
|
||||
todo un sistema de renderizado skiddeado de https://github.com/mioclient/oyvey-ported/
|
||||
- actualizado a la 1.21.11 (maomeno)
|
||||
|
||||
### adiciones
|
||||
|
||||
- marca de agua en la pantalla de inicio porque molo un montón
|
||||
- prev. de shulkers: te permite previsualizar el contenido de cajas de shulker desde el inventario
|
||||
- puntos de desconexión: te muestra el punto donde un jugador se desconecta
|
||||
- categorías de módulos: ahora puedes buscar "cámara", "jugador", "mundo", "renderizado", "red", "cliente" o "misc" para que se filtren los módulos de esas categorías, respectivamente
|
||||
|
||||
#### módulos nuevos:
|
||||
|
||||
- muletas: hace te no te caigas (de bloques), como cuando estás agachado, pero sin agacharte
|
||||
|
||||
### arreglos / mejoras
|
||||
|
||||
- el scroll del freecam ahora requiere una tecla (para mayor comodidad)
|
||||
- ahora puedes ver tu propio nametag (nametags -> mostrar propio)
|
||||
- opción para desactivar hud en chat agregada
|
||||
- arreglos menores varios
|
||||
- ahora ya puedes escribir espacios en la barra de búsqueda
|
||||
- ahora se ignoran las tildes al buscar en la barra de búsqueda
|
||||
- aviso de baja dur. ya no te avisa al reparar objetos dañados por debajo del límite
|
||||
- creo que cielo custom ya funciona por completo (las fases lunares)
|
||||
|
||||
## problemas reconocidos
|
||||
|
||||
- muchos, pero repórtalos en la página de problemas si quieres para que queden bien registrados
|
||||
- muchos, pero repórtalos en la página de problemas si quieres para que queden bien registrados
|
||||
- de esta actualización:
|
||||
- superposición de daño no funciona porque no lo he podido actualizar porque han cambiado cosas relacionadas a la renderización
|
||||
- la renderización de líneas (no rellenos) está rota, por el mismo motivo
|
||||
- por el mismo motivo, destello de enchants no funciona
|
||||
- minar sin interrupción no funciona
|
||||
+5
-2
@@ -1,8 +1,11 @@
|
||||
Meteor Client: https://github.com/MeteorDevelopment/meteor-client | https://meteorclient.com
|
||||
Meteor Client: https://github.com/MeteorDevelopment/meteor-client | https://meteorclient.com
|
||||
OyVey Port: https://github.com/mioclient/oyvey-ported/
|
||||
Lenny Boi: https://www.youtube.com/@lennyboi7195
|
||||
Shotify: https://modrinth.com/mod/shotify
|
||||
No Telemetry: https://modrinth.com/mod/no-telemetry
|
||||
Trouser Streak: https://github.com/etianl/Trouser-Streak
|
||||
No More Purple: https://github.com/Pepperoni-Jabroni/NoMorePurple/
|
||||
bypass-resource-pack: https://github.com/emilyy-dev/bypass-resource-pack
|
||||
|
||||
probablemente más pero como tengo demencia se me olvida
|
||||
si quieres que te acredite mándame un mensaje en discord (username: retucio) y sin problemas :)
|
||||
si quieres que te acredite o quite tu código de mi mod, mándame un mensaje en discord (username: retucio) y sin problemas :)
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.parallel=true
|
||||
|
||||
minecraft_version=1.21.10
|
||||
yarn_mappings=1.21.10+build.2
|
||||
loader_version=0.17.3
|
||||
loom_version=1.11-SNAPSHOT
|
||||
minecraft_version=1.21.11
|
||||
yarn_mappings=1.21.11+build.3
|
||||
loader_version=0.18.4
|
||||
loom_version=1.13-SNAPSHOT
|
||||
|
||||
mod_version=1.6
|
||||
fabric_api_version=0.140.2+1.21.11
|
||||
|
||||
mod_version=2.1
|
||||
maven_group=me.retucio
|
||||
archives_base_name=camtweaks
|
||||
|
||||
fabric_version=0.135.0+1.21.10
|
||||
archives_base_name=camtweaks
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 915 KiB |
@@ -16,28 +16,33 @@ import me.retucio.camtweaks.event.events.camtweaks.LoadModuleManagerEvent;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
|
||||
import me.retucio.camtweaks.module.modules.HUD;
|
||||
import me.retucio.camtweaks.module.modules.client.HUD;
|
||||
import me.retucio.camtweaks.ui.screen.ClickGUI;
|
||||
import me.retucio.camtweaks.ui.screen.HudEditorScreen;
|
||||
import me.retucio.camtweaks.ui.HudRenderer;
|
||||
import me.retucio.camtweaks.ui.buttons.BindButton;
|
||||
import me.retucio.camtweaks.ui.buttons.SettingButton;
|
||||
import me.retucio.camtweaks.ui.buttons.TextButton;
|
||||
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
||||
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
||||
import me.retucio.camtweaks.ui.hud.HudEditorScreen;
|
||||
import me.retucio.camtweaks.ui.hud.HudRenderer;
|
||||
import me.retucio.camtweaks.ui.widgets.buttons.settings.BindButton;
|
||||
import me.retucio.camtweaks.ui.widgets.buttons.SettingButton;
|
||||
import me.retucio.camtweaks.ui.widgets.buttons.settings.TextButton;
|
||||
import me.retucio.camtweaks.ui.widgets.frames.settings.ClientSettingsFrame;
|
||||
import me.retucio.camtweaks.ui.widgets.frames.SettingsFrame;
|
||||
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import me.retucio.camtweaks.util.KeyUtil;
|
||||
import me.retucio.camtweaks.util.Lists;
|
||||
import me.retucio.camtweaks.util.MiscUtil;
|
||||
import me.retucio.camtweaks.ui.widgets.Button;
|
||||
import me.retucio.camtweaks.util.*;
|
||||
|
||||
|
||||
import me.retucio.camtweaks.util.render.DrawUtil;
|
||||
import me.retucio.camtweaks.util.render.RenderUtil;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
import net.minecraft.client.gui.screen.ingame.AbstractCommandBlockScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.AnvilScreen;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -67,7 +72,7 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
|
||||
|
||||
private Screen prevScreen;
|
||||
public boolean settingsApplied = false;
|
||||
public static boolean settingsApplied = false;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -76,15 +81,23 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
System.setProperty("java.awt.headless", "false");
|
||||
|
||||
mc = MinecraftClient.getInstance();
|
||||
ConfigManager.load();
|
||||
|
||||
EVENT_BUS.register(this);
|
||||
EVENT_BUS.register(MiscUtil.class);
|
||||
EVENT_BUS.register(ChatUtil.class);
|
||||
|
||||
EVENT_BUS.register(HudRenderer.class);
|
||||
|
||||
EVENT_BUS.register(ChatUtil.class);
|
||||
EVENT_BUS.register(DrawUtil.class);
|
||||
EVENT_BUS.register(EntityUtil.class);
|
||||
EVENT_BUS.register(InventoryUtil.class);
|
||||
EVENT_BUS.register(MiscUtil.class);
|
||||
EVENT_BUS.register(NetworkUtil.class);
|
||||
EVENT_BUS.register(RenderUtil.class);
|
||||
|
||||
Lists.init();
|
||||
|
||||
ModuleManager.INSTANCE = new ModuleManager(EVENT_BUS);
|
||||
ModuleManager.INSTANCE = new ModuleManager();
|
||||
EVENT_BUS.post(new LoadModuleManagerEvent());
|
||||
|
||||
CommandManager.INSTANCE = new CommandManager();
|
||||
@@ -94,8 +107,6 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
HudEditorScreen.INSTANCE = new HudEditorScreen();
|
||||
EVENT_BUS.post(new LoadClickGUIEvent());
|
||||
|
||||
ConfigManager.load();
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
ConfigManager.save();
|
||||
EVENT_BUS.post(new ShutdownEvent());
|
||||
@@ -104,14 +115,14 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
|
||||
// se ejecuta cada tick, es decir, 20 veces por segundo
|
||||
public void onTick() {
|
||||
ModuleManager.INSTANCE.getEnabledModules().forEach(Module::onTick);
|
||||
|
||||
if (!settingsApplied
|
||||
&& ConfigManager.getConfig() != null
|
||||
&& mc.player != null && mc.world != null) {
|
||||
&& !ConfigManager.hasLoaded()) {
|
||||
ConfigManager.applyConfig();
|
||||
settingsApplied = true;
|
||||
}
|
||||
|
||||
ModuleManager.INSTANCE.getEnabledModules().forEach(Module::onTick);
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +150,7 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
// verifica si algún botón de ajustes está escuchando
|
||||
private boolean isAnySettingButtonFocused() {
|
||||
for (SettingsFrame sf : ClickGUI.INSTANCE.getSettingsFrames())
|
||||
for (SettingButton sb : sf.getButtons())
|
||||
for (Button sb : sf.getButtons())
|
||||
if ((sb instanceof BindButton b && b.isFocused()) || (sb instanceof TextButton t && t.isFocused()))
|
||||
return true;
|
||||
return false;
|
||||
@@ -163,16 +174,16 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
private void handleSettingButtonsKey(int key, int action) {
|
||||
for (SettingsFrame sf : ClickGUI.INSTANCE.getSettingsFrames()) {
|
||||
for (SettingButton sb : sf.getButtons()) {
|
||||
if (sb instanceof BindButton b) b.onKey(key, action);
|
||||
else if (sb instanceof TextButton t) t.onKey(key, action);
|
||||
if (sb instanceof BindButton bb) bb.onKey(key, action);
|
||||
if (sb instanceof TextButton tb) tb.onKey(key, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// maneja la lógica de apertura de la interfaz
|
||||
private void handleClickGUIKey(int key, boolean anyFocused) {
|
||||
if (key != ClientSettingsFrame.guiSettings.getKey() || anyFocused) return;
|
||||
if (!(mc != null && mc.world != null && mc.player != null)) return;
|
||||
if (key != ClientSettingsFrame.guiSettings.getKey() || anyFocused || isOnTypingScreen())
|
||||
return;
|
||||
|
||||
// al parecer esto hace que con la tecla de la interfaz puedas ir cambiando de splash text en la pantalla del título
|
||||
// pero me ha hecho gracia así que así se queda
|
||||
@@ -187,10 +198,14 @@ 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;
|
||||
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||
if (key != hud.editorKey.getKey() || anyFocused || isOnTypingScreen()) return;
|
||||
|
||||
if (mc.currentScreen != HudEditorScreen.INSTANCE) {
|
||||
if (!hud.isEnabled()) {
|
||||
ChatUtil.warn("HUD está desactivado, lumbreras");
|
||||
return;
|
||||
}
|
||||
prevScreen = mc.currentScreen;
|
||||
mc.setScreen(HudEditorScreen.INSTANCE);
|
||||
} else {
|
||||
@@ -208,8 +223,19 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
module.setEnabled(false);
|
||||
}
|
||||
|
||||
private boolean isOnTypingScreen() {
|
||||
return mc.currentScreen instanceof ChatScreen
|
||||
|| mc.currentScreen instanceof AnvilScreen
|
||||
|| mc.currentScreen instanceof AbstractSignEditScreen
|
||||
|| mc.currentScreen instanceof AbstractCommandBlockScreen;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onStop(ShutdownEvent event) {
|
||||
ConfigManager.save();
|
||||
}
|
||||
|
||||
public static String getVersionName() {
|
||||
return MOD_ID + "_v" + MOD_VERSION + "_" + SharedConstants.getGameVersion().name();
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,14 @@ package me.retucio.camtweaks.command;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.command.commands.*;
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.command.CommandSource;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Comparator;
|
||||
@@ -30,15 +34,26 @@ public class CommandManager {
|
||||
public static void registerCommands() {
|
||||
addCommand(new BindCommand());
|
||||
addCommand(new CopyScreenshotCommand());
|
||||
// addCommand(new EnderChestCommand()); no funciona D:
|
||||
addCommand(new EnderChestCommand());
|
||||
addCommand(new GarbageCleanerCommand());
|
||||
addCommand(new PeekCommand());
|
||||
addCommand(new PrefixCommand());
|
||||
addCommand(new PurgeCommand());
|
||||
addCommand(new SaveScreenshotCommand());
|
||||
addCommand(new SendCommand());
|
||||
addCommand(new SpectateCommand());
|
||||
addCommand(new ToggleCommand());
|
||||
|
||||
commands.sort(Comparator.comparing(Command::getName));
|
||||
|
||||
for (Command command : commands) {
|
||||
for (Method method : command.getClass().getDeclaredMethods()) {
|
||||
if (method.isAnnotationPresent(SubscribeEvent.class)) {
|
||||
CameraTweaks.EVENT_BUS.register(command);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addCommand(Command command) {
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
package me.retucio.camtweaks.command.args;
|
||||
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||
import com.mojang.brigadier.suggestion.Suggestions;
|
||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
|
||||
import me.retucio.camtweaks.util.EntityUtil;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
// para autocompletar entidades
|
||||
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||
|
||||
public class EntityArgumentType implements ArgumentType<Entity> {
|
||||
|
||||
public static final EntityArgumentType INSTANCE = new EntityArgumentType();
|
||||
private static final DynamicCommandExceptionType NO_SUCH_ENTITY = new DynamicCommandExceptionType(
|
||||
name -> Text.literal("Entidad \"" + name + "\" no encontrada"));
|
||||
|
||||
private static final Collection<String> EXAMPLES = List.of(
|
||||
"AdlerHitdolf",
|
||||
"@p"
|
||||
);
|
||||
|
||||
private static final Pattern UUID_PATTERN = Pattern.compile(
|
||||
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
|
||||
);
|
||||
|
||||
private EntityArgumentType() {}
|
||||
|
||||
@Override
|
||||
public Entity parse(StringReader reader) throws CommandSyntaxException {
|
||||
String argument = reader.readString();
|
||||
|
||||
if (mc.world == null)
|
||||
throw NO_SUCH_ENTITY.create(argument);
|
||||
|
||||
if (argument.startsWith("@"))
|
||||
return parseSelector(argument);
|
||||
|
||||
if (isUUID(argument)) {
|
||||
UUID uuid = UUID.fromString(argument);
|
||||
return findEntityByUUID(uuid);
|
||||
}
|
||||
|
||||
return findPlayerByName(argument);
|
||||
}
|
||||
|
||||
private boolean isUUID(String input) {
|
||||
return UUID_PATTERN.matcher(input).matches();
|
||||
}
|
||||
|
||||
private Entity parseSelector(String selector) throws CommandSyntaxException {
|
||||
if (mc.player == null) throw NO_SUCH_ENTITY.create(selector);
|
||||
|
||||
return switch (selector.toLowerCase()) {
|
||||
case "@p" ->
|
||||
findNearestPlayer();
|
||||
case "@r" ->
|
||||
findRandomPlayer();
|
||||
case "@s" ->
|
||||
mc.player;
|
||||
case "@a" -> throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.dispatcherUnknownArgument()
|
||||
.createWithContext(new StringReader(selector));
|
||||
default -> {
|
||||
if (selector.startsWith("@e"))
|
||||
yield parseEntitySelector(selector);
|
||||
else if (selector.startsWith("@p") && selector.length() > 2)
|
||||
yield parsePlayerSelector(selector);
|
||||
throw NO_SUCH_ENTITY.create(selector);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Entity findNearestPlayer() throws CommandSyntaxException {
|
||||
PlayerEntity nearest = null;
|
||||
double nearestDistance = Double.MAX_VALUE;
|
||||
|
||||
for (PlayerEntity player : mc.world.getPlayers()) {
|
||||
if (player == mc.player) continue;
|
||||
|
||||
double distance = mc.player.squaredDistanceTo(player);
|
||||
if (distance < nearestDistance) {
|
||||
nearestDistance = distance;
|
||||
nearest = player;
|
||||
}
|
||||
}
|
||||
|
||||
if (nearest == null)
|
||||
throw NO_SUCH_ENTITY.create("@p");
|
||||
|
||||
return nearest;
|
||||
}
|
||||
|
||||
private Entity findRandomPlayer() throws CommandSyntaxException {
|
||||
List<PlayerEntity> players = new ArrayList<>(mc.world.getPlayers());
|
||||
if (players.isEmpty()) throw NO_SUCH_ENTITY.create("@r");
|
||||
|
||||
players.remove(mc.player);
|
||||
if (players.isEmpty()) return mc.player;
|
||||
|
||||
Random random = new Random();
|
||||
return players.get(random.nextInt(players.size()));
|
||||
}
|
||||
|
||||
private Entity parseEntitySelector(String selector) throws CommandSyntaxException {
|
||||
if (selector.equals("@e")) {
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
for (Entity entity : mc.world.getEntities())
|
||||
if (!(entity instanceof PlayerEntity))
|
||||
entities.add(entity);
|
||||
|
||||
if (entities.isEmpty()) throw NO_SUCH_ENTITY.create(selector);
|
||||
|
||||
Random random = new Random();
|
||||
return entities.get(random.nextInt(entities.size()));
|
||||
}
|
||||
|
||||
if (selector.startsWith("@e[type=")) {
|
||||
String type = selector.substring(8, selector.length() - 1);
|
||||
return findEntityByType(type);
|
||||
}
|
||||
|
||||
throw NO_SUCH_ENTITY.create(selector);
|
||||
}
|
||||
|
||||
private Entity parsePlayerSelector(String selector) throws CommandSyntaxException {
|
||||
return findNearestPlayer();
|
||||
}
|
||||
|
||||
private Entity findEntityByType(String type) throws CommandSyntaxException {
|
||||
List<Entity> matchingEntities = new ArrayList<>();
|
||||
|
||||
for (Entity entity : mc.world.getEntities()) {
|
||||
String entityType = entity.getType().getTranslationKey();
|
||||
if (entityType.contains(type.toLowerCase().replace("minecraft:", "")))
|
||||
matchingEntities.add(entity);
|
||||
}
|
||||
|
||||
if (matchingEntities.isEmpty()) throw NO_SUCH_ENTITY.create(type);
|
||||
|
||||
Entity nearest = null;
|
||||
double nearestDistance = Double.MAX_VALUE;
|
||||
|
||||
for (Entity entity : matchingEntities) {
|
||||
double distance = mc.player.squaredDistanceTo(entity);
|
||||
if (distance < nearestDistance) {
|
||||
nearestDistance = distance;
|
||||
nearest = entity;
|
||||
}
|
||||
}
|
||||
|
||||
return nearest;
|
||||
}
|
||||
|
||||
private Entity findEntityByUUID(UUID uuid) throws CommandSyntaxException {
|
||||
for (Entity entity : mc.world.getEntities())
|
||||
if (entity.getUuid().equals(uuid))
|
||||
return entity;
|
||||
|
||||
throw NO_SUCH_ENTITY.create(uuid.toString());
|
||||
}
|
||||
|
||||
private PlayerEntity findPlayerByName(String name) throws CommandSyntaxException {
|
||||
for (PlayerEntity player : mc.world.getPlayers())
|
||||
if (player.getName().getString().equalsIgnoreCase(name))
|
||||
return player;
|
||||
|
||||
throw NO_SUCH_ENTITY.create(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
||||
if (mc.world != null)
|
||||
for (PlayerEntity player : mc.world.getPlayers())
|
||||
builder.suggest(player.getName().getString());
|
||||
|
||||
|
||||
builder.suggest("@p");
|
||||
builder.suggest("@r");
|
||||
builder.suggest("@s");
|
||||
|
||||
Entity lookingAt = EntityUtil.getEntityPlayerIsLookingAt();
|
||||
if (lookingAt != null)
|
||||
builder.suggest(lookingAt.getUuid().toString());
|
||||
|
||||
return builder.buildFuture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getExamples() {
|
||||
return EXAMPLES;
|
||||
}
|
||||
|
||||
public static Entity get(CommandContext<?> context, String name) {
|
||||
return context.getArgument(name, Entity.class);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
public class ModuleArgumentType implements ArgumentType<Module> {
|
||||
|
||||
public static final ModuleArgumentType INSTANCE = new ModuleArgumentType();
|
||||
private static final DynamicCommandExceptionType unknownModuleE = new DynamicCommandExceptionType(
|
||||
private static final DynamicCommandExceptionType UNKNOWN_MODULE = new DynamicCommandExceptionType(
|
||||
name -> Text.literal("módulo \"" + name + "\" no encontrado"));
|
||||
|
||||
private static final Collection<String> examples = ModuleManager.INSTANCE.getModules()
|
||||
@@ -29,7 +29,7 @@ public class ModuleArgumentType implements ArgumentType<Module> {
|
||||
public Module parse(StringReader reader) throws CommandSyntaxException {
|
||||
String argument = reader.readString().replace("_", " ");
|
||||
Module module = ModuleManager.INSTANCE.getModuleByName(argument);
|
||||
if (module == null) throw unknownModuleE.create(argument);
|
||||
if (module == null) throw UNKNOWN_MODULE.create(argument);
|
||||
return module;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ public class PlayerArgumentType implements ArgumentType<PlayerEntity> {
|
||||
|
||||
@Override
|
||||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
||||
return CommandSource.suggestMatching(mc.world.getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getName().getString()), builder);
|
||||
return CommandSource.suggestMatching(mc.world.getPlayers().stream().map(
|
||||
abstractClientPlayerEntity -> abstractClientPlayerEntity.getName().getString()), builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,8 +42,7 @@ public class BindCommand extends Command {
|
||||
public static boolean onKeyPress(int key) {
|
||||
if (listeningModule == null) return false;
|
||||
KeySetting bind = listeningModule.getBind();
|
||||
if (bind != null)
|
||||
bind.setKey(key);
|
||||
if (bind != null) bind.setKey(key);
|
||||
|
||||
ChatUtil.info(
|
||||
Text.of("la tecla " + Formatting.AQUA + KeyUtil.getKeyName(key) + Formatting.RESET +
|
||||
|
||||
@@ -3,7 +3,7 @@ package me.retucio.camtweaks.command.commands;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import me.retucio.camtweaks.command.Command;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.ScreenshotPlus;
|
||||
import me.retucio.camtweaks.module.modules.misc.ScreenshotPlus;
|
||||
import net.minecraft.command.CommandSource;
|
||||
|
||||
// se usa principalmente para el módulo ScreenshotPlus, pero también se puede usar sin él supongo
|
||||
|
||||
@@ -1,37 +1,47 @@
|
||||
package me.retucio.camtweaks.command.commands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.command.Command;
|
||||
import net.minecraft.client.gui.screen.ingame.GenericContainerScreen;
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.TickEvent;
|
||||
import me.retucio.camtweaks.ui.screen.PreviewScreen;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import me.retucio.camtweaks.util.InventoryUtil;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.inventory.EnderChestInventory;
|
||||
import net.minecraft.inventory.Inventories;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.SimpleInventory;
|
||||
import net.minecraft.screen.GenericContainerScreenHandler;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
// accede a los contenidos de tu enderchest
|
||||
public class EnderChestCommand extends Command {
|
||||
|
||||
private boolean shouldOpenEchest = false;
|
||||
|
||||
public EnderChestCommand() {
|
||||
super("echest", "muestra el contenido de tu enderchest", "ec", "enderchest");
|
||||
super("echest", "muestra el contenido de tu enderchest (solo de ver)", "ec", "enderchest");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.executes(ctx -> {
|
||||
mc.execute(() -> { // para evitar llamar setScreen desde el hilo equivocado, que causa crashes
|
||||
EnderChestInventory enderChestInv = mc.player.getEnderChestInventory();
|
||||
mc.execute(() -> {
|
||||
if (mc.player == null) return;
|
||||
if (InventoryUtil.getEchestInv() == null) {
|
||||
ChatUtil.warn("necesitas abrir un enderchest una vez primero");
|
||||
return;
|
||||
}
|
||||
|
||||
// llámame imbécil pero no tengo ni idea de por qué no se abre
|
||||
mc.setScreen(new GenericContainerScreen(
|
||||
GenericContainerScreenHandler.createGeneric9x3(mc.player.currentScreenHandler.syncId + 1, mc.player.getInventory(), enderChestInv),
|
||||
mc.player.getInventory(),
|
||||
Text.translatable("container.enderchest")
|
||||
));
|
||||
shouldOpenEchest = true;
|
||||
});
|
||||
|
||||
return SUCCESS;
|
||||
});
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(TickEvent.Post event) {
|
||||
if (shouldOpenEchest) {
|
||||
shouldOpenEchest = false;
|
||||
if (InventoryUtil.getEchestInv() != null)
|
||||
mc.setScreen(new PreviewScreen(InventoryUtil.getEchestInv(), null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package me.retucio.camtweaks.command.commands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import me.retucio.camtweaks.command.Command;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class GarbageCleanerCommand extends Command {
|
||||
|
||||
public GarbageCleanerCommand() {
|
||||
super("gc", "limpia la ram mediante el recolector de basura (gc)", "garbagecollect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.executes(context -> {
|
||||
System.gc();
|
||||
ChatUtil.info(Text.of("basura recolectada"));
|
||||
return SUCCESS;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package me.retucio.camtweaks.command.commands;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import me.retucio.camtweaks.command.Command;
|
||||
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
||||
import me.retucio.camtweaks.ui.widgets.frames.settings.ClientSettingsFrame;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
@@ -3,7 +3,7 @@ package me.retucio.camtweaks.command.commands;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import me.retucio.camtweaks.command.Command;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.ScreenshotPlus;
|
||||
import me.retucio.camtweaks.module.modules.misc.ScreenshotPlus;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import net.minecraft.command.CommandSource;
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package me.retucio.camtweaks.command.commands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import me.retucio.camtweaks.command.Command;
|
||||
import me.retucio.camtweaks.command.args.EntityArgumentType;
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.KeyEvent;
|
||||
import me.retucio.camtweaks.util.EntityUtil;
|
||||
import me.retucio.camtweaks.util.MiscUtil;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class SpectateCommand extends Command {
|
||||
|
||||
public SpectateCommand() {
|
||||
super("espectar", "te permite adquirir el punto de vista de una entidad", "spectate", "spec");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder
|
||||
.executes(ctx -> { // If no argument, use the entity player is looking at
|
||||
mc.execute(() -> {
|
||||
Entity target = EntityUtil.getEntityPlayerIsLookingAt();
|
||||
if (target != null)
|
||||
mc.setCameraEntity(target);
|
||||
});
|
||||
return SUCCESS;
|
||||
})
|
||||
.then(argument("entidad", EntityArgumentType.INSTANCE)
|
||||
.executes(ctx -> {
|
||||
Entity entity = EntityArgumentType.get(ctx, "entidad");
|
||||
if (mc.player != null && entity != null) {
|
||||
mc.setCameraEntity(entity);
|
||||
}
|
||||
return SUCCESS;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKey(KeyEvent event) {
|
||||
if (mc.getCameraEntity() != mc.player && mc.currentScreen == null
|
||||
&& event.getKey() == GLFW.GLFW_KEY_ESCAPE && event.getAction() != GLFW.GLFW_RELEASE ) {
|
||||
event.cancel();
|
||||
mc.setCameraEntity(mc.player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,9 @@ public class ClientConfig {
|
||||
// id del elemento del hud -> true: visible / false: no visible
|
||||
public Map<String, Boolean> hudVisibilities = new HashMap<>();
|
||||
|
||||
// posición de la barra de búsqueda (x, y)
|
||||
public int[] searchBarPosition = new int[]{340, 16};
|
||||
|
||||
public ClientConfig() {
|
||||
EVENT_BUS.register(this);
|
||||
}
|
||||
@@ -54,7 +57,9 @@ public class ClientConfig {
|
||||
case KeySetting k: value = k.getKey(); break;
|
||||
case NumberSetting n: value = n.getValue(); break;
|
||||
case StringSetting s: value = s.getValue(); break;
|
||||
case ListSetting l: value = l.getValues(); break;
|
||||
case ListSetting l: value = l.getConfigValues(); break;
|
||||
case ColorSetting c: value = c.getConfigValue(); break;
|
||||
case OptionSetting o: value = o.getIndex(); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -75,39 +80,39 @@ public class ClientConfig {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMoveSettingsFrame(SettingsFrameEvent.Move event) {
|
||||
settingsFrames.replace(event.getFrame().module.getName(), new int[]{event.getFrame().x, event.getFrame().y});
|
||||
settingsFrames.replace(event.getFrame().module.getName(), new int[]{event.getFrame().getX(), event.getFrame().getY()});
|
||||
ConfigManager.save();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onExtendModuleFrame(ModuleFrameEvent.Extend event) {
|
||||
extendableFrames.put("M", new FrameData(
|
||||
ClickGUI.INSTANCE.getModulesFrame().x,
|
||||
ClickGUI.INSTANCE.getModulesFrame().y,
|
||||
ClickGUI.INSTANCE.getModulesFrame().getX(),
|
||||
ClickGUI.INSTANCE.getModulesFrame().getY(),
|
||||
ClickGUI.INSTANCE.getModulesFrame().extended));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMoveModuleFrame(ModuleFrameEvent.Move event) {
|
||||
extendableFrames.replace("M", new FrameData(
|
||||
ClickGUI.INSTANCE.getModulesFrame().x,
|
||||
ClickGUI.INSTANCE.getModulesFrame().y,
|
||||
ClickGUI.INSTANCE.getModulesFrame().getX(),
|
||||
ClickGUI.INSTANCE.getModulesFrame().getY(),
|
||||
ClickGUI.INSTANCE.getModulesFrame().extended));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onExtendGUISettingsFrame(GUISettingsFrameEvent.Extend event) {
|
||||
extendableFrames.put("S", new FrameData(
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().x,
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().y,
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().getX(),
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().getY(),
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().extended));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMoveGUISettingsFrame(GUISettingsFrameEvent.Move event) {
|
||||
extendableFrames.replace("S", new FrameData(
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().x,
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().y,
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().getX(),
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().getY(),
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().extended));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@ import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.settings.*;
|
||||
import me.retucio.camtweaks.ui.widgets.frames.ModuleFrame;
|
||||
import me.retucio.camtweaks.ui.screen.ClickGUI;
|
||||
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
||||
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
||||
import me.retucio.camtweaks.ui.widgets.frames.settings.ClientSettingsFrame;
|
||||
import me.retucio.camtweaks.ui.widgets.frames.SettingsFrame;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
@@ -24,22 +25,28 @@ public class ConfigManager {
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
private static final File CONFIG_FILE = new File("camera_tweaks.json");
|
||||
|
||||
private static boolean loaded = false;
|
||||
private static ClientConfig config = null;
|
||||
|
||||
|
||||
// ------------------ MÉTODOS PRINCIPALES ------------------
|
||||
|
||||
// guardar configuraciones
|
||||
public static void save() {
|
||||
ensureConfig();
|
||||
|
||||
try (FileWriter writer = new FileWriter(CONFIG_FILE)) {
|
||||
GSON.toJson(config, writer);
|
||||
CameraTweaks.LOGGER.info("ajustes guardados");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
CameraTweaks.LOGGER.error("error al guardar ajustes", e);
|
||||
}
|
||||
}
|
||||
|
||||
// cargar configuraciones
|
||||
public static void load() {
|
||||
CameraTweaks.LOGGER.info("ajustes cargados");
|
||||
CameraTweaks.LOGGER.info("cargando ajustes...");
|
||||
|
||||
if (!CONFIG_FILE.exists()) {
|
||||
ensureConfig();
|
||||
save();
|
||||
@@ -48,72 +55,52 @@ public class ConfigManager {
|
||||
|
||||
try (FileReader reader = new FileReader(CONFIG_FILE)) {
|
||||
config = GSON.fromJson(reader, ClientConfig.class);
|
||||
CameraTweaks.LOGGER.info("ajustes cargados");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
CameraTweaks.LOGGER.error("no se pudieron cargar los ajustes, usando ajustes por defecto", e);
|
||||
ensureConfig();
|
||||
}
|
||||
}
|
||||
|
||||
// aplicar configuraciones cargadas
|
||||
public static void applyConfig() {
|
||||
if (CameraTweaks.mc == null || ModuleManager.INSTANCE == null || config == null)
|
||||
return;
|
||||
if (!shouldApply()) return;
|
||||
|
||||
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
||||
if (config.moduleStates.containsKey(module.getName()))
|
||||
module.setEnabled(config.moduleStates.get(module.getName())); // estados
|
||||
applyModuleStates();
|
||||
applyModuleSettings();
|
||||
applySettingsFrames();
|
||||
applySearchBarPosition();
|
||||
applyGuiSettings();
|
||||
applyExtendableFrames();
|
||||
|
||||
module.getSettings().forEach(setting -> applySetting(module, setting));
|
||||
|
||||
if (config.settingsFrames.containsKey(module.getName())) {
|
||||
int[] position = config.settingsFrames.get(module.getName());
|
||||
ClickGUI.INSTANCE.openSettingsFrame(module, position[0], position[1]);
|
||||
}
|
||||
});
|
||||
|
||||
ClientSettingsFrame.guiSettings.setEnabled(true);
|
||||
ClientSettingsFrame.guiSettings.getSettings().forEach(setting -> applySetting(ClientSettingsFrame.guiSettings, setting));
|
||||
|
||||
CameraTweaks.LOGGER.info("módulos encendidos cargados");
|
||||
CameraTweaks.LOGGER.info("ajustes de módulos cargados");
|
||||
|
||||
ClientConfig.FrameData moduleFrameData = config.extendableFrames.get("M");
|
||||
if (moduleFrameData != null) {
|
||||
ClickGUI.INSTANCE.getModulesFrame().x = moduleFrameData.x();
|
||||
ClickGUI.INSTANCE.getModulesFrame().y = moduleFrameData.y();
|
||||
ClickGUI.INSTANCE.getModulesFrame().extended = moduleFrameData.extended();
|
||||
}
|
||||
|
||||
ClientConfig.FrameData guiSettingsData = config.extendableFrames.get("S");
|
||||
if (guiSettingsData != null) {
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().x = guiSettingsData.x();
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().y = guiSettingsData.y();
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().extended = guiSettingsData.extended();
|
||||
}
|
||||
|
||||
CameraTweaks.LOGGER.info("posiciones de frames cargadas");
|
||||
ClickGUI.INSTANCE.refreshListButtons();
|
||||
loaded = true;
|
||||
CameraTweaks.LOGGER.info("ajustes aplicados");
|
||||
}
|
||||
|
||||
// obtener configuración actual
|
||||
public static ClientConfig getConfig() {
|
||||
ensureConfig();
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
// ------------------ GUARDAR VALORES INDIVIDUALES EN LA CONFIG. ------------------
|
||||
|
||||
public static void setModuleState(Module module) {
|
||||
ensureConfig();
|
||||
config.moduleStates.put(module.getName(), module.isEnabled());
|
||||
save();
|
||||
}
|
||||
|
||||
public static void setSetting(AbstractSetting setting, Object value) {
|
||||
public static void setSetting(Setting setting, Object value) {
|
||||
ensureConfig();
|
||||
config.settings.put(setting.getModule().getName() + ":" + setting.getName(), value);
|
||||
config.settings.put(getSettingKey(setting), value);
|
||||
save();
|
||||
}
|
||||
|
||||
public static void setFramePosition(SettingsFrame frame) {
|
||||
ensureConfig();
|
||||
config.settingsFrames.put(frame.module.getName(), new int[]{frame.x, frame.y});
|
||||
config.settingsFrames.put(frame.module.getName(), new int[] {frame.getX(), frame.getY()});
|
||||
save();
|
||||
}
|
||||
|
||||
@@ -125,7 +112,7 @@ public class ConfigManager {
|
||||
|
||||
public static void setHudPosition(String id, int x, int y) {
|
||||
ensureConfig();
|
||||
config.hudPositions.put(id, new int[]{x, y});
|
||||
config.hudPositions.put(id, new int[] {x, y});
|
||||
save();
|
||||
}
|
||||
|
||||
@@ -135,35 +122,200 @@ public class ConfigManager {
|
||||
save();
|
||||
}
|
||||
|
||||
public static void setSearchBarPosition(int x, int y) {
|
||||
ensureConfig();
|
||||
config.searchBarPosition = new int[] {x, y};
|
||||
save();
|
||||
}
|
||||
|
||||
|
||||
// ------------------ APLICAR AJUSTES ------------------
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static void applySetting(Module parent, AbstractSetting setting) {
|
||||
String id = parent.getName() + ":" + setting.getName();
|
||||
if (config.settings.containsKey(id)) {
|
||||
Object value = config.settings.get(id);
|
||||
public static void applySetting(Module parent, Setting setting) {
|
||||
String key = getSettingKey(setting);
|
||||
|
||||
switch (setting) {
|
||||
case BooleanSetting b -> b.setEnabled((boolean) value);
|
||||
case EnumSetting e -> e.setIndex(value instanceof Double val ? val.intValue() : (int) value);
|
||||
case NumberSetting n -> n.setValue((double) value);
|
||||
case StringSetting s -> s.setValue((String) value);
|
||||
case KeySetting k -> k.setKey(value instanceof Double val ? val.intValue() : (int) value);
|
||||
case ListSetting l -> {
|
||||
if (value instanceof Map<?, ?> map) {
|
||||
Map<Object, Boolean> converted = new HashMap<>();
|
||||
for (Object option : l.getOptions()) {
|
||||
Object key = String.valueOf(option);
|
||||
Object bv = map.get(key);
|
||||
converted.put(option, bv instanceof Boolean b && b);
|
||||
}
|
||||
l.setValues(converted);
|
||||
}
|
||||
} default -> {}
|
||||
}
|
||||
if (!config.settings.containsKey(key)) return;
|
||||
|
||||
Object value = config.settings.get(key);
|
||||
|
||||
switch (setting) {
|
||||
case BooleanSetting booleanSetting -> applyBooleanSetting(booleanSetting, value);
|
||||
case EnumSetting enumSetting -> applyEnumSetting(enumSetting, value);
|
||||
case NumberSetting numberSetting -> applyNumberSetting(numberSetting, value);
|
||||
case StringSetting stringSetting -> applyStringSetting(stringSetting, value);
|
||||
case KeySetting keySetting -> applyKeySetting(keySetting, value);
|
||||
case ListSetting listSetting -> applyListSetting(listSetting, value);
|
||||
case ColorSetting colorSetting -> applyColorSetting(colorSetting, value);
|
||||
case OptionSetting optionSetting -> applyOptionSetting(optionSetting, value);
|
||||
default -> CameraTweaks.LOGGER.warn("watafac queseso: {}", setting.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyModuleStates() {
|
||||
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
||||
if (config.moduleStates.containsKey(module.getName())) {
|
||||
module.setEnabled(config.moduleStates.get(module.getName()));
|
||||
}
|
||||
});
|
||||
CameraTweaks.LOGGER.info("estados de módulos aplicados");
|
||||
}
|
||||
|
||||
private static void applyModuleSettings() {
|
||||
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
||||
module.getSettings().forEach(setting -> applySetting(module, setting));
|
||||
});
|
||||
CameraTweaks.LOGGER.info("ajustes de módulos aplicados");
|
||||
}
|
||||
|
||||
private static void applySettingsFrames() {
|
||||
config.settingsFrames.forEach((moduleName, position) -> {
|
||||
Module module = ModuleManager.INSTANCE.getModuleByName(moduleName);
|
||||
ClickGUI.INSTANCE.openSettingsFrame(module, position[0], position[1]);
|
||||
});
|
||||
CameraTweaks.LOGGER.info("estados de marcos de ajustes aplicados");
|
||||
}
|
||||
|
||||
private static void applySearchBarPosition() {
|
||||
if (config.searchBarPosition != null && config.searchBarPosition.length == 2) {
|
||||
ClickGUI.INSTANCE.getSearchBar().setX(config.searchBarPosition[0]);
|
||||
ClickGUI.INSTANCE.getSearchBar().setY(config.searchBarPosition[1]);
|
||||
}
|
||||
CameraTweaks.LOGGER.info("posición de la barra de búsqueda aplicada");
|
||||
}
|
||||
|
||||
private static void applyGuiSettings() {
|
||||
ClientSettingsFrame.guiSettings.setEnabled(true);
|
||||
ClientSettingsFrame.guiSettings.getSettings().forEach(setting -> {
|
||||
applySetting(ClientSettingsFrame.guiSettings, setting);
|
||||
});
|
||||
CameraTweaks.LOGGER.info("ajustes del cliente aplicados");
|
||||
}
|
||||
|
||||
private static void applyExtendableFrames() {
|
||||
applyExtendableFrame(ClickGUI.INSTANCE.getModulesFrame());
|
||||
applyExtendableFrame(ClickGUI.INSTANCE.getGuiSettingsFrame());
|
||||
|
||||
CameraTweaks.LOGGER.info("posiciones de marcos extendibles aplicadasa");
|
||||
ClickGUI.INSTANCE.refreshListButtons();
|
||||
}
|
||||
|
||||
private static void applyExtendableFrame(ModuleFrame frame) {
|
||||
ClientConfig.FrameData frameData = config.extendableFrames.get("M");
|
||||
if (frameData != null) {
|
||||
frame.setX(frameData.x());
|
||||
frame.setY(frameData.y());
|
||||
frame.extended = frameData.extended();
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyExtendableFrame(ClientSettingsFrame frame) {
|
||||
ClientConfig.FrameData frameData = config.extendableFrames.get("S");
|
||||
if (frameData != null) {
|
||||
frame.setX(frameData.x());
|
||||
frame.setY(frameData.y());
|
||||
frame.extended = frameData.extended();
|
||||
}
|
||||
}
|
||||
|
||||
// ajustes de módulos
|
||||
|
||||
private static void applyBooleanSetting(BooleanSetting setting, Object value) {
|
||||
if (value instanceof Boolean) {
|
||||
setting.setEnabled((Boolean) value);
|
||||
}
|
||||
}
|
||||
|
||||
private static <T extends Enum<T>> void applyEnumSetting(EnumSetting<T> setting, Object value) {
|
||||
if (value instanceof Double) {
|
||||
setting.setIndex(((Double) value).intValue());
|
||||
} else if (value instanceof Integer) {
|
||||
setting.setIndex((Integer) value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyNumberSetting(NumberSetting setting, Object value) {
|
||||
if (value instanceof Double) {
|
||||
setting.setValue((Double) value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyStringSetting(StringSetting setting, Object value) {
|
||||
if (value instanceof String) {
|
||||
setting.setValue((String) value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyKeySetting(KeySetting setting, Object value) {
|
||||
if (value instanceof Double) {
|
||||
setting.setKey(((Double) value).intValue());
|
||||
} else if (value instanceof Integer) {
|
||||
setting.setKey((Integer) value);
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> void applyListSetting(ListSetting<T> setting, Object value) {
|
||||
if (value instanceof Map<?, ?> map) {
|
||||
Map<T, Boolean> convertedValues = new HashMap<>();
|
||||
|
||||
for (T option : setting.getOptions()) {
|
||||
String key = setting.getDisplayName(option);
|
||||
Object booleanValue = map.get(key);
|
||||
convertedValues.put(option, booleanValue instanceof Boolean && (Boolean) booleanValue);
|
||||
}
|
||||
|
||||
setting.setValues(convertedValues);
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyColorSetting(ColorSetting setting, Object value) {
|
||||
if (!(value instanceof Map<?, ?> map)) return;
|
||||
|
||||
Number r = (Number) map.get("r");
|
||||
Number g = (Number) map.get("g");
|
||||
Number b = (Number) map.get("b");
|
||||
Number a = (Number) map.get("a");
|
||||
|
||||
if (r != null && g != null && b != null && a != null)
|
||||
setting.setRGB(r.intValue(), g.intValue(), b.intValue(), a.intValue());
|
||||
|
||||
applyOptionalProperty(map, "rb", Boolean.class, setting::setRainbow);
|
||||
applyOptionalProperty(map, "rs", Number.class, val -> setting.setRainbowSpeed(val.intValue()));
|
||||
applyOptionalProperty(map, "sat", Number.class, val -> setting.setSaturation(val.floatValue()));
|
||||
applyOptionalProperty(map, "bri", Number.class, val -> setting.setBrightness(val.floatValue()));
|
||||
}
|
||||
|
||||
private static <T> void applyOptionSetting(OptionSetting<T> setting, Object value) {
|
||||
if (value instanceof Double) {
|
||||
int index = ((Double) value).intValue();
|
||||
setting.setValue(setting.getOption(index));
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> void applyOptionalProperty(Map<?, ?> map, String key, Class<T> type, java.util.function.Consumer<T> setter) {
|
||||
Object value = map.get(key);
|
||||
if (type.isInstance(value)) {
|
||||
setter.accept(type.cast(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------ MÉTODOS DE AYUDA ------------------
|
||||
|
||||
private static boolean shouldApply() {
|
||||
return CameraTweaks.mc != null && ModuleManager.INSTANCE != null && config != null;
|
||||
}
|
||||
|
||||
|
||||
private static void ensureConfig() {
|
||||
if (config == null) config = new ClientConfig();
|
||||
}
|
||||
|
||||
private static String getSettingKey(Setting setting) {
|
||||
return setting.getModule().getName() + ":" + setting.getName();
|
||||
}
|
||||
|
||||
public static boolean hasLoaded() {
|
||||
return loaded;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package me.retucio.camtweaks.event;
|
||||
|
||||
// evento base, cancelable (usado en mixins)
|
||||
public class Event {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
public boolean isCancelled() {
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.*;
|
||||
|
||||
// al llamar un evento, se guarda en el bus de eventos, de donde luego se puede detectar si ese evento ha sucedido
|
||||
public class EventBus {
|
||||
|
||||
private final Map<Class<?>, List<ListenerMethod>> listeners = new HashMap<>();
|
||||
|
||||
private record ListenerMethod(Object instance, Method method) {}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package me.retucio.camtweaks.event;
|
||||
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onJoinWorld
|
||||
*/
|
||||
public class JoinWorldEvent extends Event {
|
||||
|
||||
private final ClientWorld world;
|
||||
|
||||
public JoinWorldEvent(ClientWorld world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public ClientWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -1,8 +1,12 @@
|
||||
package me.retucio.camtweaks.event.events.camtweaks;
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientWorldMixin#onAddEntity
|
||||
*/
|
||||
public class AddEntityEvent extends Event {
|
||||
|
||||
private final Entity entity;
|
||||
@@ -0,0 +1,21 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientPlayerInteractionManagerMixin#onAttackEntity
|
||||
*/
|
||||
public class AttackEntityEvent extends Event {
|
||||
|
||||
private final Entity entity;
|
||||
|
||||
public AttackEntityEvent(Entity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientPlayerInteractionManagerMixin#onBlockBreak
|
||||
*/
|
||||
public class BreakBlockEvent extends Event {
|
||||
|
||||
private BlockPos pos;
|
||||
|
||||
public BreakBlockEvent(BlockPos pos) {
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
public BlockPos getPos() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
public void setPos(BlockPos pos) {
|
||||
this.pos = pos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.EntityMixin#onRotation
|
||||
* @see me.retucio.camtweaks.mixin.EntityMixin#onChangeYaw
|
||||
* @see me.retucio.camtweaks.mixin.EntityMixin#onChangePitch
|
||||
*/
|
||||
public class ChangeRotationEvent extends Event {
|
||||
|
||||
private float yaw;
|
||||
private float pitch;
|
||||
|
||||
public ChangeRotationEvent(float yaw, float pitch) {
|
||||
this.yaw = yaw;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
public float getYaw() {
|
||||
return yaw;
|
||||
}
|
||||
|
||||
public void setYaw(float yaw) {
|
||||
this.yaw = yaw;
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
public void setPitch(float pitch) {
|
||||
this.pitch = pitch;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ChunkOcclusionDataBuilderMixin#onChunkOcclusion
|
||||
*/
|
||||
|
||||
public class ChunkOcclusionEvent extends Event {}
|
||||
@@ -1,11 +1,12 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.module.modules.misc.ChatPlus;
|
||||
import net.minecraft.text.ClickEvent;
|
||||
|
||||
/** este evento es solo para asegurarse de que comandos del mod se puedan ejecutar solo desde el lado del cliente
|
||||
* @see me.retucio.camtweaks.module.modules.ChatPlus#getSendButton
|
||||
*/
|
||||
|
||||
/** este evento es solo para asegurarse de que comandos del mod se puedan ejecutar solo desde el lado del cliente
|
||||
* @see ChatPlus#getSendButton
|
||||
*/
|
||||
public class ClientClickEvent implements ClickEvent {
|
||||
|
||||
private final String value;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
public class ClipAtLedgeEvent extends Event {
|
||||
|
||||
private boolean clipping;
|
||||
|
||||
public ClipAtLedgeEvent(boolean clipping) {
|
||||
this.clipping = clipping;
|
||||
}
|
||||
|
||||
public boolean isClipping() {
|
||||
return clipping;
|
||||
}
|
||||
|
||||
public void setClipping(boolean clipping) {
|
||||
this.clipping = clipping;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ItemStackMixin#onDamage
|
||||
*/
|
||||
public class DamageItemEvent extends Event {
|
||||
|
||||
private final int amount;
|
||||
private final ItemStack stack;
|
||||
|
||||
public DamageItemEvent(int amount, ItemStack stack) {
|
||||
this.amount = amount;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,28 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.network.DisconnectionInfo;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onDisconnect
|
||||
*/
|
||||
public class DisconnectEvent extends Event {
|
||||
|
||||
public class DisconnectEvent extends Event {}
|
||||
private final DisconnectionInfo info;
|
||||
private final ServerInfo server;
|
||||
|
||||
public DisconnectEvent(DisconnectionInfo info, ServerInfo server) {
|
||||
this.info = info;
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
public DisconnectionInfo getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public ServerInfo getServer() {
|
||||
return server;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.GameRendererMixin#modifyFov
|
||||
*/
|
||||
|
||||
public class GetFOVEvent extends Event {
|
||||
|
||||
private float fov;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientPlayerInteractionManagerMixin#onEntityInteract
|
||||
*/
|
||||
public class InteractEntityEvent extends Event {
|
||||
|
||||
private final Entity entity;
|
||||
private Hand hand;
|
||||
|
||||
public InteractEntityEvent(Entity entity, Hand hand) {
|
||||
this.entity = entity;
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public Hand getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
public void setHand(Hand hand) {
|
||||
this.hand = hand;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.KeyboardMixin#onKeyPress
|
||||
*/
|
||||
|
||||
public class KeyEvent extends Event {
|
||||
|
||||
private final int key, scancode, action;
|
||||
|
||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.MouseMixin#onMouseButton
|
||||
*/
|
||||
|
||||
public class MouseClickEvent extends Event {
|
||||
|
||||
private final int action, button;
|
||||
|
||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.MouseMixin#onMouseScroll
|
||||
*/
|
||||
|
||||
public class MouseScrollEvent extends Event {
|
||||
|
||||
private double horizontal, vertical;
|
||||
|
||||
@@ -3,10 +3,10 @@ package me.retucio.camtweaks.event.events;
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onOpenScreen
|
||||
*/
|
||||
|
||||
public class OpenScreenEvent extends Event {
|
||||
|
||||
private final Screen screen;
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import me.retucio.camtweaks.event.Stage;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onSendPacketPre
|
||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onSendPacketPre
|
||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onSendPacketPost
|
||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onReceivePacket
|
||||
*/
|
||||
|
||||
public class PacketEvent {
|
||||
|
||||
public static class Send extends Event {
|
||||
|
||||
@@ -3,10 +3,10 @@ package me.retucio.camtweaks.event.events;
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.client.option.Perspective;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.GameOptionsMixin#changePerspective
|
||||
*/
|
||||
|
||||
public class PerspectiveChangeEvent extends Event {
|
||||
|
||||
private Perspective perspective;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientPlayerInteractionManagerMixin#onBlockPlace
|
||||
*/
|
||||
public class PlaceBlockEvent extends Event {
|
||||
|
||||
private Hand hand;
|
||||
private BlockHitResult result;
|
||||
|
||||
public PlaceBlockEvent(Hand hand, BlockHitResult result) {
|
||||
this.hand = hand;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public Hand getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
public void setHand(Hand hand) {
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
public BlockHitResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(BlockHitResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.text.Text;
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ChatHudMixin#onAddMessage
|
||||
*/
|
||||
|
||||
public class ReceiveMessageEvent extends Event {
|
||||
|
||||
private Text text;
|
||||
|
||||
+5
-1
@@ -1,8 +1,12 @@
|
||||
package me.retucio.camtweaks.event.events.camtweaks;
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientWorldMixin#onRemoveEntity
|
||||
*/
|
||||
public class RemoveEntityEvent extends Event {
|
||||
|
||||
private final Entity entity;
|
||||
@@ -4,10 +4,10 @@ import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.HeldItemRendererMixin#onRenderArm
|
||||
*/
|
||||
|
||||
public class RenderArmEvent extends Event {
|
||||
|
||||
private MatrixStack matrices;
|
||||
|
||||
@@ -6,12 +6,12 @@ import net.minecraft.text.Text;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.BossBarHudMixin#modifyBossBarIterator
|
||||
* @see me.retucio.camtweaks.mixin.BossBarHudMixin#modifyBossBarName
|
||||
* @see me.retucio.camtweaks.mixin.BossBarHudMixin#modifySpacingConstant
|
||||
*/
|
||||
|
||||
public class RenderBossbarEvent {
|
||||
|
||||
public static class BossText extends Event {
|
||||
|
||||
@@ -4,10 +4,10 @@ import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.HeldItemRendererMixin#onRenderItem
|
||||
*/
|
||||
|
||||
public class RenderHeldItemEvent extends Event {
|
||||
|
||||
private MatrixStack matrices;
|
||||
|
||||
@@ -5,6 +5,10 @@ import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.client.render.RenderTickCounter;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.WorldRendererMixin#render
|
||||
*/
|
||||
public class RenderWorldEvent extends Event {
|
||||
|
||||
private final MatrixStack matrices;
|
||||
|
||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientPlayNetworkHandlerMixin#onSendMessage
|
||||
*/
|
||||
|
||||
public class SendMessageEvent extends Event {
|
||||
|
||||
private String message;
|
||||
|
||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onStop
|
||||
*/
|
||||
|
||||
public class ShutdownEvent extends Event {
|
||||
|
||||
public ShutdownEvent() {}
|
||||
|
||||
@@ -2,11 +2,11 @@ package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onTickPre
|
||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onTickPost
|
||||
*/
|
||||
|
||||
public class TickEvent {
|
||||
|
||||
public static class Pre extends Event {}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onUseItem
|
||||
*/
|
||||
public class UseItemEvent extends Event {
|
||||
|
||||
private ItemStack stack;
|
||||
private Hand hand;
|
||||
|
||||
public UseItemEvent(ItemStack stack, Hand hand) {
|
||||
this.stack = stack;
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void setStack(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public Hand getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
public void setHand(Hand hand) {
|
||||
this.hand = hand;
|
||||
}
|
||||
}
|
||||
@@ -2,4 +2,5 @@ package me.retucio.camtweaks.event.events.camtweaks;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
// se genera cuando carga la interfaz del mod
|
||||
public class LoadClickGUIEvent extends Event {}
|
||||
@@ -2,4 +2,5 @@ package me.retucio.camtweaks.event.events.camtweaks;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
// se genera cuando carga el gestor de comandos
|
||||
public class LoadCommandManagerEvent extends Event {}
|
||||
@@ -2,4 +2,5 @@ package me.retucio.camtweaks.event.events.camtweaks;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
// se genera cuando carga el gestor de módulos
|
||||
public class LoadModuleManagerEvent extends Event {}
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.retucio.camtweaks.event.events.camtweaks;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
||||
import me.retucio.camtweaks.ui.widgets.frames.SettingsFrame;
|
||||
|
||||
// se genera cada que se interactúa con un marco de ajustes de un módulo
|
||||
public class SettingsFrameEvent {
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package me.retucio.camtweaks.event.events.camtweaks;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import me.retucio.camtweaks.module.settings.AbstractSetting;
|
||||
import me.retucio.camtweaks.module.settings.Setting;
|
||||
|
||||
// se genera cada que se cambia el valor de un ajuste
|
||||
public class UpdateSettingEvent extends Event {
|
||||
|
||||
private final AbstractSetting setting;
|
||||
private final Setting setting;
|
||||
private boolean shouldSave;
|
||||
|
||||
public UpdateSettingEvent(AbstractSetting setting, boolean shouldSave) {
|
||||
public UpdateSettingEvent(Setting setting, boolean shouldSave) {
|
||||
this.setting = setting;
|
||||
this.shouldSave = shouldSave;
|
||||
}
|
||||
|
||||
public AbstractSetting getSetting() {
|
||||
public Setting getSetting() {
|
||||
return setting;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Iterator;
|
||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||
|
||||
@Mixin(BossBarHud.class)
|
||||
public class BossBarHudMixin {
|
||||
public abstract class BossBarHudMixin {
|
||||
|
||||
@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Ljava/util/Collection;iterator()Ljava/util/Iterator;"))
|
||||
public Iterator<ClientBossBar> modifyBossBarIterator(Iterator<ClientBossBar> original) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
|
||||
import me.retucio.camtweaks.util.render.GlintRenderLayer;
|
||||
import net.minecraft.client.render.BufferBuilderStorage;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.util.BufferAllocator;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(BufferBuilderStorage.class)
|
||||
public abstract class BufferStorageMixin {
|
||||
|
||||
@Inject(method = "assignBufferBuilder", at = @At("HEAD"))
|
||||
private static void addGlintTypes(Object2ObjectLinkedOpenHashMap<RenderLayer, BufferAllocator> builderStorage, RenderLayer layer, CallbackInfo ci) {
|
||||
GlintRenderLayer.addGlintTypes(builderStorage);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Freelook;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.PerspectivePlus;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freelook;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.camera.PerspectivePlus;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
@@ -44,7 +44,7 @@ public abstract class CameraMixin {
|
||||
}
|
||||
|
||||
@Inject(method = "update", at = @At("HEAD"))
|
||||
private void onUpdateHead(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo info) {
|
||||
private void onUpdateHead(World area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo ci) {
|
||||
this.tickDelta = tickDelta;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public abstract class CameraMixin {
|
||||
// cámara libre
|
||||
|
||||
@Inject(method = "update", at = @At("TAIL"))
|
||||
private void onUpdateTail(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo info) {
|
||||
private void onUpdateTail(World area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickProgress, CallbackInfo ci) {
|
||||
if (freecam.isEnabled())
|
||||
this.thirdPerson = true;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import com.llamalad7.mixinextras.injector.ModifyReceiver;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import me.retucio.camtweaks.event.events.ReceiveMessageEvent;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.ChatPlus;
|
||||
import me.retucio.camtweaks.module.modules.misc.ChatPlus;
|
||||
import me.retucio.camtweaks.util.interfaces.IChatHud;
|
||||
import me.retucio.camtweaks.util.interfaces.IChatHudLine;
|
||||
import me.retucio.camtweaks.util.interfaces.IChatHudLineVisible;
|
||||
import me.retucio.camtweaks.util.interfaces.IMessageHandler;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.ChatHud;
|
||||
import net.minecraft.client.gui.hud.ChatHudLine;
|
||||
import net.minecraft.client.gui.hud.MessageIndicator;
|
||||
@@ -61,6 +58,7 @@ public abstract class ChatHudMixin implements IChatHud {
|
||||
chatPlus = ModuleManager.INSTANCE.getModuleByClass(ChatPlus.class);
|
||||
}
|
||||
|
||||
|
||||
// métodos relacionados a las interfaces IChatHud, IChatHudLine, IChadHudLineVisible y IMessageHandler
|
||||
|
||||
@Override
|
||||
@@ -70,12 +68,12 @@ public abstract class ChatHudMixin implements IChatHud {
|
||||
nextId = 0;
|
||||
}
|
||||
|
||||
@Inject(method = "addVisibleMessage", at = @At(value = "INVOKE", target = "Ljava/util/List;add(ILjava/lang/Object;)V", shift = At.Shift.AFTER))
|
||||
@Inject(method = "addVisibleMessage", at = @At(value = "INVOKE", target = "Ljava/util/List;addFirst(Ljava/lang/Object;)V", shift = At.Shift.AFTER))
|
||||
private void onAddMessageAfterNewChatHudLineVisible(ChatHudLine message, CallbackInfo ci) {
|
||||
((IChatHudLine) (Object) visibleMessages.getFirst()).smegma$setId(nextId);
|
||||
}
|
||||
|
||||
@Inject(method = "addMessage(Lnet/minecraft/client/gui/hud/ChatHudLine;)V", at = @At(value = "INVOKE", target = "Ljava/util/List;add(ILjava/lang/Object;)V", shift = At.Shift.AFTER))
|
||||
@Inject(method = "addMessage(Lnet/minecraft/client/gui/hud/ChatHudLine;)V", at = @At(value = "INVOKE", target = "Ljava/util/List;addFirst(Ljava/lang/Object;)V", shift = At.Shift.AFTER))
|
||||
private void onAddMessageAfterNewChatHudLine(ChatHudLine message, CallbackInfo ci) {
|
||||
((IChatHudLine) (Object) messages.getFirst()).smegma$setId(nextId);
|
||||
}
|
||||
@@ -109,8 +107,8 @@ public abstract class ChatHudMixin implements IChatHud {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// modificar contenido del mensaje
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", cancellable = true)
|
||||
private void onAddMessage(Text message, MessageSignatureData signatureData, MessageIndicator indicator, CallbackInfo ci) {
|
||||
if (skipOnAddMessage) return;
|
||||
@@ -143,23 +141,11 @@ public abstract class ChatHudMixin implements IChatHud {
|
||||
|
||||
// cabezas
|
||||
|
||||
@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;ceil(F)I"))
|
||||
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/gui/hud/ChatHud$Backend;IIZ)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;ceil(F)I"))
|
||||
private int onRender_modifyWidth(int width) {
|
||||
return (chatPlus.isEnabled() && chatPlus.showHeads.isEnabled()) ? width + 10 : width;
|
||||
}
|
||||
|
||||
@ModifyReceiver(method = "method_71991", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/OrderedText;III)V"))
|
||||
private DrawContext onRender_beforeDrawTextWithShadow(DrawContext context, TextRenderer textRenderer, OrderedText text, int x, int y, int color, @Local(argsOnly = true) ChatHudLine.Visible line) {
|
||||
chatPlus.beforeDrawMessage(context, line, y, color);
|
||||
return context;
|
||||
}
|
||||
|
||||
@Inject(method = "method_71991", at = @At("TAIL"))
|
||||
private void onRender_afterDrawTextWithShadow(int i, DrawContext context, float f, int j, int k, int l, ChatHudLine.Visible visible, int m, float g, CallbackInfo info) {
|
||||
chatPlus.afterDrawMessage(context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// historial (registro) del chat
|
||||
|
||||
@@ -180,7 +166,7 @@ public abstract class ChatHudMixin implements IChatHud {
|
||||
chatPlus.lines.addFirst(list.size());
|
||||
}
|
||||
|
||||
@Inject(method = "addMessage(Lnet/minecraft/client/gui/hud/ChatHudLine;)V", at = @At(value = "INVOKE", target = "Ljava/util/List;remove(I)Ljava/lang/Object;"))
|
||||
@Inject(method = "addMessage(Lnet/minecraft/client/gui/hud/ChatHudLine;)V", at = @At(value = "INVOKE", target = "Ljava/util/List;removeLast()Ljava/lang/Object;"))
|
||||
private void onRemoveMessage(ChatHudLine message, CallbackInfo ci) {
|
||||
int extra = chatPlus.chatHistoryExtraLength.getIntValue();
|
||||
int size = chatPlus.lines.size();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.ChatPlus;
|
||||
import me.retucio.camtweaks.module.modules.misc.ChatPlus;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freecam;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.debug.ChunkBorderDebugRenderer;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.ChunkSectionPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
@Mixin(ChunkBorderDebugRenderer.class)
|
||||
@@ -21,14 +18,16 @@ public abstract class ChunkBorderDebugRendererMixin {
|
||||
@Shadow @Final
|
||||
private MinecraftClient client;
|
||||
|
||||
@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getChunkPos()Lnet/minecraft/util/math/ChunkPos;"))
|
||||
private ChunkPos getChunkPos(ChunkPos chunkPos) {
|
||||
@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/ChunkSectionPos;from(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/ChunkSectionPos;"))
|
||||
private ChunkSectionPos getChunkPos(ChunkSectionPos chunkPos) {
|
||||
Freecam freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
||||
if (!freecam.isEnabled()) return chunkPos;
|
||||
|
||||
float delta = client.getRenderTickCounter().getTickProgress(true);
|
||||
return new ChunkPos(
|
||||
return ChunkSectionPos.from(
|
||||
ChunkSectionPos.getSectionCoord(MathHelper.floor(freecam.getX(delta))),
|
||||
ChunkSectionPos.getSectionCoord(MathHelper.floor(freecam.getZ(delta))));
|
||||
ChunkSectionPos.getSectionCoord(MathHelper.floor(freecam.getY(delta))),
|
||||
ChunkSectionPos.getSectionCoord(MathHelper.floor(freecam.getZ(delta)))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.mixin.accessor.ConfirmServerResourcePackScreenAccessor;
|
||||
import me.retucio.camtweaks.mixin.accessor.PackAccessor;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.network.RPackBypass;
|
||||
import me.retucio.camtweaks.util.interfaces.IConfirmScreen;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.client.option.ServerList;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.packet.c2s.common.ResourcePackStatusC2SPacket;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@Mixin(ClientCommonNetworkHandler.class)
|
||||
public abstract class ClientCommonNetworkHandlerMixin {
|
||||
|
||||
@Shadow @Final protected MinecraftClient client;
|
||||
@Shadow @Final protected ServerInfo serverInfo;
|
||||
@Shadow @Final protected ClientConnection connection;
|
||||
|
||||
@Unique // tardar 3 segundos porque algunos servers detectar el tiempo entre que se acepta y se carga el pack
|
||||
private final Executor DELAYED_EXECUTOR = CompletableFuture.delayedExecutor(3L, TimeUnit.SECONDS);
|
||||
|
||||
@Inject(method = "createConfirmServerResourcePackScreen", at = @At("TAIL"))
|
||||
private void setScreenBypassAction(UUID id, URL url, String hash, boolean required, Text prompt, CallbackInfoReturnable<Screen> cir) {
|
||||
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
if (!bypassPack.isEnabled()) return;
|
||||
|
||||
final Screen screen = cir.getReturnValue();
|
||||
((IConfirmScreen) screen).smegma$setBypassAction(() -> {
|
||||
client.setScreen(((ConfirmServerResourcePackScreenAccessor) screen).getParentScreen());
|
||||
if (this.serverInfo != null) {
|
||||
this.serverInfo.setResourcePackPolicy(bypassPack.getPolicy());
|
||||
this.client.getServerResourcePackProvider().acceptAll();
|
||||
ServerList.updateServerListEntry(this.serverInfo);
|
||||
}
|
||||
bypass(((ConfirmServerResourcePackScreenAccessor) screen).getRequests().stream().map(PackAccessor::callId).toList());
|
||||
});
|
||||
}
|
||||
|
||||
@Unique
|
||||
public void bypass(List<UUID> ids) {
|
||||
ids.forEach(id -> connection.send(new ResourcePackStatusC2SPacket(id, ResourcePackStatusC2SPacket.Status.ACCEPTED)));
|
||||
ids.forEach(id -> connection.send(new ResourcePackStatusC2SPacket(id, ResourcePackStatusC2SPacket.Status.DOWNLOADED)));
|
||||
DELAYED_EXECUTOR.execute(() ->
|
||||
ids.forEach(id -> connection.send(new ResourcePackStatusC2SPacket(id, ResourcePackStatusC2SPacket.Status.SUCCESSFULLY_LOADED)))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||
|
||||
@Mixin(ClientConnection.class)
|
||||
public abstract class ClientConnectionMixin {
|
||||
@@ -46,7 +47,7 @@ public abstract class ClientConnectionMixin {
|
||||
|
||||
@Inject(method = "disconnect(Lnet/minecraft/network/DisconnectionInfo;)V", at = @At("HEAD"), cancellable = true)
|
||||
private void onDisconnect(DisconnectionInfo disconnectionInfo, CallbackInfo ci) {
|
||||
DisconnectEvent event = EVENT_BUS.post(new DisconnectEvent());
|
||||
DisconnectEvent event = EVENT_BUS.post(new DisconnectEvent(disconnectionInfo, mc.getCurrentServerEntry()));
|
||||
if (event.isCancelled()) ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,11 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import me.retucio.camtweaks.command.CommandManager;
|
||||
import me.retucio.camtweaks.event.events.SendMessageEvent;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.NoRender;
|
||||
import me.retucio.camtweaks.module.modules.render.NoRender;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
@@ -56,6 +55,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
|
||||
@Redirect(method = "onEntityStatus", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;showFloatingItem(Lnet/minecraft/item/ItemStack;)V"))
|
||||
private void noRenderTotemPop(GameRenderer instance, ItemStack floatingItem) {
|
||||
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||
if (!noRender.isEnabled() || noRender.totemPop.isEnabled()) mc.gameRenderer.showFloatingItem(Items.TOTEM_OF_UNDYING.getDefaultStack());
|
||||
if (!noRender.isEnabled() || noRender.totemPop.isEnabled())
|
||||
mc.gameRenderer.showFloatingItem(floatingItem);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,38 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.PortalGUI;
|
||||
import me.retucio.camtweaks.module.modules.world.NoMiningInterruptions;
|
||||
import me.retucio.camtweaks.module.modules.player.PortalGUI;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.util.hit.EntityHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
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;"))
|
||||
@ModifyExpressionValue(method = "tickNausea", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;", opcode = Opcodes.GETFIELD))
|
||||
private Screen allowScreensInPortals(Screen original) {
|
||||
if (ModuleManager.INSTANCE.getModuleByClass(PortalGUI.class).isEnabled()) return null;
|
||||
return original;
|
||||
}
|
||||
|
||||
@ModifyReturnValue(method = "getCrosshairTarget(FLnet/minecraft/entity/Entity;)Lnet/minecraft/util/hit/HitResult;", at = @At("RETURN"))
|
||||
private static HitResult onGetCrosshairTarget(HitResult original, @Local HitResult hitResult) {
|
||||
NoMiningInterruptions nmi = ModuleManager.INSTANCE.getModuleByClass(NoMiningInterruptions.class);
|
||||
if (original instanceof EntityHitResult ehr) {
|
||||
if (nmi.shouldIgnoreEntity(ehr.getEntity())
|
||||
&& hitResult.getType() == HitResult.Type.BLOCK) {
|
||||
return hitResult;
|
||||
}
|
||||
}
|
||||
|
||||
return original;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.event.events.AttackEntityEvent;
|
||||
import me.retucio.camtweaks.event.events.BreakBlockEvent;
|
||||
import me.retucio.camtweaks.event.events.InteractEntityEvent;
|
||||
import me.retucio.camtweaks.event.events.PlaceBlockEvent;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freecam;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
@@ -12,16 +16,24 @@ import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||
|
||||
@Mixin(ClientPlayerInteractionManager.class)
|
||||
public abstract class ClientPlayerInteractionManagerMixin {
|
||||
|
||||
@Shadow @Final
|
||||
private MinecraftClient client;
|
||||
|
||||
@Unique
|
||||
Freecam freecam;
|
||||
|
||||
@@ -30,19 +42,31 @@ public abstract class ClientPlayerInteractionManagerMixin {
|
||||
freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
||||
}
|
||||
|
||||
// los paquetes ya se cancelan en la clase de Freecam, pero visualmente el bloque sigue apareciendo roto
|
||||
|
||||
@Inject(method = "breakBlock", at = @At("HEAD"), cancellable = true)
|
||||
private void cancelBlockBreaking(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (freecam.isEnabled() && freecam.cancelActionPackets.isEnabled()) cir.setReturnValue(false);
|
||||
private void onBlockBreak(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
|
||||
BreakBlockEvent event = EVENT_BUS.post(new BreakBlockEvent(pos));
|
||||
if (event.isCancelled()) cir.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true)
|
||||
private void cancelBlockPlacement(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (freecam.isEnabled() && freecam.cancelActionPackets.isEnabled()) cir.setReturnValue(ActionResult.FAIL);
|
||||
private void onBlockPlace(ClientPlayerEntity player, Hand hand, BlockHitResult result, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (mc.player != player) return;
|
||||
PlaceBlockEvent event = EVENT_BUS.post(new PlaceBlockEvent(hand, result));
|
||||
if (event.isCancelled()) cir.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "interactEntity", at = @At("HEAD"), cancellable = true)
|
||||
private void cancelEntityInteractions(PlayerEntity player, Entity entity, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (freecam.isEnabled() && freecam.cancelActionPackets.isEnabled()) cir.setReturnValue(ActionResult.FAIL);
|
||||
private void onEntityInteract(PlayerEntity player, Entity entity, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (mc.player != player) return;
|
||||
InteractEntityEvent event = EVENT_BUS.post(new InteractEntityEvent(entity, hand));
|
||||
if (event.isCancelled()) cir.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "attackEntity", at = @At("HEAD"), cancellable = true)
|
||||
private void onAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) {
|
||||
if (mc.player != player) return;
|
||||
AttackEntityEvent event = EVENT_BUS.post(new AttackEntityEvent(target));
|
||||
if (event.isCancelled()) ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.event.events.camtweaks.AddEntityEvent;
|
||||
import me.retucio.camtweaks.event.events.camtweaks.RemoveEntityEvent;
|
||||
import me.retucio.camtweaks.event.events.AddEntityEvent;
|
||||
import me.retucio.camtweaks.event.events.RemoveEntityEvent;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -20,7 +20,7 @@ public abstract class ClientWorldMixin {
|
||||
public abstract Entity getEntityById(int id);
|
||||
|
||||
@Inject(method = "addEntity", at = @At("HEAD"))
|
||||
private void onEntityAdded(Entity entity, CallbackInfo ci) {
|
||||
private void onAddEntity(Entity entity, CallbackInfo ci) {
|
||||
if (entity != null) EVENT_BUS.post(new AddEntityEvent(entity));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.TimeChanger;
|
||||
import me.retucio.camtweaks.module.modules.world.TimeChanger;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.network.RPackBypass;
|
||||
import me.retucio.camtweaks.util.interfaces.IConfirmScreen;
|
||||
import net.minecraft.client.gui.screen.ConfirmScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.DirectionalLayoutWidget;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ConfirmScreen.class)
|
||||
public abstract class ConfirmScreenMixin extends Screen implements IConfirmScreen {
|
||||
|
||||
@Shadow protected DirectionalLayoutWidget layout;
|
||||
@Unique private Runnable bypassAction = null;
|
||||
|
||||
protected ConfirmScreenMixin(final Text title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ConfirmScreen;addButtons(Lnet/minecraft/client/gui/widget/DirectionalLayoutWidget;)V", shift = At.Shift.AFTER))
|
||||
protected void addBypassButton(CallbackInfo ci) {
|
||||
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
if (this.bypassAction != null && bypassPack.isEnabled())
|
||||
this.layout.add(ButtonWidget.builder(bypassPack.BYPASS_TEXT, $ -> this.bypassAction.run()).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void smegma$setBypassAction(Runnable bypass) {
|
||||
this.bypassAction = bypass;
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,13 @@ package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.CritsPlus;
|
||||
import me.retucio.camtweaks.module.modules.render.CritsPlus;
|
||||
import net.minecraft.client.particle.BillboardParticle;
|
||||
import net.minecraft.client.particle.DamageParticle;
|
||||
import net.minecraft.client.particle.ParticleTextureSheet;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@Mixin(DamageParticle.class)
|
||||
public abstract class DamageParticleMixin {
|
||||
|
||||
@@ -31,22 +28,13 @@ abstract class DamageParticleFactoryMixin {
|
||||
CritsPlus crits = ModuleManager.INSTANCE.getModuleByClass(CritsPlus.class);
|
||||
if (!crits.isEnabled()) return original;
|
||||
|
||||
if (crits.rainbow.isEnabled()) {
|
||||
float speed = 10001 - crits.rainbowSpeed.getFloatValue();
|
||||
float hue = (System.currentTimeMillis() % (int) speed) / speed;
|
||||
Color gamning = Color.getHSBColor(hue, 1, 1);
|
||||
original.setColor(
|
||||
gamning.getRed() / 255f,
|
||||
gamning.getGreen() / 255f,
|
||||
gamning.getBlue() / 255f);
|
||||
} else {
|
||||
original.setColor(
|
||||
crits.red.getFloatValue() / 255f,
|
||||
crits.green.getFloatValue() / 255f,
|
||||
crits.blue.getFloatValue() / 255f);
|
||||
}
|
||||
original.setColor(
|
||||
crits.color.getR() / 255f,
|
||||
crits.color.getG() / 255f,
|
||||
crits.color.getB() / 255f
|
||||
);
|
||||
|
||||
original.alpha = crits.alpha.getFloatValue() / 255f;
|
||||
original.alpha = crits.color.getA() / 255f;
|
||||
original.scale *= crits.scale.getFloatValue();
|
||||
original.velocityMultiplier *= crits.velocityMultipler.getFloatValue();
|
||||
original.gravityStrength *= crits.gravity.getFloatValue();
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.TimeChanger;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||
|
||||
@Mixin(DimensionType.class)
|
||||
public abstract class DimensionTypeMixin {
|
||||
|
||||
@ModifyReturnValue(method = "getMoonPhase", at = @At("RETURN"))
|
||||
private int overrideMoonPhase(int original) {
|
||||
TimeChanger timeChanger = ModuleManager.INSTANCE.getModuleByClass(TimeChanger.class);
|
||||
if (timeChanger.isEnabled() && mc.world != null && !timeChanger.moonPhase.is(TimeChanger.MoonPhases.DEFAULT))
|
||||
return timeChanger.getMoonPhase();
|
||||
return original;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.network.Reconnect;
|
||||
|
||||
import net.minecraft.client.gui.screen.DisconnectedScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.DirectionalLayoutWidget;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(DisconnectedScreen.class)
|
||||
public abstract class DisconnectedScreenMixin {
|
||||
|
||||
@Shadow @Final
|
||||
private DirectionalLayoutWidget grid;
|
||||
|
||||
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/DirectionalLayoutWidget;add(Lnet/minecraft/client/gui/widget/Widget;)Lnet/minecraft/client/gui/widget/Widget;", ordinal = 2, shift = At.Shift.AFTER))
|
||||
private void addReconnectButton(CallbackInfo ci) {
|
||||
Reconnect reconnect = ModuleManager.INSTANCE.getModuleByClass(Reconnect.class);
|
||||
if (reconnect == null || !reconnect.isEnabled()) return;
|
||||
|
||||
grid.add(ButtonWidget.builder(
|
||||
Text.literal("reconectarse"),
|
||||
button -> reconnect.reconnect()
|
||||
).build());
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import me.retucio.camtweaks.event.events.ChangeRotationEvent;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.AntiInvis;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.Freelook;
|
||||
import me.retucio.camtweaks.module.modules.Nametags;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freelook;
|
||||
import me.retucio.camtweaks.module.modules.camera.Rotations;
|
||||
import me.retucio.camtweaks.module.modules.misc.AntiInvis;
|
||||
import me.retucio.camtweaks.module.modules.render.Nametags;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.passive.TameableEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -21,25 +23,26 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
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.mc;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public abstract class EntityMixin {
|
||||
|
||||
@Shadow
|
||||
public abstract Text getName();
|
||||
@Shadow public abstract Text getName();
|
||||
@Shadow public abstract EntityType<?> getType();
|
||||
|
||||
@Shadow
|
||||
public abstract EntityType<?> getType();
|
||||
@Shadow private float yaw;
|
||||
@Shadow private float pitch;
|
||||
|
||||
@Unique
|
||||
Freecam freecam;
|
||||
|
||||
@Unique
|
||||
Freelook freelook;
|
||||
|
||||
@Unique
|
||||
Nametags nametags;
|
||||
@Unique
|
||||
Rotations rotations;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
@@ -47,6 +50,7 @@ public abstract class EntityMixin {
|
||||
freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
||||
freelook = ModuleManager.INSTANCE.getModuleByClass(Freelook.class);
|
||||
nametags = ModuleManager.INSTANCE.getModuleByClass(Nametags.class);
|
||||
rotations = ModuleManager.INSTANCE.getModuleByClass(Rotations.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,10 +66,10 @@ public abstract class EntityMixin {
|
||||
ci.cancel();
|
||||
|
||||
} else if (freelook.isEnabled() && freelook.mode.is(Freelook.CameraMode.CAMERA)) {
|
||||
freelook.setYaw(freelook.getYaw() + (float) (cursorDeltaX / freelook.mouseSens.getFloatValue()));
|
||||
freelook.setPitch(freelook.getPitch() + (float) (cursorDeltaY / freelook.mouseSens.getFloatValue()));
|
||||
freelook.setYaw(freelook.getYaw() + (float) (cursorDeltaX * freelook.mouseSens.getFloatValue()));
|
||||
freelook.setPitch(freelook.getPitch() + (float) (cursorDeltaY * freelook.mouseSens.getFloatValue()));
|
||||
|
||||
if (Math.abs(freelook.getPitch()) > 90.0F) freelook.setPitch(freelook.getPitch() > 0 ? 90 : -90);
|
||||
if (Math.abs(freelook.getPitch()) > 90) freelook.setPitch(freelook.getPitch() > 0 ? 90 : -90);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -115,6 +119,30 @@ public abstract class EntityMixin {
|
||||
}
|
||||
|
||||
|
||||
// rotaciones
|
||||
|
||||
@Inject(method = "setRotation", at = @At("HEAD"), cancellable = true)
|
||||
private void onRotation(float yaw, float pitch, CallbackInfo ci) {
|
||||
if ((Object) this != mc.player) return;
|
||||
ChangeRotationEvent event = EVENT_BUS.post(new ChangeRotationEvent(yaw, pitch));
|
||||
if (event.isCancelled()) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "setYaw", at = @At("HEAD"), cancellable = true)
|
||||
private void onChangeYaw(float yaw, CallbackInfo ci) {
|
||||
if ((Object) this != mc.player) return;
|
||||
ChangeRotationEvent event = EVENT_BUS.post(new ChangeRotationEvent(yaw, this.pitch));
|
||||
if (event.isCancelled()) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "setPitch", at = @At("HEAD"), cancellable = true)
|
||||
private void onChangePitch(float pitch, CallbackInfo ci) {
|
||||
if ((Object) this != mc.player) return;
|
||||
ChangeRotationEvent event = EVENT_BUS.post(new ChangeRotationEvent(this.yaw, pitch));
|
||||
if (event.isCancelled()) ci.cancel();
|
||||
}
|
||||
|
||||
|
||||
// otros
|
||||
|
||||
@Inject(method = "isInvisibleTo", at = @At("RETURN"), cancellable = true)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.render.GlintPlus;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.entity.equipment.EquipmentRenderer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(EquipmentRenderer.class)
|
||||
public abstract class EquipmentRendererMixin {
|
||||
|
||||
@Redirect(method = "render(Lnet/minecraft/client/render/entity/equipment/EquipmentModel$LayerType;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;ILnet/minecraft/util/Identifier;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayers;armorEntityGlint()Lnet/minecraft/client/render/RenderLayer;"))
|
||||
private RenderLayer redirectArmorEntityGlint() {
|
||||
GlintPlus glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
||||
return glintPlus.getArmorEntityGlint();
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ 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.modules.NoRender;
|
||||
import me.retucio.camtweaks.module.modules.render.NoRender;
|
||||
import net.minecraft.block.enums.CameraSubmersionType;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.client.render.fog.FogModifier;
|
||||
@@ -28,7 +28,7 @@ public abstract class FogRendererMixin {
|
||||
noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||
}
|
||||
|
||||
@Redirect(method = "applyFog(Lnet/minecraft/client/render/Camera;IZLnet/minecraft/client/render/RenderTickCounter;FLnet/minecraft/client/world/ClientWorld;)Lorg/joml/Vector4f;", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/fog/FogModifier;shouldApply(Lnet/minecraft/block/enums/CameraSubmersionType;Lnet/minecraft/entity/Entity;)Z"))
|
||||
@Redirect(method = "applyFog(Lnet/minecraft/client/render/Camera;ILnet/minecraft/client/render/RenderTickCounter;FLnet/minecraft/client/world/ClientWorld;)Lorg/joml/Vector4f;", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/fog/FogModifier;shouldApply(Lnet/minecraft/block/enums/CameraSubmersionType;Lnet/minecraft/entity/Entity;)Z"))
|
||||
private boolean noRenderFogs(FogModifier instance, CameraSubmersionType cameraSubmersionType, Entity entity) {
|
||||
if (!noRender.isEnabled()) return instance.shouldApply(cameraSubmersionType, entity);
|
||||
String className = instance.getClass().getSimpleName();
|
||||
@@ -36,8 +36,7 @@ public abstract class FogRendererMixin {
|
||||
if ((className.equals("BlindnessEffectFogModifier") && !noRender.blindnessEffect.isEnabled())
|
||||
|| (className.equals("DarknessEffectFogModifier") && !noRender.darknessEffect.isEnabled())
|
||||
|| ((className.equals("LavaFogModifier") || className.equals("WaterFogModifier")
|
||||
|| className.equals("PowederSnowFogModifier")) && !noRender.fluidOverlay.isEnabled())
|
||||
|| (className.equals("DimensionOrBossFogModifier") && !noRender.dimensionFog.isEnabled()))
|
||||
|| className.equals("PowederSnowFogModifier")) && !noRender.fluidOverlay.isEnabled()))
|
||||
return false;
|
||||
|
||||
return instance.shouldApply(cameraSubmersionType, entity);
|
||||
|
||||
@@ -2,7 +2,7 @@ package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.event.events.PerspectiveChangeEvent;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freecam;
|
||||
import net.minecraft.client.option.GameOptions;
|
||||
import net.minecraft.client.option.Perspective;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@@ -3,9 +3,9 @@ package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.event.events.GetFOVEvent;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.NoRender;
|
||||
import me.retucio.camtweaks.module.modules.Zoom;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.render.NoRender;
|
||||
import me.retucio.camtweaks.module.modules.camera.Zoom;
|
||||
import me.retucio.camtweaks.util.interfaces.IVec3d;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.network.BungeecordSpoofer;
|
||||
import net.minecraft.network.packet.c2s.handshake.ConnectionIntent;
|
||||
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||
|
||||
@Mixin(HandshakeC2SPacket.class)
|
||||
public abstract class HandshakeC2SPacketMixin {
|
||||
|
||||
@Shadow @Mutable @Final
|
||||
private String address;
|
||||
|
||||
@Unique
|
||||
private final Gson gson = new Gson();
|
||||
|
||||
@Unique
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
@Shadow
|
||||
public abstract ConnectionIntent intendedState();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Inject(method = "<init>(ILjava/lang/String;ILnet/minecraft/network/packet/c2s/handshake/ConnectionIntent;)V", at = @At("RETURN"))
|
||||
private void onHandshakeC2SPacket(int i, String string, int j, ConnectionIntent connectionIntent, CallbackInfo ci) {
|
||||
BungeecordSpoofer spoofer = ModuleManager.INSTANCE.getModuleByClass(BungeecordSpoofer.class);
|
||||
if (!spoofer.isEnabled()) return;
|
||||
|
||||
if (this.intendedState() != ConnectionIntent.LOGIN) return;
|
||||
|
||||
final String[] spoofedUUID = {CameraTweaks.mc.getSession().getUuidOrNull().toString()};
|
||||
String URL = "https://api.mojang.com/users/profiles/minecraft/" + mc.getSession().getUsername();
|
||||
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
HttpURLConnection req = (HttpURLConnection) new URL(URL).openConnection();
|
||||
req.setRequestMethod("GET");
|
||||
req.setConnectTimeout(5000);
|
||||
req.setReadTimeout(5000);
|
||||
|
||||
if (req.getResponseCode() != 200) {
|
||||
this.address += "\u0000" + spoofer.address.getValue() + "\u0000" + spoofedUUID[0];
|
||||
return;
|
||||
}
|
||||
|
||||
JsonObject obj = JsonParser.parseReader(new InputStreamReader(req.getInputStream())).getAsJsonObject();
|
||||
|
||||
if (obj.has("id"))
|
||||
spoofedUUID[0] = obj.get("id").getAsString();
|
||||
|
||||
this.address += "\u0000" + spoofer.address.getValue() + "\u0000" + spoofedUUID[0];
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
this.address += "\u0000" + spoofer.address.getValue() + "\u0000" + spoofedUUID[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,15 +4,13 @@ import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import me.retucio.camtweaks.event.events.RenderHeldItemEvent;
|
||||
import me.retucio.camtweaks.event.events.RenderArmEvent;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.HandView;
|
||||
import me.retucio.camtweaks.module.modules.player.HandView;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.item.ItemModelManager;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
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.ItemRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -50,7 +48,7 @@ public abstract class HeldItemRendererMixin {
|
||||
protected abstract boolean shouldSkipHandAnimationOnSwap(ItemStack from, ItemStack to);
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
private void getModules(MinecraftClient client, EntityRenderManager entityRenderDispatcher, ItemRenderer itemRenderer, ItemModelManager itemModelManager, CallbackInfo ci) {
|
||||
private void getModules(MinecraftClient client, EntityRenderManager entityRenderDispatcher, ItemModelManager itemModelManager, CallbackInfo ci) {
|
||||
handView = ModuleManager.INSTANCE.getModuleByClass(HandView.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.ChatPlus;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.NoRender;
|
||||
import me.retucio.camtweaks.ui.HudRenderer;
|
||||
import me.retucio.camtweaks.module.modules.misc.ChatPlus;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.render.NoRender;
|
||||
import me.retucio.camtweaks.ui.hud.HudRenderer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.NoRender;
|
||||
import me.retucio.camtweaks.module.modules.render.NoRender;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.hud.InGameOverlayRenderer;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
|
||||
@@ -2,7 +2,7 @@ package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Nametags;
|
||||
import me.retucio.camtweaks.module.modules.render.Nametags;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.MutableText;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.misc.ShulkerPeek;
|
||||
import net.minecraft.block.ShulkerBoxBlock;
|
||||
import net.minecraft.component.type.TooltipDisplayComponent;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.tooltip.TooltipType;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mixin(Item.class)
|
||||
public abstract class ItemMixin {
|
||||
|
||||
@Inject(method = "appendTooltip", at = @At("HEAD"))
|
||||
private void onAppendTooltip(ItemStack stack, Item.TooltipContext context, TooltipDisplayComponent displayComponent, Consumer<Text> textConsumer, TooltipType type, CallbackInfo ci) {
|
||||
ShulkerPeek shulkerPeek = ModuleManager.INSTANCE.getModuleByClass(ShulkerPeek.class);
|
||||
if (!shulkerPeek.isEnabled() || !shulkerPeek.showTooltips.isEnabled()) return;
|
||||
|
||||
if (stack.getItem() instanceof BlockItem blockItem && blockItem.getBlock() instanceof ShulkerBoxBlock) {
|
||||
if (ShulkerPeek.isShulkerEmpty(stack)) {
|
||||
textConsumer.accept(Text.literal("vacío").formatted(Formatting.GRAY, Formatting.ITALIC));
|
||||
} else {
|
||||
textConsumer.accept(
|
||||
Text.literal("mantén ")
|
||||
.append(Text.literal(shulkerPeek.previewKey.getKeyName())
|
||||
.formatted(Formatting.GOLD, Formatting.BOLD))
|
||||
.append(" para previsualizar")
|
||||
.formatted(Formatting.GRAY)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.render.GlintPlus;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ItemRenderer.class)
|
||||
public abstract class ItemRendererMixin {
|
||||
|
||||
@Unique
|
||||
private static GlintPlus glintPlus;
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
private void getModules(CallbackInfo ci) {
|
||||
glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
||||
}
|
||||
|
||||
@Redirect(method = "getItemGlintConsumer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayers;glint()Lnet/minecraft/client/render/RenderLayer;"))
|
||||
private static RenderLayer getGlint() {
|
||||
return glintPlus.getGlint();
|
||||
}
|
||||
|
||||
@Redirect(method = "getItemGlintConsumer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayers;entityGlint()Lnet/minecraft/client/render/RenderLayer;"))
|
||||
private static RenderLayer getEntityGlint() {
|
||||
return glintPlus.getEntityGlint();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.event.events.DamageItemEvent;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||
|
||||
@Mixin(ItemStack.class)
|
||||
public abstract class ItemStackMixin {
|
||||
|
||||
@Shadow
|
||||
public abstract int getDamage();
|
||||
|
||||
@Inject(method = "onDurabilityChange", at = @At("TAIL"))
|
||||
private void onDamage(int damage, ServerPlayerEntity player, Consumer<Item> breakCallback, CallbackInfo ci) {
|
||||
ItemStack stack = (ItemStack) (Object) this;
|
||||
EVENT_BUS.post(new DamageItemEvent(getDamage(), stack));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freecam;
|
||||
import net.minecraft.client.input.Input;
|
||||
import net.minecraft.client.input.KeyboardInput;
|
||||
import net.minecraft.util.PlayerInput;
|
||||
|
||||
@@ -2,6 +2,7 @@ package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.event.events.KeyEvent;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import net.minecraft.client.Keyboard;
|
||||
import net.minecraft.client.input.KeyInput;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -16,8 +17,8 @@ public abstract class KeyboardMixin {
|
||||
|
||||
@Inject(method = "onKey", at = @At("HEAD"), cancellable = true)
|
||||
private void onKeyPress(long window, int action, KeyInput input, CallbackInfo ci) {
|
||||
if (input.key() == -1) return;
|
||||
CameraTweaks.INSTANCE.onKeyPress(input.key(), action);
|
||||
|
||||
KeyEvent event = EVENT_BUS.post(new KeyEvent(input.key(), input.scancode(), action));
|
||||
if (event.isCancelled()) ci.cancel();
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@ import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.textures.GpuTexture;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Fullbright;
|
||||
import me.retucio.camtweaks.module.modules.camera.Fullbright;
|
||||
import me.retucio.camtweaks.module.modules.render.NoRender;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.render.LightmapTextureManager;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@@ -17,6 +19,7 @@ import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(LightmapTextureManager.class)
|
||||
public abstract class LightmapTextureManagerMixin {
|
||||
@@ -24,25 +27,34 @@ public abstract class LightmapTextureManagerMixin {
|
||||
@Unique
|
||||
Fullbright fullbright;
|
||||
|
||||
@Unique
|
||||
NoRender noRender;
|
||||
|
||||
@Shadow @Final
|
||||
private GpuTexture glTexture;
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
private void getModules(GameRenderer renderer, MinecraftClient client, CallbackInfo ci) {
|
||||
fullbright = ModuleManager.INSTANCE.getModuleByClass(Fullbright.class);
|
||||
noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||
}
|
||||
|
||||
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||
private void update(float tickProgress, CallbackInfo ci, @Local Profiler profiler) {
|
||||
if (fullbright.isEnabled() && fullbright.mode.is(Fullbright.Modes.GAMMA)) {
|
||||
RenderSystem.getDevice().createCommandEncoder().clearColorTexture(glTexture, ColorHelper.getArgb(
|
||||
fullbright.alpha.getIntValue(),
|
||||
fullbright.red.getIntValue(),
|
||||
fullbright.green.getIntValue(),
|
||||
fullbright.blue.getIntValue()
|
||||
fullbright.color.getA(),
|
||||
fullbright.color.getR(),
|
||||
fullbright.color.getG(),
|
||||
fullbright.color.getB()
|
||||
));
|
||||
profiler.pop();
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getDarkness", at = @At("HEAD"), cancellable = true)
|
||||
private void noRenderDarkness(LivingEntity entity, float factor, float tickProgress, CallbackInfoReturnable<Float> cir) {
|
||||
if (noRender.isEnabled() && !noRender.darknessEffect.isEnabled()) cir.setReturnValue(0f);
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.Nametags;
|
||||
import me.retucio.camtweaks.module.modules.camera.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.render.Nametags;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
|
||||
@@ -1,23 +1,35 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.event.JoinWorldEvent;
|
||||
import me.retucio.camtweaks.event.events.OpenScreenEvent;
|
||||
import me.retucio.camtweaks.event.events.ShutdownEvent;
|
||||
import me.retucio.camtweaks.event.events.TickEvent;
|
||||
import me.retucio.camtweaks.event.events.UseItemEvent;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.player.FastUse;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public abstract class MinecraftClientMixin {
|
||||
|
||||
@Shadow
|
||||
private int itemUseCooldown;
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"))
|
||||
private void onTickPre(CallbackInfo ci) {
|
||||
CameraTweaks.INSTANCE.onTick();
|
||||
@@ -44,4 +56,24 @@ public abstract class MinecraftClientMixin {
|
||||
private void disableMicropenisTelemetryShi(CallbackInfoReturnable<Boolean> cir) {
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
|
||||
@Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;"), cancellable = true)
|
||||
private void onUseItem(CallbackInfo ci, @Local Hand hand) {
|
||||
if (mc.player == null) return;
|
||||
UseItemEvent event = EVENT_BUS.post(new UseItemEvent(mc.player.getStackInHand(hand), hand));
|
||||
if (event.isCancelled()) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isItemEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z"))
|
||||
private void modifyItemUseCooldown(CallbackInfo ci, @Local ItemStack stack) {
|
||||
FastUse fastUse = ModuleManager.INSTANCE.getModuleByClass(FastUse.class);
|
||||
if (!fastUse.isEnabled()) return;
|
||||
itemUseCooldown = fastUse.getCooldown(stack);
|
||||
}
|
||||
|
||||
@Inject(method = "joinWorld", at = @At("HEAD"), cancellable = true)
|
||||
private void onJoinWorld(ClientWorld world, CallbackInfo ci) {
|
||||
JoinWorldEvent event = EVENT_BUS.post(new JoinWorldEvent(world));
|
||||
if (event.isCancelled()) ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.DamageOverlay;
|
||||
import me.retucio.camtweaks.module.modules.render.DamageOverlay;
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.NoRender;
|
||||
import me.retucio.camtweaks.module.modules.render.NoRender;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.particle.ParticleEffect;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.event.events.ClipAtLedgeEvent;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Nametags;
|
||||
import me.retucio.camtweaks.module.modules.render.Nametags;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -11,6 +13,8 @@ import net.minecraft.util.Formatting;
|
||||
import net.minecraft.world.World;
|
||||
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(PlayerEntity.class)
|
||||
public abstract class PlayerEntityMixin extends LivingEntity {
|
||||
@@ -49,4 +53,11 @@ public abstract class PlayerEntityMixin extends LivingEntity {
|
||||
|
||||
return original.copy().append(text);
|
||||
}
|
||||
|
||||
@Inject(method = "clipAtLedge", at = @At("HEAD"), cancellable = true)
|
||||
private void clipAtLedge(CallbackInfoReturnable<Boolean> cir) {
|
||||
if (!getEntityWorld().isClient()) return;
|
||||
ClipAtLedgeEvent event = CameraTweaks.EVENT_BUS.post(new ClipAtLedgeEvent(isSneaking()));
|
||||
cir.setReturnValue(event.isClipping());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.network.RPackBypass;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Mixin(ServerInfo.ResourcePackPolicy.class)
|
||||
public abstract class ResourcePackPolicyMixin {
|
||||
|
||||
@Unique
|
||||
private static ServerInfo.ResourcePackPolicy BYPASS;
|
||||
|
||||
@Invoker("<init>")
|
||||
public static ServerInfo.ResourcePackPolicy init(final String enumName, final int enumOrdinal, final String name) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Inject(method = "values", at = @At("TAIL"), cancellable = true)
|
||||
private static void addVariant(CallbackInfoReturnable<ServerInfo.ResourcePackPolicy[]> cir) {
|
||||
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
if (!bypassPack.isEnabled()) return;
|
||||
|
||||
ServerInfo.ResourcePackPolicy[] values = cir.getReturnValue();
|
||||
final int ordinal = values.length;
|
||||
cir.setReturnValue(values = Arrays.copyOfRange(values, 0, ordinal + 1));
|
||||
values[ordinal] = BYPASS = init(bypassPack.ENUM_NAME, ordinal, "bypass");
|
||||
}
|
||||
|
||||
@Inject(method = "getName", at = @At("HEAD"), cancellable = true)
|
||||
private void addToGetName(final CallbackInfoReturnable<Text> cir) {
|
||||
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
if (BYPASS == (Object) this && bypassPack.isEnabled())
|
||||
cir.setReturnValue(bypassPack.BYPASS_TEXT);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,11 @@ package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import me.retucio.camtweaks.command.CommandManager;
|
||||
import me.retucio.camtweaks.config.ConfigManager;
|
||||
import me.retucio.camtweaks.event.events.ClientClickEvent;
|
||||
import me.retucio.camtweaks.ui.widgets.frames.settings.ClientSettingsFrame;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.ClickEvent;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -11,6 +14,8 @@ 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(Screen.class)
|
||||
public class ScreenMixin {
|
||||
|
||||
@@ -19,4 +24,15 @@ public class ScreenMixin {
|
||||
if (clickEvent instanceof ClientClickEvent event && event.getValue().startsWith(CommandManager.INSTANCE.getPrefix()))
|
||||
CommandManager.dispatch(event.getValue().substring(CommandManager.INSTANCE.getPrefix().length()));
|
||||
}
|
||||
|
||||
@Inject(method = "render", at = @At("HEAD"))
|
||||
private void renderWatermark(DrawContext context, int mouseX, int mouseY, float deltaTicks, CallbackInfo ci) {
|
||||
if (!ConfigManager.hasLoaded()) return; // para evitar dibujar la marca de agua por defecto
|
||||
String watermark = ClientSettingsFrame.guiSettings.watermark.getValue();
|
||||
if (watermark == null || watermark.isEmpty()) return;
|
||||
context.drawText(mc.textRenderer, watermark,
|
||||
mc.getWindow().getScaledWidth() - mc.textRenderer.getWidth(watermark) - 2, 2,
|
||||
ClientSettingsFrame.guiSettings.color.getRGB(), false
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.ScreenshotPlus;
|
||||
import me.retucio.camtweaks.module.modules.misc.ScreenshotPlus;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.util.ScreenshotRecorder;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.network.RPackBypass;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.client.resource.server.ServerResourcePackManager;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.gui.screen.multiplayer.ConnectScreen$1")
|
||||
public abstract class ServerConnectorMixin {
|
||||
|
||||
@Inject(method = "toAcceptanceStatus", at = @At("HEAD"), cancellable = true)
|
||||
private static void guardSwitchCase(ServerInfo.ResourcePackPolicy policy, CallbackInfoReturnable<ServerResourcePackManager.AcceptanceStatus> cir) {
|
||||
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
if (!bypassPack.isEnabled()) return;
|
||||
if (policy == bypassPack.getPolicy())
|
||||
cir.setReturnValue(ServerResourcePackManager.AcceptanceStatus.ALLOWED);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 271 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user