Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e44dda9cf | ||
|
|
2329476fe4 |
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/
|
||||
+16
-20
@@ -1,35 +1,31 @@
|
||||
# v1.7
|
||||
|
||||
> al parecer me he saltado la versión 1.6, y la llamé 1.7, o sea que esta será 1.7.1 en el commit y a tomar por culo la 1.6
|
||||
# v1.9
|
||||
|
||||
## novedades
|
||||
|
||||
- se ha cambiado el icono a uno más "family friendly"
|
||||
|
||||
### adiciones
|
||||
|
||||
- opción para agregar un pequeño tooltip a los shulkers (prev. de shulkers)
|
||||
- marca de agua para interfaces opcional y customizable
|
||||
- opción para desactivar flashes del end de norender. aún se cambia el nivel de luz porque eso se maneja server-side
|
||||
- tipo de ajuste específico para colores (el selector está muy roto, ya lo arreglaré)
|
||||
- comando para espectar a jugadores o entidades (`$spec`)
|
||||
|
||||
#### módulos nuevos:
|
||||
|
||||
- attribute-swapper: automatiza el attribute swapping (aplicar propiedades de una herramienta a otra al intercambiar y usar una al mismo tiempo)
|
||||
- autocartel: te permite colocar carteles con un texto preconfigurado sin tener que abrir la interfaz de cada uno
|
||||
- bungeecord spoofer: (no funciona bien (todavía)) te permite conectarte a un servidor backend de un server con bungeecord mal configurado y manipular tu UUID mediante un proxy
|
||||
- carteles gays: te permite agregar formato a los carteles mediante un símbolo a elegir que será reemplazado por el símbolo de formato de Minecraft (§)
|
||||
- headhitters: establece jumpingCooldown como 0 siempre para que puedas mantener espacio en vez de espamearlo, para hacer headhitters (espamear espacio al estar bajo bloques para avanzar más rápido)
|
||||
- minar sin interrupción: te permite ignorar entidades al minar y romper bloques a través de ellas
|
||||
- precoz: reduce el cooldown de algunas cosas como colocar bloques o usar items al valor deseado
|
||||
- rotaciones: te permite forzar una rotación específica del lado del cliente y del servidor
|
||||
- reconectar: añade un botón para reconectarse a un servidor tras ser desconectado
|
||||
- superposición de luz: te muestra en qué bloques pueden spawnear bichos
|
||||
- yunques con pluma: te permite utilizar tipografías distintas al renombrar items en un yunque (a falta de formato)
|
||||
|
||||
### arreglos / mejoras
|
||||
|
||||
- ya no se activan / desactivan los módulos sin tecla asignada al subir y bajar el volumen (era porque tenía el número de tecla -1 que se usa también para cuando no hay una tecla)
|
||||
- arreglado el freecam y su opción de cancelar paquetes
|
||||
- arreglada la sensibilidad de perspectiva libre
|
||||
- otros cambios irrelevantes al público general (hablo como si más de una persona usase el mod)
|
||||
- ya no se marcan como jugadores desconectados aquellos que abandonan la distancia de renderizado
|
||||
- aviso de baja dur. ya funciona en servers de paper
|
||||
- ahora puedes filtrar módulos también mediante la barra de búsqueda, además de que esta ahora funciona y tal
|
||||
- los ajustes cuya visibilidad dependía de otros ajustes ahora se muestran correctamente
|
||||
- ahora la posición de la barra de búsqueda es guardada en el config
|
||||
- ya no te sigues moviendo en el freecam al estar moviéndote, abrir una interfaz y soltar las teclas de movimiento
|
||||
- elemento del hud que muestra el ping en milisegundos (a veces no va)
|
||||
- ya no se dibujan los tooltips de ajustes del marco de ajustes del mod si no está extendido
|
||||
- el problema donde se restablecían las teclas a las de por defecto en módulos cuyas teclas ya estaban establecidas tras cada relaunch se ha solucionado
|
||||
- puntos de desconexión ahora funciona y todo (gracias Meteor)
|
||||
- alguna que otra cosilla más, supongo
|
||||
|
||||
## problemas reconocidos
|
||||
|
||||
|
||||
+3
-1
@@ -4,6 +4,8 @@ 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 :)
|
||||
+1
-1
@@ -6,7 +6,7 @@ yarn_mappings=1.21.10+build.2
|
||||
loader_version=0.17.3
|
||||
loom_version=1.11-SNAPSHOT
|
||||
|
||||
mod_version=1.7
|
||||
mod_version=1.9
|
||||
maven_group=me.retucio
|
||||
archives_base_name=camtweaks
|
||||
|
||||
|
||||
@@ -77,11 +77,13 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
System.setProperty("java.awt.headless", "false");
|
||||
|
||||
mc = MinecraftClient.getInstance();
|
||||
ConfigManager.load();
|
||||
|
||||
EVENT_BUS.register(this);
|
||||
EVENT_BUS.register(new HudRenderer());
|
||||
|
||||
EVENT_BUS.register(MiscUtil.class);
|
||||
EVENT_BUS.register(ChatUtil.class);
|
||||
EVENT_BUS.register(HudRenderer.class);
|
||||
|
||||
Lists.init();
|
||||
|
||||
@@ -95,8 +97,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());
|
||||
@@ -105,14 +105,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,6 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
// 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;
|
||||
|
||||
// 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
|
||||
@@ -188,8 +187,12 @@ 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) return;
|
||||
if (!hud.isEnabled()) {
|
||||
ChatUtil.warn("HUD está desactivado, lumbreras");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mc.currentScreen != HudEditorScreen.INSTANCE) {
|
||||
prevScreen = mc.currentScreen;
|
||||
|
||||
@@ -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,16 +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.MiscUtil;
|
||||
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 = MiscUtil.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 +
|
||||
|
||||
@@ -1,37 +1,59 @@
|
||||
package me.retucio.camtweaks.command.commands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.command.Command;
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.DisconnectEvent;
|
||||
import me.retucio.camtweaks.event.events.OpenScreenEvent;
|
||||
import me.retucio.camtweaks.event.events.PacketEvent;
|
||||
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.MiscUtil;
|
||||
import net.minecraft.client.gui.screen.ingame.GenericContainerScreen;
|
||||
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.network.packet.s2c.play.CloseScreenS2CPacket;
|
||||
import net.minecraft.screen.GenericContainerScreenHandler;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
|
||||
// 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 (MiscUtil.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 (MiscUtil.getEchestInv() != null)
|
||||
mc.setScreen(new PreviewScreen(MiscUtil.getEchestInv(), null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,14 @@ import net.minecraft.text.Text;
|
||||
public class GarbageCleanerCommand extends Command {
|
||||
|
||||
public GarbageCleanerCommand() {
|
||||
super("cleanram", "limpia la ram mediante el recolector de basura (gc)", "gc", "garbagecollect");
|
||||
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("ram limpiada"));
|
||||
ChatUtil.info(Text.of("basura recolectada"));
|
||||
return SUCCESS;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
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.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 = MiscUtil.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);
|
||||
}
|
||||
@@ -55,6 +58,7 @@ public class ClientConfig {
|
||||
case NumberSetting n: value = n.getValue(); break;
|
||||
case StringSetting s: value = s.getValue(); break;
|
||||
case ListSetting l: value = l.getValues(); break;
|
||||
case ColorSetting c: value = c.getConfigValue(); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ 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;
|
||||
|
||||
@@ -71,6 +72,11 @@ public class ConfigManager {
|
||||
}
|
||||
});
|
||||
|
||||
if (config.searchBarPosition != null && config.searchBarPosition.length == 2) {
|
||||
ClickGUI.INSTANCE.getSearchBar().setX(config.searchBarPosition[0]);
|
||||
ClickGUI.INSTANCE.getSearchBar().setY(config.searchBarPosition[1]);
|
||||
}
|
||||
|
||||
ClientSettingsFrame.guiSettings.setEnabled(true);
|
||||
ClientSettingsFrame.guiSettings.getSettings().forEach(setting -> applySetting(ClientSettingsFrame.guiSettings, setting));
|
||||
|
||||
@@ -93,6 +99,8 @@ public class ConfigManager {
|
||||
|
||||
CameraTweaks.LOGGER.info("posiciones de frames cargadas");
|
||||
ClickGUI.INSTANCE.refreshListButtons();
|
||||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
public static ClientConfig getConfig() {
|
||||
@@ -135,6 +143,12 @@ public class ConfigManager {
|
||||
save();
|
||||
}
|
||||
|
||||
public static void setSearchBarPosition(int x, int y) {
|
||||
ensureConfig();
|
||||
config.searchBarPosition = new int[]{x, y};
|
||||
save();
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static void applySetting(Module parent, AbstractSetting setting) {
|
||||
@@ -158,7 +172,27 @@ public class ConfigManager {
|
||||
}
|
||||
l.setValues(converted);
|
||||
}
|
||||
} default -> {}
|
||||
} case ColorSetting c -> {
|
||||
if (value instanceof Map<?, ?> map) {
|
||||
Number r = (Number) map.get("r");
|
||||
Number g = (Number) map.get("g");
|
||||
Number b = (Number) map.get("b");
|
||||
Number a = (Number) map.get("a");
|
||||
Boolean rainbow = (Boolean) map.get("rb");
|
||||
Number rainbowSpeed = (Number) map.get("rs");
|
||||
Number saturation = (Number) map.get("sat");
|
||||
Number brightness = (Number) map.get("bri");
|
||||
|
||||
if (r != null && g != null && b != null && a != null)
|
||||
c.setRGB(r.intValue(), g.intValue(), b.intValue(), a.intValue());
|
||||
|
||||
if (rainbow != null) c.setRainbow(rainbow);
|
||||
if (rainbowSpeed != null) c.setRainbowSpeed(rainbowSpeed.intValue());
|
||||
if (saturation != null) c.setSaturation(saturation.floatValue());
|
||||
if (brightness != null) c.setBrightness(brightness.floatValue());
|
||||
}
|
||||
}
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,4 +200,8 @@ public class ConfigManager {
|
||||
private static void ensureConfig() {
|
||||
if (config == null) config = new ClientConfig();
|
||||
}
|
||||
|
||||
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) {}
|
||||
|
||||
+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;
|
||||
@@ -3,6 +3,10 @@ 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;
|
||||
|
||||
@@ -3,6 +3,10 @@ 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;
|
||||
|
||||
@@ -2,6 +2,12 @@ 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;
|
||||
|
||||
@@ -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 {}
|
||||
@@ -2,10 +2,10 @@ package me.retucio.camtweaks.event.events;
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
public class ClientClickEvent implements ClickEvent {
|
||||
|
||||
private final String value;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ItemStackMixin#onDamage
|
||||
*/
|
||||
public class DamageItemEvent extends Event {
|
||||
|
||||
private final int amount;
|
||||
private final ItemStack stack;
|
||||
|
||||
public DamageItemEvent(int amount, ItemStack stack) {
|
||||
this.amount = amount;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,28 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
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;
|
||||
|
||||
@@ -2,9 +2,12 @@ package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientPlayerInteractionManagerMixin#onEntityInteract
|
||||
*/
|
||||
public class InteractEntityEvent extends Event {
|
||||
|
||||
private final Entity entity;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4,12 +4,12 @@ import me.retucio.camtweaks.event.Event;
|
||||
import me.retucio.camtweaks.event.Stage;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
|
||||
|
||||
/**
|
||||
* @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;
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.util.ActionResult;
|
||||
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;
|
||||
|
||||
@@ -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 {}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,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
|
||||
@@ -109,8 +110,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;
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.mixin.accessor.ConfirmServerResourcePackScreenAccessor;
|
||||
import me.retucio.camtweaks.mixin.accessor.PackAccessor;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.RPackBypass;
|
||||
import me.retucio.camtweaks.util.interfaces.IConfirmScreen;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.client.option.ServerList;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.packet.c2s.common.ResourcePackStatusC2SPacket;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@Mixin(ClientCommonNetworkHandler.class)
|
||||
public abstract class ClientCommonNetworkHandlerMixin {
|
||||
|
||||
@Shadow @Final protected MinecraftClient client;
|
||||
@Shadow @Final protected ServerInfo serverInfo;
|
||||
@Shadow @Final protected ClientConnection connection;
|
||||
|
||||
@Unique // tardar 3 segundos porque algunos servers detectar el tiempo entre que se acepta y se carga el pack
|
||||
private final Executor DELAYED_EXECUTOR = CompletableFuture.delayedExecutor(3L, TimeUnit.SECONDS);
|
||||
|
||||
@Inject(method = "createConfirmServerResourcePackScreen", at = @At("TAIL"))
|
||||
private void setScreenBypassAction(UUID id, URL url, String hash, boolean required, Text prompt, CallbackInfoReturnable<Screen> cir) {
|
||||
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
if (!bypassPack.isEnabled()) return;
|
||||
|
||||
final Screen screen = cir.getReturnValue();
|
||||
((IConfirmScreen) screen).smegma$setBypassAction(() -> {
|
||||
client.setScreen(((ConfirmServerResourcePackScreenAccessor) screen).getParentScreen());
|
||||
if (this.serverInfo != null) {
|
||||
this.serverInfo.setResourcePackPolicy(bypassPack.getPolicy());
|
||||
this.client.getServerResourcePackProvider().acceptAll();
|
||||
ServerList.updateServerListEntry(this.serverInfo);
|
||||
}
|
||||
bypass(((ConfirmServerResourcePackScreenAccessor) screen).getRequests().stream().map(PackAccessor::callId).toList());
|
||||
});
|
||||
}
|
||||
|
||||
@Unique
|
||||
public void bypass(List<UUID> ids) {
|
||||
ids.forEach(id -> connection.send(new ResourcePackStatusC2SPacket(id, ResourcePackStatusC2SPacket.Status.ACCEPTED)));
|
||||
ids.forEach(id -> connection.send(new ResourcePackStatusC2SPacket(id, ResourcePackStatusC2SPacket.Status.DOWNLOADED)));
|
||||
DELAYED_EXECUTOR.execute(() ->
|
||||
ids.forEach(id -> connection.send(new ResourcePackStatusC2SPacket(id, ResourcePackStatusC2SPacket.Status.SUCCESSFULLY_LOADED)))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import 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();
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
|
||||
@Redirect(method = "onEntityStatus", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;showFloatingItem(Lnet/minecraft/item/ItemStack;)V"))
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,9 @@ import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||
@Mixin(ClientPlayerInteractionManager.class)
|
||||
public abstract class ClientPlayerInteractionManagerMixin {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
@Shadow @Final
|
||||
private MinecraftClient client;
|
||||
|
||||
@Unique
|
||||
Freecam freecam;
|
||||
|
||||
@@ -68,7 +68,7 @@ public abstract class ClientPlayerInteractionManagerMixin {
|
||||
|
||||
@Inject(method = "attackEntity", at = @At("HEAD"), cancellable = true)
|
||||
private void onAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) {
|
||||
if (player != client.player) return;
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.RPackBypass;
|
||||
import me.retucio.camtweaks.util.interfaces.IConfirmScreen;
|
||||
import net.minecraft.client.gui.screen.ConfirmScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.DirectionalLayoutWidget;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ConfirmScreen.class)
|
||||
public abstract class ConfirmScreenMixin extends Screen implements IConfirmScreen {
|
||||
|
||||
@Shadow protected DirectionalLayoutWidget layout;
|
||||
@Unique private Runnable bypassAction = null;
|
||||
|
||||
protected ConfirmScreenMixin(final Text title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ConfirmScreen;addButtons(Lnet/minecraft/client/gui/widget/DirectionalLayoutWidget;)V", shift = At.Shift.AFTER))
|
||||
protected void addBypassButton(CallbackInfo ci) {
|
||||
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
if (this.bypassAction != null && bypassPack.isEnabled())
|
||||
this.layout.add(ButtonWidget.builder(bypassPack.BYPASS_TEXT, $ -> this.bypassAction.run()).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void smegma$setBypassAction(Runnable bypass) {
|
||||
this.bypassAction = bypass;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.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;
|
||||
@@ -31,22 +30,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,8 +1,10 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.TimeChanger;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -12,11 +14,17 @@ import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||
@Mixin(DimensionType.class)
|
||||
public abstract class DimensionTypeMixin {
|
||||
|
||||
// no consigo arreglar lo de que la fase lunar por defecto siempre sea luna llena
|
||||
@ModifyReturnValue(method = "getMoonPhase", at = @At("RETURN"))
|
||||
private int overrideMoonPhase(int original) {
|
||||
private int overrideMoonPhase(int original, @Local(argsOnly = true) long time) {
|
||||
TimeChanger timeChanger = ModuleManager.INSTANCE.getModuleByClass(TimeChanger.class);
|
||||
if (timeChanger.isEnabled() && mc.world != null && !timeChanger.moonPhase.is(TimeChanger.MoonPhases.DEFAULT))
|
||||
return timeChanger.getMoonPhase();
|
||||
return original;
|
||||
if (timeChanger == null || !timeChanger.isEnabled() || mc.world == null) {
|
||||
return original;
|
||||
}
|
||||
|
||||
if (timeChanger.moonPhase.is(TimeChanger.MoonPhases.DEFAULT))
|
||||
return (int) (time / 24000L % 8L + 8L) % 8;
|
||||
|
||||
return timeChanger.getMoonPhase();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.Reconnect;
|
||||
|
||||
import net.minecraft.client.gui.screen.DisconnectedScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.DirectionalLayoutWidget;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(DisconnectedScreen.class)
|
||||
public abstract class DisconnectedScreenMixin {
|
||||
|
||||
@Shadow @Final
|
||||
private DirectionalLayoutWidget grid;
|
||||
|
||||
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/DirectionalLayoutWidget;add(Lnet/minecraft/client/gui/widget/Widget;)Lnet/minecraft/client/gui/widget/Widget;", ordinal = 2, shift = At.Shift.AFTER))
|
||||
private void addReconnectButton(CallbackInfo ci) {
|
||||
Reconnect reconnect = ModuleManager.INSTANCE.getModuleByClass(Reconnect.class);
|
||||
if (reconnect == null || !reconnect.isEnabled()) return;
|
||||
|
||||
grid.add(ButtonWidget.builder(
|
||||
Text.literal("reconectarse"),
|
||||
button -> reconnect.reconnect()
|
||||
).build());
|
||||
}
|
||||
}
|
||||
@@ -25,29 +25,16 @@ 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;
|
||||
|
||||
@Shadow
|
||||
private float yaw;
|
||||
|
||||
@Shadow
|
||||
private float pitch;
|
||||
|
||||
@Unique
|
||||
Freecam freecam;
|
||||
|
||||
@Unique
|
||||
Freelook freelook;
|
||||
|
||||
@Unique
|
||||
Nametags nametags;
|
||||
|
||||
@Unique
|
||||
Rotations rotations;
|
||||
@Unique Freecam freecam;
|
||||
@Unique Freelook freelook;
|
||||
@Unique Nametags nametags;
|
||||
@Unique Rotations rotations;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.GlintPlus;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.entity.equipment.EquipmentRenderer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(EquipmentRenderer.class)
|
||||
public abstract class EquipmentRendererMixin {
|
||||
|
||||
@Redirect(method = "render(Lnet/minecraft/client/render/entity/equipment/EquipmentModel$LayerType;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;ILnet/minecraft/util/Identifier;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayer;getArmorEntityGlint()Lnet/minecraft/client/render/RenderLayer;"))
|
||||
private RenderLayer redirectArmorEntityGlint() {
|
||||
GlintPlus glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
||||
return glintPlus.getArmorEntityGlint();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.GlintPlus;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ItemRenderer.class)
|
||||
public abstract class ItemRendererMixin {
|
||||
|
||||
@Unique
|
||||
private static GlintPlus glintPlus;
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
private void getModules(CallbackInfo ci) {
|
||||
glintPlus = ModuleManager.INSTANCE.getModuleByClass(GlintPlus.class);
|
||||
}
|
||||
|
||||
@Redirect(method = "getItemGlintConsumer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayer;getGlint()Lnet/minecraft/client/render/RenderLayer;"))
|
||||
private static RenderLayer getGlint() {
|
||||
return glintPlus.getGlint();
|
||||
}
|
||||
|
||||
@Redirect(method = "getItemGlintConsumer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayer;getEntityGlint()Lnet/minecraft/client/render/RenderLayer;"))
|
||||
private static RenderLayer getEntityGlint() {
|
||||
return glintPlus.getEntityGlint();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.event.events.DamageItemEvent;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||
|
||||
@Mixin(ItemStack.class)
|
||||
public abstract class ItemStackMixin {
|
||||
|
||||
@Shadow
|
||||
public abstract int getDamage();
|
||||
|
||||
@Inject(method = "onDurabilityChange", at = @At("TAIL"))
|
||||
private void onDamage(int damage, ServerPlayerEntity player, Consumer<Item> breakCallback, CallbackInfo ci) {
|
||||
ItemStack stack = (ItemStack) (Object) this;
|
||||
EVENT_BUS.post(new DamageItemEvent(getDamage(), stack));
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,11 @@ 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.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);
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,13 @@ import me.retucio.camtweaks.CameraTweaks;
|
||||
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.FastUse;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
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;
|
||||
@@ -20,6 +22,7 @@ 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 {
|
||||
@@ -54,6 +57,13 @@ public abstract class MinecraftClientMixin {
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.RPackBypass;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Mixin(ServerInfo.ResourcePackPolicy.class)
|
||||
public abstract class ResourcePackPolicyMixin {
|
||||
|
||||
@Unique
|
||||
private static ServerInfo.ResourcePackPolicy BYPASS;
|
||||
|
||||
@Invoker("<init>")
|
||||
public static ServerInfo.ResourcePackPolicy init(final String enumName, final int enumOrdinal, final String name) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Inject(method = "values", at = @At("TAIL"), cancellable = true)
|
||||
private static void addVariant(CallbackInfoReturnable<ServerInfo.ResourcePackPolicy[]> cir) {
|
||||
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
if (!bypassPack.isEnabled()) return;
|
||||
|
||||
ServerInfo.ResourcePackPolicy[] values = cir.getReturnValue();
|
||||
final int ordinal = values.length;
|
||||
cir.setReturnValue(values = Arrays.copyOfRange(values, 0, ordinal + 1));
|
||||
values[ordinal] = BYPASS = init(bypassPack.ENUM_NAME, ordinal, "bypass");
|
||||
}
|
||||
|
||||
@Inject(method = "getName", at = @At("HEAD"), cancellable = true)
|
||||
private void addToGetName(final CallbackInfoReturnable<Text> cir) {
|
||||
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
if (BYPASS == (Object) this && bypassPack.isEnabled())
|
||||
cir.setReturnValue(bypassPack.BYPASS_TEXT);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package me.retucio.camtweaks.mixin;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.command.CommandManager;
|
||||
import me.retucio.camtweaks.config.ConfigManager;
|
||||
import me.retucio.camtweaks.event.events.ClientClickEvent;
|
||||
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
||||
import net.minecraft.SharedConstants;
|
||||
@@ -31,15 +32,12 @@ public class ScreenMixin {
|
||||
|
||||
@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,
|
||||
new Color((int) ClientSettingsFrame.guiSettings.red.getDefaultValue(),
|
||||
(int) ClientSettingsFrame.guiSettings.green.getDefaultValue(),
|
||||
(int) ClientSettingsFrame.guiSettings.blue.getDefaultValue(),
|
||||
(int) ClientSettingsFrame.guiSettings.alpha.getDefaultValue()
|
||||
).getRGB(), false
|
||||
ClientSettingsFrame.guiSettings.color.getRGB(), false
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.RPackBypass;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.client.resource.server.ServerResourcePackManager;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.gui.screen.multiplayer.ConnectScreen$1")
|
||||
public abstract class ServerConnectorMixin {
|
||||
|
||||
@Inject(method = "toAcceptanceStatus", at = @At("HEAD"), cancellable = true)
|
||||
private static void guardSwitchCase(ServerInfo.ResourcePackPolicy policy, CallbackInfoReturnable<ServerResourcePackManager.AcceptanceStatus> cir) {
|
||||
RPackBypass bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
if (!bypassPack.isEnabled()) return;
|
||||
if (policy == bypassPack.getPolicy())
|
||||
cir.setReturnValue(ServerResourcePackManager.AcceptanceStatus.ALLOWED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.RPackBypass;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ServerInfo.class)
|
||||
public abstract class ServerInfoMixin {
|
||||
|
||||
@Shadow private ServerInfo.ResourcePackPolicy resourcePackPolicy;
|
||||
@Unique private boolean isBypassStatus;
|
||||
|
||||
@Unique
|
||||
private static RPackBypass bypassPack;
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
private void getModules(String name, String address, ServerInfo.ServerType serverType, CallbackInfo ci) {
|
||||
bypassPack = ModuleManager.INSTANCE.getModuleByClass(RPackBypass.class);
|
||||
}
|
||||
|
||||
@Inject(method = "fromNbt", at = @At("TAIL"))
|
||||
private static void addToRead(NbtCompound root, CallbackInfoReturnable<ServerInfo> cir) {
|
||||
if (!bypassPack.isEnabled()) return;
|
||||
if (root.getBoolean(bypassPack.TAG_NAME, false))
|
||||
cir.getReturnValue().setResourcePackPolicy(bypassPack.getPolicy());
|
||||
}
|
||||
|
||||
@Inject(method = "toNbt", at = @At("HEAD"))
|
||||
private void preWrite(CallbackInfoReturnable<NbtCompound> cir) {
|
||||
if (!bypassPack.isEnabled()) return;
|
||||
if (this.resourcePackPolicy == bypassPack.getPolicy()) {
|
||||
this.isBypassStatus = true;
|
||||
this.resourcePackPolicy = ServerInfo.ResourcePackPolicy.PROMPT;
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "toNbt", at = @At("TAIL"))
|
||||
private void addToWrite(CallbackInfoReturnable<NbtCompound> cir) {
|
||||
if (!bypassPack.isEnabled()) return;
|
||||
if (this.isBypassStatus) {
|
||||
cir.getReturnValue().putBoolean(bypassPack.TAG_NAME, true);
|
||||
this.resourcePackPolicy = bypassPack.getPolicy();
|
||||
this.isBypassStatus = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package me.retucio.camtweaks.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.NoRender;
|
||||
import net.minecraft.client.render.fog.StatusEffectFogModifier;
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
@Mixin(StatusEffectFogModifier.class)
|
||||
public abstract class StatusEffectFogModifierMixin {
|
||||
|
||||
@Shadow
|
||||
public abstract RegistryEntry<StatusEffect> getStatusEffect();
|
||||
|
||||
@ModifyReturnValue(method = "shouldApply", at = @At("RETURN"))
|
||||
public boolean noRenderBadEffects(boolean original) {
|
||||
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
|
||||
if (!noRender.isEnabled()) return original;
|
||||
if (getStatusEffect() == StatusEffects.BLINDNESS && !noRender.blindnessEffect.isEnabled()) return false;
|
||||
if (getStatusEffect() == StatusEffects.DARKNESS && !noRender.darknessEffect.isEnabled()) return false;
|
||||
return original;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.BlockOutline;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.NoRender;
|
||||
import me.retucio.camtweaks.util.Colors;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.state.WorldRenderState;
|
||||
@@ -76,24 +77,6 @@ public abstract class WorldRendererMixin {
|
||||
BlockOutline outline = ModuleManager.INSTANCE.getModuleByClass(BlockOutline.class);
|
||||
if (!outline.isEnabled()) return ColorHelper.withAlpha(alpha, rgb);
|
||||
|
||||
if (outline.rainbow.isEnabled()) {
|
||||
float speed = 10001 - outline.rainbowSpeed.getFloatValue(); // 10001 para evitar divisiones por cero
|
||||
float hue = (System.currentTimeMillis() % (int) speed) / speed;
|
||||
Color gamingProMax = Color.getHSBColor(hue, 1, 1);
|
||||
|
||||
return new Color(
|
||||
gamingProMax.getRed(),
|
||||
gamingProMax.getGreen(),
|
||||
gamingProMax.getBlue(),
|
||||
outline.alpha.getIntValue()
|
||||
).getRGB();
|
||||
} else {
|
||||
return new Color(
|
||||
outline.red.getIntValue(),
|
||||
outline.green.getIntValue(),
|
||||
outline.blue.getIntValue(),
|
||||
outline.alpha.getIntValue()
|
||||
).getRGB();
|
||||
}
|
||||
return outline.color.getRGB();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package me.retucio.camtweaks.mixin.accessor;
|
||||
|
||||
import net.minecraft.client.gui.screen.ingame.AnvilScreen;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(AnvilScreen.class)
|
||||
public interface AnvilScreenAccessor {
|
||||
|
||||
@Accessor("nameField")
|
||||
TextFieldWidget getNameField();
|
||||
|
||||
@Accessor("nameField")
|
||||
void setNameField(TextFieldWidget nameField);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package me.retucio.camtweaks.mixin.accessor;
|
||||
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(ClientCommonNetworkHandler.ConfirmServerResourcePackScreen.class)
|
||||
public interface ConfirmServerResourcePackScreenAccessor {
|
||||
|
||||
@Accessor("parent")
|
||||
Screen getParentScreen();
|
||||
|
||||
@Accessor("packs")
|
||||
List<? extends PackAccessor> getRequests();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package me.retucio.camtweaks.mixin.accessor;
|
||||
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Mixin(ClientCommonNetworkHandler.ConfirmServerResourcePackScreen.Pack.class)
|
||||
public interface PackAccessor {
|
||||
|
||||
@Invoker
|
||||
UUID callId();
|
||||
}
|
||||
@@ -23,6 +23,7 @@ public class Module {
|
||||
private String description;
|
||||
private boolean enabled;
|
||||
private boolean saveSettings = true;
|
||||
private boolean searchMatch = true;
|
||||
|
||||
// dejar al usuario elegir si el módulo debería apagarse tras soltar su tecla asignada, o si la tecla debería alternar su estado
|
||||
protected EnumSetting<KeyModes> keyMode = new EnumSetting<>("modo de tecla", "cómo interpretar la tecla configurada", KeyModes.class, KeyModes.TOGGLE);
|
||||
@@ -39,6 +40,13 @@ public class Module {
|
||||
addSettings(bind, keyMode, notify);
|
||||
}
|
||||
|
||||
public Module(String name, String description, int key) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
addSettings(bind, keyMode, notify);
|
||||
this.bind.setDefaultKey(key);
|
||||
this.bind.setKey(key);
|
||||
}
|
||||
|
||||
// ajustes
|
||||
public List<AbstractSetting> getSettings() {
|
||||
@@ -49,7 +57,7 @@ public class Module {
|
||||
public <S extends AbstractSetting> S addSetting(AbstractSetting setting) {
|
||||
settings.add(setting);
|
||||
setting.setModule(this);
|
||||
return (S) setting; // por convenciencia
|
||||
return (S) setting; // por conveniencia
|
||||
}
|
||||
|
||||
public void addSettings(AbstractSetting... settings) {
|
||||
@@ -141,6 +149,14 @@ public class Module {
|
||||
return bind;
|
||||
}
|
||||
|
||||
public boolean isSearchMatch() {
|
||||
return searchMatch;
|
||||
}
|
||||
|
||||
public void setSearchMatch(boolean searchMatch) {
|
||||
this.searchMatch = searchMatch;
|
||||
}
|
||||
|
||||
public enum KeyModes {
|
||||
HOLD("mantener"),
|
||||
TOGGLE("alternar");
|
||||
|
||||
@@ -26,6 +26,7 @@ public class ModuleManager {
|
||||
// por orden alfabético y todo, flipas
|
||||
private void addModules() {
|
||||
modules.add(new AntiInvis());
|
||||
modules.add(new AnvilFont());
|
||||
modules.add(new AttributeSwapper());
|
||||
modules.add(new AutoSign());
|
||||
modules.add(new BlockOutline());
|
||||
@@ -40,20 +41,24 @@ public class ModuleManager {
|
||||
modules.add(new Freecam());
|
||||
modules.add(new Freelook());
|
||||
modules.add(new Fullbright());
|
||||
modules.add(new GlintPlus());
|
||||
modules.add(new HandView());
|
||||
modules.add(new Headhitters());
|
||||
modules.add(new HUD());
|
||||
modules.add(new LightOverlay());
|
||||
modules.add(new LogoutSpots());
|
||||
modules.add(new Nametags());
|
||||
modules.add(new NoMiningInterruptions());
|
||||
modules.add(new NoRender());
|
||||
modules.add(new PerspectivePlus());
|
||||
modules.add(new PortalGUI());
|
||||
modules.add(new Reconnect());
|
||||
modules.add(new Rotations());
|
||||
modules.add(new RPackBypass());
|
||||
modules.add(new ScreenshotPlus());
|
||||
modules.add(new ShulkerPeek());
|
||||
modules.add(new TimeChanger());
|
||||
// modules.add(new TooltipsPlus());
|
||||
modules.add(new WarnLowDurability());
|
||||
modules.add(new Zoom());
|
||||
|
||||
modules.sort(Comparator.comparing(module -> module.getName().toLowerCase()));
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.mixin.accessor.AnvilScreenAccessor;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||
import net.minecraft.client.gui.screen.ingame.AnvilScreen;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
|
||||
import me.retucio.camtweaks.module.modules.AnvilFont.CustomFont.CharMap;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class AnvilFont extends Module {
|
||||
|
||||
public EnumSetting<FontMode> fontMode = addSetting(new EnumSetting<>("tipografía", "qué tipografía utilizar",
|
||||
FontMode.class, FontMode.NORMAL));
|
||||
|
||||
String text;
|
||||
|
||||
private static final List<CustomFont> fonts = Arrays.asList(
|
||||
new CustomFont( // normal
|
||||
CharMap.range('!', 65281, 95)),
|
||||
|
||||
new CustomFont( // mayúsculas
|
||||
CharMap.single('a', 'ᴀ'), CharMap.single('b', 'ʙ'), CharMap.range('c', 0x1d04, 2), CharMap.single('e', 'ᴇ'),
|
||||
CharMap.single('f', 'ꜰ'), CharMap.single('g', 'ɢ'), CharMap.single('h', 'ʜ'), CharMap.single('i', 'ɪ'),
|
||||
CharMap.range('j', 0x1D0a, 2), CharMap.single('l', 'ʟ'), CharMap.single('m', 'ᴍ'), CharMap.single('n', 'ɴ'),
|
||||
CharMap.single('o', 'ᴏ'), CharMap.single('p', 'ᴩ'), CharMap.single('r', 'ʀ'), CharMap.single('s', 'ꜱ'),
|
||||
CharMap.range('t', 0x1D1b, 2), CharMap.range('v', 0x1d20, 2), CharMap.single('z', 'ᴢ'),
|
||||
CharMap.single('A', 'ᴀ'), CharMap.single('B', 'ʙ'), CharMap.range('C', 0x1d04, 2), CharMap.single('E', 'ᴇ'),
|
||||
CharMap.single('F', 'ꜰ'), CharMap.single('G', 'ɢ'), CharMap.single('H', 'ʜ'), CharMap.single('I', 'ɪ'),
|
||||
CharMap.range('J', 0x1D0a, 2), CharMap.single('L', 'ʟ'), CharMap.single('M', 'ᴍ'), CharMap.single('N', 'ɴ'),
|
||||
CharMap.single('O', 'ᴏ'), CharMap.single('P', 'ᴩ'), CharMap.single('R', 'ʀ'), CharMap.single('S', 'ꜱ'),
|
||||
CharMap.range('T', 0x1D1b, 2), CharMap.range('V', 0x1d20, 2), CharMap.single('z', 'ᴢ')),
|
||||
|
||||
new CustomFont( // redondo
|
||||
CharMap.range('1', 9313, 9),
|
||||
CharMap.range('A', 9398, 26),
|
||||
CharMap.range('a', 9424, 26)),
|
||||
|
||||
new CustomFont( // to raro
|
||||
CharMap.single('a', 'Λ'), CharMap.single('c', 'ᑕ'), CharMap.single('e', 'Σ'), CharMap.single('h', 'Ή'),
|
||||
CharMap.single('l', 'ᒪ'), CharMap.single('n', 'П'), CharMap.single('o', 'Ө'), CharMap.single('r', 'Я'),
|
||||
CharMap.single('s', 'Ƨ'), CharMap.single('t', 'Ƭ'), CharMap.single('u', 'Ц'), CharMap.single('w', 'Щ'),
|
||||
CharMap.single('A', 'Λ'), CharMap.single('C', 'ᑕ'), CharMap.single('E', 'Σ'), CharMap.single('H', 'Ή'),
|
||||
CharMap.single('L', 'ᒪ'), CharMap.single('N', 'П'), CharMap.single('O', 'Ө'), CharMap.single('R', 'Я'),
|
||||
CharMap.single('S', 'Ƨ'), CharMap.single('T', 'Ƭ'), CharMap.single('U', 'Ц'), CharMap.single('W', 'Щ')),
|
||||
|
||||
new CustomFont( // griego
|
||||
CharMap.single('a', 'α'), CharMap.single('b', 'в'), CharMap.single('d', '∂'), CharMap.single('e', 'є'),
|
||||
CharMap.single('f', 'ƒ'), CharMap.single('h', 'н'), CharMap.single('i', 'ι'), CharMap.single('j', 'נ'),
|
||||
CharMap.single('k', 'к'), CharMap.single('l', 'ℓ'), CharMap.single('m', 'м'), CharMap.single('n', 'η'),
|
||||
CharMap.single('o', 'σ'), CharMap.single('p', 'ρ'), CharMap.single('r', 'я'), CharMap.single('s', 'ѕ'),
|
||||
CharMap.single('t', 'т'), CharMap.single('u', 'υ'), CharMap.single('v', 'ν'), CharMap.single('w', 'ω'),
|
||||
CharMap.single('x', 'χ'), CharMap.single('y', 'у'),
|
||||
CharMap.single('A', 'α'), CharMap.single('B', 'в'), CharMap.single('D', '∂'), CharMap.single('E', 'є'),
|
||||
CharMap.single('F', 'ƒ'), CharMap.single('H', 'н'), CharMap.single('I', 'ι'), CharMap.single('J', 'נ'),
|
||||
CharMap.single('K', 'к'), CharMap.single('L', 'ℓ'), CharMap.single('M', 'м'), CharMap.single('N', 'η'),
|
||||
CharMap.single('O', 'σ'), CharMap.single('P', 'ρ'), CharMap.single('R', 'я'), CharMap.single('S', 'ѕ'),
|
||||
CharMap.single('T', 'т'), CharMap.single('U', 'υ'), CharMap.single('V', 'ν'), CharMap.single('W', 'ω'),
|
||||
CharMap.single('X', 'χ'), CharMap.single('Y', 'у'))
|
||||
);
|
||||
|
||||
public AnvilFont() {
|
||||
super("yunques con pluma", "te permite tipografías distintas al renombrar items en un yunque");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (mc.currentScreen == null) return;
|
||||
|
||||
if (mc.currentScreen instanceof AnvilScreen) {
|
||||
TextFieldWidget nameField = ((AnvilScreenAccessor) mc.currentScreen).getNameField();
|
||||
|
||||
if (fontMode.getValue() != FontMode.NORMAL)
|
||||
text = fonts.get(fontMode.getIndex()).replace(nameField.getText());
|
||||
else
|
||||
text = nameField.getText();
|
||||
|
||||
if (!text.equals(nameField.getText()))
|
||||
nameField.setText(text);
|
||||
|
||||
((AnvilScreenAccessor) mc.currentScreen).setNameField(nameField);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class CustomFont {
|
||||
|
||||
private final HashMap<Character, Character> allMaps = new HashMap<>();
|
||||
|
||||
public CustomFont(CharMap... maps) {
|
||||
for (CharMap map : maps)
|
||||
allMaps.putAll(map.getMap());
|
||||
}
|
||||
|
||||
public String replace(String startString) {
|
||||
for (Map.Entry<Character, Character> e : allMaps.entrySet())
|
||||
startString = startString.replace(e.getKey(), e.getValue());
|
||||
return startString;
|
||||
}
|
||||
|
||||
|
||||
static class CharMap {
|
||||
|
||||
private final HashMap<Character, Character> map = new HashMap<>();
|
||||
|
||||
private CharMap(char... mappings) {
|
||||
for (int i = 0; i < mappings.length - 1; i += 2)
|
||||
map.put(mappings[i], mappings[i + 1]);
|
||||
}
|
||||
|
||||
public static CharMap single(char from, char to) {
|
||||
return new CharMap(from, to);
|
||||
}
|
||||
|
||||
public static CharMap range(char start, int start1, int amount) {
|
||||
char[] chars = new char[amount * 2];
|
||||
for (int i = 0; i < amount; i++) {
|
||||
chars[i * 2] = (char) (start + i);
|
||||
chars[i * 2 + 1] = (char) (start1 + i);
|
||||
}
|
||||
return new CharMap(chars);
|
||||
}
|
||||
|
||||
public HashMap<Character, Character> getMap() {
|
||||
return map;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum FontMode {
|
||||
NORMAL("normal"),
|
||||
UPPERCASE("mayúsculas"),
|
||||
CIRCLED("redondo"),
|
||||
CURSED("to raro"),
|
||||
GREEK("griego");
|
||||
|
||||
private final String name;
|
||||
FontMode(String name) { this.name = name; }
|
||||
@Override public String toString() { return name; }
|
||||
}
|
||||
}
|
||||
@@ -2,30 +2,21 @@ package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.ColorSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/** continúa en:
|
||||
* @see me.retucio.camtweaks.mixin.WorldRendererMixin
|
||||
*/
|
||||
|
||||
public class BlockOutline extends Module {
|
||||
|
||||
public BooleanSetting rainbow = addSetting(new BooleanSetting("RGB", "erre ge be gueiming", false));
|
||||
public NumberSetting rainbowSpeed = addSetting(new NumberSetting("velocidad", "velocidad de la bandera gay", 2000, 0, 10000, 2));
|
||||
|
||||
public NumberSetting red = addSetting(new NumberSetting("rojo", "factor r del rbg", 0, 0, 255, 1));
|
||||
public NumberSetting green = addSetting(new NumberSetting("verde", "factor g del rgb", 0, 0, 255, 1));
|
||||
public NumberSetting blue = addSetting(new NumberSetting("azul", "factor b del rbg", 0, 0, 255, 1));
|
||||
|
||||
public NumberSetting alpha = addSetting(new NumberSetting("opacidad", "transparencia invertida", 102, 0, 255, 1));
|
||||
public ColorSetting color = addSetting(new ColorSetting("color", "color del contorno de los bloques",
|
||||
new Color(0, 0, 0, 102), true));
|
||||
|
||||
public BlockOutline() {
|
||||
super("contorno", "customiza el contorno de los bloques");
|
||||
rainbow.onUpdate(v -> {
|
||||
rainbowSpeed.setVisible(v);
|
||||
red.setVisible(!v);
|
||||
green.setVisible(!v);
|
||||
blue.setVisible(!v);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,11 @@ package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.ColorSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/** continúa en:
|
||||
* @see me.retucio.camtweaks.mixin.DamageParticleMixin
|
||||
* @see me.retucio.camtweaks.mixin.DamageParticleFactoryMixin
|
||||
@@ -11,13 +14,7 @@ import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
|
||||
public class CritsPlus extends Module {
|
||||
|
||||
public BooleanSetting rainbow = addSetting(new BooleanSetting("LUCES GAMING", "PARTÍCULAS GAMING", false));
|
||||
public NumberSetting rainbowSpeed = addSetting(new NumberSetting("velocidad del erre ge be", "qué tan gaming son las luces gaming", 1000, 0, 10000, 2));
|
||||
|
||||
public NumberSetting red = addSetting(new NumberSetting("rojo", "comunismo", 0, 0, 255, 1));
|
||||
public NumberSetting green = addSetting(new NumberSetting("verde", "vox", 0, 0, 255, 1));
|
||||
public NumberSetting blue = addSetting(new NumberSetting("azul", "metanfetamina", 255, 0, 255, 1));
|
||||
public NumberSetting alpha = addSetting(new NumberSetting("alpha", "opacidad", 255, 0, 255, 1));
|
||||
public ColorSetting color = addSetting(new ColorSetting("color", "color de las partículas", new Color(0, 0, 255, 255), false));
|
||||
|
||||
public NumberSetting scale = addSetting(new NumberSetting("escala", "tamaño", 1, 0, 2, 0.05));
|
||||
public NumberSetting multiplier; // no sé dónde se calcula cuántas partículas aparecen :/
|
||||
@@ -28,11 +25,5 @@ public class CritsPlus extends Module {
|
||||
|
||||
public CritsPlus() {
|
||||
super("críticos", "cambia la apariencia de los críticos al gusto");
|
||||
rainbow.onUpdate(v -> {
|
||||
rainbowSpeed.setVisible(v);
|
||||
red.setVisible(!v);
|
||||
green.setVisible(!v);
|
||||
blue.setVisible(!v);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package me.retucio.camtweaks.module.modules;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.textures.GpuTextureView;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.ColorSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||
@@ -15,19 +16,13 @@ import java.awt.*;
|
||||
|
||||
public class DamageOverlay extends Module {
|
||||
|
||||
public NumberSetting red = addSetting(new NumberSetting("rojo", "r o j o", 255, 0, 255, 1));
|
||||
public NumberSetting green = addSetting(new NumberSetting("verde", "v e r d e", 0, 0, 255, 1));
|
||||
public NumberSetting blue = addSetting(new NumberSetting("azul", "a z u l", 0, 0, 255, 1));
|
||||
public NumberSetting alpha = addSetting(new NumberSetting("alpha", "o p a c i d a d", 77, 0, 255, 1));
|
||||
public ColorSetting colorSetting = addSetting(new ColorSetting("color", "color", new Color(255, 0, 0, 77), false));
|
||||
|
||||
private NativeImageBackedTexture texture = null;
|
||||
|
||||
public DamageOverlay() {
|
||||
super("superposición de daño", "modifica el color en el que se renderiza la superposición de recibir daño");
|
||||
|
||||
NumberSetting[] settings = {red, green, blue, alpha};
|
||||
for (NumberSetting setting : settings)
|
||||
setting.onUpdate(v -> reloadOverlayIfReady());
|
||||
colorSetting.onUpdate(v -> reloadOverlayIfReady());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,6 +37,11 @@ public class DamageOverlay extends Module {
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (colorSetting.isRainbow()) reloadOverlayIfReady();
|
||||
}
|
||||
|
||||
private void reloadOverlayIfReady() {
|
||||
if (texture != null && texture.getImage() != null) reloadOverlay(texture);
|
||||
}
|
||||
@@ -50,8 +50,13 @@ public class DamageOverlay extends Module {
|
||||
public void reloadOverlay(NativeImageBackedTexture texture) {
|
||||
if (this.texture == null) this.texture = texture;
|
||||
|
||||
int color = isEnabled() ?
|
||||
new Color(red.getIntValue(), green.getIntValue(), blue.getIntValue(), 255 - alpha.getIntValue()).getRGB()
|
||||
int color = isEnabled()
|
||||
? new Color(
|
||||
colorSetting.getR(),
|
||||
colorSetting.getG(),
|
||||
colorSetting.getB(),
|
||||
255 - colorSetting.getA()
|
||||
).getRGB()
|
||||
: new Color(255, 0, 0, 178).getRGB();
|
||||
|
||||
NativeImage image = texture.getImage();
|
||||
|
||||
@@ -33,10 +33,17 @@ public class FakePlayer extends Module {
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
// intento miserable de hacer que no colisione con jugadores
|
||||
public OtherClientPlayerEntity addPlayer(PlayerEntity playerToCopy, String dummyName) {
|
||||
player = new OtherClientPlayerEntity(mc.world, new GameProfile(UUID.randomUUID(), dummyName));
|
||||
player = new OtherClientPlayerEntity(mc.world, new GameProfile(UUID.randomUUID(), dummyName)) {
|
||||
@Override public void onPlayerCollision(PlayerEntity player) {}
|
||||
};
|
||||
|
||||
player.copyFrom(playerToCopy);
|
||||
player.setCustomNameVisible(true);
|
||||
player.noClip = true;
|
||||
player.horizontalCollision = false;
|
||||
player.verticalCollision = false;
|
||||
mc.world.addEntity(player);
|
||||
return player;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.play.DeathMessageS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.HealthUpdateS2CPacket;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import org.joml.Vector3d;
|
||||
@@ -70,8 +69,7 @@ public class Freecam extends Module {
|
||||
private float yaw, pitch;
|
||||
|
||||
public Freecam() {
|
||||
super("cámara libre", "permite a la cámara moverse independientemente del jugador. útil para explorar alrededores");
|
||||
assignKey(GLFW.GLFW_KEY_V);
|
||||
super("cámara libre", "permite a la cámara moverse independientemente del jugador. útil para explorar alrededores", GLFW.GLFW_KEY_V);
|
||||
speedSetting.onUpdate(newSpeed -> speed = newSpeed);
|
||||
}
|
||||
|
||||
@@ -115,6 +113,7 @@ public class Freecam extends Module {
|
||||
|
||||
unpress();
|
||||
if (reloadChunks.isEnabled()) mc.worldRenderer.reload();
|
||||
|
||||
super.onEnable();
|
||||
}
|
||||
|
||||
@@ -207,7 +206,6 @@ public class Freecam extends Module {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKey(KeyEvent event) {
|
||||
if (mc.currentScreen != null) return;
|
||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_F3)) return;
|
||||
KeyInput key = new KeyInput(event.getKey(), event.getScancode(), 0);
|
||||
|
||||
@@ -239,7 +237,6 @@ public class Freecam extends Module {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMouseClick(MouseClickEvent event) { // por si el restrasado del usuario usa el ratón para moverse
|
||||
if (mc.currentScreen != null) return;
|
||||
Click click = new Click(0, 0, new MouseInput(event.getButton(), 0));
|
||||
|
||||
boolean shouldCancel = true;
|
||||
@@ -305,6 +302,7 @@ public class Freecam extends Module {
|
||||
@SubscribeEvent
|
||||
public void onOpenScreen(OpenScreenEvent event) {
|
||||
unpress();
|
||||
stopMoving();
|
||||
prevPos.set(pos);
|
||||
prevYaw = yaw;
|
||||
prevPitch = pitch;
|
||||
@@ -351,6 +349,15 @@ public class Freecam extends Module {
|
||||
mc.options.sneakKey.setPressed(false);
|
||||
}
|
||||
|
||||
private void stopMoving() {
|
||||
forward = false;
|
||||
backward = false;
|
||||
left = false;
|
||||
right = false;
|
||||
up = false;
|
||||
down = false;
|
||||
}
|
||||
|
||||
|
||||
// getters
|
||||
|
||||
|
||||
@@ -29,9 +29,12 @@ public class Freelook extends Module {
|
||||
private Perspective prevPerspective;
|
||||
|
||||
public Freelook() {
|
||||
super("perspectiva libre", "te permite mover la cámara de la perspectiva sin mover la del jugador, o vice versa");
|
||||
assignKey(GLFW.GLFW_KEY_B);
|
||||
super("perspectiva libre", "te permite mover la cámara de la perspectiva sin mover la del jugador, o vice versa", GLFW.GLFW_KEY_B);
|
||||
|
||||
keyMode.setDefaultValue(KeyModes.HOLD);
|
||||
keyMode.setValue(KeyModes.HOLD);
|
||||
|
||||
notify.setDefaultValue(false);
|
||||
notify.setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.mixin.accessor.StatusEffectInstanceAccessor;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.ColorSetting;
|
||||
import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
@@ -9,6 +10,8 @@ import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.registry.Registries;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/** continúa en:
|
||||
* @see me.retucio.camtweaks.mixin.LightmapTextureManagerMixin
|
||||
*/
|
||||
@@ -17,28 +20,14 @@ public class Fullbright extends Module {
|
||||
|
||||
public EnumSetting<Modes> mode = addSetting(new EnumSetting<>("modo", "qué modo de iluminación emplear (usar poción con shaders)", Modes.class, Modes.GAMMA));
|
||||
|
||||
public NumberSetting red = addSetting(new NumberSetting("rojo", "cantidad de rojo a aplicar",
|
||||
255, 0, 255, 1));
|
||||
|
||||
public NumberSetting green = addSetting(new NumberSetting("verde", "cantidad de verde a aplicar",
|
||||
255, 0, 255, 1));
|
||||
|
||||
public NumberSetting blue = addSetting(new NumberSetting("azul", "cantidad de azul a aplicar",
|
||||
255, 0, 255, 1));
|
||||
|
||||
public NumberSetting alpha = addSetting(new NumberSetting("opacidad", "opacidad del shader",
|
||||
255, 0, 255, 1));
|
||||
public ColorSetting color = addSetting(new ColorSetting("filtro", "filtro de color", new Color(255, 255, 255, 255), false));
|
||||
|
||||
public Fullbright() {
|
||||
super("brilli brilli", "deshabilita la oscuridad (y aplica colores a los shaders)");
|
||||
assignKey(GLFW.GLFW_KEY_K);
|
||||
super("brilli brilli", "deshabilita la oscuridad (y aplica colores a los shaders)", GLFW.GLFW_KEY_K);
|
||||
mode.onUpdate(mode -> { if (mode != Modes.POTION) disableNightVision(); });
|
||||
mode.onUpdate(mode -> {
|
||||
boolean v = mode.equals(Modes.GAMMA);
|
||||
red.setVisible(v);
|
||||
green.setVisible(v);
|
||||
blue.setVisible(v);
|
||||
alpha.setVisible(v);
|
||||
color.setVisible(v);
|
||||
|
||||
if (v) disableNightVision();
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ import me.retucio.camtweaks.event.events.camtweaks.LoadCommandManagerEvent;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.ColorSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import me.retucio.camtweaks.module.settings.StringSetting;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
@@ -20,18 +21,8 @@ import java.awt.*;
|
||||
// módulo no visible solo para los ajustes de la interfaz (y del cliente en general)
|
||||
public class GUI extends Module {
|
||||
|
||||
public BooleanSetting rainbow = addSetting(new BooleanSetting("gaming", "gaming", false));
|
||||
public NumberSetting rainbowSpeed = addSetting(new NumberSetting("velocidad del gaming", "velocidad, del gaming.",
|
||||
1000, 0, 10000, 2));
|
||||
public NumberSetting saturation = addSetting(new NumberSetting("saturación del gaming", "saturación, del gaming",
|
||||
1, 0, 1, 0.01));
|
||||
public NumberSetting brightness = addSetting(new NumberSetting("brillo del gaming", "brillo, del gaming",
|
||||
0.8, 0, 1, 0.01));
|
||||
|
||||
public NumberSetting red = addSetting(new NumberSetting("rojo", "cantidad de rojo en el RGB del marco", 70, 0, 255, 1));
|
||||
public NumberSetting green = addSetting(new NumberSetting("verde", "cantidad de verde en el RGB del marco", 20, 0, 255, 1));
|
||||
public NumberSetting blue = addSetting(new NumberSetting("azul", "cantidad de azul en el RGB del marco", 210, 0, 255, 1));
|
||||
public NumberSetting alpha = addSetting(new NumberSetting("alpha", "opacidad del marco", 230, 0, 255, 1));
|
||||
public ColorSetting color = addSetting(new ColorSetting("color", "color principal de la interfaz y el mod",
|
||||
new Color(70, 20, 210, 230), false));
|
||||
|
||||
// números negativos para deslizamiento inverso, 0 para desactivar
|
||||
public NumberSetting scrollSens = addSetting(new NumberSetting("sensibilidad del scroll", "qué tan sensible es la interfaz a la rueda del ratón",
|
||||
@@ -50,24 +41,18 @@ public class GUI extends Module {
|
||||
|
||||
public BooleanSetting multipleKeybinds = addSetting(new BooleanSetting("teclas multimódulo", "permitir asignar la misma tecla a más de un módulo", false));
|
||||
|
||||
private int prevRed, prevGreen, prevBlue;
|
||||
|
||||
public GUI() {
|
||||
super("interfaz", "ajustes de la interfaz, y otros misceláneos");
|
||||
assignKey(GLFW.GLFW_KEY_RIGHT_SHIFT);
|
||||
super("interfaz", "ajustes de la interfaz, y otros misceláneos", GLFW.GLFW_KEY_RIGHT_SHIFT);
|
||||
|
||||
// registrar aquí, porque no se añade a ModuleManager.modules. de lo contrario no podría detectar eventos
|
||||
CameraTweaks.EVENT_BUS.register(this);
|
||||
|
||||
keyMode.setVisible(false);
|
||||
notify.setVisible(false);
|
||||
|
||||
searchBar.onUpdate(v -> matchCase.setVisible(v));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLoadCommandManager(LoadCommandManagerEvent event) {
|
||||
commandPrefix.onUpdate(prefix -> CommandManager.INSTANCE.setPrefix(prefix));
|
||||
commandPrefix.onUpdate(CommandManager.INSTANCE::setPrefix);
|
||||
commandPrefix.setDefaultValue(CommandManager.INSTANCE.getPrefix());
|
||||
|
||||
chatName.onUpdate(name -> {
|
||||
@@ -76,65 +61,24 @@ public class GUI extends Module {
|
||||
});
|
||||
}
|
||||
|
||||
// lógica un poco prolija pero bueno
|
||||
@SubscribeEvent
|
||||
public void onLoadClickGUI(LoadClickGUIEvent event) {
|
||||
rainbow.onUpdate(v -> {
|
||||
if (v) {
|
||||
prevRed = red.getIntValue();
|
||||
prevGreen = green.getIntValue();
|
||||
prevBlue = blue.getIntValue();
|
||||
} else {
|
||||
red.setValue(prevRed);
|
||||
green.setValue(prevGreen);
|
||||
blue.setValue(prevBlue);
|
||||
}
|
||||
|
||||
rainbowSpeed.setVisible(v);
|
||||
saturation.setVisible(v);
|
||||
brightness.setVisible(v);
|
||||
red.setVisible(!v);
|
||||
green.setVisible(!v);
|
||||
blue.setVisible(!v);
|
||||
|
||||
applyRGBAColorUpdates();
|
||||
color.onUpdate(v -> {
|
||||
Colors.red = color.getR();
|
||||
Colors.green = color.getG();
|
||||
Colors.blue = color.getB();
|
||||
Colors.alpha = color.getA();
|
||||
Colors.updateAllColors(new Color(Colors.red, Colors.green, Colors.blue, Colors.alpha));
|
||||
});
|
||||
|
||||
red.onUpdate(r -> applyRGBAColorUpdates());
|
||||
green.onUpdate(g -> applyRGBAColorUpdates());
|
||||
blue.onUpdate(b -> applyRGBAColorUpdates());
|
||||
alpha.onUpdate(a -> applyRGBAColorUpdates());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(TickEvent.Post event) {
|
||||
if (rainbow.isEnabled()) {
|
||||
float speed = (float) (rainbowSpeed.getMax() - rainbowSpeed.getValue());
|
||||
float hue = (System.currentTimeMillis() % (long) speed) / speed;
|
||||
Color color = Color.getHSBColor(hue, saturation.getFloatValue(), brightness.getFloatValue());
|
||||
|
||||
Colors.red = color.getRed();
|
||||
Colors.green = color.getGreen();
|
||||
Colors.blue = color.getBlue();
|
||||
|
||||
updateColor();
|
||||
if (color.isRainbow()) {
|
||||
Colors.red = color.getR();
|
||||
Colors.green = color.getG();
|
||||
Colors.blue = color.getB();
|
||||
Colors.updateAllColors(new Color(Colors.red, Colors.green, Colors.blue, Colors.alpha));
|
||||
}
|
||||
}
|
||||
|
||||
private void applyRGBAColorUpdates() {
|
||||
Colors.red = red.getIntValue();
|
||||
Colors.green = green.getIntValue();
|
||||
Colors.blue = blue.getIntValue();
|
||||
Colors.alpha = alpha.getIntValue();
|
||||
updateColor();
|
||||
}
|
||||
|
||||
private void updateColor() {
|
||||
Colors.updateAllColors(new Color(
|
||||
Colors.red,
|
||||
Colors.green,
|
||||
Colors.blue,
|
||||
Colors.alpha
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||
import me.retucio.camtweaks.util.render.GlintRenderLayer;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.util.DyeColor;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/** continúa en:
|
||||
* @see me.retucio.camtweaks.mixin.BufferStorageMixin
|
||||
* @see me.retucio.camtweaks.mixin.EquipmentRendererMixin
|
||||
* @see me.retucio.camtweaks.mixin.ItemRendererMixin
|
||||
*/
|
||||
|
||||
public class GlintPlus extends Module {
|
||||
|
||||
public BooleanSetting items = addSetting(new BooleanSetting("items", "modificar el destello de encantamiento de los items", true));
|
||||
public BooleanSetting armor = addSetting(new BooleanSetting("armadura", "modificar el destello de encantamiento de la armadura", true));
|
||||
public EnumSetting<GlintColors> glintColor = addSetting(new EnumSetting<>("colores", "color del glint", GlintColors.class, GlintColors.PURPLE));
|
||||
|
||||
public GlintPlus() {
|
||||
super("destello de enchants.", "modifica el color del brillo de los encantamientos");
|
||||
}
|
||||
|
||||
public RenderLayer getGlint() {
|
||||
int color = getColor();
|
||||
if (!isEnabled() || !items.isEnabled()) return RenderLayer.getGlint();
|
||||
return GlintRenderLayer.glintColor.get(color);
|
||||
}
|
||||
|
||||
public RenderLayer getEntityGlint() {
|
||||
int color = getColor();
|
||||
if (!isEnabled() || !items.isEnabled()) return RenderLayer.getEntityGlint();
|
||||
return GlintRenderLayer.entityGlintColor.get(color);
|
||||
}
|
||||
|
||||
public RenderLayer getArmorEntityGlint() {
|
||||
int color = getColor();
|
||||
if (!isEnabled() || !armor.isEnabled()) return RenderLayer.getArmorEntityGlint();
|
||||
return GlintRenderLayer.armorEntityGlintColor.get(color);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
String colorName = glintColor.getValue().getRealName().toLowerCase();
|
||||
|
||||
switch (colorName) {
|
||||
case "rainbow":
|
||||
return DyeColor.values().length;
|
||||
case "none":
|
||||
return DyeColor.values().length + 1;
|
||||
}
|
||||
|
||||
for (DyeColor dye : DyeColor.values())
|
||||
if (dye.name().equalsIgnoreCase(colorName)) return dye.getIndex();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public enum GlintColors {
|
||||
RED("rojo"),
|
||||
ORANGE("naranja"),
|
||||
YELLOW("amarillo"),
|
||||
LIME("lima"),
|
||||
GREEN("verde"),
|
||||
CYAN("cian"),
|
||||
LIGHT_BLUE("celeste"),
|
||||
BLUE("azul"),
|
||||
PURPLE("morado"),
|
||||
MAGENTA("magenta"),
|
||||
PINK("rosa"),
|
||||
BROWN("marrón"),
|
||||
BLACK("negro"),
|
||||
GRAY("gris"),
|
||||
LIGHT_GRAY("plata"),
|
||||
WHITE("blanco"),
|
||||
RAINBOW("gay."),
|
||||
NONE("desactivado");
|
||||
|
||||
private final String name;
|
||||
GlintColors(String name) { this.name = name; }
|
||||
@Override public String toString() { return name; }
|
||||
public String getRealName() { return super.toString(); }
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import me.retucio.camtweaks.module.settings.*;
|
||||
import me.retucio.camtweaks.ui.screen.HudEditorScreen;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/** lógica del HUD manejada en:
|
||||
* @see me.retucio.camtweaks.ui.HudRenderer
|
||||
* @see me.retucio.camtweaks.ui.widgets.HudElement
|
||||
@@ -16,17 +18,9 @@ public class HUD extends Module {
|
||||
// editor
|
||||
public KeySetting editorKey = addSetting(new KeySetting("tecla del editor", "tecla asignada al editor de elementos del hud", GLFW.GLFW_KEY_PAGE_UP));
|
||||
|
||||
// colores
|
||||
public NumberSetting red = addSetting(new NumberSetting("rojo", "cantidad de rojo", 255, 0, 255, 1));
|
||||
public NumberSetting green = addSetting(new NumberSetting("verde", "cantidad de verde", 255, 0, 255, 1));
|
||||
public NumberSetting blue = addSetting(new NumberSetting("azul", "cantidad de azul", 255, 0, 255, 1));
|
||||
|
||||
public BooleanSetting rainbow = addSetting(new BooleanSetting("arcoíris", "gay.", false));
|
||||
public NumberSetting rainbowSpeed = addSetting(new NumberSetting("velocidad del arcoíris", "velocidad del arcoíris", 1000, 0, 10000, 2));
|
||||
|
||||
public NumberSetting alpha = addSetting(new NumberSetting("opacidad", "antitransparencia", 255, 0, 255, 1));
|
||||
|
||||
// ajustes
|
||||
public ColorSetting color = addSetting(new ColorSetting("color", "color del texto de los elementos del HUD",
|
||||
new Color(255, 255, 255, 255), false));
|
||||
public BooleanSetting showOnF3 = addSetting(new BooleanSetting("mostrar en F3", "renderizar HUD en el menú de debug", false));
|
||||
public BooleanSetting showOnChat = addSetting(new BooleanSetting("mostrar en chat", "renderizar HUD en la pantalla del chat", false));
|
||||
|
||||
@@ -37,13 +31,6 @@ public class HUD extends Module {
|
||||
|
||||
public HUD() {
|
||||
super("HUD", "superposición de la pantalla con info. adicional");
|
||||
|
||||
rainbow.onUpdate(v -> {
|
||||
rainbowSpeed.setVisible(v);
|
||||
red.setVisible(!v);
|
||||
green.setVisible(!v);
|
||||
blue.setVisible(!v);
|
||||
});
|
||||
}
|
||||
|
||||
public enum TimeFormat {
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.RenderWorldEvent;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.ColorSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import me.retucio.camtweaks.util.render.RenderUtil;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LightOverlay extends Module {
|
||||
|
||||
public NumberSetting radius = addSetting(new NumberSetting("radio", "radio a tener en cuenta al renderizar superposición",
|
||||
16, 5, 128, 1));
|
||||
public NumberSetting yRadius = addSetting(new NumberSetting("rango vertical", "distancia vertical a tener en cuenta",
|
||||
4, 1, 16, 1));
|
||||
|
||||
public NumberSetting interval = addSetting(new NumberSetting("intervalo", "cada cuántos ticks comprobar el nivel de luz",
|
||||
10, 1, 80, 1));
|
||||
|
||||
public ColorSetting lightColor = addSetting(new ColorSetting("color de la luz", "color de los bloques con luz",
|
||||
new Color(0, 255, 0, 67), false));
|
||||
public ColorSetting darknessColor = addSetting(new ColorSetting("color de oscuridad", "color de bloques con 0 luz",
|
||||
new Color(255, 0, 0, 67), false));
|
||||
|
||||
public BooleanSetting onWater = addSetting(new BooleanSetting("en agua", "mostrar también bloques cubiertos en agua", true));
|
||||
|
||||
List<BlockPos> blocks = new ArrayList<>();
|
||||
|
||||
public LightOverlay() {
|
||||
super("superposición de luz", "te muestra el nivel de luz en bloques, para prevenir mob spawns");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderWorld(RenderWorldEvent event) {
|
||||
if (mc.player == null || mc.world == null) return;
|
||||
if (mc.player.age % interval.getIntValue() == 0) {
|
||||
blocks = findExposedBlocks(
|
||||
radius.getIntValue(),
|
||||
yRadius.getIntValue()
|
||||
);
|
||||
}
|
||||
|
||||
for (BlockPos block : blocks) {
|
||||
if (!mc.world.isTopSolid(block, mc.player) || !mc.world.getBlockState(block).isOpaque()) continue;
|
||||
int light = mc.world.getLightLevel(LightType.BLOCK, block.up());
|
||||
|
||||
Color color = light == 0 ? darknessColor.getColor()
|
||||
: new Color(
|
||||
(lightColor.getR() / 15) * light,
|
||||
(lightColor.getG() / 15) * light,
|
||||
(lightColor.getB() / 15) * light,
|
||||
lightColor.getA());
|
||||
|
||||
RenderUtil.drawBlockFaceFilled(event.getMatrices(), block, Direction.UP, color, 0.001f);
|
||||
}
|
||||
}
|
||||
|
||||
private List<BlockPos> findExposedBlocks(int radius, int yRadius) {
|
||||
List<BlockPos> results = new ArrayList<>();
|
||||
|
||||
BlockPos pos = mc.player.getBlockPos();
|
||||
|
||||
int minX = pos.getX() - radius;
|
||||
int maxX = pos.getX() + radius;
|
||||
int minY = Math.max(mc.world.getDimension().minY(), pos.getY() - yRadius);
|
||||
int maxY = Math.min(mc.world.getDimension().height() - 1, pos.getY() + yRadius);
|
||||
int minZ = pos.getZ() - radius;
|
||||
int maxZ = pos.getZ() + radius;
|
||||
|
||||
maxY = Math.min(maxY, mc.world.getDimension().height() - 2);
|
||||
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
for (int y = minY; y <= maxY; y++) {
|
||||
BlockPos current = new BlockPos(x, y, z);
|
||||
BlockPos above = current.up();
|
||||
|
||||
if (!mc.world.isAir(current) && (mc.world.isAir(above) || (mc.world.isWater(above) && onWater.isEnabled())))
|
||||
results.add(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.AddEntityEvent;
|
||||
import me.retucio.camtweaks.event.events.RenderWorldEvent;
|
||||
import me.retucio.camtweaks.event.events.camtweaks.AddEntityEvent;
|
||||
import me.retucio.camtweaks.event.events.camtweaks.RemoveEntityEvent;
|
||||
import me.retucio.camtweaks.event.events.TickEvent;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import me.retucio.camtweaks.module.settings.ColorSetting;
|
||||
import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||
import me.retucio.camtweaks.util.render.RenderUtil;
|
||||
|
||||
import net.minecraft.client.network.OtherClientPlayerEntity;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import org.joml.*;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
import java.awt.*;
|
||||
import java.time.Instant;
|
||||
@@ -25,91 +25,261 @@ import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
// lógica sutilmente robada de MeteorClient porque la mía era una mierda
|
||||
public class LogoutSpots extends Module {
|
||||
|
||||
public BooleanSetting filledBox = addSetting(new BooleanSetting("caja rellena", "rellenar caja", true));
|
||||
public BooleanSetting outlineBox = addSetting(new BooleanSetting("caja de esquinas", "contorno de caja", true));
|
||||
public BooleanSetting outlines = addSetting(new BooleanSetting("contorno", "renderizar contorno de la caja (lados)", true));
|
||||
public ColorSetting outlineColor = addSetting(new ColorSetting("color del contorno", "Color de las líneas", new Color(255, 0, 0, 230), false));
|
||||
|
||||
public NumberSetting red = addSetting(new NumberSetting("rojo", "cantidad de rojo", 200, 0, 255, 1));
|
||||
public NumberSetting green = addSetting(new NumberSetting("verde", "cantidad de verde", 90, 0, 255, 1));
|
||||
public NumberSetting blue = addSetting(new NumberSetting("azul", "cantidad de azul", 255, 0, 255, 1));
|
||||
public NumberSetting alpha = addSetting(new NumberSetting("opacidad", "antitransparencia", 50, 0, 255, 1));
|
||||
public BooleanSetting filling = addSetting(new BooleanSetting("relleno", "renderizar relleno de la caja (caras)", true));
|
||||
public ColorSetting fillingColor = addSetting(new ColorSetting("color del relleno", "Color de los lados", new Color(230, 0, 0, 55), false));
|
||||
|
||||
public NumberSetting lineWidth = addSetting(new NumberSetting("grosor", "grosor de las líneas a dibujar",
|
||||
2, 1, 10, 0.5f));
|
||||
public BooleanSetting fullHeight = addSetting(new BooleanSetting("hitbox completa", "renderizar la caja completa de la hitbox, o solo marcar la posición", true));
|
||||
|
||||
private final List<LogoutBox> boxes = new ArrayList<>();
|
||||
public BooleanSetting dummy = addSetting(new BooleanSetting("monigote", "spawnear un monigote para marcar la posición", true));
|
||||
public EnumSetting<Nametags.HealthMode> healthMode = addSetting(new EnumSetting<>("formato de vida", "en qué formato mostrar la vida del jugador",
|
||||
Nametags.HealthMode.class, Nametags.HealthMode.POINTS));
|
||||
|
||||
private final List<LogoutEntry> players = new ArrayList<>();
|
||||
private final List<PlayerListEntry> lastPlayerList = new ArrayList<>();
|
||||
private final List<PlayerEntity> lastPlayers = new ArrayList<>();
|
||||
|
||||
private int timer;
|
||||
private DimensionType lastDimension;
|
||||
|
||||
public LogoutSpots() {
|
||||
super("puntos de desconexión", "te muestra los puntos donde se desconectan los jugadores");
|
||||
super("puntos de desconexión", "te muestra los puntos donde otros jugadores se desconectan");
|
||||
|
||||
outlines.onUpdate(v -> {
|
||||
outlineColor.setVisible(v);
|
||||
fullHeight.setVisible(v || filling.isEnabled());
|
||||
});
|
||||
|
||||
filling.onUpdate(v -> {
|
||||
fillingColor.setVisible(v);
|
||||
fullHeight.setVisible(v || outlines.isEnabled());
|
||||
});
|
||||
|
||||
dummy.onUpdate(v -> {
|
||||
if (!v) removeDummies();
|
||||
healthMode.setVisible(v);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if (mc.getNetworkHandler() != null) {
|
||||
lastPlayerList.clear();
|
||||
lastPlayerList.addAll(mc.getNetworkHandler().getPlayerList());
|
||||
}
|
||||
|
||||
updateLastPlayers();
|
||||
|
||||
timer = 10;
|
||||
if (mc.world != null) lastDimension = mc.world.getDimension();
|
||||
|
||||
super.onEnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
removeDummies();
|
||||
|
||||
players.clear();
|
||||
lastPlayerList.clear();
|
||||
lastPlayers.clear();
|
||||
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (mc.world == null || mc.getNetworkHandler() == null) return;
|
||||
|
||||
if (mc.getNetworkHandler().getPlayerList().size() != lastPlayerList.size()) {
|
||||
for (PlayerListEntry entry : lastPlayerList) {
|
||||
boolean stillOnline = mc.getNetworkHandler().getPlayerList().stream()
|
||||
.anyMatch(playerEntry -> playerEntry.getProfile().id().equals(entry.getProfile().id()));
|
||||
|
||||
if (stillOnline) continue;
|
||||
|
||||
// encontrar al jugador que se ha desconectado
|
||||
for (PlayerEntity player : lastPlayers) {
|
||||
if (player.getUuid().equals(entry.getProfile().id())) {
|
||||
LogoutEntry logoutEntry = new LogoutEntry(player);
|
||||
|
||||
if (mc.world != null && !mc.world.hasEntity(logoutEntry.dummy) && dummy.isEnabled())
|
||||
mc.world.addEntity(logoutEntry.dummy);
|
||||
|
||||
addLogoutSpot(logoutEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastPlayerList.clear();
|
||||
lastPlayerList.addAll(mc.getNetworkHandler().getPlayerList());
|
||||
updateLastPlayers();
|
||||
}
|
||||
|
||||
if (timer <= 0) {
|
||||
updateLastPlayers();
|
||||
timer = 10;
|
||||
} else {
|
||||
timer--;
|
||||
}
|
||||
|
||||
// borrar todos los logout spots al cambiar de dimensión
|
||||
DimensionType currentDimension = mc.world.getDimension();
|
||||
if (currentDimension != lastDimension) {
|
||||
for (LogoutEntry entry : players) {
|
||||
if (entry.dummy != null) {
|
||||
entry.dummy.remove(Entity.RemovalReason.KILLED);
|
||||
entry.dummy.onRemoved();
|
||||
}
|
||||
}
|
||||
players.clear();
|
||||
}
|
||||
lastDimension = currentDimension;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityAdded(AddEntityEvent event) {
|
||||
if (event.getEntity() instanceof PlayerEntity player) {
|
||||
for (LogoutEntry entry : players) {
|
||||
if (entry.uuid.equals(player.getUuid())) {
|
||||
if (entry.dummy != null && mc.world != null) {
|
||||
if (mc.world.getEntityById(entry.dummy.getId()) != null) {
|
||||
entry.dummy.remove(Entity.RemovalReason.KILLED);
|
||||
entry.dummy.onRemoved();
|
||||
}
|
||||
}
|
||||
players.remove(entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRender(RenderWorldEvent event) {
|
||||
if (mc.player == null || mc.world == null) return;
|
||||
|
||||
int r = red.getIntValue();
|
||||
int g = green.getIntValue();
|
||||
int b = blue.getIntValue();
|
||||
int a = alpha.getIntValue();
|
||||
for (LogoutEntry entry : players)
|
||||
entry.renderBox(event.getMatrices());
|
||||
}
|
||||
|
||||
MatrixStack matrices = event.getMatrices();
|
||||
private void addLogoutSpot(LogoutEntry entry) {
|
||||
for (LogoutEntry e : players) {
|
||||
if (e.uuid.equals(entry.uuid)) {
|
||||
if (e.dummy != null && mc.world != null) {
|
||||
if (mc.world.getEntityById(e.dummy.getId()) != null) {
|
||||
e.dummy.remove(Entity.RemovalReason.KILLED);
|
||||
e.dummy.onRemoved();
|
||||
}
|
||||
}
|
||||
players.remove(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (LogoutBox box : boxes) {
|
||||
if (filledBox.isEnabled())
|
||||
RenderUtil.drawFilledBox(matrices, box.dummy.getBoundingBox(), new Color(r, g, b, a));
|
||||
if (outlineBox.isEnabled())
|
||||
RenderUtil.drawOutlineBox(matrices, box.dummy.getBoundingBox(), new Color(r, g, b, a), lineWidth.getFloatValue());
|
||||
players.add(entry);
|
||||
}
|
||||
|
||||
private void updateLastPlayers() {
|
||||
if (mc.world == null) return;
|
||||
|
||||
lastPlayers.clear();
|
||||
for (Entity entity : mc.world.getEntities())
|
||||
if (entity instanceof PlayerEntity player && player != mc.player)
|
||||
lastPlayers.add(player);
|
||||
}
|
||||
|
||||
private void removeDummies() {
|
||||
for (LogoutEntry entry : players) {
|
||||
if (entry.dummy != null) {
|
||||
entry.dummy.remove(Entity.RemovalReason.KILLED);
|
||||
entry.dummy.onRemoved();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityRemoved(RemoveEntityEvent event) {
|
||||
if (event.getEntity() instanceof PlayerEntity player && player != mc.player) {
|
||||
if (mc.world != null && mc.world.hasEntity(player)) return; // asegurarse de que salirse de la distancia de renderizado no cuenta como "desconectarse"
|
||||
String playerName = player.getName().getString() + " (" + getLogoutTime(System.currentTimeMillis()) + ")";
|
||||
|
||||
boxes.add(new LogoutBox(
|
||||
ModuleManager.INSTANCE.getModuleByClass(FakePlayer.class).addPlayer(player, playerName),
|
||||
System.currentTimeMillis()
|
||||
));
|
||||
private class LogoutEntry {
|
||||
|
||||
public final double x, y, z;
|
||||
public final double xWidth, zWidth, halfWidth, height;
|
||||
|
||||
public final UUID uuid;
|
||||
public final String name;
|
||||
public final int health;
|
||||
public final String logoutTime;
|
||||
|
||||
public final String dummyName;
|
||||
public final OtherClientPlayerEntity dummy;
|
||||
|
||||
public LogoutEntry(PlayerEntity player) {
|
||||
this.halfWidth = player.getWidth() / 2;
|
||||
this.x = player.getX() - halfWidth;
|
||||
this.y = player.getY();
|
||||
this.z = player.getZ() - halfWidth;
|
||||
|
||||
Box box = player.getBoundingBox();
|
||||
this.xWidth = box.getLengthX();
|
||||
this.zWidth = box.getLengthZ();
|
||||
this.height = box.getLengthY();
|
||||
|
||||
this.uuid = player.getUuid();
|
||||
this.name = player.getName().getString();
|
||||
this.health = Math.round(player.getHealth() + player.getAbsorptionAmount());
|
||||
this.logoutTime = getLogoutTime();
|
||||
|
||||
String healthText = healthMode.is(Nametags.HealthMode.HEARTS)
|
||||
? String.format("%.2f", (float) health / 2)
|
||||
: health + "hp";
|
||||
|
||||
this.dummyName = name + " [" + healthText + "] (" + logoutTime + ")";
|
||||
this.dummy = ModuleManager.INSTANCE.getModuleByClass(FakePlayer.class).addPlayer(player, dummyName);
|
||||
|
||||
this.dummy.updatePositionAndAngles(x + halfWidth, y, z + halfWidth,
|
||||
player.getYaw(), player.getPitch());
|
||||
}
|
||||
|
||||
private String getLogoutTime() {
|
||||
try {
|
||||
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||
Instant instant = Instant.now();
|
||||
ZoneOffset offset = ZoneOffset.ofHours(hud.timezone.getIntValue());
|
||||
LocalTime logoutTime = LocalTime.from(instant.atOffset(offset));
|
||||
|
||||
boolean is24 = hud.timeFormat.is(HUD.TimeFormat.TWENTY_FOUR_HOUR);
|
||||
DateTimeFormatter format = DateTimeFormatter.ofPattern(is24 ? "HH:mm" : "hh:mm a");
|
||||
return logoutTime.format(format);
|
||||
} catch (Exception e) {
|
||||
return "??:??";
|
||||
}
|
||||
}
|
||||
|
||||
public void renderBox(MatrixStack matrices) {
|
||||
if (fullHeight.isEnabled()) {
|
||||
if (outlines.isEnabled())
|
||||
RenderUtil.drawOutlineBox(matrices, new Box(x, y, z, x + xWidth, y + height, z + zWidth), outlineColor.getColor(), 1.5);
|
||||
if (filling.isEnabled())
|
||||
RenderUtil.drawFilledBox(matrices, new Box(x, y, z, x + xWidth, y + height, z + zWidth), fillingColor.getColor());
|
||||
} else {
|
||||
if (outlines.isEnabled()) {
|
||||
Box bottomBox = new Box(x, y, z, x + xWidth, y + 0.01, z + zWidth);
|
||||
RenderUtil.drawOutlineBox(matrices, bottomBox, outlineColor.getColor(), 1.5);
|
||||
}
|
||||
if (filling.isEnabled()) {
|
||||
RenderUtil.drawBlockFaceFilled(matrices,
|
||||
net.minecraft.util.math.BlockPos.ofFloored(x + halfWidth, y, z + halfWidth),
|
||||
net.minecraft.util.math.Direction.UP, fillingColor.getColor(), 0.001f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityAdded(AddEntityEvent event) {
|
||||
boxes.removeIf(box -> event.getEntity().getUuid().equals(box.dummy.getUuid()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
boxes.forEach(box -> {
|
||||
box.dummy.setRemoved(Entity.RemovalReason.KILLED);
|
||||
box.dummy.onRemoved();
|
||||
});
|
||||
|
||||
boxes.clear();
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
private String getLogoutTime(long logoutTimeMillis) {
|
||||
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||
|
||||
Instant instant = Instant.ofEpochMilli(logoutTimeMillis);
|
||||
|
||||
ZoneOffset offset = ZoneOffset.ofHours(hud.timezone.getIntValue());
|
||||
LocalTime logoutTime = LocalTime.from(instant.atOffset(offset));
|
||||
|
||||
boolean is24 = hud.timeFormat.is(HUD.TimeFormat.TWENTY_FOUR_HOUR);
|
||||
DateTimeFormatter format = DateTimeFormatter.ofPattern(is24 ? "HH:mm" : "hh:mm a");
|
||||
|
||||
return logoutTime.format(format);
|
||||
}
|
||||
|
||||
public record LogoutBox(
|
||||
OtherClientPlayerEntity dummy,
|
||||
long logoutTime
|
||||
) {}
|
||||
}
|
||||
@@ -11,12 +11,12 @@ import net.minecraft.util.Formatting;
|
||||
|
||||
/** continúa en:
|
||||
* @see me.retucio.camtweaks.mixin.ClientPlayNetworkHandlerMixin
|
||||
* @see me.retucio.camtweaks.mixin.EntityEffectParticleEffectMixin
|
||||
* @see me.retucio.camtweaks.mixin.FogRendererMixin
|
||||
* @see me.retucio.camtweaks.mixin.GameRendererMixin
|
||||
* @see me.retucio.camtweaks.mixin.InGameHudMixin
|
||||
* @see me.retucio.camtweaks.mixin.InGameOverlayRendererMixin
|
||||
* @see me.retucio.camtweaks.mixin.ParticleManagerMixin
|
||||
* @see me.retucio.camtweaks.mixin.StatusEffectFogModifierMixin
|
||||
* @see me.retucio.camtweaks.mixin.StuckArrowsFeatureRendererMixin
|
||||
* @see me.retucio.camtweaks.mixin.TextRendererDrawerMixin
|
||||
* @see me.retucio.camtweaks.mixin.WeatherRenderingMixin
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
||||
/** continúa en:
|
||||
* @see me.retucio.camtweaks.mixin.ClientCommonNetworkHandlerMixin
|
||||
* @see me.retucio.camtweaks.mixin.ConfirmScreenMixin
|
||||
* @see me.retucio.camtweaks.mixin.ResourcePackPolicyMixin
|
||||
* @see me.retucio.camtweaks.mixin.ServerConnectorMixin
|
||||
* @see me.retucio.camtweaks.mixin.ServerInfoMixin
|
||||
*/
|
||||
|
||||
public class RPackBypass extends Module {
|
||||
|
||||
public String TAG_NAME = "bypassTextures";
|
||||
public String ENUM_NAME = "BYPASS";
|
||||
public Text BYPASS_TEXT = Text.literal("nuh uh");
|
||||
|
||||
public RPackBypass() {
|
||||
super("bypassear packs", "te permite omitir packs de recursos forzados por servers");
|
||||
}
|
||||
|
||||
public ServerInfo.ResourcePackPolicy getPolicy() {
|
||||
return ServerInfo.ResourcePackPolicy.valueOf(ENUM_NAME);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.DisconnectEvent;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
|
||||
public class Reconnect extends Module {
|
||||
|
||||
private ServerInfo lastServer = null;
|
||||
|
||||
public Reconnect() {
|
||||
super("reconectar", "añade un botón para reconectarse a un servidor tras ser desconectado");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDisconnect(DisconnectEvent event) {
|
||||
lastServer = event.getServer();
|
||||
}
|
||||
|
||||
public void reconnect() {
|
||||
if (lastServer == null) return;
|
||||
ConnectScreen.connect(
|
||||
null,
|
||||
mc,
|
||||
ServerAddress.parse(lastServer.address),
|
||||
lastServer,
|
||||
false,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,34 +6,28 @@ import me.retucio.camtweaks.mixin.accessor.HandledScreenAccessor;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.KeySetting;
|
||||
import me.retucio.camtweaks.ui.screen.ShulkerPreviewScreen;
|
||||
import me.retucio.camtweaks.ui.screen.PreviewScreen;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import me.retucio.camtweaks.util.Colors;
|
||||
|
||||
import me.retucio.camtweaks.util.MiscUtil;
|
||||
import net.minecraft.block.ShulkerBoxBlock;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.component.ComponentType;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.component.type.ContainerComponent;
|
||||
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.Items;
|
||||
import net.minecraft.item.tooltip.TooltipType;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
|
||||
import net.minecraft.text.Text;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
public class ShulkerPeek extends Module {
|
||||
|
||||
public KeySetting previewKey = addSetting(new KeySetting("tecla de previsualización", "tecla a mantener para previsualizar", GLFW.GLFW_KEY_LEFT_ALT));
|
||||
@@ -45,23 +39,23 @@ public class ShulkerPeek extends Module {
|
||||
super("prev. de shulkers", "te permite previsualizar el contenido de shulkers desde el inventario");
|
||||
|
||||
// colores y tal (https://github.com/kgriff0n/shulker-preview)
|
||||
SHULKER_COLORS.put(Items.SHULKER_BOX, new Color(142, 108, 142));
|
||||
SHULKER_COLORS.put(Items.WHITE_SHULKER_BOX, new Color(225, 230, 230));
|
||||
SHULKER_COLORS.put(Items.LIGHT_GRAY_SHULKER_BOX, new Color(137, 137, 128));
|
||||
SHULKER_COLORS.put(Items.GRAY_SHULKER_BOX, new Color(60, 65, 68));
|
||||
SHULKER_COLORS.put(Items.BLACK_SHULKER_BOX, new Color(31, 31, 35));
|
||||
SHULKER_COLORS.put(Items.BROWN_SHULKER_BOX, new Color(113, 70, 39));
|
||||
SHULKER_COLORS.put(Items.RED_SHULKER_BOX, new Color(152, 36, 34));
|
||||
SHULKER_COLORS.put(Items.ORANGE_SHULKER_BOX, new Color(241, 114, 15));
|
||||
SHULKER_COLORS.put(Items.YELLOW_SHULKER_BOX, new Color(249, 196, 35));
|
||||
SHULKER_COLORS.put(Items.LIME_SHULKER_BOX, new Color(110, 185, 24));
|
||||
SHULKER_COLORS.put(Items.GREEN_SHULKER_BOX, new Color(83, 107, 29));
|
||||
SHULKER_COLORS.put(Items.CYAN_SHULKER_BOX, new Color(22, 133, 144));
|
||||
SHULKER_COLORS.put(Items.LIGHT_BLUE_SHULKER_BOX, new Color(57, 177, 215));
|
||||
SHULKER_COLORS.put(Items.BLUE_SHULKER_BOX, new Color(49, 52, 152));
|
||||
SHULKER_COLORS.put(Items.PURPLE_SHULKER_BOX, new Color(113, 37, 166));
|
||||
SHULKER_COLORS.put(Items.MAGENTA_SHULKER_BOX, new Color(183, 61, 172));
|
||||
SHULKER_COLORS.put(Items.PINK_SHULKER_BOX, new Color(239, 135, 166));
|
||||
SHULKER_COLORS.put(Items.SHULKER_BOX, Colors.LAVENDER);
|
||||
SHULKER_COLORS.put(Items.WHITE_SHULKER_BOX, Colors.WHITE);
|
||||
SHULKER_COLORS.put(Items.LIGHT_GRAY_SHULKER_BOX, Colors.SILVER);
|
||||
SHULKER_COLORS.put(Items.GRAY_SHULKER_BOX, Colors.GRAY);
|
||||
SHULKER_COLORS.put(Items.BLACK_SHULKER_BOX, Colors.BLACK);
|
||||
SHULKER_COLORS.put(Items.BROWN_SHULKER_BOX, Colors.BROWN);
|
||||
SHULKER_COLORS.put(Items.RED_SHULKER_BOX, Colors.RED);
|
||||
SHULKER_COLORS.put(Items.ORANGE_SHULKER_BOX, Colors.ORANGE);
|
||||
SHULKER_COLORS.put(Items.YELLOW_SHULKER_BOX, Colors.YELLOW);
|
||||
SHULKER_COLORS.put(Items.LIME_SHULKER_BOX, Colors.LIME);
|
||||
SHULKER_COLORS.put(Items.GREEN_SHULKER_BOX, Colors.GREEN);
|
||||
SHULKER_COLORS.put(Items.CYAN_SHULKER_BOX, Colors.CYAN);
|
||||
SHULKER_COLORS.put(Items.LIGHT_BLUE_SHULKER_BOX, Colors.CELESTE);
|
||||
SHULKER_COLORS.put(Items.BLUE_SHULKER_BOX, Colors.BLUE);
|
||||
SHULKER_COLORS.put(Items.PURPLE_SHULKER_BOX, Colors.PURPLE);
|
||||
SHULKER_COLORS.put(Items.MAGENTA_SHULKER_BOX, Colors.MAGENTA);
|
||||
SHULKER_COLORS.put(Items.PINK_SHULKER_BOX, Colors.PINK);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -75,31 +69,45 @@ public class ShulkerPeek extends Module {
|
||||
}
|
||||
|
||||
if (event.getAction() == GLFW.GLFW_REPEAT) {
|
||||
if (!(mc.currentScreen instanceof ShulkerPreviewScreen)) {
|
||||
openPreviewScreen();
|
||||
return;
|
||||
}
|
||||
if (mc.currentScreen instanceof PreviewScreen preview) {
|
||||
if (preview.getType() != PreviewScreen.PreviewType.SHULKER)
|
||||
openPreviewScreen();
|
||||
} else openPreviewScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getAction() == GLFW.GLFW_RELEASE) {
|
||||
if (mc.currentScreen instanceof ShulkerPreviewScreen preview)
|
||||
if (mc.currentScreen instanceof PreviewScreen preview)
|
||||
preview.close();
|
||||
}
|
||||
}
|
||||
|
||||
private void openPreviewScreen() {
|
||||
if (!(mc.currentScreen instanceof HandledScreen<?> prevScreen)) return;
|
||||
ItemStack stack;
|
||||
|
||||
Slot focusedSlot = ((HandledScreenAccessor) prevScreen).getFocusedSlot();
|
||||
if (focusedSlot == null) return;
|
||||
if (mc.currentScreen instanceof PreviewScreen previewScreen) {
|
||||
int focusedSlot = previewScreen.getFocusedSlot();
|
||||
if (focusedSlot == -1) return;
|
||||
stack = previewScreen.getInventory().get(focusedSlot);
|
||||
} else if (mc.currentScreen instanceof HandledScreen<?> handledScreen) {
|
||||
stack = ((HandledScreenAccessor) handledScreen).getFocusedSlot().getStack();
|
||||
} else return;
|
||||
|
||||
ItemStack stack = focusedSlot.getStack();
|
||||
if (isShulkerEmpty(stack)) return;
|
||||
if (stack.getItem() == Items.ENDER_CHEST) {
|
||||
if (MiscUtil.getEchestInv() == null) {
|
||||
ChatUtil.warn("abre un enderchest primero");
|
||||
return;
|
||||
}
|
||||
mc.setScreen(new PreviewScreen(MiscUtil.getEchestInv(), mc.currentScreen));
|
||||
return;
|
||||
}
|
||||
|
||||
mc.setScreen(new ShulkerPreviewScreen(stack, prevScreen));
|
||||
else if (isShulkerEmpty(stack)) return;
|
||||
mc.setScreen(new PreviewScreen(stack, mc.currentScreen));
|
||||
}
|
||||
|
||||
public static boolean isShulkerEmpty(ItemStack stack) {
|
||||
if (stack == null) return true;
|
||||
if (!(stack.getItem() instanceof BlockItem blockItem)) return true;
|
||||
if (!(blockItem.getBlock() instanceof ShulkerBoxBlock)) return true;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import net.minecraft.network.packet.s2c.play.WorldTimeUpdateS2CPacket;
|
||||
|
||||
// continúa en ClientWorldPropertiesMixin, DimensionTypeMixin,
|
||||
@@ -29,12 +30,14 @@ public class TimeChanger extends Module {
|
||||
public void onEnable() {
|
||||
if (mc.world == null) return;
|
||||
realTime = mc.world.getTime();
|
||||
super.onEnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (mc.world == null) return;
|
||||
mc.world.getLevelProperties().setTimeOfDay(realTime);
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -55,7 +58,7 @@ public class TimeChanger extends Module {
|
||||
if (mc.world == null) return -1;
|
||||
|
||||
return switch (moonPhase.getValue()) {
|
||||
case DEFAULT -> (int) (mc.world.getLunarTime() / 24000L) % 8;
|
||||
case DEFAULT -> -1;
|
||||
case FULL_MOON -> 0;
|
||||
case WANING_GIBBOUS -> 1;
|
||||
case LAST_QUARTER -> 2;
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||
import me.retucio.camtweaks.module.settings.KeySetting;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class TooltipsPlus extends Module {
|
||||
|
||||
public EnumSetting<DisplayModes> displayMode = addSetting(new EnumSetting<>(
|
||||
"mostrar", "cúando mostrar la cajita de los huevos", DisplayModes.class, DisplayModes.ALWAYS));
|
||||
|
||||
public KeySetting displayKey = addSetting(new KeySetting(
|
||||
"tecla de visualización", "tecla a presionar para mostrar la cajita", GLFW.GLFW_KEY_LEFT_CONTROL));
|
||||
|
||||
public BooleanSetting middleClickPreview = addSetting(new BooleanSetting("preview de middle click",
|
||||
"abre una interfaz con los contenidos de un bloque de almacenamiento al presionar el middle click (la ruedita)", false));
|
||||
|
||||
public EnumSetting<SizeFormat> itemSize = addSetting(new EnumSetting<>(
|
||||
"tamaño del ítem", "cómo mostrar el tamaño del ítem en memoria", SizeFormat.class, SizeFormat.NONE));
|
||||
|
||||
|
||||
|
||||
public TooltipsPlus() {
|
||||
super("tooltips plus", "mejoras varias a las cajitas de descripción de items");
|
||||
}
|
||||
|
||||
public enum DisplayModes {
|
||||
ALWAYS("siempre"),
|
||||
KEY("al presionar una tecla"),
|
||||
NEVER("nunca");
|
||||
|
||||
final String name;
|
||||
DisplayModes(String name) { this.name = name; }
|
||||
@Override public String toString() { return name; }
|
||||
}
|
||||
|
||||
public enum SizeFormat {
|
||||
NONE("no mostrar"),
|
||||
BYTES("bytes"),
|
||||
KB("kilobytes"),
|
||||
MB("megabytes");
|
||||
|
||||
final String name;
|
||||
SizeFormat(String name) { this.name = name; }
|
||||
@Override public String toString() { return name; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
// al parecer DamageItemEvent no se lanza si estás en un server de Paper, o sea que ahora se usa onTick()
|
||||
public class WarnLowDurability extends Module {
|
||||
|
||||
public NumberSetting limitPercentage = addSetting(new NumberSetting("porcentaje", "porcentaje de durabilidad restante a la que se te avisa",
|
||||
5, 1, 100, 1));
|
||||
|
||||
public BooleanSetting message = addSetting(new BooleanSetting("mensaje", "enviar un mensaje para alertar al usuario", true));
|
||||
public BooleanSetting sound = addSetting(new BooleanSetting("sonido", "reproducir un sonido para alertar al usuario", true));
|
||||
|
||||
private final List<ItemStack> warned = new ArrayList<>();
|
||||
|
||||
public WarnLowDurability() {
|
||||
super("aviso de baja dur.", "te avisa cuando la herramienta que sostengas sobrepase un límite de durabilidad");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (mc.player == null || mc.world == null) return;
|
||||
ItemStack stack = mc.player.getStackInHand(Hand.MAIN_HAND);
|
||||
if (warned.contains(stack)) return;
|
||||
|
||||
float percentage = (1 - (float) stack.getDamage() / stack.getMaxDamage()) * 100;
|
||||
|
||||
if (percentage <= limitPercentage.getValue()) {
|
||||
if (sound.isEnabled())
|
||||
mc.world.playSound(mc.player, mc.player.getBlockPos(),
|
||||
SoundEvents.BLOCK_BELL_USE, SoundCategory.AMBIENT, 1, 1);
|
||||
|
||||
if (message.isEnabled()) {
|
||||
String customName = stack.getCustomName() == null ? "" : " \"" + stack.getCustomName().getString() + "\"";
|
||||
Text text = Text.literal(Formatting.AQUA + stack.getItemName().getString()
|
||||
+ Formatting.GREEN + customName + Formatting.RESET
|
||||
+ " a " + Formatting.GOLD + ((int) percentage + "") + "%"
|
||||
+ Formatting.RESET + " de durabilidad");
|
||||
ChatUtil.warn(text);
|
||||
}
|
||||
|
||||
warned.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
warned.clear();
|
||||
super.onDisable();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.GetFOVEvent;
|
||||
import me.retucio.camtweaks.event.events.MouseScrollEvent;
|
||||
@@ -37,20 +36,19 @@ public class Zoom extends Module {
|
||||
private double value;
|
||||
|
||||
public Zoom() {
|
||||
super("zoom", "lupa");
|
||||
super.keyMode.setValue(KeyModes.HOLD);
|
||||
super.keyMode.setDefaultValue(KeyModes.HOLD);
|
||||
super.notify.setEnabled(false);
|
||||
super.notify.setDefaultValue(false);
|
||||
assignKey(GLFW.GLFW_KEY_F);
|
||||
super("zoom", "lupa", GLFW.GLFW_KEY_F);
|
||||
|
||||
keyMode.setDefaultValue(KeyModes.HOLD);
|
||||
keyMode.setValue(KeyModes.HOLD);
|
||||
|
||||
notify.setDefaultValue(false);
|
||||
notify.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if (mc.options == null) return;
|
||||
|
||||
CameraTweaks.EVENT_BUS.register(this);
|
||||
|
||||
prevSmoothCam = mc.options.smoothCameraEnabled;
|
||||
prevMouseSens = mc.options.getMouseSensitivity().getValue();
|
||||
prevFov = mc.options.getFov().getValue();
|
||||
@@ -58,18 +56,21 @@ public class Zoom extends Module {
|
||||
mc.options.hudHidden = !showHUD.isEnabled();
|
||||
|
||||
value = defaultZoom.getValue();
|
||||
|
||||
super.onEnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (mc.options == null) return;
|
||||
CameraTweaks.EVENT_BUS.unregister(this);
|
||||
|
||||
mc.options.smoothCameraEnabled = prevSmoothCam;
|
||||
mc.options.getMouseSensitivity().setValue(prevMouseSens);
|
||||
mc.options.hudHidden = prevHUD;
|
||||
|
||||
mc.worldRenderer.scheduleTerrainUpdate();
|
||||
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
package me.retucio.camtweaks.module.settings;
|
||||
|
||||
import me.retucio.camtweaks.util.Colors;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ColorSetting extends AbstractSetting {
|
||||
|
||||
private Color color;
|
||||
private Consumer<Color> updateListener;
|
||||
|
||||
private Color defaultColor;
|
||||
private boolean defaultRainbow;
|
||||
private int defaultRainbowSpeed;
|
||||
|
||||
private int r, g, b, a;
|
||||
|
||||
private boolean rainbow;
|
||||
private int rainbowSpeed;
|
||||
private float saturation;
|
||||
private float brightness;
|
||||
|
||||
public ColorSetting(String name, String description, Color defaultColor, boolean rainbow) {
|
||||
super(name, description);
|
||||
this.color = this.defaultColor = defaultColor;
|
||||
|
||||
this.r = defaultColor.getRed();
|
||||
this.g = defaultColor.getGreen();
|
||||
this.b = defaultColor.getBlue();
|
||||
this.a = defaultColor.getAlpha();
|
||||
|
||||
this.rainbow = rainbow;
|
||||
this.defaultRainbow = rainbow;
|
||||
this.rainbowSpeed = 1000;
|
||||
this.defaultRainbowSpeed = rainbowSpeed;
|
||||
|
||||
this.saturation = 1f;
|
||||
this.brightness = 1f;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
if (rainbow) return Colors.rainbowColor(rainbowSpeed, a, saturation, brightness);
|
||||
return color;
|
||||
}
|
||||
|
||||
public int getR() {
|
||||
return getColor().getRed();
|
||||
}
|
||||
|
||||
public void setR(int r) {
|
||||
if (this.r != r) {
|
||||
this.r = Math.clamp(r, 0, 255);
|
||||
updateColorFromRGB();
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null) updateListener.accept(color);
|
||||
}
|
||||
}
|
||||
|
||||
public int getG() {
|
||||
return getColor().getGreen();
|
||||
}
|
||||
|
||||
public void setG(int g) {
|
||||
if (this.g != g) {
|
||||
this.g = Math.clamp(g, 0, 255);
|
||||
updateColorFromRGB();
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null) updateListener.accept(color);
|
||||
}
|
||||
}
|
||||
|
||||
public int getB() {
|
||||
return getColor().getBlue();
|
||||
}
|
||||
|
||||
public void setB(int b) {
|
||||
if (this.b != b) {
|
||||
this.b = Math.clamp(b, 0, 255);
|
||||
updateColorFromRGB();
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null) updateListener.accept(color);
|
||||
}
|
||||
}
|
||||
|
||||
public int getA() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public void setA(int a) {
|
||||
if (this.a != a) {
|
||||
this.a = Math.clamp(a, 0, 255);
|
||||
updateColorFromRGB();
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null) updateListener.accept(color);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateColorFromRGB() {
|
||||
this.color = new Color(r, g, b, a);
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
if (!this.color.equals(color)) {
|
||||
this.color = color;
|
||||
this.r = color.getRed();
|
||||
this.g = color.getGreen();
|
||||
this.b = color.getBlue();
|
||||
this.a = color.getAlpha();
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null) updateListener.accept(color);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRGB(int r, int g, int b) {
|
||||
setRGB(r, g, b, this.a);
|
||||
}
|
||||
|
||||
public void setRGB(int r, int g, int b, int a) {
|
||||
boolean changed = false;
|
||||
|
||||
if (this.r != r) {
|
||||
this.r = Math.clamp(r, 0, 255);
|
||||
changed = true;
|
||||
}
|
||||
if (this.g != g) {
|
||||
this.g = Math.clamp(g, 0, 255);
|
||||
changed = true;
|
||||
}
|
||||
if (this.b != b) {
|
||||
this.b = Math.clamp(b, 0, 255);
|
||||
changed = true;
|
||||
}
|
||||
if (this.a != a) {
|
||||
this.a = Math.clamp(a, 0, 255);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
updateColorFromRGB();
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null) updateListener.accept(color);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRainbow() {
|
||||
return rainbow;
|
||||
}
|
||||
|
||||
public void setRainbow(boolean rainbow) {
|
||||
if (this.rainbow != rainbow) {
|
||||
this.rainbow = rainbow;
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null) updateListener.accept(getColor());
|
||||
}
|
||||
}
|
||||
|
||||
public int getRainbowSpeed() {
|
||||
return rainbowSpeed;
|
||||
}
|
||||
|
||||
public void setRainbowSpeed(int rainbowSpeed) {
|
||||
if (this.rainbowSpeed != rainbowSpeed) {
|
||||
this.rainbowSpeed = rainbowSpeed;
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null && rainbow) updateListener.accept(getColor());
|
||||
}
|
||||
}
|
||||
|
||||
public float getSaturation() {
|
||||
return saturation;
|
||||
}
|
||||
|
||||
public void setSaturation(float saturation) {
|
||||
if (this.saturation != saturation) {
|
||||
this.saturation = Math.clamp(saturation, 0f, 1f);
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null && rainbow) updateListener.accept(getColor());
|
||||
}
|
||||
}
|
||||
|
||||
public float getBrightness() {
|
||||
return brightness;
|
||||
}
|
||||
|
||||
public void setBrightness(float brightness) {
|
||||
if (this.brightness != brightness) {
|
||||
this.brightness = Math.clamp(brightness, 0f, 1f);
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null && rainbow) updateListener.accept(getColor());
|
||||
}
|
||||
}
|
||||
|
||||
public Color getDefaultColor() {
|
||||
return defaultColor;
|
||||
}
|
||||
|
||||
public void setDefaultColor(Color defaultColor) {
|
||||
this.defaultColor = defaultColor;
|
||||
}
|
||||
|
||||
public int getDefaultR() {
|
||||
return defaultColor.getRed();
|
||||
}
|
||||
|
||||
public int getDefaultG() {
|
||||
return defaultColor.getGreen();
|
||||
}
|
||||
|
||||
public int getDefaultB() {
|
||||
return defaultColor.getBlue();
|
||||
}
|
||||
|
||||
public int getDefaultA() {
|
||||
return defaultColor.getAlpha();
|
||||
}
|
||||
|
||||
public float getDefaultSaturation() {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public float getDefaultBrightness() {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public boolean getDefaultRainbow() {
|
||||
return defaultRainbow;
|
||||
}
|
||||
|
||||
public int getDefaultRainbowSpeed() {
|
||||
return defaultRainbowSpeed;
|
||||
}
|
||||
|
||||
public int getRGB() {
|
||||
return getColor().getRGB();
|
||||
}
|
||||
|
||||
public Text getTooltipText() {
|
||||
if (rainbow) return Text.literal("arcoíris");
|
||||
return Text.literal(Colors.getFormatting(color) + Colors.ARGBtoHex(a, r, g, b));
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.color = defaultColor;
|
||||
this.r = defaultColor.getRed();
|
||||
this.g = defaultColor.getGreen();
|
||||
this.b = defaultColor.getBlue();
|
||||
this.a = defaultColor.getAlpha();
|
||||
this.rainbow = false;
|
||||
this.rainbowSpeed = 2;
|
||||
this.saturation = 1f;
|
||||
this.brightness = 1f;
|
||||
fireUpdateEvent();
|
||||
if (updateListener != null) updateListener.accept(color);
|
||||
}
|
||||
|
||||
public void onUpdate(Consumer<Color> listener) {
|
||||
this.updateListener = listener;
|
||||
if (updateListener != null) updateListener.accept(getColor());
|
||||
}
|
||||
|
||||
public Map<String, ?> getConfigValue() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("r", r);
|
||||
map.put("g", g);
|
||||
map.put("b", b);
|
||||
map.put("a", a);
|
||||
map.put("rb", rainbow);
|
||||
map.put("rs", rainbowSpeed);
|
||||
map.put("sat", saturation);
|
||||
map.put("bri", brightness);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,14 @@ import me.retucio.camtweaks.module.modules.HUD;
|
||||
import me.retucio.camtweaks.ui.screen.HudEditorScreen;
|
||||
import me.retucio.camtweaks.ui.widgets.HudElement;
|
||||
|
||||
import me.retucio.camtweaks.util.Colors;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.client.render.RenderTickCounter;
|
||||
import net.minecraft.network.packet.s2c.play.WorldTimeUpdateS2CPacket;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -22,6 +25,7 @@ import java.time.LocalTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -30,8 +34,11 @@ public class HudRenderer {
|
||||
|
||||
private static final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
// tps
|
||||
private static float estimatedTPS = 20f;
|
||||
private long lastPacketTime = 0;
|
||||
private static final List<Float> tpsHistory = new ArrayList<>();
|
||||
private long lastWorldTime = -1L;
|
||||
private long lastRealTime = -1L;
|
||||
|
||||
private static final Map<String, int[]> positions = ConfigManager.getConfig().hudPositions;
|
||||
private static final Map<String, Boolean> visibilities = ConfigManager.getConfig().hudVisibilities;
|
||||
@@ -76,6 +83,11 @@ public class HudRenderer {
|
||||
drawSnappedText(ctx, getElementText("time", delta, hud), mx, my, getColor(hud).getRGB(), hud.shadow.isEnabled());
|
||||
});
|
||||
|
||||
// ping
|
||||
addElement("ping", 2, 2 * (mc.textRenderer.fontHeight + 4), (ctx, mx, my, delta) -> {
|
||||
drawSnappedText(ctx, getElementText("ping", delta, hud), mx, my, getColor(hud).getRGB(), hud.shadow.isEnabled());
|
||||
});
|
||||
|
||||
HudEditorScreen.INSTANCE.setElements(getElements());
|
||||
}
|
||||
|
||||
@@ -95,13 +107,7 @@ public class HudRenderer {
|
||||
}
|
||||
|
||||
public static Color getColor(HUD hud) {
|
||||
if (hud.rainbow.isEnabled()) {
|
||||
float speed = 10001 - hud.rainbowSpeed.getFloatValue();
|
||||
float hue = (System.currentTimeMillis() % (int) speed) / speed;
|
||||
Color rgb = Color.getHSBColor(hue, 1, 1);
|
||||
return new Color(rgb.getRed(), rgb.getGreen(), rgb.getBlue(), hud.alpha.getIntValue());
|
||||
}
|
||||
return new Color(hud.red.getIntValue(), hud.green.getIntValue(), hud.blue.getIntValue(), hud.alpha.getIntValue());
|
||||
return hud.color.getColor();
|
||||
}
|
||||
|
||||
public static void drawSnappedText(DrawContext ctx, String text, int x, int y, int color, boolean shadow) {
|
||||
@@ -131,7 +137,7 @@ public class HudRenderer {
|
||||
|
||||
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||
if (!hud.isEnabled()) return;
|
||||
if (mc.getDebugHud().shouldShowDebugHud() && !hud.showOnF3.isEnabled()) return;
|
||||
if (mc.debugHudEntryList.isF3Enabled() && !hud.showOnF3.isEnabled()) return;
|
||||
if (mc.currentScreen instanceof ChatScreen && !hud.showOnChat.isEnabled()) return;
|
||||
|
||||
initElements();
|
||||
@@ -162,7 +168,7 @@ public class HudRenderer {
|
||||
return "FPS: " + mc.getCurrentFps();
|
||||
}
|
||||
case "tps" -> {
|
||||
return "TPS: " + estimatedTPS;
|
||||
return String.format("TPS: %.1f", estimatedTPS);
|
||||
}
|
||||
case "customText" -> {
|
||||
return ModuleManager.INSTANCE.getModuleByClass(HUD.class).customText.getValue();
|
||||
@@ -175,25 +181,56 @@ public class HudRenderer {
|
||||
DateTimeFormatter format = DateTimeFormatter.ofPattern(is24 ? "HH:mm" : "hh:mm a");
|
||||
return now.format(format);
|
||||
}
|
||||
case "ping" -> {
|
||||
if (mc.getNetworkHandler() == null || mc.player == null) return "? ms";
|
||||
if (mc.isInSingleplayer()) return "-1 ms";
|
||||
|
||||
PlayerListEntry playerListEntry = mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid());
|
||||
return playerListEntry != null ? playerListEntry.getLatency() + " ms" : "? ms";
|
||||
}
|
||||
default -> { return id; }
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onReceivePacket(PacketEvent.Receive event) {
|
||||
long now = System.currentTimeMillis();
|
||||
if (lastPacketTime > 0) {
|
||||
float tps = 1000f / (now - lastPacketTime);
|
||||
estimatedTPS = Math.min(20f, tps);
|
||||
if (event.getPacket() instanceof WorldTimeUpdateS2CPacket packet) {
|
||||
long currentWorldTime = packet.time();
|
||||
long currentRealTime = System.currentTimeMillis();
|
||||
|
||||
if (lastWorldTime != -1L && lastRealTime != -1L) {
|
||||
long elapsedRealTime = currentRealTime - lastRealTime;
|
||||
long elapsedWorldTicks = currentWorldTime - lastWorldTime;
|
||||
|
||||
if (elapsedRealTime > 0) {
|
||||
// TPS = (ticks passed) / (seconds passed)
|
||||
float tps = (float) elapsedWorldTicks / (elapsedRealTime / 1000.0f);
|
||||
|
||||
// clampear
|
||||
tps = Math.max(0.1f, Math.min(20.0f, tps));
|
||||
|
||||
// usar historial para suavizar resultados
|
||||
tpsHistory.add(tps);
|
||||
if (tpsHistory.size() > 10)
|
||||
tpsHistory.removeFirst();
|
||||
|
||||
// calcular media de tps
|
||||
float sum = 0;
|
||||
for (float t : tpsHistory) sum += t;
|
||||
estimatedTPS = sum / tpsHistory.size();
|
||||
}
|
||||
}
|
||||
|
||||
lastWorldTime = currentWorldTime;
|
||||
lastRealTime = currentRealTime;
|
||||
}
|
||||
lastPacketTime = now;
|
||||
}
|
||||
|
||||
/** para cuando se cambie el valor del texto custom */
|
||||
@SubscribeEvent
|
||||
public void onUpdateSetting(UpdateSettingEvent event) {
|
||||
if (ModuleManager.INSTANCE == null) return;
|
||||
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||
|
||||
if (event.getSetting() == hud.customText) {
|
||||
if (customTextElement != null) {
|
||||
int newX = mc.getWindow().getScaledWidth() / 2 - mc.textRenderer.getWidth(hud.customText.getValue()) / 2;
|
||||
|
||||
@@ -84,4 +84,7 @@ public class BindButton extends SettingButton {
|
||||
public void mouseReleased(double mouseX, double mouseY, int button) {
|
||||
ClickGUI.INSTANCE.unselect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(double mouseX, double mouseY) {}
|
||||
}
|
||||
Loaded 100 of 165 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user