Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
347ec658bb | ||
|
|
a9cf6dd924 | ||
|
|
8e44dda9cf |
No files matched your search
+3
-1
@@ -43,4 +43,6 @@ replay_*.log
|
||||
|
||||
todo.txt
|
||||
cambios.md
|
||||
remappedSrc/
|
||||
remappedSrc/
|
||||
src/main/java/me/retucio/camtweaks/ui/widgets/Frame.java
|
||||
src/main/java/me/retucio/camtweaks/ui/widgets/Button.java
|
||||
+13
-15
@@ -1,29 +1,27 @@
|
||||
# v1.7
|
||||
# v2.0
|
||||
|
||||
## novedades
|
||||
|
||||
|
||||
### adiciones
|
||||
|
||||
- comando `$echest` (o `$ec` si eres un puto vago) para previsualizar los contenidos del enderchest en cualquier momento
|
||||
- se ha añadido un gradiente negro leve en la parte inferior del clickgui si el contenido excede los límites de la pantalla, para indicarlo visualmente
|
||||
- ajuste de opción: similar a enumsetting, pero abre un marco de selección, igual que listsetting.
|
||||
|
||||
#### módulos nuevos:
|
||||
|
||||
- aviso de baja durabilidad: te avisa cuando un ítem llega a cierto porcentaje de durabilidad
|
||||
- bypassear packs: te permite omitir packs de recursos forzados por el servidor, al establecer el modo en "preguntar" y seleccionar la opción "nuh uh"
|
||||
- destello de enchants.: modifica el color del destello de los items y armadura encantada
|
||||
- resaltado de bloques: resalta bloques de cierto tipo renderizando una caja con su forma, visible a través de paredes
|
||||
- delay de paquetes: simula un ping alto añadiendo delay a los paquetes
|
||||
- inventario plus: te permite mover items a cualquier slot del inventario mediante teclas (ej.: d + tecla para slot 4);
|
||||
- progreso de minado: muestra el progreso de minado de un bloque de una manera más visual, mediante cajas de color
|
||||
- mano secundaria: equipa de manera automática un ítem en tu mano secundaria
|
||||
- moverse en interfaz: te permite utilizar las teclas de movimiento con ciertas interfaces abiertas (configurable)
|
||||
|
||||
### arreglos / mejoras
|
||||
|
||||
- ahora puedes volver a abrir el clickgui y el editor de hud en la pantalla de inicio
|
||||
- ya no se deja de renderizar el hud si algún modo de debug (chunks, hitboxes, etc.) está activado y "mostar en F3" está desactivado
|
||||
- ahora se pueden previsualizar enderchests igual que shulkers, desde el inventario (prev. de shulkers)
|
||||
- ahora el mod funciona al compilarlo tras clonarlo por github, ya que había gitignorado algunos archivos importantes jsajajs
|
||||
- arreglados los problemas del módulo zoom (creo)
|
||||
- arregladas las opciones de ceguera y oscuridad de norender
|
||||
- el color de la interfaz ya no es negro en el primer launch o cuando no se ha generado el archivo de config todavía
|
||||
- arreglado el problema donde se muestra la marca de agua por defecto en la pantalla de inicio si no se abre un mundo primero
|
||||
- ahora se pueden mostrar también las coordenadas del nether en el elemento del hud para coordenadas
|
||||
- ahora ChatPlus utilizará los corchetes [] para mostrar la hora (antes era <>), además de también detectar cuando un jugador se une a la hora de dibujar las cabezas
|
||||
- ahora puedes elegir el sonido en aviso de baja dur., junto a la altura y volumen de este
|
||||
- ya no se pueden abrir interfaces del mod estando en pantallas donde se suele escribir (chat, carteles, etc.)
|
||||
- arreglado algunos problemas con las configuraciones
|
||||
|
||||
## problemas reconocidos
|
||||
|
||||
|
||||
+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.8
|
||||
mod_version=2.0
|
||||
maven_group=me.retucio
|
||||
archives_base_name=camtweaks
|
||||
|
||||
|
||||
@@ -18,27 +18,30 @@ import me.retucio.camtweaks.module.ModuleManager;
|
||||
|
||||
import me.retucio.camtweaks.module.modules.HUD;
|
||||
import me.retucio.camtweaks.ui.screen.ClickGUI;
|
||||
import me.retucio.camtweaks.ui.screen.HudEditorScreen;
|
||||
import me.retucio.camtweaks.ui.HudRenderer;
|
||||
import me.retucio.camtweaks.ui.hud.HudEditorScreen;
|
||||
import me.retucio.camtweaks.ui.hud.HudRenderer;
|
||||
import me.retucio.camtweaks.ui.buttons.BindButton;
|
||||
import me.retucio.camtweaks.ui.buttons.SettingButton;
|
||||
import me.retucio.camtweaks.ui.buttons.TextButton;
|
||||
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
||||
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
||||
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import me.retucio.camtweaks.util.KeyUtil;
|
||||
import me.retucio.camtweaks.util.Lists;
|
||||
import me.retucio.camtweaks.util.MiscUtil;
|
||||
import me.retucio.camtweaks.util.*;
|
||||
|
||||
|
||||
import me.retucio.camtweaks.util.render.DrawUtil;
|
||||
import me.retucio.camtweaks.util.render.RenderUtil;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
import net.minecraft.client.gui.screen.ingame.AbstractCommandBlockScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.AnvilScreen;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -68,7 +71,7 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
|
||||
|
||||
private Screen prevScreen;
|
||||
public boolean settingsApplied = false;
|
||||
public static boolean settingsApplied = false;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -80,13 +83,20 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
ConfigManager.load();
|
||||
|
||||
EVENT_BUS.register(this);
|
||||
EVENT_BUS.register(MiscUtil.class);
|
||||
|
||||
EVENT_BUS.register(new HudRenderer());
|
||||
|
||||
EVENT_BUS.register(ChatUtil.class);
|
||||
EVENT_BUS.register(HudRenderer.class);
|
||||
EVENT_BUS.register(DrawUtil.class);
|
||||
EVENT_BUS.register(EntityUtil.class);
|
||||
EVENT_BUS.register(InventoryUtil.class);
|
||||
EVENT_BUS.register(MiscUtil.class);
|
||||
EVENT_BUS.register(NetworkUtil.class);
|
||||
EVENT_BUS.register(RenderUtil.class);
|
||||
|
||||
Lists.init();
|
||||
|
||||
ModuleManager.INSTANCE = new ModuleManager(EVENT_BUS);
|
||||
ModuleManager.INSTANCE = new ModuleManager();
|
||||
EVENT_BUS.post(new LoadModuleManagerEvent());
|
||||
|
||||
CommandManager.INSTANCE = new CommandManager();
|
||||
@@ -171,7 +181,8 @@ 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 (key != ClientSettingsFrame.guiSettings.getKey() || anyFocused || isOnTypingScreen())
|
||||
return;
|
||||
|
||||
// al parecer esto hace que con la tecla de la interfaz puedas ir cambiando de splash text en la pantalla del título
|
||||
// pero me ha hecho gracia así que así se queda
|
||||
@@ -186,9 +197,14 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
|
||||
// manejar la lógica de apertura del editor de elementos del hud, con la misma lógica que handleClickGUIKey()
|
||||
private void handleHudEditorKey(int key, boolean anyFocused) {
|
||||
if (key != ModuleManager.INSTANCE.getModuleByClass(HUD.class).editorKey.getKey() || anyFocused) return;
|
||||
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||
if (key != hud.editorKey.getKey() || anyFocused || isOnTypingScreen()) return;
|
||||
|
||||
if (mc.currentScreen != HudEditorScreen.INSTANCE) {
|
||||
if (!hud.isEnabled()) {
|
||||
ChatUtil.warn("HUD está desactivado, lumbreras");
|
||||
return;
|
||||
}
|
||||
prevScreen = mc.currentScreen;
|
||||
mc.setScreen(HudEditorScreen.INSTANCE);
|
||||
} else {
|
||||
@@ -206,6 +222,13 @@ public class CameraTweaks implements ClientModInitializer {
|
||||
module.setEnabled(false);
|
||||
}
|
||||
|
||||
private boolean isOnTypingScreen() {
|
||||
return mc.currentScreen instanceof ChatScreen
|
||||
|| mc.currentScreen instanceof AnvilScreen
|
||||
|| mc.currentScreen instanceof AbstractSignEditScreen
|
||||
|| mc.currentScreen instanceof AbstractCommandBlockScreen;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onStop(ShutdownEvent event) {
|
||||
ConfigManager.save();
|
||||
|
||||
@@ -41,6 +41,7 @@ public class CommandManager {
|
||||
addCommand(new PurgeCommand());
|
||||
addCommand(new SaveScreenshotCommand());
|
||||
addCommand(new SendCommand());
|
||||
addCommand(new SpectateCommand());
|
||||
addCommand(new ToggleCommand());
|
||||
|
||||
commands.sort(Comparator.comparing(Command::getName));
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
package me.retucio.camtweaks.command.args;
|
||||
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||
import com.mojang.brigadier.suggestion.Suggestions;
|
||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
|
||||
import me.retucio.camtweaks.util.EntityUtil;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
// para autocompletar entidades
|
||||
import static me.retucio.camtweaks.CameraTweaks.mc;
|
||||
|
||||
public class EntityArgumentType implements ArgumentType<Entity> {
|
||||
|
||||
public static final EntityArgumentType INSTANCE = new EntityArgumentType();
|
||||
private static final DynamicCommandExceptionType NO_SUCH_ENTITY = new DynamicCommandExceptionType(
|
||||
name -> Text.literal("Entidad \"" + name + "\" no encontrada"));
|
||||
|
||||
private static final Collection<String> EXAMPLES = List.of(
|
||||
"AdlerHitdolf",
|
||||
"@p"
|
||||
);
|
||||
|
||||
private static final Pattern UUID_PATTERN = Pattern.compile(
|
||||
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
|
||||
);
|
||||
|
||||
private EntityArgumentType() {}
|
||||
|
||||
@Override
|
||||
public Entity parse(StringReader reader) throws CommandSyntaxException {
|
||||
String argument = reader.readString();
|
||||
|
||||
if (mc.world == null)
|
||||
throw NO_SUCH_ENTITY.create(argument);
|
||||
|
||||
if (argument.startsWith("@"))
|
||||
return parseSelector(argument);
|
||||
|
||||
if (isUUID(argument)) {
|
||||
UUID uuid = UUID.fromString(argument);
|
||||
return findEntityByUUID(uuid);
|
||||
}
|
||||
|
||||
return findPlayerByName(argument);
|
||||
}
|
||||
|
||||
private boolean isUUID(String input) {
|
||||
return UUID_PATTERN.matcher(input).matches();
|
||||
}
|
||||
|
||||
private Entity parseSelector(String selector) throws CommandSyntaxException {
|
||||
if (mc.player == null) throw NO_SUCH_ENTITY.create(selector);
|
||||
|
||||
return switch (selector.toLowerCase()) {
|
||||
case "@p" ->
|
||||
findNearestPlayer();
|
||||
case "@r" ->
|
||||
findRandomPlayer();
|
||||
case "@s" ->
|
||||
mc.player;
|
||||
case "@a" -> throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.dispatcherUnknownArgument()
|
||||
.createWithContext(new StringReader(selector));
|
||||
default -> {
|
||||
if (selector.startsWith("@e"))
|
||||
yield parseEntitySelector(selector);
|
||||
else if (selector.startsWith("@p") && selector.length() > 2)
|
||||
yield parsePlayerSelector(selector);
|
||||
throw NO_SUCH_ENTITY.create(selector);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Entity findNearestPlayer() throws CommandSyntaxException {
|
||||
PlayerEntity nearest = null;
|
||||
double nearestDistance = Double.MAX_VALUE;
|
||||
|
||||
for (PlayerEntity player : mc.world.getPlayers()) {
|
||||
if (player == mc.player) continue;
|
||||
|
||||
double distance = mc.player.squaredDistanceTo(player);
|
||||
if (distance < nearestDistance) {
|
||||
nearestDistance = distance;
|
||||
nearest = player;
|
||||
}
|
||||
}
|
||||
|
||||
if (nearest == null)
|
||||
throw NO_SUCH_ENTITY.create("@p");
|
||||
|
||||
return nearest;
|
||||
}
|
||||
|
||||
private Entity findRandomPlayer() throws CommandSyntaxException {
|
||||
List<PlayerEntity> players = new ArrayList<>(mc.world.getPlayers());
|
||||
if (players.isEmpty()) throw NO_SUCH_ENTITY.create("@r");
|
||||
|
||||
players.remove(mc.player);
|
||||
if (players.isEmpty()) return mc.player;
|
||||
|
||||
Random random = new Random();
|
||||
return players.get(random.nextInt(players.size()));
|
||||
}
|
||||
|
||||
private Entity parseEntitySelector(String selector) throws CommandSyntaxException {
|
||||
if (selector.equals("@e")) {
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
for (Entity entity : mc.world.getEntities())
|
||||
if (!(entity instanceof PlayerEntity))
|
||||
entities.add(entity);
|
||||
|
||||
if (entities.isEmpty()) throw NO_SUCH_ENTITY.create(selector);
|
||||
|
||||
Random random = new Random();
|
||||
return entities.get(random.nextInt(entities.size()));
|
||||
}
|
||||
|
||||
if (selector.startsWith("@e[type=")) {
|
||||
String type = selector.substring(8, selector.length() - 1);
|
||||
return findEntityByType(type);
|
||||
}
|
||||
|
||||
throw NO_SUCH_ENTITY.create(selector);
|
||||
}
|
||||
|
||||
private Entity parsePlayerSelector(String selector) throws CommandSyntaxException {
|
||||
return findNearestPlayer();
|
||||
}
|
||||
|
||||
private Entity findEntityByType(String type) throws CommandSyntaxException {
|
||||
List<Entity> matchingEntities = new ArrayList<>();
|
||||
|
||||
for (Entity entity : mc.world.getEntities()) {
|
||||
String entityType = entity.getType().getTranslationKey();
|
||||
if (entityType.contains(type.toLowerCase().replace("minecraft:", "")))
|
||||
matchingEntities.add(entity);
|
||||
}
|
||||
|
||||
if (matchingEntities.isEmpty()) throw NO_SUCH_ENTITY.create(type);
|
||||
|
||||
Entity nearest = null;
|
||||
double nearestDistance = Double.MAX_VALUE;
|
||||
|
||||
for (Entity entity : matchingEntities) {
|
||||
double distance = mc.player.squaredDistanceTo(entity);
|
||||
if (distance < nearestDistance) {
|
||||
nearestDistance = distance;
|
||||
nearest = entity;
|
||||
}
|
||||
}
|
||||
|
||||
return nearest;
|
||||
}
|
||||
|
||||
private Entity findEntityByUUID(UUID uuid) throws CommandSyntaxException {
|
||||
for (Entity entity : mc.world.getEntities())
|
||||
if (entity.getUuid().equals(uuid))
|
||||
return entity;
|
||||
|
||||
throw NO_SUCH_ENTITY.create(uuid.toString());
|
||||
}
|
||||
|
||||
private PlayerEntity findPlayerByName(String name) throws CommandSyntaxException {
|
||||
for (PlayerEntity player : mc.world.getPlayers())
|
||||
if (player.getName().getString().equalsIgnoreCase(name))
|
||||
return player;
|
||||
|
||||
throw NO_SUCH_ENTITY.create(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
||||
if (mc.world != null)
|
||||
for (PlayerEntity player : mc.world.getPlayers())
|
||||
builder.suggest(player.getName().getString());
|
||||
|
||||
|
||||
builder.suggest("@p");
|
||||
builder.suggest("@r");
|
||||
builder.suggest("@s");
|
||||
|
||||
Entity lookingAt = EntityUtil.getEntityPlayerIsLookingAt();
|
||||
if (lookingAt != null)
|
||||
builder.suggest(lookingAt.getUuid().toString());
|
||||
|
||||
return builder.buildFuture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getExamples() {
|
||||
return EXAMPLES;
|
||||
}
|
||||
|
||||
public static Entity get(CommandContext<?> context, String name) {
|
||||
return context.getArgument(name, Entity.class);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
public class ModuleArgumentType implements ArgumentType<Module> {
|
||||
|
||||
public static final ModuleArgumentType INSTANCE = new ModuleArgumentType();
|
||||
private static final DynamicCommandExceptionType unknownModuleE = new DynamicCommandExceptionType(
|
||||
private static final DynamicCommandExceptionType UNKNOWN_MODULE = new DynamicCommandExceptionType(
|
||||
name -> Text.literal("módulo \"" + name + "\" no encontrado"));
|
||||
|
||||
private static final Collection<String> examples = ModuleManager.INSTANCE.getModules()
|
||||
@@ -29,7 +29,7 @@ public class ModuleArgumentType implements ArgumentType<Module> {
|
||||
public Module parse(StringReader reader) throws CommandSyntaxException {
|
||||
String argument = reader.readString().replace("_", " ");
|
||||
Module module = ModuleManager.INSTANCE.getModuleByName(argument);
|
||||
if (module == null) throw unknownModuleE.create(argument);
|
||||
if (module == null) throw UNKNOWN_MODULE.create(argument);
|
||||
return module;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ public class PlayerArgumentType implements ArgumentType<PlayerEntity> {
|
||||
|
||||
@Override
|
||||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
||||
return CommandSource.suggestMatching(mc.world.getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getName().getString()), builder);
|
||||
return CommandSource.suggestMatching(mc.world.getPlayers().stream().map(
|
||||
abstractClientPlayerEntity -> abstractClientPlayerEntity.getName().getString()), builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,8 +42,7 @@ public class BindCommand extends Command {
|
||||
public static boolean onKeyPress(int key) {
|
||||
if (listeningModule == null) return false;
|
||||
KeySetting bind = listeningModule.getBind();
|
||||
if (bind != null)
|
||||
bind.setKey(key);
|
||||
if (bind != null) bind.setKey(key);
|
||||
|
||||
ChatUtil.info(
|
||||
Text.of("la tecla " + Formatting.AQUA + KeyUtil.getKeyName(key) + Formatting.RESET +
|
||||
|
||||
@@ -4,23 +4,11 @@ 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 me.retucio.camtweaks.util.InventoryUtil;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.inventory.EnderChestInventory;
|
||||
import net.minecraft.inventory.Inventories;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.SimpleInventory;
|
||||
import net.minecraft.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 {
|
||||
@@ -36,7 +24,7 @@ public class EnderChestCommand extends Command {
|
||||
builder.executes(ctx -> {
|
||||
mc.execute(() -> {
|
||||
if (mc.player == null) return;
|
||||
if (MiscUtil.getEchestInv() == null) {
|
||||
if (InventoryUtil.getEchestInv() == null) {
|
||||
ChatUtil.warn("necesitas abrir un enderchest una vez primero");
|
||||
return;
|
||||
}
|
||||
@@ -49,11 +37,11 @@ public class EnderChestCommand extends Command {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void tickEvent(TickEvent.Post event) {
|
||||
public void onTick(TickEvent.Post event) {
|
||||
if (shouldOpenEchest) {
|
||||
shouldOpenEchest = false;
|
||||
if (MiscUtil.getEchestInv() != null)
|
||||
mc.setScreen(new PreviewScreen(MiscUtil.getEchestInv(), null));
|
||||
if (InventoryUtil.getEchestInv() != null)
|
||||
mc.setScreen(new PreviewScreen(InventoryUtil.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,50 @@
|
||||
package me.retucio.camtweaks.command.commands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import me.retucio.camtweaks.command.Command;
|
||||
import me.retucio.camtweaks.command.args.EntityArgumentType;
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.KeyEvent;
|
||||
import me.retucio.camtweaks.util.EntityUtil;
|
||||
import me.retucio.camtweaks.util.MiscUtil;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class SpectateCommand extends Command {
|
||||
|
||||
public SpectateCommand() {
|
||||
super("espectar", "te permite adquirir el punto de vista de una entidad", "spectate", "spec");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder
|
||||
.executes(ctx -> { // If no argument, use the entity player is looking at
|
||||
mc.execute(() -> {
|
||||
Entity target = EntityUtil.getEntityPlayerIsLookingAt();
|
||||
if (target != null)
|
||||
mc.setCameraEntity(target);
|
||||
});
|
||||
return SUCCESS;
|
||||
})
|
||||
.then(argument("entidad", EntityArgumentType.INSTANCE)
|
||||
.executes(ctx -> {
|
||||
Entity entity = EntityArgumentType.get(ctx, "entidad");
|
||||
if (mc.player != null && entity != null) {
|
||||
mc.setCameraEntity(entity);
|
||||
}
|
||||
return SUCCESS;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKey(KeyEvent event) {
|
||||
if (mc.getCameraEntity() != mc.player && mc.currentScreen == null
|
||||
&& event.getKey() == GLFW.GLFW_KEY_ESCAPE && event.getAction() != GLFW.GLFW_RELEASE ) {
|
||||
event.cancel();
|
||||
mc.setCameraEntity(mc.player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,9 @@ public class ClientConfig {
|
||||
// id del elemento del hud -> true: visible / false: no visible
|
||||
public Map<String, Boolean> hudVisibilities = new HashMap<>();
|
||||
|
||||
// posición de la barra de búsqueda (x, y)
|
||||
public int[] searchBarPosition = new int[]{340, 16};
|
||||
|
||||
public ClientConfig() {
|
||||
EVENT_BUS.register(this);
|
||||
}
|
||||
@@ -54,7 +57,9 @@ public class ClientConfig {
|
||||
case KeySetting k: value = k.getKey(); break;
|
||||
case NumberSetting n: value = n.getValue(); break;
|
||||
case StringSetting s: value = s.getValue(); break;
|
||||
case ListSetting l: value = l.getValues(); break;
|
||||
case ListSetting l: value = l.getConfigValues(); break;
|
||||
case ColorSetting c: value = c.getConfigValue(); break;
|
||||
case OptionSetting o: value = o.getIndex(); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.settings.*;
|
||||
import me.retucio.camtweaks.ui.frames.ModuleFrame;
|
||||
import me.retucio.camtweaks.ui.screen.ClickGUI;
|
||||
import me.retucio.camtweaks.ui.frames.ClientSettingsFrame;
|
||||
import me.retucio.camtweaks.ui.frames.SettingsFrame;
|
||||
@@ -23,24 +24,29 @@ 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 boolean loaded = false;
|
||||
private static ClientConfig config = null;
|
||||
|
||||
|
||||
// ------------------ MÉTODOS PRINCIPALES ------------------
|
||||
|
||||
// guardar configuraciones
|
||||
public static void save() {
|
||||
ensureConfig();
|
||||
|
||||
try (FileWriter writer = new FileWriter(CONFIG_FILE)) {
|
||||
GSON.toJson(config, writer);
|
||||
CameraTweaks.LOGGER.info("ajustes guardados");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
CameraTweaks.LOGGER.error("error al guardar ajustes", e);
|
||||
}
|
||||
}
|
||||
|
||||
// cargar configuraciones
|
||||
public static void load() {
|
||||
CameraTweaks.LOGGER.info("ajustes cargados");
|
||||
CameraTweaks.LOGGER.info("cargando ajustes...");
|
||||
|
||||
if (!CONFIG_FILE.exists()) {
|
||||
ensureConfig();
|
||||
save();
|
||||
@@ -49,74 +55,52 @@ public class ConfigManager {
|
||||
|
||||
try (FileReader reader = new FileReader(CONFIG_FILE)) {
|
||||
config = GSON.fromJson(reader, ClientConfig.class);
|
||||
CameraTweaks.LOGGER.info("ajustes cargados");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
CameraTweaks.LOGGER.error("no se pudieron cargar los ajustes, usando ajustes por defecto", e);
|
||||
ensureConfig();
|
||||
}
|
||||
}
|
||||
|
||||
// aplicar configuraciones cargadas
|
||||
public static void applyConfig() {
|
||||
if (CameraTweaks.mc == null || ModuleManager.INSTANCE == null || config == null)
|
||||
return;
|
||||
if (!shouldApply()) return;
|
||||
|
||||
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
||||
if (config.moduleStates.containsKey(module.getName()))
|
||||
module.setEnabled(config.moduleStates.get(module.getName())); // estados
|
||||
|
||||
module.getSettings().forEach(setting -> applySetting(module, setting));
|
||||
|
||||
if (config.settingsFrames.containsKey(module.getName())) {
|
||||
int[] position = config.settingsFrames.get(module.getName());
|
||||
ClickGUI.INSTANCE.openSettingsFrame(module, position[0], position[1]);
|
||||
}
|
||||
});
|
||||
|
||||
ClientSettingsFrame.guiSettings.setEnabled(true);
|
||||
ClientSettingsFrame.guiSettings.getSettings().forEach(setting -> applySetting(ClientSettingsFrame.guiSettings, setting));
|
||||
|
||||
CameraTweaks.LOGGER.info("módulos encendidos cargados");
|
||||
CameraTweaks.LOGGER.info("ajustes de módulos cargados");
|
||||
|
||||
ClientConfig.FrameData moduleFrameData = config.extendableFrames.get("M");
|
||||
if (moduleFrameData != null) {
|
||||
ClickGUI.INSTANCE.getModulesFrame().x = moduleFrameData.x();
|
||||
ClickGUI.INSTANCE.getModulesFrame().y = moduleFrameData.y();
|
||||
ClickGUI.INSTANCE.getModulesFrame().extended = moduleFrameData.extended();
|
||||
}
|
||||
|
||||
ClientConfig.FrameData guiSettingsData = config.extendableFrames.get("S");
|
||||
if (guiSettingsData != null) {
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().x = guiSettingsData.x();
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().y = guiSettingsData.y();
|
||||
ClickGUI.INSTANCE.getGuiSettingsFrame().extended = guiSettingsData.extended();
|
||||
}
|
||||
|
||||
CameraTweaks.LOGGER.info("posiciones de frames cargadas");
|
||||
ClickGUI.INSTANCE.refreshListButtons();
|
||||
applyModuleStates();
|
||||
applyModuleSettings();
|
||||
applySettingsFrames();
|
||||
applySearchBarPosition();
|
||||
applyGuiSettings();
|
||||
applyExtendableFrames();
|
||||
|
||||
loaded = true;
|
||||
CameraTweaks.LOGGER.info("ajustes aplicados");
|
||||
}
|
||||
|
||||
// obtener configuración actual
|
||||
public static ClientConfig getConfig() {
|
||||
ensureConfig();
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
// ------------------ GUARDAR VALORES INDIVIDUALES EN LA CONFIG. ------------------
|
||||
|
||||
public static void setModuleState(Module module) {
|
||||
ensureConfig();
|
||||
config.moduleStates.put(module.getName(), module.isEnabled());
|
||||
save();
|
||||
}
|
||||
|
||||
public static void setSetting(AbstractSetting setting, Object value) {
|
||||
public static void setSetting(Setting setting, Object value) {
|
||||
ensureConfig();
|
||||
config.settings.put(setting.getModule().getName() + ":" + setting.getName(), value);
|
||||
config.settings.put(getSettingKey(setting), value);
|
||||
save();
|
||||
}
|
||||
|
||||
public static void setFramePosition(SettingsFrame frame) {
|
||||
ensureConfig();
|
||||
config.settingsFrames.put(frame.module.getName(), new int[]{frame.x, frame.y});
|
||||
config.settingsFrames.put(frame.module.getName(), new int[] {frame.x, frame.y});
|
||||
save();
|
||||
}
|
||||
|
||||
@@ -128,7 +112,7 @@ public class ConfigManager {
|
||||
|
||||
public static void setHudPosition(String id, int x, int y) {
|
||||
ensureConfig();
|
||||
config.hudPositions.put(id, new int[]{x, y});
|
||||
config.hudPositions.put(id, new int[] {x, y});
|
||||
save();
|
||||
}
|
||||
|
||||
@@ -138,38 +122,199 @@ public class ConfigManager {
|
||||
save();
|
||||
}
|
||||
|
||||
public static void setSearchBarPosition(int x, int y) {
|
||||
ensureConfig();
|
||||
config.searchBarPosition = new int[] {x, y};
|
||||
save();
|
||||
}
|
||||
|
||||
|
||||
// ------------------ APLICAR AJUSTES ------------------
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static void applySetting(Module parent, AbstractSetting setting) {
|
||||
String id = parent.getName() + ":" + setting.getName();
|
||||
if (config.settings.containsKey(id)) {
|
||||
Object value = config.settings.get(id);
|
||||
public static void applySetting(Module parent, Setting setting) {
|
||||
String key = getSettingKey(setting);
|
||||
|
||||
switch (setting) {
|
||||
case BooleanSetting b -> b.setEnabled((boolean) value);
|
||||
case EnumSetting e -> e.setIndex(value instanceof Double val ? val.intValue() : (int) value);
|
||||
case NumberSetting n -> n.setValue((double) value);
|
||||
case StringSetting s -> s.setValue((String) value);
|
||||
case KeySetting k -> k.setKey(value instanceof Double val ? val.intValue() : (int) value);
|
||||
case ListSetting l -> {
|
||||
if (value instanceof Map<?, ?> map) {
|
||||
Map<Object, Boolean> converted = new HashMap<>();
|
||||
for (Object option : l.getOptions()) {
|
||||
Object key = String.valueOf(option);
|
||||
Object bv = map.get(key);
|
||||
converted.put(option, bv instanceof Boolean b && b);
|
||||
}
|
||||
l.setValues(converted);
|
||||
}
|
||||
} default -> {}
|
||||
}
|
||||
if (!config.settings.containsKey(key)) return;
|
||||
|
||||
Object value = config.settings.get(key);
|
||||
|
||||
switch (setting) {
|
||||
case BooleanSetting booleanSetting -> applyBooleanSetting(booleanSetting, value);
|
||||
case EnumSetting enumSetting -> applyEnumSetting(enumSetting, value);
|
||||
case NumberSetting numberSetting -> applyNumberSetting(numberSetting, value);
|
||||
case StringSetting stringSetting -> applyStringSetting(stringSetting, value);
|
||||
case KeySetting keySetting -> applyKeySetting(keySetting, value);
|
||||
case ListSetting listSetting -> applyListSetting(listSetting, value);
|
||||
case ColorSetting colorSetting -> applyColorSetting(colorSetting, value);
|
||||
case OptionSetting optionSetting -> applyOptionSetting(optionSetting, value);
|
||||
default -> CameraTweaks.LOGGER.warn("watafac queseso: {}", setting.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyModuleStates() {
|
||||
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
||||
if (config.moduleStates.containsKey(module.getName())) {
|
||||
module.setEnabled(config.moduleStates.get(module.getName()));
|
||||
}
|
||||
});
|
||||
CameraTweaks.LOGGER.info("estados de módulos aplicados");
|
||||
}
|
||||
|
||||
private static void applyModuleSettings() {
|
||||
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
||||
module.getSettings().forEach(setting -> applySetting(module, setting));
|
||||
});
|
||||
CameraTweaks.LOGGER.info("ajustes de módulos aplicados");
|
||||
}
|
||||
|
||||
private static void applySettingsFrames() {
|
||||
config.settingsFrames.forEach((moduleName, position) -> {
|
||||
Module module = ModuleManager.INSTANCE.getModuleByName(moduleName);
|
||||
ClickGUI.INSTANCE.openSettingsFrame(module, position[0], position[1]);
|
||||
});
|
||||
CameraTweaks.LOGGER.info("estados de marcos de ajustes aplicados");
|
||||
}
|
||||
|
||||
private static void applySearchBarPosition() {
|
||||
if (config.searchBarPosition != null && config.searchBarPosition.length == 2) {
|
||||
ClickGUI.INSTANCE.getSearchBar().setX(config.searchBarPosition[0]);
|
||||
ClickGUI.INSTANCE.getSearchBar().setY(config.searchBarPosition[1]);
|
||||
}
|
||||
CameraTweaks.LOGGER.info("posición de la barra de búsqueda aplicada");
|
||||
}
|
||||
|
||||
private static void applyGuiSettings() {
|
||||
ClientSettingsFrame.guiSettings.setEnabled(true);
|
||||
ClientSettingsFrame.guiSettings.getSettings().forEach(setting -> {
|
||||
applySetting(ClientSettingsFrame.guiSettings, setting);
|
||||
});
|
||||
CameraTweaks.LOGGER.info("ajustes del cliente aplicados");
|
||||
}
|
||||
|
||||
private static void applyExtendableFrames() {
|
||||
applyExtendableFrame(ClickGUI.INSTANCE.getModulesFrame());
|
||||
applyExtendableFrame(ClickGUI.INSTANCE.getGuiSettingsFrame());
|
||||
|
||||
CameraTweaks.LOGGER.info("posiciones de marcos extendibles aplicadasa");
|
||||
ClickGUI.INSTANCE.refreshListButtons();
|
||||
}
|
||||
|
||||
private static void applyExtendableFrame(ModuleFrame frame) {
|
||||
ClientConfig.FrameData frameData = config.extendableFrames.get("M");
|
||||
if (frameData != null) {
|
||||
frame.x = frameData.x();
|
||||
frame.y = frameData.y();
|
||||
frame.extended = frameData.extended();
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyExtendableFrame(ClientSettingsFrame frame) {
|
||||
ClientConfig.FrameData frameData = config.extendableFrames.get("S");
|
||||
if (frameData != null) {
|
||||
frame.x = frameData.x();
|
||||
frame.y = frameData.y();
|
||||
frame.extended = frameData.extended();
|
||||
}
|
||||
}
|
||||
|
||||
// ajustes de módulos
|
||||
|
||||
private static void applyBooleanSetting(BooleanSetting setting, Object value) {
|
||||
if (value instanceof Boolean) {
|
||||
setting.setEnabled((Boolean) value);
|
||||
}
|
||||
}
|
||||
|
||||
private static <T extends Enum<T>> void applyEnumSetting(EnumSetting<T> setting, Object value) {
|
||||
if (value instanceof Double) {
|
||||
setting.setIndex(((Double) value).intValue());
|
||||
} else if (value instanceof Integer) {
|
||||
setting.setIndex((Integer) value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyNumberSetting(NumberSetting setting, Object value) {
|
||||
if (value instanceof Double) {
|
||||
setting.setValue((Double) value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyStringSetting(StringSetting setting, Object value) {
|
||||
if (value instanceof String) {
|
||||
setting.setValue((String) value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyKeySetting(KeySetting setting, Object value) {
|
||||
if (value instanceof Double) {
|
||||
setting.setKey(((Double) value).intValue());
|
||||
} else if (value instanceof Integer) {
|
||||
setting.setKey((Integer) value);
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> void applyListSetting(ListSetting<T> setting, Object value) {
|
||||
if (value instanceof Map<?, ?> map) {
|
||||
Map<T, Boolean> convertedValues = new HashMap<>();
|
||||
|
||||
for (T option : setting.getOptions()) {
|
||||
String key = setting.getDisplayName(option);
|
||||
Object booleanValue = map.get(key);
|
||||
convertedValues.put(option, booleanValue instanceof Boolean && (Boolean) booleanValue);
|
||||
}
|
||||
|
||||
setting.setValues(convertedValues);
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyColorSetting(ColorSetting setting, Object value) {
|
||||
if (!(value instanceof Map<?, ?> map)) return;
|
||||
|
||||
Number r = (Number) map.get("r");
|
||||
Number g = (Number) map.get("g");
|
||||
Number b = (Number) map.get("b");
|
||||
Number a = (Number) map.get("a");
|
||||
|
||||
if (r != null && g != null && b != null && a != null)
|
||||
setting.setRGB(r.intValue(), g.intValue(), b.intValue(), a.intValue());
|
||||
|
||||
applyOptionalProperty(map, "rb", Boolean.class, setting::setRainbow);
|
||||
applyOptionalProperty(map, "rs", Number.class, val -> setting.setRainbowSpeed(val.intValue()));
|
||||
applyOptionalProperty(map, "sat", Number.class, val -> setting.setSaturation(val.floatValue()));
|
||||
applyOptionalProperty(map, "bri", Number.class, val -> setting.setBrightness(val.floatValue()));
|
||||
}
|
||||
|
||||
private static <T> void applyOptionSetting(OptionSetting<T> setting, Object value) {
|
||||
if (value instanceof Double) {
|
||||
int index = ((Double) value).intValue();
|
||||
setting.setValue(setting.getOption(index));
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> void applyOptionalProperty(Map<?, ?> map, String key, Class<T> type, java.util.function.Consumer<T> setter) {
|
||||
Object value = map.get(key);
|
||||
if (type.isInstance(value)) {
|
||||
setter.accept(type.cast(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------ MÉTODOS DE AYUDA ------------------
|
||||
|
||||
private static boolean shouldApply() {
|
||||
return CameraTweaks.mc != null && ModuleManager.INSTANCE != null && config != null;
|
||||
}
|
||||
|
||||
|
||||
private static void ensureConfig() {
|
||||
if (config == null) config = new ClientConfig();
|
||||
}
|
||||
|
||||
private static String getSettingKey(Setting setting) {
|
||||
return setting.getModule().getName() + ":" + setting.getName();
|
||||
}
|
||||
|
||||
public static boolean hasLoaded() {
|
||||
return loaded;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package me.retucio.camtweaks.event;
|
||||
|
||||
// evento base, cancelable (usado en mixins)
|
||||
public class Event {
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
public boolean isCancelled() {
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.*;
|
||||
|
||||
// al llamar un evento, se guarda en el bus de eventos, de donde luego se puede detectar si ese evento ha sucedido
|
||||
public class EventBus {
|
||||
|
||||
private final Map<Class<?>, List<ListenerMethod>> listeners = new HashMap<>();
|
||||
|
||||
private record ListenerMethod(Object instance, Method method) {}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package me.retucio.camtweaks.event;
|
||||
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.MinecraftClientMixin#onJoinWorld
|
||||
*/
|
||||
public class JoinWorldEvent extends Event {
|
||||
|
||||
private final ClientWorld world;
|
||||
|
||||
public JoinWorldEvent(ClientWorld world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public ClientWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -1,8 +1,12 @@
|
||||
package me.retucio.camtweaks.event.events.camtweaks;
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientWorldMixin#onAddEntity
|
||||
*/
|
||||
public class AddEntityEvent extends Event {
|
||||
|
||||
private final Entity entity;
|
||||
@@ -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;
|
||||
|
||||
@@ -3,6 +3,10 @@ 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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package me.retucio.camtweaks.event.events;
|
||||
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import me.retucio.camtweaks.event.Stage;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onSendPacketPre
|
||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onSendPacketPre
|
||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onSendPacketPost
|
||||
* @see me.retucio.camtweaks.mixin.ClientConnectionMixin#onReceivePacket
|
||||
*/
|
||||
|
||||
public class PacketEvent {
|
||||
|
||||
public static class Send extends Event {
|
||||
|
||||
@@ -3,10 +3,10 @@ package me.retucio.camtweaks.event.events;
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import net.minecraft.client.option.Perspective;
|
||||
|
||||
|
||||
/**
|
||||
* @see me.retucio.camtweaks.mixin.GameOptionsMixin#changePerspective
|
||||
*/
|
||||
|
||||
public class PerspectiveChangeEvent extends Event {
|
||||
|
||||
private Perspective perspective;
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
@@ -4,6 +4,10 @@ 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;
|
||||
|
||||
@@ -2,4 +2,5 @@ package me.retucio.camtweaks.event.events.camtweaks;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
// se genera cuando carga la interfaz del mod
|
||||
public class LoadClickGUIEvent extends Event {}
|
||||
@@ -2,4 +2,5 @@ package me.retucio.camtweaks.event.events.camtweaks;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
// se genera cuando carga el gestor de comandos
|
||||
public class LoadCommandManagerEvent extends Event {}
|
||||
@@ -2,4 +2,5 @@ package me.retucio.camtweaks.event.events.camtweaks;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
|
||||
// se genera cuando carga el gestor de módulos
|
||||
public class LoadModuleManagerEvent extends Event {}
|
||||
@@ -1,20 +1,20 @@
|
||||
package me.retucio.camtweaks.event.events.camtweaks;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import me.retucio.camtweaks.module.settings.AbstractSetting;
|
||||
import me.retucio.camtweaks.module.settings.Setting;
|
||||
|
||||
// se genera cada que se cambia el valor de un ajuste
|
||||
public class UpdateSettingEvent extends Event {
|
||||
|
||||
private final AbstractSetting setting;
|
||||
private final Setting setting;
|
||||
private boolean shouldSave;
|
||||
|
||||
public UpdateSettingEvent(AbstractSetting setting, boolean shouldSave) {
|
||||
public UpdateSettingEvent(Setting setting, boolean shouldSave) {
|
||||
this.setting = setting;
|
||||
this.shouldSave = shouldSave;
|
||||
}
|
||||
|
||||
public AbstractSetting getSetting() {
|
||||
public Setting getSetting() {
|
||||
return setting;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Iterator;
|
||||
import static me.retucio.camtweaks.CameraTweaks.EVENT_BUS;
|
||||
|
||||
@Mixin(BossBarHud.class)
|
||||
public class BossBarHudMixin {
|
||||
public abstract class BossBarHudMixin {
|
||||
|
||||
@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Ljava/util/Collection;iterator()Ljava/util/Iterator;"))
|
||||
public Iterator<ClientBossBar> modifyBossBarIterator(Iterator<ClientBossBar> original) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class ClientCommonNetworkHandlerMixin {
|
||||
@Shadow @Final protected ServerInfo serverInfo;
|
||||
@Shadow @Final protected ClientConnection connection;
|
||||
|
||||
@Unique // tardar 3 segundos porque algunos servers
|
||||
@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"))
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@ package me.retucio.camtweaks.mixin;
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.CritsPlus;
|
||||
import me.retucio.camtweaks.util.Colors;
|
||||
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;
|
||||
@@ -32,20 +30,13 @@ abstract class DamageParticleFactoryMixin {
|
||||
CritsPlus crits = ModuleManager.INSTANCE.getModuleByClass(CritsPlus.class);
|
||||
if (!crits.isEnabled()) return original;
|
||||
|
||||
if (crits.rainbow.isEnabled()) {
|
||||
Color gamning = Colors.rainbowColor(crits.rainbowSpeed.getIntValue(), crits.alpha.getIntValue());
|
||||
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"))
|
||||
|
||||
@@ -5,7 +5,7 @@ import me.retucio.camtweaks.module.ModuleManager;
|
||||
import me.retucio.camtweaks.module.modules.ChatPlus;
|
||||
import me.retucio.camtweaks.module.modules.Freecam;
|
||||
import me.retucio.camtweaks.module.modules.NoRender;
|
||||
import me.retucio.camtweaks.ui.HudRenderer;
|
||||
import me.retucio.camtweaks.ui.hud.HudRenderer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
|
||||
@@ -1,20 +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 {
|
||||
|
||||
@Inject(method = "setDamage", at = @At("HEAD"))
|
||||
private void onDamage(int damage, CallbackInfo ci) {
|
||||
@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(damage, stack));
|
||||
EVENT_BUS.post(new DamageItemEvent(getDamage(), stack));
|
||||
}
|
||||
}
|
||||
@@ -43,10 +43,10 @@ public abstract class LightmapTextureManagerMixin {
|
||||
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();
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.ibm.icu.util.CodePointTrie;
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.event.JoinWorldEvent;
|
||||
import me.retucio.camtweaks.event.events.OpenScreenEvent;
|
||||
import me.retucio.camtweaks.event.events.ShutdownEvent;
|
||||
import me.retucio.camtweaks.event.events.TickEvent;
|
||||
@@ -12,6 +13,7 @@ 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.client.world.ClientWorld;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -70,4 +72,10 @@ public abstract class MinecraftClientMixin {
|
||||
if (!fastUse.isEnabled()) return;
|
||||
itemUseCooldown = fastUse.getCooldown(stack);
|
||||
}
|
||||
|
||||
@Inject(method = "joinWorld", at = @At("HEAD"), cancellable = true)
|
||||
private void onJoinWorld(ClientWorld world, CallbackInfo ci) {
|
||||
JoinWorldEvent event = EVENT_BUS.post(new JoinWorldEvent(world));
|
||||
if (event.isCancelled()) ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -37,11 +37,7 @@ public class ScreenMixin {
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -77,15 +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()) {
|
||||
return Colors.rainbowInt(outline.rainbowSpeed.getIntValue(), outline.alpha.getIntValue());
|
||||
} 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);
|
||||
}
|
||||
@@ -10,4 +10,7 @@ public interface HandledScreenAccessor {
|
||||
|
||||
@Accessor("focusedSlot")
|
||||
Slot getFocusedSlot();
|
||||
|
||||
@Accessor("doubleClicking")
|
||||
void setDoubleClicking(boolean doubleClicking);
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
package me.retucio.camtweaks.module;
|
||||
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.config.ClientConfig;
|
||||
import me.retucio.camtweaks.config.ConfigManager;
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.camtweaks.ToggleModuleEvent;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||
import me.retucio.camtweaks.module.settings.KeySetting;
|
||||
import me.retucio.camtweaks.module.settings.AbstractSetting;
|
||||
import me.retucio.camtweaks.module.settings.Setting;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
@@ -23,13 +25,14 @@ 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);
|
||||
protected KeySetting bind = new KeySetting("tecla", "tecla asignada al módulo, ESC para desactivar", GLFW.GLFW_KEY_UNKNOWN);
|
||||
protected BooleanSetting notify = new BooleanSetting("notificar", "notificar en el chat al activar / desactivar", true);
|
||||
|
||||
private final List<AbstractSetting> settings = new ArrayList<>();
|
||||
private final List<Setting> settings = new ArrayList<>();
|
||||
|
||||
protected MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
@@ -39,21 +42,31 @@ 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);
|
||||
|
||||
// puto marcos
|
||||
if (ConfigManager.getConfig().settings.get(this.getName() + ":" + bind.getName()) == null)
|
||||
this.bind.setKey(key);
|
||||
}
|
||||
|
||||
// ajustes
|
||||
public List<AbstractSetting> getSettings() {
|
||||
public List<Setting> getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <S extends AbstractSetting> S addSetting(AbstractSetting setting) {
|
||||
public <S extends Setting> S addSetting(Setting setting) {
|
||||
settings.add(setting);
|
||||
setting.setModule(this);
|
||||
return (S) setting; // por convenciencia
|
||||
return (S) setting; // por conveniencia
|
||||
}
|
||||
|
||||
public void addSettings(AbstractSetting... settings) {
|
||||
for (AbstractSetting setting : settings) addSetting(setting);
|
||||
public void addSettings(Setting... settings) {
|
||||
for (Setting setting : settings) addSetting(setting);
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +154,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");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package me.retucio.camtweaks.module;
|
||||
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.event.EventBus;
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.module.modules.*;
|
||||
@@ -16,20 +17,21 @@ public class ModuleManager {
|
||||
public static ModuleManager INSTANCE;
|
||||
|
||||
private final List<Module> modules = new ArrayList<>();
|
||||
private final EventBus eventBus;
|
||||
|
||||
public ModuleManager(EventBus bus) {
|
||||
this.eventBus = bus;
|
||||
public ModuleManager() {
|
||||
addModules();
|
||||
}
|
||||
|
||||
// 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 BlockESP());
|
||||
modules.add(new BlockOutline());
|
||||
modules.add(new BossbarStack());
|
||||
modules.add(new BreakingProgress());
|
||||
modules.add(new BungeecordSpoofer());
|
||||
modules.add(new ChatPlus());
|
||||
modules.add(new ColoredSigns());
|
||||
@@ -44,17 +46,24 @@ public class ModuleManager {
|
||||
modules.add(new HandView());
|
||||
modules.add(new Headhitters());
|
||||
modules.add(new HUD());
|
||||
modules.add(new InventoryPlus());
|
||||
modules.add(new LightOverlay());
|
||||
modules.add(new LogoutSpots());
|
||||
modules.add(new Nametags());
|
||||
modules.add(new NoMiningInterruptions());
|
||||
modules.add(new NoRender());
|
||||
modules.add(new Offhand());
|
||||
modules.add(new PacketDelay());
|
||||
modules.add(new PerspectivePlus());
|
||||
modules.add(new PortalGUI());
|
||||
modules.add(new Racist());
|
||||
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 UIMove());
|
||||
modules.add(new WarnLowDurability());
|
||||
modules.add(new Zoom());
|
||||
|
||||
@@ -64,7 +73,7 @@ public class ModuleManager {
|
||||
for (Module module : getEnabledModules()) {
|
||||
for (Method method : module.getClass().getDeclaredMethods()) {
|
||||
if (method.isAnnotationPresent(SubscribeEvent.class)) {
|
||||
eventBus.register(module);
|
||||
CameraTweaks.EVENT_BUS.register(module);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
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.ListSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import me.retucio.camtweaks.util.Colors;
|
||||
import me.retucio.camtweaks.util.Lists;
|
||||
import me.retucio.camtweaks.util.render.RenderUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class BlockESP extends Module {
|
||||
|
||||
public ListSetting<Block> blocks = addSetting(new ListSetting<>("bloques", "bloques a resaltar",
|
||||
Lists.blockList, Lists.allFalse(Lists.blockList), Lists.blockNames));
|
||||
|
||||
public NumberSetting radius = addSetting(new NumberSetting("radio", "radio de búsqueda de bloques", 24, 2, 128, 1));
|
||||
|
||||
public BooleanSetting outlines = addSetting(new BooleanSetting("contorno", "renderizar contorno de bloques", true));
|
||||
public ColorSetting outlineColor = addSetting(new ColorSetting("color del contorno", "color del contorno", Colors.CELESTE, false));
|
||||
public NumberSetting lineWidth = addSetting(new NumberSetting("grosor del contorno", "grosor de las líneas del contorno", 1, 1, 5, 0.2));
|
||||
|
||||
public BooleanSetting fillings = addSetting(new BooleanSetting("relleno", "renderizar relleno de bloques", true));
|
||||
public ColorSetting fillingColor = addSetting(new ColorSetting("color del relleno", "color del relleno", new Color(57, 177, 215, 67), false));
|
||||
|
||||
|
||||
public BlockESP() {
|
||||
super("resaltado de bloques", "te muestra la posición de cierto tipo de bloque renderizando una caja con su forma");
|
||||
|
||||
outlines.onUpdate(v -> {
|
||||
outlineColor.setVisible(v);
|
||||
lineWidth.setVisible(v);
|
||||
});
|
||||
|
||||
fillings.onUpdate(v -> fillingColor.setVisible(v));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderWorld(RenderWorldEvent event) {
|
||||
if (mc.player == null || mc.world == null) return;
|
||||
|
||||
for (Block block : blocks.getOptions()) {
|
||||
if (blocks.isEnabled(block)) {
|
||||
List<BlockPos> blocksToHighlight = getNearbyBlocks(block);
|
||||
for (BlockPos pos : blocksToHighlight) {
|
||||
if (outlines.isEnabled()) {
|
||||
RenderUtil.drawVoxelShapeOutline(
|
||||
event.getMatrices(),
|
||||
getVoxelShape(pos),
|
||||
pos,
|
||||
outlineColor.getColor(),
|
||||
lineWidth.getFloatValue());
|
||||
}
|
||||
if (fillings.isEnabled()) {
|
||||
RenderUtil.drawVoxelShapeFilled(
|
||||
event.getMatrices(),
|
||||
getVoxelShape(pos),
|
||||
pos,
|
||||
fillingColor.getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<BlockPos> getNearbyBlocks(Block block) {
|
||||
List<BlockPos> blockPosList = new ArrayList<>();
|
||||
|
||||
for (int i = -radius.getIntValue(); i < radius.getIntValue(); i++) {
|
||||
for (int j = -radius.getIntValue(); j < radius.getIntValue(); j++) {
|
||||
for (int k = -radius.getIntValue(); k < radius.getIntValue(); k++) {
|
||||
BlockPos pos = mc.player.getBlockPos().add(new Vec3i(i, j, k));
|
||||
if (mc.world.getBlockState(pos).getBlock() == block) {
|
||||
blockPosList.add(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return blockPosList;
|
||||
}
|
||||
|
||||
private VoxelShape getVoxelShape(BlockPos pos) {
|
||||
return mc.world.getBlockState(pos).getOutlineShape(mc.world, pos);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
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.EnumSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import me.retucio.camtweaks.util.render.RenderUtil;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class BreakingProgress extends Module {
|
||||
|
||||
public EnumSetting<BreakMode> breakMode = addSetting(new EnumSetting<>("modo de minado", "elige si el cubo se encoge o se dilata",
|
||||
BreakMode.class, BreakMode.INWARDS));
|
||||
|
||||
public BooleanSetting outlines = addSetting(new BooleanSetting("contorno", "renderizar contorno", true));
|
||||
public ColorSetting outlineColor = addSetting(new ColorSetting("color del contorno", "color del contorno",
|
||||
new Color(0, 255, 0, 200), false));
|
||||
public NumberSetting lineWidth = addSetting(new NumberSetting("grosor de línea", "grosor de las líneas del contorno", 1, 1, 5, 0.1));
|
||||
|
||||
public BooleanSetting fillings = addSetting(new BooleanSetting("relleno", "renderizar relleno", true));
|
||||
public ColorSetting fillingColor = addSetting(new ColorSetting("color del relleno", "color del relleno",
|
||||
new Color(0, 255, 0, 60), false));
|
||||
|
||||
public BreakingProgress() {
|
||||
super("progreso de minado", "te muestra el progreso de minado de un bloque de manera más visible");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderWorld(RenderWorldEvent event) {
|
||||
if (mc.interactionManager == null || mc.world == null) return;
|
||||
if (!(mc.crosshairTarget instanceof BlockHitResult hitResult)) return;
|
||||
BlockPos pos = hitResult.getBlockPos();
|
||||
|
||||
int breakingProgress = mc.interactionManager.getBlockBreakingProgress();
|
||||
if (breakingProgress <= 0) return;
|
||||
float progress = breakingProgress / 10f;
|
||||
|
||||
VoxelShape shape = mc.world.getBlockState(pos).getOutlineShape(mc.world, pos);
|
||||
if (shape.isEmpty()) return;
|
||||
|
||||
Box box = shape.getBoundingBox().offset(pos);
|
||||
|
||||
float shrinkFactor = breakMode.is(BreakMode.INWARDS)
|
||||
? 1f - progress
|
||||
: progress;
|
||||
|
||||
double centerX = (box.minX + box.maxX) / 2;
|
||||
double centerY = (box.minY + box.maxY) / 2;
|
||||
double centerZ = (box.minZ + box.maxZ) / 2;
|
||||
|
||||
double shrunkX = (box.maxX - box.minX) / 2 * shrinkFactor;
|
||||
double shrunkY = (box.maxY - box.minY) / 2 * shrinkFactor;
|
||||
double shrunkZ = (box.maxZ - box.minZ) / 2 * shrinkFactor;
|
||||
|
||||
Box scaledBox = new Box(
|
||||
centerX - shrunkX, centerY - shrunkY, centerZ - shrunkZ,
|
||||
centerX + shrunkX, centerY + shrunkZ, centerZ + shrunkZ
|
||||
);
|
||||
|
||||
if (outlines.isEnabled()) RenderUtil.drawOutlineBox(event.getMatrices(), scaledBox, outlineColor.getColor(), lineWidth.getFloatValue());
|
||||
if (fillings.isEnabled()) RenderUtil.drawFilledBox(event.getMatrices(), scaledBox, fillingColor.getColor());
|
||||
}
|
||||
|
||||
public enum BreakMode {
|
||||
INWARDS("para dentro"),
|
||||
OUTWARDS("para fuera");
|
||||
|
||||
private final String name;
|
||||
BreakMode(String name) { this.name = name; }
|
||||
@Override public String toString() { return name; }
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class ChatPlus extends Module {
|
||||
private SimpleDateFormat dateFormat;
|
||||
|
||||
private static final Pattern loggerRegex = Pattern.compile("\\n(\\n|\\s)+\\n");
|
||||
private static final Pattern usernameRegex = Pattern.compile("^(?:<[0-9]{2}:[0-9]{2}>\\s)?<(.*?)>.*");
|
||||
private static final Pattern usernameRegex = Pattern.compile("^(?:\\[[0-9]{2}:[0-9]{2}\\]\\s*)?(?:<([^<>\\s]+)>|([^<>\\s]+)).*");
|
||||
private static final Pattern timestampRegex = Pattern.compile("^<\\d{1,2}:\\d{1,2}>");
|
||||
private static final Pattern coordRegex = Pattern.compile("(?<x>-?\\d{3,}(?:\\.\\d*)?)(?:\\s+(?<y>-?\\d{1,3}(?:\\.\\d*)?))?\\s+(?<z>-?\\d{3,}(?:\\.\\d*)?)");
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ChatPlus extends Module {
|
||||
|
||||
// agregar sellos de tiempo a los mensajes
|
||||
if (timestamps.isEnabled()) {
|
||||
Text timestamp = Text.literal("<" + dateFormat.format(new Date()) + "> ").formatted(Formatting.GRAY);
|
||||
Text timestamp = Text.literal("[" + dateFormat.format(new Date()) + "] ").formatted(Formatting.GRAY);
|
||||
message = Text.empty().append(timestamp).append(message);
|
||||
}
|
||||
|
||||
@@ -178,6 +178,8 @@ public class ChatPlus extends Module {
|
||||
|
||||
if (usernameMatcher.matches()) {
|
||||
String username = usernameMatcher.group(1);
|
||||
if (username == null)
|
||||
username = usernameMatcher.group(2);
|
||||
|
||||
PlayerListEntry entry = mc.getNetworkHandler().getPlayerListEntry(username);
|
||||
if (entry != null) sender = entry.getProfile();
|
||||
|
||||
@@ -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,8 +29,7 @@ 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);
|
||||
|
||||
@@ -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,69 +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());
|
||||
|
||||
// muy mierdas la solución pero funciona
|
||||
red.reset();
|
||||
green.reset();
|
||||
blue.reset();
|
||||
alpha.reset();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(TickEvent.Post event) {
|
||||
if (rainbow.isEnabled()) {
|
||||
Color color = Colors.rainbowColor(rainbowSpeed.getIntValue(), alpha.getIntValue(), 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
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,17 @@ package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.*;
|
||||
import me.retucio.camtweaks.ui.screen.HudEditorScreen;
|
||||
import me.retucio.camtweaks.ui.hud.CoordsElement;
|
||||
import me.retucio.camtweaks.ui.hud.HudElement;
|
||||
import me.retucio.camtweaks.ui.hud.HudRenderer;
|
||||
import me.retucio.camtweaks.ui.hud.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
|
||||
* @see HudRenderer
|
||||
* @see HudElement
|
||||
* @see HudEditorScreen
|
||||
*/
|
||||
|
||||
@@ -16,17 +21,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));
|
||||
|
||||
@@ -34,16 +31,10 @@ public class HUD extends Module {
|
||||
public NumberSetting timezone = addSetting(new NumberSetting("zona horaria", "zona horaria en UTC+n", 1, -6, 6, 1));
|
||||
public EnumSetting<TimeFormat> timeFormat = addSetting(new EnumSetting<>("formato de la hora", "12h o 24h", TimeFormat.class, TimeFormat.TWENTY_FOUR_HOUR));
|
||||
public StringSetting customText = addSetting(new StringSetting("texto custom", "marca de agua (dejar vacío para quitar)", "adolf jitler inshtagram feishbuc twiter", 40));
|
||||
public EnumSetting<CoordsMode> coordsMode = addSetting(new EnumSetting<>("modo de coordenadas", "qué coordenadas mostrar", CoordsMode.class, CoordsMode.OVERWORLD));
|
||||
|
||||
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 {
|
||||
@@ -54,4 +45,14 @@ public class HUD extends Module {
|
||||
TimeFormat(String name) { this.name = name; }
|
||||
@Override public String toString() { return name; }
|
||||
}
|
||||
|
||||
public enum CoordsMode {
|
||||
OVERWORLD("superficie"),
|
||||
NETHER("nether"),
|
||||
BOTH("ambas");
|
||||
|
||||
private final String name;
|
||||
CoordsMode(String name) { this.name = name; }
|
||||
@Override public String toString() { return name; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.event.Event;
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.KeyEvent;
|
||||
import me.retucio.camtweaks.event.events.MouseClickEvent;
|
||||
import me.retucio.camtweaks.mixin.accessor.HandledScreenAccessor;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.KeySetting;
|
||||
import me.retucio.camtweaks.util.InventoryUtil;
|
||||
import me.retucio.camtweaks.util.KeyUtil;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class InventoryPlus extends Module {
|
||||
|
||||
public KeySetting row1key = addSetting(new KeySetting("fila 1", "tecla para mover items a la primera fila", GLFW.GLFW_KEY_A));
|
||||
public KeySetting row2key = addSetting(new KeySetting("fila 2", "tecla para mover items a la segunda fila", GLFW.GLFW_KEY_S));
|
||||
public KeySetting row3key = addSetting(new KeySetting("fila 3", "tecla para mover items a la tercera fila", GLFW.GLFW_KEY_D));
|
||||
|
||||
public InventoryPlus() {
|
||||
super("inventario plus", "mueve ítems del inventario usando solo el teclado");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKey(KeyEvent event) {
|
||||
if (event.getAction() == GLFW.GLFW_RELEASE) return;
|
||||
processInput(event.getKey(), event);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMouseButton(MouseClickEvent event) {
|
||||
if (event.getAction() == GLFW.GLFW_RELEASE) return;
|
||||
processInput(event.getButton(), event);
|
||||
}
|
||||
|
||||
private void processInput(int inputCode, Event event) {
|
||||
if (!(mc.currentScreen instanceof HandledScreen<?> screen) || mc.player == null) return;
|
||||
|
||||
Slot focusedSlot = ((HandledScreenAccessor) screen).getFocusedSlot();
|
||||
if (focusedSlot == null) return;
|
||||
|
||||
int containerSlot = focusedSlot.id;
|
||||
int hotbarKeyIndex = InventoryUtil.getSlotNumberFromKey(inputCode);
|
||||
if (hotbarKeyIndex == -1) return;
|
||||
|
||||
int rowOffset = InventoryUtil.getRowOffset(screen);
|
||||
|
||||
if (KeyUtil.isKeyDown(row1key.getKey())) {
|
||||
event.cancel();
|
||||
swapWithRow(screen, containerSlot, hotbarKeyIndex, rowOffset);
|
||||
}
|
||||
else if (KeyUtil.isKeyDown(row2key.getKey())) {
|
||||
event.cancel();
|
||||
swapWithRow(screen, containerSlot, hotbarKeyIndex, rowOffset + 9);
|
||||
}
|
||||
else if (KeyUtil.isKeyDown(row3key.getKey())) {
|
||||
event.cancel();
|
||||
swapWithRow(screen, containerSlot, hotbarKeyIndex, rowOffset + 18);
|
||||
}
|
||||
}
|
||||
|
||||
private void swapWithRow(HandledScreen<?> screen, int containerSlot, int column, int rowOffset) {
|
||||
int targetContainerSlot = InventoryUtil.calculateTargetSlot(screen, containerSlot, column, rowOffset);
|
||||
if (targetContainerSlot != -1) {
|
||||
InventoryUtil.swapSlots(containerSlot, targetContainerSlot, screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
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.getBlockState(block).isAir() || !mc.world.getBlockState(block.up()).isAir()) continue;
|
||||
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,24 @@
|
||||
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.ColorSetting;
|
||||
import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import me.retucio.camtweaks.util.MiscUtil;
|
||||
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 +27,238 @@ 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 lineWidth = addSetting(new NumberSetting("grosor de línea", "grosor de las líneas del contorno", 1.5, 0.5, 5, 0.1));
|
||||
|
||||
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));
|
||||
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
||||
@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 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.logoutTime = MiscUtil.getCurrentFormattedTime();
|
||||
|
||||
this.dummyName = name + " (" + logoutTime + ")";
|
||||
this.dummy = ModuleManager.INSTANCE.getModuleByClass(FakePlayer.class).addPlayer(player, dummyName);
|
||||
|
||||
this.dummy.updatePositionAndAngles(x + halfWidth, y, z + halfWidth,
|
||||
player.getYaw(), player.getPitch());
|
||||
}
|
||||
|
||||
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(), lineWidth.getFloatValue());
|
||||
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(), lineWidth.getFloatValue());
|
||||
}
|
||||
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
|
||||
) {}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||
import me.retucio.camtweaks.module.settings.ListSetting;
|
||||
import me.retucio.camtweaks.util.Lists;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LazyEntityReference;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
@@ -24,6 +25,7 @@ import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -39,8 +41,9 @@ import java.util.concurrent.Executors;
|
||||
|
||||
public class Nametags extends Module {
|
||||
|
||||
Map<EntityType<?>, Boolean> defaultEntities = Lists.allFalse(Lists.entityList);
|
||||
public ListSetting<EntityType<?>> entities = addSetting(new ListSetting<>("entidades", "entidades cuyo nametag será visible",
|
||||
Lists.entityList, Lists.allFalse(Lists.entityList), Lists.entityNames));
|
||||
Lists.entityList, defaultEntities, Lists.entityNames));
|
||||
|
||||
public BooleanSetting alwaysVisible = addSetting(new BooleanSetting("siempre mostrar nametags", "mostrar nametag cuando el jugador está agachado o es invisible", false));
|
||||
public BooleanSetting health = addSetting(new BooleanSetting("mostrar vida", "muestra la vida de una entidad en su nametag", true));
|
||||
@@ -62,17 +65,22 @@ public class Nametags extends Module {
|
||||
super("nametags", "modifica la manera en la que se renderizan los nametags");
|
||||
|
||||
// entidades activadas por defecto
|
||||
entities.setEnabled(EntityType.PLAYER, true);
|
||||
entities.setEnabled(EntityType.ITEM, true);
|
||||
entities.setEnabled(EntityType.ARROW, true);
|
||||
entities.setEnabled(EntityType.SPECTRAL_ARROW, true);
|
||||
entities.setEnabled(EntityType.TRIDENT, true);
|
||||
entities.setDefaultValues(entities.getValues());
|
||||
defaultEntities.replace(EntityType.PLAYER, true);
|
||||
defaultEntities.replace(EntityType.ITEM, true);
|
||||
defaultEntities.replace(EntityType.ARROW, true);
|
||||
defaultEntities.replace(EntityType.SPECTRAL_ARROW, true);
|
||||
defaultEntities.replace(EntityType.TRIDENT, true);
|
||||
entities.setDefaultValues(defaultEntities);
|
||||
|
||||
health.onUpdate(v -> healthMode.setVisible(v));
|
||||
|
||||
entities.onUpdate(entities -> {
|
||||
items.setVisible(entities.get(EntityType.ITEM));
|
||||
|
||||
boolean anyProjectile = entities.get(EntityType.TRIDENT)
|
||||
|| entities.get(EntityType.ARROW)
|
||||
|| entities.get(EntityType.SPECTRAL_ARROW);
|
||||
showProjectileDamage.setVisible(anyProjectile);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
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.module.settings.OptionSetting;
|
||||
import me.retucio.camtweaks.util.Lists;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket;
|
||||
import net.minecraft.screen.slot.SlotActionType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
public class Offhand extends Module {
|
||||
|
||||
public OptionSetting<Item> item = addSetting(new OptionSetting<>("ítem", "ítem a equipar",
|
||||
Lists.itemList, Items.TOTEM_OF_UNDYING, Lists.itemNames));
|
||||
public NumberSetting delaySetting = addSetting(new NumberSetting("delay", "delay del cambiazo (en ticks)", 0, 0, 20, 1));
|
||||
public BooleanSetting override = addSetting(new BooleanSetting("anular", "ignora que ya haya un ítem en la mano secundaria", true));
|
||||
|
||||
|
||||
private int delay;
|
||||
private boolean holdingItem;
|
||||
|
||||
public Offhand() {
|
||||
super("mano secundaria", "automáticamente equipa un ítem en la mano secundaria");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (mc.player == null || mc.interactionManager == null) return;
|
||||
|
||||
if (holdingItem && mc.player.getOffHandStack().getItem() != item.getValue())
|
||||
delay = Math.max(delaySetting.getIntValue(), delay);
|
||||
|
||||
holdingItem = mc.player.getOffHandStack().getItem() == item.getValue();
|
||||
|
||||
if (delay > 0) {
|
||||
delay--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (holdingItem || (!mc.player.getOffHandStack().isEmpty()
|
||||
&& !override.isEnabled()))
|
||||
return;
|
||||
|
||||
if (mc.player.playerScreenHandler == mc.player.currentScreenHandler) {
|
||||
for (int i = 9; i < 45; i++) {
|
||||
|
||||
if (mc.player.getInventory().getStack(i >= 36 ? i - 36 : i).getItem() == item.getValue()) {
|
||||
boolean itemInOffhand = !mc.player.getOffHandStack().isEmpty();
|
||||
|
||||
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, i, 0, SlotActionType.PICKUP, mc.player);
|
||||
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, 45, 0, SlotActionType.PICKUP, mc.player);
|
||||
|
||||
if (itemInOffhand)
|
||||
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, i, 0, SlotActionType.PICKUP, mc.player);
|
||||
|
||||
delay = delaySetting.getIntValue();
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (mc.player.getInventory().getStack(i).getItem() == item.getValue()) {
|
||||
if (i != mc.player.getInventory().getSelectedSlot()) {
|
||||
mc.player.getInventory().setSelectedSlot(i);
|
||||
mc.player.networkHandler.sendPacket(new UpdateSelectedSlotC2SPacket(i));
|
||||
}
|
||||
|
||||
mc.player.networkHandler.sendPacket(new PlayerActionC2SPacket(
|
||||
PlayerActionC2SPacket.Action.SWAP_ITEM_WITH_OFFHAND,
|
||||
BlockPos.ORIGIN,
|
||||
Direction.DOWN));
|
||||
delay = delaySetting.getIntValue();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.event.JoinWorldEvent;
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.DisconnectEvent;
|
||||
import me.retucio.camtweaks.event.events.PacketEvent;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.EnumSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import me.retucio.camtweaks.util.NetworkUtil;
|
||||
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.listener.PacketListener;
|
||||
import net.minecraft.network.message.SentMessage;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.common.KeepAliveC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.common.KeepAliveS2CPacket;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
|
||||
public class PacketDelay extends Module {
|
||||
|
||||
public NumberSetting delay = addSetting(new NumberSetting("delay", "delay a añadir a los paquetes, en milisegundos", 1500, 0, 3000, 5));
|
||||
public EnumSetting<Directions> directions = addSetting(new EnumSetting<>("dirección", "dirección de los paquetes a los que añadir delay",
|
||||
Directions.class, Directions.BOTH));
|
||||
public EnumSetting<Packets> packets = addSetting(new EnumSetting<>("paquetes", "paquetes a los que aplicar el delay",
|
||||
Packets.class, Packets.ALL));
|
||||
|
||||
private final List<DelayedPacket> delayedPackets = new CopyOnWriteArrayList<>();
|
||||
private long lastProcessTime = 0;
|
||||
|
||||
public PacketDelay() {
|
||||
super("delay de paquetes", "aplica un delay a los paquetes");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
for (DelayedPacket delayedPacket : delayedPackets)
|
||||
processDelayedPacket(delayedPacket);
|
||||
delayedPackets.clear();
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (mc.player == null || mc.world == null || mc.getNetworkHandler() == null) {
|
||||
delayedPackets.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (currentTime - lastProcessTime < 50) return;
|
||||
lastProcessTime = currentTime;
|
||||
|
||||
List<DelayedPacket> toProcess = new ArrayList<>();
|
||||
for (DelayedPacket packet : delayedPackets) {
|
||||
if (System.currentTimeMillis() >= packet.scheduledTime())
|
||||
toProcess.add(packet);
|
||||
}
|
||||
|
||||
for (DelayedPacket packet : toProcess) {
|
||||
processDelayedPacket(packet);
|
||||
delayedPackets.remove(packet);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPacketSend(PacketEvent.Send event) {
|
||||
if (directions.is(Directions.S2C)
|
||||
|| mc.player == null || mc.world == null || mc.getNetworkHandler() == null
|
||||
|| (event.getPacket() instanceof KeepAliveC2SPacket && !packets.is(Packets.OTHERS)))
|
||||
return;
|
||||
|
||||
event.cancel();
|
||||
|
||||
delayedPackets.add(new DelayedPacket(
|
||||
event.getPacket(),
|
||||
System.currentTimeMillis() + delay.getLongValue(),
|
||||
true,
|
||||
mc.getNetworkHandler().getConnection().getPacketListener()
|
||||
));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPacketReceive(PacketEvent.Receive event) {
|
||||
if (mc.player == null || mc.world == null
|
||||
|| mc.getNetworkHandler() == null || mc.getNetworkHandler().getConnection() == null
|
||||
|| (event.getPacket() instanceof KeepAliveS2CPacket && !packets.is(Packets.OTHERS)))
|
||||
return;
|
||||
|
||||
event.cancel();
|
||||
|
||||
ClientConnection connection = mc.getNetworkHandler().getConnection();
|
||||
|
||||
delayedPackets.add(new DelayedPacket(
|
||||
event.getPacket(),
|
||||
System.currentTimeMillis() + delay.getLongValue(),
|
||||
false,
|
||||
connection.getPacketListener()
|
||||
));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onJoinWorld(JoinWorldEvent event) {
|
||||
ChatUtil.error("delay de paquetes no funciona en un solo jugador");
|
||||
toggle();
|
||||
}
|
||||
|
||||
private void processDelayedPacket(DelayedPacket delayedPacket) {
|
||||
if (mc.getNetworkHandler() == null) return;
|
||||
|
||||
if (delayedPacket.isOutgoing()) {
|
||||
NetworkUtil.sendPacketNoEvent(delayedPacket.packet());
|
||||
} else {
|
||||
if (delayedPacket.packetListener != null && mc.getNetworkHandler().getConnection() != null) {
|
||||
NetworkUtil.receivePacketNoEvent(delayedPacket.packet(), delayedPacket.packetListener());
|
||||
} else {
|
||||
NetworkUtil.receivePacketNoEvent(delayedPacket.packet());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private record DelayedPacket(Packet<?> packet, long scheduledTime, boolean isOutgoing, PacketListener packetListener) {}
|
||||
|
||||
public enum Directions {
|
||||
C2S("cliente a server"),
|
||||
S2C("server a cliente"),
|
||||
BOTH("ambos");
|
||||
|
||||
private final String name;
|
||||
Directions(String name) { this.name = name; }
|
||||
@Override public String toString() { return name; }
|
||||
}
|
||||
|
||||
public enum Packets {
|
||||
KEEP_ALIVE("paquetes KeepAlive"),
|
||||
OTHERS("todos menos KeepAlive"),
|
||||
ALL("todos");
|
||||
|
||||
private final String name;
|
||||
Packets(String name) { this.name = name; }
|
||||
@Override public String toString() { return name; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.util.EntityUtil;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.mob.EndermanEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Racist extends Module {
|
||||
|
||||
private int lookTimer;
|
||||
private final List<EndermanEntity> lookedEndermen = new ArrayList<>();
|
||||
|
||||
public Racist() {
|
||||
super("racismo", "amego segarro");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
lookedEndermen.clear();
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (mc.world == null || mc.player == null) return;
|
||||
|
||||
for (Entity entity : mc.world.getEntities()) {
|
||||
if (!(entity instanceof EndermanEntity enderman)) continue;
|
||||
|
||||
if (shouldLookAt(enderman)) {
|
||||
lookAtEnderman(enderman);
|
||||
|
||||
lookedEndermen.add(enderman);
|
||||
lookTimer = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
lookTimer++;
|
||||
}
|
||||
|
||||
private boolean shouldLookAt(EndermanEntity enderman) {
|
||||
return !(lookedEndermen.contains(enderman)) && lookTimer >= 10
|
||||
&& EntityUtil.hasLineOfSight(mc.player, enderman);
|
||||
}
|
||||
|
||||
private void lookAtEnderman(EndermanEntity enderman) {
|
||||
double yaw = EntityUtil.getYaw(enderman);
|
||||
double pitch = EntityUtil.getPitch(enderman, EntityUtil.Target.HEAD);
|
||||
|
||||
mc.player.setYaw((float) yaw);
|
||||
mc.player.setPitch((float) pitch);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import me.retucio.camtweaks.ui.screen.PreviewScreen;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import me.retucio.camtweaks.util.Colors;
|
||||
|
||||
import me.retucio.camtweaks.util.InventoryUtil;
|
||||
import me.retucio.camtweaks.util.MiscUtil;
|
||||
import net.minecraft.block.ShulkerBoxBlock;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
@@ -94,11 +95,11 @@ public class ShulkerPeek extends Module {
|
||||
} else return;
|
||||
|
||||
if (stack.getItem() == Items.ENDER_CHEST) {
|
||||
if (MiscUtil.getEchestInv() == null) {
|
||||
if (InventoryUtil.getEchestInv() == null) {
|
||||
ChatUtil.warn("abre un enderchest primero");
|
||||
return;
|
||||
}
|
||||
mc.setScreen(new PreviewScreen(MiscUtil.getEchestInv(), mc.currentScreen));
|
||||
mc.setScreen(new PreviewScreen(InventoryUtil.getEchestInv(), mc.currentScreen));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.mixin.accessor.KeyBindingAccessor;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.ListSetting;
|
||||
import me.retucio.camtweaks.ui.screen.ClickGUI;
|
||||
import me.retucio.camtweaks.util.KeyUtil;
|
||||
import me.retucio.camtweaks.util.Lists;
|
||||
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.screen.GenericContainerScreenHandler;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class UIMove extends Module {
|
||||
|
||||
public ListSetting<ScreenHandlerType<?>> screens = addSetting(new ListSetting<>("interfaces", "interfaces en las que te podrás mover",
|
||||
Lists.screenList, Lists.allTrue(Lists.screenList), Lists.screenNames));
|
||||
|
||||
private List<KeyBinding> movementKeys;
|
||||
|
||||
private final ScreenHandlerType<?> inventoryHandlerType = ScreenHandlerType.register(
|
||||
"player_inventory", GenericContainerScreenHandler::createGeneric9x3);
|
||||
private final ScreenHandlerType<?> clickGuiHandlerType = ScreenHandlerType.register(
|
||||
"camtweaks_clickgui", GenericContainerScreenHandler::createGeneric9x3); // 9x3 porque no importa (creo)
|
||||
|
||||
public UIMove() {
|
||||
super("moverse en interfaz", "te permite seguir usando las teclas de movimiento aún estando en ciertas interfaces");
|
||||
screens.addOption(inventoryHandlerType, true, "inventario");
|
||||
screens.addOption(clickGuiHandlerType, true, "interfaz del mod");
|
||||
|
||||
screens.onUpdate(v -> unpress());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
movementKeys = Arrays.asList(
|
||||
mc.options.forwardKey,
|
||||
mc.options.backKey,
|
||||
mc.options.leftKey,
|
||||
mc.options.rightKey,
|
||||
mc.options.jumpKey,
|
||||
mc.options.sneakKey,
|
||||
mc.options.sprintKey);
|
||||
super.onEnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
unpress();
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (mc.player == null || mc.options == null || mc.currentScreen == null) return;
|
||||
|
||||
ScreenHandlerType<?> handler = null;
|
||||
if (mc.currentScreen == ClickGUI.INSTANCE)
|
||||
handler = clickGuiHandlerType;
|
||||
|
||||
if (mc.currentScreen instanceof HandledScreen<?> screen) {
|
||||
try {
|
||||
handler = screen.getScreenHandler().getType();
|
||||
} catch (UnsupportedOperationException e) {
|
||||
handler = inventoryHandlerType;
|
||||
}
|
||||
}
|
||||
|
||||
if (handler == null || !screens.isEnabled(handler)) return;
|
||||
|
||||
for (KeyBinding kb : movementKeys) {
|
||||
kb.setPressed(KeyUtil.isKeyDown((
|
||||
(KeyBindingAccessor) kb).getBoundKey().getCode()));
|
||||
}
|
||||
}
|
||||
|
||||
private void unpress() {
|
||||
if (movementKeys == null) return;
|
||||
for (KeyBinding kb : movementKeys) {
|
||||
kb.setPressed(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,64 @@
|
||||
package me.retucio.camtweaks.module.modules;
|
||||
|
||||
import me.retucio.camtweaks.event.SubscribeEvent;
|
||||
import me.retucio.camtweaks.event.events.DamageItemEvent;
|
||||
import me.retucio.camtweaks.module.Module;
|
||||
import me.retucio.camtweaks.module.settings.BooleanSetting;
|
||||
import me.retucio.camtweaks.module.settings.NumberSetting;
|
||||
import me.retucio.camtweaks.module.settings.OptionSetting;
|
||||
import me.retucio.camtweaks.util.ChatUtil;
|
||||
import me.retucio.camtweaks.util.Lists;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
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;
|
||||
|
||||
|
||||
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));
|
||||
public BooleanSetting message = addSetting(new BooleanSetting("enviar mensaje", "enviar un mensaje para alertar al usuario", true));
|
||||
|
||||
public BooleanSetting playSound = addSetting(new BooleanSetting("reproducir sonido", "reproducir un sonido para alertar al usuario", true));
|
||||
public OptionSetting<SoundEvent> sound = addSetting(new OptionSetting<>("sonido", "qué sonido reproducir",
|
||||
Lists.soundList, SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), Lists.soundNames));
|
||||
public NumberSetting volume = addSetting(new NumberSetting("volumen", "volumen del sonido", 70, 0, 125, 1));
|
||||
public NumberSetting pitch = addSetting(new NumberSetting("frecuencia", "altura del sonido", 70, 0, 125, 1));
|
||||
|
||||
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");
|
||||
|
||||
playSound.onUpdate(v -> {
|
||||
sound.setVisible(v);
|
||||
volume.setVisible(v);
|
||||
pitch.setVisible(v);
|
||||
});
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDecreaseDurability(DamageItemEvent event) {
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (mc.player == null || mc.world == null) return;
|
||||
ItemStack stack = event.getStack();
|
||||
ItemStack stack = mc.player.getStackInHand(Hand.MAIN_HAND);
|
||||
if (warned.contains(stack)) return;
|
||||
|
||||
float percentage = (1 - (float) stack.getDamage() / stack.getMaxDamage()) * 100;
|
||||
|
||||
double percentage = 100 * (1 - ((double) stack.getDamage() / stack.getMaxDamage()));
|
||||
if (percentage <= limitPercentage.getValue()) {
|
||||
|
||||
if (sound.isEnabled())
|
||||
if (playSound.isEnabled())
|
||||
mc.world.playSound(mc.player, mc.player.getBlockPos(),
|
||||
SoundEvents.BLOCK_BELL_USE, SoundCategory.AMBIENT, 1, 1);
|
||||
sound.getValue(),
|
||||
SoundCategory.AMBIENT,
|
||||
toExponential(volume),
|
||||
toExponential(pitch)
|
||||
);
|
||||
|
||||
if (message.isEnabled()) {
|
||||
String customName = stack.getCustomName() == null ? "" : " \"" + stack.getCustomName().getString() + "\"";
|
||||
@@ -42,8 +66,27 @@ public class WarnLowDurability extends Module {
|
||||
+ Formatting.GREEN + customName + Formatting.RESET
|
||||
+ " a " + Formatting.GOLD + ((int) percentage + "") + "%"
|
||||
+ Formatting.RESET + " de durabilidad");
|
||||
mc.execute(() -> ChatUtil.warn(text)); // en mc.execute porque si lo llamo directamente, lo hago desde el thread del server que causa un error
|
||||
ChatUtil.warn(text);
|
||||
}
|
||||
|
||||
warned.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
warned.clear();
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
// el sistema decibélico es un sistema logarítmico
|
||||
private float toExponential(NumberSetting setting) {
|
||||
double linear = setting.getValue();
|
||||
|
||||
double normalized = linear / (setting.getMax() - setting.getMax() / 4);
|
||||
double exponential = Math.pow(normalized, 3);
|
||||
|
||||
if (exponential < 0.01) exponential = 0;
|
||||
return (float) exponential;
|
||||
}
|
||||
}
|
||||
@@ -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,8 +36,7 @@ public class Zoom extends Module {
|
||||
private double value;
|
||||
|
||||
public Zoom() {
|
||||
super("zoom", "lupa");
|
||||
assignKey(GLFW.GLFW_KEY_F);
|
||||
super("zoom", "lupa", GLFW.GLFW_KEY_F);
|
||||
|
||||
keyMode.setDefaultValue(KeyModes.HOLD);
|
||||
keyMode.setValue(KeyModes.HOLD);
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package me.retucio.camtweaks.module.settings;
|
||||
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.event.events.camtweaks.UpdateSettingEvent;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
// ajuste booleano, es decir, o se encuentra encencido o apagado (similar a un interruptor)
|
||||
public class BooleanSetting extends AbstractSetting {
|
||||
public class BooleanSetting extends Setting {
|
||||
|
||||
private boolean defaultValue;
|
||||
private boolean enabled;
|
||||
|
||||
@@ -0,0 +1,277 @@
|
||||
package me.retucio.camtweaks.module.settings;
|
||||
|
||||
import me.retucio.camtweaks.util.Colors;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ColorSetting extends Setting {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
package me.retucio.camtweaks.module.settings;
|
||||
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.event.events.camtweaks.UpdateSettingEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
// ajuste que te deja elegir entre distintas opciones definidas, dentro de un Enum
|
||||
public class EnumSetting<E extends Enum<E>> extends AbstractSetting {
|
||||
public class EnumSetting<E extends Enum<E>> extends Setting {
|
||||
|
||||
private final List<E> values;
|
||||
private E defaultValue;
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class KeySetting extends AbstractSetting {
|
||||
public class KeySetting extends Setting {
|
||||
|
||||
private int key;
|
||||
private int defaultKey;
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package me.retucio.camtweaks.module.settings;
|
||||
|
||||
import me.retucio.camtweaks.CameraTweaks;
|
||||
import me.retucio.camtweaks.event.events.camtweaks.UpdateSettingEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ListSetting<T> extends AbstractSetting {
|
||||
public class ListSetting<T> extends Setting {
|
||||
|
||||
private final List<T> options;
|
||||
private List<T> options;
|
||||
private Map<T, Boolean> values;
|
||||
private Map<T, Boolean> defaultValues;
|
||||
private Map<T, String> displayNames = null;
|
||||
@@ -19,7 +17,7 @@ public class ListSetting<T> extends AbstractSetting {
|
||||
|
||||
public ListSetting(String name, String description, List<T> options, Map<T, Boolean> initialValues) {
|
||||
super(name, description);
|
||||
this.options = options;
|
||||
this.options = new ArrayList<>(options);
|
||||
this.defaultValues = new HashMap<>();
|
||||
|
||||
for (T option : options) {
|
||||
@@ -66,6 +64,25 @@ public class ListSetting<T> extends AbstractSetting {
|
||||
defaultValues = values;
|
||||
}
|
||||
|
||||
public Map<String, Boolean> getConfigValues() {
|
||||
Map<String, Boolean> configValues = new HashMap<>();
|
||||
for (int i = 0; i < values.size(); i++)
|
||||
configValues.put(getDisplayName(options.get(i)), values.get(options.get(i)));
|
||||
return configValues;
|
||||
}
|
||||
|
||||
public void addOption(T option, boolean value, String displayName) {
|
||||
if (!(this.options instanceof ArrayList))
|
||||
this.options = new ArrayList<>(this.options);
|
||||
|
||||
this.options.add(option);
|
||||
this.values.put(option, value);
|
||||
this.defaultValues.put(option, value);
|
||||
|
||||
if (this.displayNames != null)
|
||||
this.displayNames.put(option, displayName);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
values.clear();
|
||||
values.putAll(defaultValues);
|
||||
|
||||
Loaded 100 of 145 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user