From 9b6d037b6c4a1a84ec82f7c4da2df69f9f3849c1 Mon Sep 17 00:00:00 2001 From: retuci0 Date: Sun, 1 Feb 2026 13:46:01 +0100 Subject: [PATCH] v3.0 --- cambios.md | 37 +- credits.txt | 3 + gradle.properties | 2 +- gradlew | 0 src/main/java/me/retucio/sputnik/Sputnik.java | 3 +- .../sputnik/command/CommandManager.java | 4 + .../command/args/EnumArgumentType.java | 46 ++ .../command/commands/ClickSlotCommand.java | 35 ++ .../command/commands/PluginsCommand.java | 113 +++++ .../command/commands/RepeatCommand.java | 32 ++ .../command/commands/SpectateCommand.java | 2 +- .../sputnik/command/commands/WaitCommand.java | 40 ++ .../retucio/sputnik/config/ConfigManager.java | 2 +- .../events/{ => input}/ClientClickEvent.java | 2 +- .../event/events/{ => input}/KeyEvent.java | 2 +- .../events/{ => input}/MouseClickEvent.java | 2 +- .../events/{ => input}/MouseScrollEvent.java | 2 +- .../{ => interact}/AttackBlockEvent.java | 2 +- .../{ => interact}/AttackEntityEvent.java | 2 +- .../{ => interact}/BlockShapeEvent.java | 2 +- .../{ => events/interact}/BoatMoveEvent.java | 3 +- .../{ => interact}/BreakBlockEvent.java | 2 +- .../{ => interact}/ClipAtLedgeEvent.java | 2 +- .../{ => interact}/DamageItemEvent.java | 2 +- .../{ => interact}/InteractEntityEvent.java | 2 +- .../{ => interact}/OpenScreenEvent.java | 2 +- .../{ => interact}/PlaceBlockEvent.java | 2 +- .../events/{ => interact}/UseItemEvent.java | 2 +- .../events/{ => network}/AddEntityEvent.java | 2 +- .../{ => network}/ChunkOcclusionEvent.java | 2 +- .../events/{ => network}/DisconnectEvent.java | 2 +- .../events/{ => network}/JoinWorldEvent.java | 2 +- .../events/{ => network}/PacketEvent.java | 2 +- .../{ => network}/ReceiveMessageEvent.java | 2 +- .../{ => network}/RemoveEntityEvent.java | 2 +- .../{ => network}/SendMessageEvent.java | 2 +- .../{ => render}/ChangeRotationEvent.java | 2 +- .../events/{ => render}/GetFOVEvent.java | 2 +- .../{ => render}/PerspectiveChangeEvent.java | 2 +- .../events/{ => render}/Render2DEvent.java | 2 +- .../events/{ => render}/Render3DEvent.java | 2 +- .../events/{ => render}/RenderArmEvent.java | 2 +- .../render/RenderBlockOutlineEvent.java | 30 ++ .../{ => render}/RenderBossbarEvent.java | 2 +- .../{ => render}/RenderHeldItemEvent.java | 2 +- .../mixin/AbstractBoatEntityMixin.java | 2 +- .../mixin/BlockCollisionSpliteratorMixin.java | 2 +- .../sputnik/mixin/BossBarHudMixin.java | 2 +- .../retucio/sputnik/mixin/ChatHudMixin.java | 2 +- .../mixin/ChunkOcclusionDataBuilderMixin.java | 2 +- .../sputnik/mixin/ClientConnectionMixin.java | 4 +- .../mixin/ClientPlayNetworkHandlerMixin.java | 2 +- .../ClientPlayerInteractionManagerMixin.java | 2 +- .../sputnik/mixin/ClientWorldMixin.java | 4 +- .../mixin/CreativeInventoryScreenMixin.java | 28 ++ .../me/retucio/sputnik/mixin/EntityMixin.java | 13 +- .../sputnik/mixin/FontManagerMixin.java | 5 +- .../sputnik/mixin/GameOptionsMixin.java | 2 +- .../sputnik/mixin/GameRendererMixin.java | 3 +- .../sputnik/mixin/HeldItemRendererMixin.java | 4 +- .../retucio/sputnik/mixin/InGameHudMixin.java | 2 +- .../retucio/sputnik/mixin/ItemStackMixin.java | 2 +- .../retucio/sputnik/mixin/KeyboardMixin.java | 2 +- .../sputnik/mixin/MinecraftClientMixin.java | 7 +- .../me/retucio/sputnik/mixin/MouseMixin.java | 4 +- .../sputnik/mixin/PlayerEntityMixin.java | 2 +- .../me/retucio/sputnik/mixin/ScreenMixin.java | 2 +- .../sputnik/mixin/ShaderLoaderMixin.java | 17 + .../sputnik/mixin/WorldRendererMixin.java | 40 +- .../accessor/FishingBobberEntityAccessor.java | 15 + .../me/retucio/sputnik/module/Category.java | 4 +- .../retucio/sputnik/module/ModuleManager.java | 15 +- .../sputnik/module/modules/camera/Autism.java | 67 +++ .../module/modules/camera/Freecam.java | 52 ++- .../module/modules/camera/Freelook.java | 6 +- .../module/modules/camera/Fullbright.java | 6 +- .../modules/camera/PerspectivePlus.java | 22 +- .../module/modules/camera/Rotations.java | 26 +- .../sputnik/module/modules/camera/Zoom.java | 27 +- .../module/modules/client/DiscordRPC.java | 30 +- .../sputnik/module/modules/client/GUI.java | 35 +- .../sputnik/module/modules/client/HUD.java | 6 +- .../{player => combat}/AttributeSwapper.java | 12 +- .../modules/{player => combat}/MaceKill.java | 19 +- .../combat/ProjectileTrajectories.java | 414 ++++++++++++++++++ .../module/modules/combat/SpearKill.java | 119 +++++ .../module/modules/misc/AnvilFont.java | 4 +- .../module/modules/misc/BossbarStack.java | 8 +- .../sputnik/module/modules/misc/ChatPlus.java | 27 +- .../misc/CreativeInventoryHotbarKeybinds.java | 18 + .../module/modules/misc/FakePlayer.java | 2 +- .../module/modules/misc/ScreenshotPlus.java | 14 +- .../module/modules/misc/ShulkerPeek.java | 8 +- .../module/modules/movement/BoatFly.java | 14 +- .../module/modules/movement/Dolphin.java | 8 +- .../module/modules/movement/ElytraFly.java | 2 +- .../module/modules/movement/Headhitters.java | 2 +- .../modules/movement/InfiniteElytra.java | 16 +- .../module/modules/movement/Jesus.java | 21 +- .../module/modules/movement/ReverseStep.java | 13 +- .../module/modules/movement/SafeWalk.java | 6 +- .../module/modules/movement/Slippy.java | 2 +- .../sputnik/module/modules/movement/Step.java | 2 +- .../module/modules/movement/TridentBoost.java | 4 +- .../modules/{player => movement}/UIMove.java | 4 +- .../modules/network/BungeecordSpoofer.java | 2 +- .../module/modules/network/LogoutSpots.java | 28 +- .../module/modules/network/PacketDelay.java | 20 +- .../module/modules/network/PacketMine.java | 20 +- .../module/modules/network/RPackBypass.java | 1 + .../module/modules/network/Reconnect.java | 4 +- .../module/modules/player/AirPlace.java | 147 +++++++ .../module/modules/player/AntiHunger.java | 44 ++ .../module/modules/player/AutoFish.java | 122 ++++++ .../module/modules/player/FastUse.java | 12 +- .../module/modules/player/HandView.java | 113 +++-- .../module/modules/player/InventoryPlus.java | 14 +- .../sputnik/module/modules/player/NoFall.java | 118 +++++ .../module/modules/player/Offhand.java | 19 +- .../modules/player/WarnLowDurability.java | 16 +- .../module/modules/render/BlockESP.java | 37 +- .../module/modules/render/BlockOutline.java | 14 +- .../modules/render/BreakingProgress.java | 35 +- .../module/modules/render/CritsPlus.java | 20 +- .../module/modules/render/DamageOverlay.java | 2 +- .../sputnik/module/modules/render/Fonts.java | 8 +- .../module/modules/render/GlintPlus.java | 6 +- .../module/modules/render/Nametags.java | 35 +- .../module/modules/render/NoRender.java | 54 +-- .../module/modules/render/Particles.java | 35 +- .../module/modules/world/AutoSign.java | 10 +- .../module/modules/world/AutoTool.java | 195 +++++++++ .../module/modules/world/BlockInfo.java | 16 +- .../module/modules/world/ColoredSigns.java | 11 +- .../module/modules/world/LightOverlay.java | 32 +- .../modules/world/NoMiningInterruptions.java | 4 +- .../sputnik/module/modules/world/Racist.java | 2 - .../modules/world/StrongholdTriangulator.java | 5 +- .../module/modules/world/TimeChanger.java | 35 +- .../sputnik/module/setting/Setting.java | 4 +- .../module/setting/settings/KeySetting.java | 4 + .../setting/settings/NumberSetting.java | 4 + .../sputnik/ui/hud/HudEditorScreen.java | 2 +- .../retucio/sputnik/ui/screen/ClickGUI.java | 6 +- .../widgets/buttons/settings/ColorButton.java | 2 +- .../me/retucio/sputnik/util/ChatUtil.java | 17 + .../java/me/retucio/sputnik/util/Colors.java | 9 + .../retucio/sputnik/util/InventoryUtil.java | 60 ++- .../me/retucio/sputnik/util/MiscUtil.java | 14 + .../me/retucio/sputnik/util/NetworkUtil.java | 20 +- .../sputnik/util/misc/ProjectileInfo.java | 192 ++++++++ .../sputnik/util/render/Pipelines.java | 63 ++- .../sputnik/util/render/RenderUtil.java | 29 ++ .../retucio/sputnik/util/render/Textures.java | 2 +- .../resources/assets/sputnik/shaders/lsd.frag | 126 ++++++ .../resources/assets/sputnik/shaders/lsd.vert | 11 + src/main/resources/sputnik.accesswidener | 8 + src/main/resources/sputnik.mixins.json | 5 +- 158 files changed, 2830 insertions(+), 601 deletions(-) mode change 100644 => 100755 gradlew create mode 100644 src/main/java/me/retucio/sputnik/command/args/EnumArgumentType.java create mode 100644 src/main/java/me/retucio/sputnik/command/commands/ClickSlotCommand.java create mode 100644 src/main/java/me/retucio/sputnik/command/commands/PluginsCommand.java create mode 100644 src/main/java/me/retucio/sputnik/command/commands/RepeatCommand.java create mode 100644 src/main/java/me/retucio/sputnik/command/commands/WaitCommand.java rename src/main/java/me/retucio/sputnik/event/events/{ => input}/ClientClickEvent.java (92%) rename src/main/java/me/retucio/sputnik/event/events/{ => input}/KeyEvent.java (91%) rename src/main/java/me/retucio/sputnik/event/events/{ => input}/MouseClickEvent.java (90%) rename src/main/java/me/retucio/sputnik/event/events/{ => input}/MouseScrollEvent.java (93%) rename src/main/java/me/retucio/sputnik/event/events/{ => interact}/AttackBlockEvent.java (90%) rename src/main/java/me/retucio/sputnik/event/events/{ => interact}/AttackEntityEvent.java (88%) rename src/main/java/me/retucio/sputnik/event/events/{ => interact}/BlockShapeEvent.java (94%) rename src/main/java/me/retucio/sputnik/event/{ => events/interact}/BoatMoveEvent.java (85%) rename src/main/java/me/retucio/sputnik/event/events/{ => interact}/BreakBlockEvent.java (89%) rename src/main/java/me/retucio/sputnik/event/events/{ => interact}/ClipAtLedgeEvent.java (87%) rename src/main/java/me/retucio/sputnik/event/events/{ => interact}/DamageItemEvent.java (90%) rename src/main/java/me/retucio/sputnik/event/events/{ => interact}/InteractEntityEvent.java (92%) rename src/main/java/me/retucio/sputnik/event/events/{ => interact}/OpenScreenEvent.java (88%) rename src/main/java/me/retucio/sputnik/event/events/{ => interact}/PlaceBlockEvent.java (93%) rename src/main/java/me/retucio/sputnik/event/events/{ => interact}/UseItemEvent.java (92%) rename src/main/java/me/retucio/sputnik/event/events/{ => network}/AddEntityEvent.java (88%) rename src/main/java/me/retucio/sputnik/event/events/{ => network}/ChunkOcclusionEvent.java (78%) rename src/main/java/me/retucio/sputnik/event/events/{ => network}/DisconnectEvent.java (92%) rename src/main/java/me/retucio/sputnik/event/events/{ => network}/JoinWorldEvent.java (88%) rename src/main/java/me/retucio/sputnik/event/events/{ => network}/PacketEvent.java (95%) rename src/main/java/me/retucio/sputnik/event/events/{ => network}/ReceiveMessageEvent.java (95%) rename src/main/java/me/retucio/sputnik/event/events/{ => network}/RemoveEntityEvent.java (88%) rename src/main/java/me/retucio/sputnik/event/events/{ => network}/SendMessageEvent.java (89%) rename src/main/java/me/retucio/sputnik/event/events/{ => render}/ChangeRotationEvent.java (93%) rename src/main/java/me/retucio/sputnik/event/events/{ => render}/GetFOVEvent.java (88%) rename src/main/java/me/retucio/sputnik/event/events/{ => render}/PerspectiveChangeEvent.java (91%) rename src/main/java/me/retucio/sputnik/event/events/{ => render}/Render2DEvent.java (91%) rename src/main/java/me/retucio/sputnik/event/events/{ => render}/Render3DEvent.java (94%) rename src/main/java/me/retucio/sputnik/event/events/{ => render}/RenderArmEvent.java (93%) create mode 100644 src/main/java/me/retucio/sputnik/event/events/render/RenderBlockOutlineEvent.java rename src/main/java/me/retucio/sputnik/event/events/{ => render}/RenderBossbarEvent.java (97%) rename src/main/java/me/retucio/sputnik/event/events/{ => render}/RenderHeldItemEvent.java (93%) create mode 100644 src/main/java/me/retucio/sputnik/mixin/CreativeInventoryScreenMixin.java create mode 100644 src/main/java/me/retucio/sputnik/mixin/ShaderLoaderMixin.java create mode 100644 src/main/java/me/retucio/sputnik/mixin/accessor/FishingBobberEntityAccessor.java create mode 100644 src/main/java/me/retucio/sputnik/module/modules/camera/Autism.java rename src/main/java/me/retucio/sputnik/module/modules/{player => combat}/AttributeSwapper.java (66%) rename src/main/java/me/retucio/sputnik/module/modules/{player => combat}/MaceKill.java (93%) create mode 100644 src/main/java/me/retucio/sputnik/module/modules/combat/ProjectileTrajectories.java create mode 100644 src/main/java/me/retucio/sputnik/module/modules/combat/SpearKill.java create mode 100644 src/main/java/me/retucio/sputnik/module/modules/misc/CreativeInventoryHotbarKeybinds.java rename src/main/java/me/retucio/sputnik/module/modules/{player => movement}/UIMove.java (97%) create mode 100644 src/main/java/me/retucio/sputnik/module/modules/player/AirPlace.java create mode 100644 src/main/java/me/retucio/sputnik/module/modules/player/AntiHunger.java create mode 100644 src/main/java/me/retucio/sputnik/module/modules/player/AutoFish.java create mode 100644 src/main/java/me/retucio/sputnik/module/modules/player/NoFall.java create mode 100644 src/main/java/me/retucio/sputnik/module/modules/world/AutoTool.java create mode 100644 src/main/java/me/retucio/sputnik/util/misc/ProjectileInfo.java create mode 100644 src/main/resources/assets/sputnik/shaders/lsd.frag create mode 100644 src/main/resources/assets/sputnik/shaders/lsd.vert diff --git a/cambios.md b/cambios.md index 0461259..73cc955 100644 --- a/cambios.md +++ b/cambios.md @@ -1,29 +1,36 @@ -# v2.9 +# v3.0 ## novedades -varios módulos que no quería añadir porque son cheats en toda regla, pero ya total, como la mayoría que he añadido hasta la fecha es baneable +- categoría de combate ### adiciones -- categoría de movimiento - #### módulos nuevos: -- packetmine: mina usando paquetes, para minar más rápido o para evitar la animación de minado -- aliviar cpu: evita renderizar objetos en pantalla si la ventana no está seleccionada -- delfín: *ruidos de delfín* -- patinaje: esparce semen allá por donde pisas (haciéndolo más resbaladizo) -- jesús: hermano se cree Jesús (camina sobre el agua) -- info. de bloque: (muestra el contenido nbt de un bloque) -- estampaescrotos: mazo en esteroides -- tenedor mágico: hermano se cree Poseidón (tweaks a la propulsión acuática del tridente) -- elytras: vuela con las elytras (en vez de solo planear) -- barco volador: convierte tu bote de acacia en un caza militar +- colocar en aire: te permite colocar bloques sin soporte alguno +- tobillos fuertes: evita el daño de caída, ya sea por medio de paquetes o amortiguándola con un cubo de agua, si este está disponible +- don quijote: te acelera para inflingir cantidades importantes de daño con la lanza +- auto herramienta: cambia automáticamente a la herramienta más veloz disponible para el bloque seleccionado +- autismo: da vueltas +- anti hambre: previene el hambre, cancelando los paquetes que le indican al server que empiezas a esprintar +- trayectoria: preve la trayectoria de los proyectiles (maomeno, aún lo tengo que ajustar un poco) +- hotkeys inv. creativo: te permite usar las teclas de la hotbar correctamente en la pestaña de búsqueda, por ejemplo, si tienes el slot 5 en la E, al posicionar el cursor sobre un stack del resultado de búsqueda, y darle a la E, en vez de escribir una E, actúa como las teclas del 1-9 +- auto pesca: pesca por ti + +#### comandos nuevos: + +- `$plugins`: trata de buscar plugins del server al que estás conectado mediante la búsqueda de comandos no vanilla +- `$clickslot`: simula un clic en un slot específico, también se especifica el botón del ratón y la acción +- `$wait`: espera un delay determinado antes de enviar un mensaje / ejecutar un comando +- `$repeat`: repite un comando o mensaje x veces ### arreglos / mejoras -- ahora puedes cambiar el título de la ventana en los ajustes del mod +- delfín ahora funciona mejor (*ruidos de delfín*) +- barco volador ahora usa el ajuste de velocidad vertical +- escalones inversos ahora usa el ajuste de velocidad +- ahora puedes ver el tiempo restante hasta que una entidad de tnt explote ## problemas reconocidos diff --git a/credits.txt b/credits.txt index 606730b..d9b8397 100644 --- a/credits.txt +++ b/credits.txt @@ -7,6 +7,9 @@ Trouser Streak: https://github.com/etianl/Trouser-Streak No More Purple: https://github.com/Pepperoni-Jabroni/NoMorePurple/ bypass-resource-pack: https://github.com/emilyy-dev/bypass-resource-pack elytra-recast: https://github.com/InLieuOfLuna/elytra-recast/ +SpearHax: https://github.com/etianl/spearHax/ +ProjectileTrajectoryPreview: https://github.com/maDU59/ProjectilesTrajectoryPreview +DupersUnited public addon: https://discord.gg/dupes | https://dupers.wtf probablemente más pero como tengo demencia se me olvida si quieres que te acredite o quite tu código de mi mod, mándame un mensaje en discord (username: retucio) y sin problemas :) \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index bc0fac2..2755528 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,6 @@ loom_version=1.13-SNAPSHOT fabric_api_version=0.140.2+1.21.11 -mod_version=2.9 +mod_version=3.0 maven_group=me.retucio archives_base_name=sputnik \ No newline at end of file diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/java/me/retucio/sputnik/Sputnik.java b/src/main/java/me/retucio/sputnik/Sputnik.java index e10514d..7d1fd50 100644 --- a/src/main/java/me/retucio/sputnik/Sputnik.java +++ b/src/main/java/me/retucio/sputnik/Sputnik.java @@ -32,6 +32,7 @@ import me.retucio.sputnik.ui.widgets.Button; import me.retucio.sputnik.util.*; import me.retucio.sputnik.util.KeyUtil; import me.retucio.sputnik.util.render.DrawUtil; +import me.retucio.sputnik.util.render.Pipelines; import me.retucio.sputnik.util.render.RenderUtil; import me.retucio.sputnik.util.render.Textures; @@ -94,7 +95,7 @@ public class Sputnik implements ClientModInitializer { Lists.init(); - Textures.registerAll(); + Textures.init(); CapeManager.INSTANCE = new CapeManager(); EVENT_BUS.post(new LoadCapeManagerEvent()); diff --git a/src/main/java/me/retucio/sputnik/command/CommandManager.java b/src/main/java/me/retucio/sputnik/command/CommandManager.java index 94a7cfd..3432da0 100644 --- a/src/main/java/me/retucio/sputnik/command/CommandManager.java +++ b/src/main/java/me/retucio/sputnik/command/CommandManager.java @@ -32,17 +32,21 @@ public class CommandManager { public static void registerCommands() { addCommand(new BindCommand()); + addCommand(new ClickSlotCommand()); addCommand(new ConfigCommand()); addCommand(new CopyScreenshotCommand()); addCommand(new EnderChestCommand()); addCommand(new GarbageCleanerCommand()); addCommand(new PeekCommand()); + addCommand(new PluginsCommand()); addCommand(new PrefixCommand()); addCommand(new PurgeCommand()); + addCommand(new RepeatCommand()); addCommand(new SaveScreenshotCommand()); addCommand(new SendCommand()); addCommand(new SpectateCommand()); addCommand(new ToggleCommand()); + addCommand(new WaitCommand()); commands.sort(Comparator.comparing(Command::getName)); diff --git a/src/main/java/me/retucio/sputnik/command/args/EnumArgumentType.java b/src/main/java/me/retucio/sputnik/command/args/EnumArgumentType.java new file mode 100644 index 0000000..a44ae0e --- /dev/null +++ b/src/main/java/me/retucio/sputnik/command/args/EnumArgumentType.java @@ -0,0 +1,46 @@ +package me.retucio.sputnik.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 net.minecraft.command.CommandSource; +import net.minecraft.text.Text; + +import java.util.Arrays; +import java.util.concurrent.CompletableFuture; + +public class EnumArgumentType> implements ArgumentType { + + private static final DynamicCommandExceptionType NO_SUCH_TYPE = new DynamicCommandExceptionType((value) -> Text.of(" argumento inválido: " + value)); + + private final T[] values; + + public EnumArgumentType(T defaultValue) { + this.values = defaultValue.getDeclaringClass().getEnumConstants(); + } + + public static > EnumArgumentType enumArgument(T defaultValue) { + return new EnumArgumentType<>(defaultValue); + } + + public static > T getEnum(CommandContext context, String name, T defaultValue) { + return context.getArgument(name, defaultValue.getDeclaringClass()); + } + + public T parse(StringReader reader) throws CommandSyntaxException { + String argument = reader.readString(); + return Arrays.stream(this.values) + .filter((value) -> value.toString().equals(argument)) + .findFirst() + .orElseThrow(() -> NO_SUCH_TYPE.create(argument) + ); + } + + public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { + return CommandSource.suggestMatching(Arrays.stream(this.values).map(e -> e.toString().toLowerCase()), builder); + } +} \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/command/commands/ClickSlotCommand.java b/src/main/java/me/retucio/sputnik/command/commands/ClickSlotCommand.java new file mode 100644 index 0000000..8f4c704 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/command/commands/ClickSlotCommand.java @@ -0,0 +1,35 @@ +package me.retucio.sputnik.command.commands; + +import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import me.retucio.sputnik.command.Command; +import me.retucio.sputnik.command.args.EnumArgumentType; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.GenericContainerScreen; +import net.minecraft.command.CommandSource; +import net.minecraft.screen.slot.SlotActionType; + +// https://cdn.discordapp.com/attachments/1456079799045980400/1457154232737206375/dupersunited-public-addon-1.21.11-3.1.3.jar?ex=69735be1&is=69720a61&hm=77fb6faee49762e0a812661f0d98931e89cb725db711c45722249d0efe3b91e4& +public class ClickSlotCommand extends Command { + + public ClickSlotCommand() { + super("clickslot", "simula un clic a un slot"); + } + + public void build(LiteralArgumentBuilder builder) { + builder.then(argument("slot", IntegerArgumentType.integer()) + .then(argument("botón", IntegerArgumentType.integer()) + .then(argument("acción", EnumArgumentType.enumArgument(SlotActionType.SWAP)) + .executes(context -> { + int slot = context.getArgument("slot", Integer.class), button = context.getArgument("botón", Integer.class); + SlotActionType action = context.getArgument("acción", SlotActionType.class); + Screen screen = mc.currentScreen; + int syncId = (screen instanceof GenericContainerScreen gcScreen) ? gcScreen.getScreenHandler().syncId : 0; + mc.interactionManager.clickSlot(syncId, slot, button, action, mc.player); + return SUCCESS; + }) + ) + ) + ); + } +} diff --git a/src/main/java/me/retucio/sputnik/command/commands/PluginsCommand.java b/src/main/java/me/retucio/sputnik/command/commands/PluginsCommand.java new file mode 100644 index 0000000..ed27f36 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/command/commands/PluginsCommand.java @@ -0,0 +1,113 @@ +package me.retucio.sputnik.command.commands; + +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.tree.CommandNode; + +import com.mojang.brigadier.tree.RootCommandNode; +import me.retucio.sputnik.Sputnik; +import me.retucio.sputnik.command.Command; +import me.retucio.sputnik.event.SubscribeEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; +import me.retucio.sputnik.util.ChatUtil; + +import net.minecraft.client.network.ClientCommandSource; +import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.command.CommandSource; +import net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket; + +import java.util.HashSet; +import java.util.Set; + + +public class PluginsCommand extends Command { + private final Set plugins = new HashSet<>(); + private boolean scanning = false; + + public PluginsCommand() { + super("plugins", "busca los plugins que tenga el server", "pl", "serverplugins"); + Sputnik.EVENT_BUS.subscribe(this); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder.executes(context -> { + if (mc.isIntegratedServerRunning()) { + ChatUtil.error("estás en un solo jugador"); + return SUCCESS; + } + + if (scanning) { + ChatUtil.error("calmaaa"); + return SUCCESS; + } + + plugins.clear(); + scanning = true; + + findNamespaces(); + + return SUCCESS; + }); + } + + private void findNamespaces() { + try { + ClientPlayNetworkHandler networkHandler = mc.getNetworkHandler(); + if (networkHandler == null || networkHandler.getCommandDispatcher() == null) { + return; + } + + RootCommandNode root = networkHandler.getCommandDispatcher().getRoot(); + root.getChildren().forEach(this::checkNodeForPlugins); + + if (!plugins.isEmpty()) { + ChatUtil.info(plugins.size() + " namespace(s) encontrado(s) de comandos:"); + plugins.stream() + .sorted() + .forEach(plugin -> ChatUtil.info(" - " + plugin)); + } + + displayResults(); + + } catch (Exception e) { + ChatUtil.error("error analizando comandos: " + e.getMessage()); + } + } + + private void checkNodeForPlugins(CommandNode node) { + String name = node.getName(); + + if (name.contains(":")) { + String namespace = name.split(":")[0]; + if (!namespace.equalsIgnoreCase("minecraft") + && !namespace.equalsIgnoreCase("bukkit") + && !namespace.equalsIgnoreCase("spigot") + && !namespace.equalsIgnoreCase("paper")) { + plugins.add(namespace); + } + } + + node.getChildren().forEach(this::checkNodeForPlugins); + } + + @SubscribeEvent + private void onPacketReceive(PacketEvent.Receive event) { + if (!scanning) return; + + if (event.getPacket() instanceof CommandTreeS2CPacket) { + findNamespaces(); + } + } + + private void displayResults() { + if (!plugins.isEmpty()) { + ChatUtil.info(plugins.size() + " plugin(s) encontrado(s)"); + plugins.stream().sorted() + .forEach(plugin -> ChatUtil.info(" - " + plugin)); + } else { + ChatUtil.warn("sin plugins (probablemente)"); + } + + scanning = false; + } +} \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/command/commands/RepeatCommand.java b/src/main/java/me/retucio/sputnik/command/commands/RepeatCommand.java new file mode 100644 index 0000000..0c85fc3 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/command/commands/RepeatCommand.java @@ -0,0 +1,32 @@ +package me.retucio.sputnik.command.commands; + +import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import me.retucio.sputnik.command.Command; +import me.retucio.sputnik.util.ChatUtil; +import net.minecraft.command.CommandSource; + +public class RepeatCommand extends Command { + + public RepeatCommand() { + super("repetir", "repite un comando x veces", "repeat"); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder + .then(argument("veces", IntegerArgumentType.integer(1)) + .then(argument("comando", StringArgumentType.greedyString()) + .executes(ctx -> { + int j = ctx.getArgument("veces", Integer.class); + String command = ctx.getArgument("comando", String.class); + for (int i = 0; i < j; i++) { + ChatUtil.simulateChatMessage(command); + } + return SUCCESS; + }) + ) + ); + } +} diff --git a/src/main/java/me/retucio/sputnik/command/commands/SpectateCommand.java b/src/main/java/me/retucio/sputnik/command/commands/SpectateCommand.java index 571e32a..b02f2c9 100644 --- a/src/main/java/me/retucio/sputnik/command/commands/SpectateCommand.java +++ b/src/main/java/me/retucio/sputnik/command/commands/SpectateCommand.java @@ -4,7 +4,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import me.retucio.sputnik.command.Command; import me.retucio.sputnik.command.args.EntityArgumentType; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.KeyEvent; +import me.retucio.sputnik.event.events.input.KeyEvent; import me.retucio.sputnik.util.EntityUtil; import net.minecraft.command.CommandSource; import net.minecraft.entity.Entity; diff --git a/src/main/java/me/retucio/sputnik/command/commands/WaitCommand.java b/src/main/java/me/retucio/sputnik/command/commands/WaitCommand.java new file mode 100644 index 0000000..e622768 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/command/commands/WaitCommand.java @@ -0,0 +1,40 @@ +package me.retucio.sputnik.command.commands; + +import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import me.retucio.sputnik.command.Command; +import me.retucio.sputnik.command.CommandManager; +import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame; +import me.retucio.sputnik.util.ChatUtil; +import net.minecraft.command.CommandSource; + +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +public class WaitCommand extends Command { + + private static final ScheduledExecutorService DELAYED_EXECUTOR = new ScheduledThreadPoolExecutor(2); + + public WaitCommand() { + super("wait", "espera un tiempo determinado antes de ejecutar otro comando", "esperar", "sleep", "delay"); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder + .then(argument("delay", IntegerArgumentType.integer(0)) + .then(argument("comando", StringArgumentType.greedyString()) + .executes(ctx -> { + int delay = ctx.getArgument("delay", Integer.class); + String command = ctx.getArgument("comando", String.class); + + DELAYED_EXECUTOR.schedule(() -> ChatUtil.simulateChatMessage(command), delay, TimeUnit.MILLISECONDS); + return SUCCESS; + }) + ) + ); + } +} diff --git a/src/main/java/me/retucio/sputnik/config/ConfigManager.java b/src/main/java/me/retucio/sputnik/config/ConfigManager.java index c7849c3..1925a6b 100644 --- a/src/main/java/me/retucio/sputnik/config/ConfigManager.java +++ b/src/main/java/me/retucio/sputnik/config/ConfigManager.java @@ -343,7 +343,7 @@ public class ConfigManager { } private static String getSettingKey(Setting setting) { - return setting.getSg().getModule().getName() + ":" + setting.getName(); + return setting.getSg().getModule().getName() + ":" + setting.getTrueName(); } public static boolean hasLoaded() { diff --git a/src/main/java/me/retucio/sputnik/event/events/ClientClickEvent.java b/src/main/java/me/retucio/sputnik/event/events/input/ClientClickEvent.java similarity index 92% rename from src/main/java/me/retucio/sputnik/event/events/ClientClickEvent.java rename to src/main/java/me/retucio/sputnik/event/events/input/ClientClickEvent.java index 3cf31be..df8158b 100644 --- a/src/main/java/me/retucio/sputnik/event/events/ClientClickEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/input/ClientClickEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.input; import me.retucio.sputnik.module.modules.misc.ChatPlus; import net.minecraft.text.ClickEvent; diff --git a/src/main/java/me/retucio/sputnik/event/events/KeyEvent.java b/src/main/java/me/retucio/sputnik/event/events/input/KeyEvent.java similarity index 91% rename from src/main/java/me/retucio/sputnik/event/events/KeyEvent.java rename to src/main/java/me/retucio/sputnik/event/events/input/KeyEvent.java index 4f05173..40dc62e 100644 --- a/src/main/java/me/retucio/sputnik/event/events/KeyEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/input/KeyEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.input; import me.retucio.sputnik.event.Event; diff --git a/src/main/java/me/retucio/sputnik/event/events/MouseClickEvent.java b/src/main/java/me/retucio/sputnik/event/events/input/MouseClickEvent.java similarity index 90% rename from src/main/java/me/retucio/sputnik/event/events/MouseClickEvent.java rename to src/main/java/me/retucio/sputnik/event/events/input/MouseClickEvent.java index ce565b6..4698c76 100644 --- a/src/main/java/me/retucio/sputnik/event/events/MouseClickEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/input/MouseClickEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.input; import me.retucio.sputnik.event.Event; diff --git a/src/main/java/me/retucio/sputnik/event/events/MouseScrollEvent.java b/src/main/java/me/retucio/sputnik/event/events/input/MouseScrollEvent.java similarity index 93% rename from src/main/java/me/retucio/sputnik/event/events/MouseScrollEvent.java rename to src/main/java/me/retucio/sputnik/event/events/input/MouseScrollEvent.java index 244f229..286d279 100644 --- a/src/main/java/me/retucio/sputnik/event/events/MouseScrollEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/input/MouseScrollEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.input; import me.retucio.sputnik.event.Event; diff --git a/src/main/java/me/retucio/sputnik/event/events/AttackBlockEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/AttackBlockEvent.java similarity index 90% rename from src/main/java/me/retucio/sputnik/event/events/AttackBlockEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/AttackBlockEvent.java index 1f0083b..b8f4d22 100644 --- a/src/main/java/me/retucio/sputnik/event/events/AttackBlockEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/AttackBlockEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.interact; import me.retucio.sputnik.event.Event; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/me/retucio/sputnik/event/events/AttackEntityEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/AttackEntityEvent.java similarity index 88% rename from src/main/java/me/retucio/sputnik/event/events/AttackEntityEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/AttackEntityEvent.java index bdeb4bd..9228cbe 100644 --- a/src/main/java/me/retucio/sputnik/event/events/AttackEntityEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/AttackEntityEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.interact; import me.retucio.sputnik.event.Event; import net.minecraft.entity.Entity; diff --git a/src/main/java/me/retucio/sputnik/event/events/BlockShapeEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/BlockShapeEvent.java similarity index 94% rename from src/main/java/me/retucio/sputnik/event/events/BlockShapeEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/BlockShapeEvent.java index ec24c2f..1511691 100644 --- a/src/main/java/me/retucio/sputnik/event/events/BlockShapeEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/BlockShapeEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.interact; import me.retucio.sputnik.event.Event; import net.minecraft.block.BlockState; diff --git a/src/main/java/me/retucio/sputnik/event/BoatMoveEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/BoatMoveEvent.java similarity index 85% rename from src/main/java/me/retucio/sputnik/event/BoatMoveEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/BoatMoveEvent.java index 0eea3fa..5209c9e 100644 --- a/src/main/java/me/retucio/sputnik/event/BoatMoveEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/BoatMoveEvent.java @@ -1,5 +1,6 @@ -package me.retucio.sputnik.event; +package me.retucio.sputnik.event.events.interact; +import me.retucio.sputnik.event.Event; import net.minecraft.entity.vehicle.AbstractBoatEntity; import net.minecraft.util.math.Vec3d; diff --git a/src/main/java/me/retucio/sputnik/event/events/BreakBlockEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/BreakBlockEvent.java similarity index 89% rename from src/main/java/me/retucio/sputnik/event/events/BreakBlockEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/BreakBlockEvent.java index 8824ce5..a7624c9 100644 --- a/src/main/java/me/retucio/sputnik/event/events/BreakBlockEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/BreakBlockEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.interact; import me.retucio.sputnik.event.Event; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/me/retucio/sputnik/event/events/ClipAtLedgeEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/ClipAtLedgeEvent.java similarity index 87% rename from src/main/java/me/retucio/sputnik/event/events/ClipAtLedgeEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/ClipAtLedgeEvent.java index 75a1870..1685472 100644 --- a/src/main/java/me/retucio/sputnik/event/events/ClipAtLedgeEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/ClipAtLedgeEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.interact; import me.retucio.sputnik.event.Event; diff --git a/src/main/java/me/retucio/sputnik/event/events/DamageItemEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/DamageItemEvent.java similarity index 90% rename from src/main/java/me/retucio/sputnik/event/events/DamageItemEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/DamageItemEvent.java index 7684581..704f3ae 100644 --- a/src/main/java/me/retucio/sputnik/event/events/DamageItemEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/DamageItemEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.interact; import me.retucio.sputnik.event.Event; import net.minecraft.item.ItemStack; diff --git a/src/main/java/me/retucio/sputnik/event/events/InteractEntityEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/InteractEntityEvent.java similarity index 92% rename from src/main/java/me/retucio/sputnik/event/events/InteractEntityEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/InteractEntityEvent.java index dbc61d8..5602ab5 100644 --- a/src/main/java/me/retucio/sputnik/event/events/InteractEntityEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/InteractEntityEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.interact; import me.retucio.sputnik.event.Event; import net.minecraft.entity.Entity; diff --git a/src/main/java/me/retucio/sputnik/event/events/OpenScreenEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/OpenScreenEvent.java similarity index 88% rename from src/main/java/me/retucio/sputnik/event/events/OpenScreenEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/OpenScreenEvent.java index 87c809c..963ebc8 100644 --- a/src/main/java/me/retucio/sputnik/event/events/OpenScreenEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/OpenScreenEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.interact; import me.retucio.sputnik.event.Event; import net.minecraft.client.gui.screen.Screen; diff --git a/src/main/java/me/retucio/sputnik/event/events/PlaceBlockEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/PlaceBlockEvent.java similarity index 93% rename from src/main/java/me/retucio/sputnik/event/events/PlaceBlockEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/PlaceBlockEvent.java index b49496e..e8f3c7e 100644 --- a/src/main/java/me/retucio/sputnik/event/events/PlaceBlockEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/PlaceBlockEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.interact; import me.retucio.sputnik.event.Event; import net.minecraft.util.Hand; diff --git a/src/main/java/me/retucio/sputnik/event/events/UseItemEvent.java b/src/main/java/me/retucio/sputnik/event/events/interact/UseItemEvent.java similarity index 92% rename from src/main/java/me/retucio/sputnik/event/events/UseItemEvent.java rename to src/main/java/me/retucio/sputnik/event/events/interact/UseItemEvent.java index 1bc572d..9c1aef0 100644 --- a/src/main/java/me/retucio/sputnik/event/events/UseItemEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/interact/UseItemEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.interact; import me.retucio.sputnik.event.Event; import net.minecraft.item.ItemStack; diff --git a/src/main/java/me/retucio/sputnik/event/events/AddEntityEvent.java b/src/main/java/me/retucio/sputnik/event/events/network/AddEntityEvent.java similarity index 88% rename from src/main/java/me/retucio/sputnik/event/events/AddEntityEvent.java rename to src/main/java/me/retucio/sputnik/event/events/network/AddEntityEvent.java index 8b0f2a7..8512177 100644 --- a/src/main/java/me/retucio/sputnik/event/events/AddEntityEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/network/AddEntityEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.network; import me.retucio.sputnik.event.Event; import net.minecraft.entity.Entity; diff --git a/src/main/java/me/retucio/sputnik/event/events/ChunkOcclusionEvent.java b/src/main/java/me/retucio/sputnik/event/events/network/ChunkOcclusionEvent.java similarity index 78% rename from src/main/java/me/retucio/sputnik/event/events/ChunkOcclusionEvent.java rename to src/main/java/me/retucio/sputnik/event/events/network/ChunkOcclusionEvent.java index e1f196b..3de3b79 100644 --- a/src/main/java/me/retucio/sputnik/event/events/ChunkOcclusionEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/network/ChunkOcclusionEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.network; import me.retucio.sputnik.event.Event; diff --git a/src/main/java/me/retucio/sputnik/event/events/DisconnectEvent.java b/src/main/java/me/retucio/sputnik/event/events/network/DisconnectEvent.java similarity index 92% rename from src/main/java/me/retucio/sputnik/event/events/DisconnectEvent.java rename to src/main/java/me/retucio/sputnik/event/events/network/DisconnectEvent.java index f3c6fa3..7489939 100644 --- a/src/main/java/me/retucio/sputnik/event/events/DisconnectEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/network/DisconnectEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.network; import me.retucio.sputnik.event.Event; import net.minecraft.client.network.ServerInfo; diff --git a/src/main/java/me/retucio/sputnik/event/events/JoinWorldEvent.java b/src/main/java/me/retucio/sputnik/event/events/network/JoinWorldEvent.java similarity index 88% rename from src/main/java/me/retucio/sputnik/event/events/JoinWorldEvent.java rename to src/main/java/me/retucio/sputnik/event/events/network/JoinWorldEvent.java index c095403..69ca1fa 100644 --- a/src/main/java/me/retucio/sputnik/event/events/JoinWorldEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/network/JoinWorldEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.network; import me.retucio.sputnik.event.Event; import net.minecraft.client.world.ClientWorld; diff --git a/src/main/java/me/retucio/sputnik/event/events/PacketEvent.java b/src/main/java/me/retucio/sputnik/event/events/network/PacketEvent.java similarity index 95% rename from src/main/java/me/retucio/sputnik/event/events/PacketEvent.java rename to src/main/java/me/retucio/sputnik/event/events/network/PacketEvent.java index 844679f..a1a2829 100644 --- a/src/main/java/me/retucio/sputnik/event/events/PacketEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/network/PacketEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.network; import me.retucio.sputnik.event.Event; import me.retucio.sputnik.event.Stage; diff --git a/src/main/java/me/retucio/sputnik/event/events/ReceiveMessageEvent.java b/src/main/java/me/retucio/sputnik/event/events/network/ReceiveMessageEvent.java similarity index 95% rename from src/main/java/me/retucio/sputnik/event/events/ReceiveMessageEvent.java rename to src/main/java/me/retucio/sputnik/event/events/network/ReceiveMessageEvent.java index 161c9df..e6b9e42 100644 --- a/src/main/java/me/retucio/sputnik/event/events/ReceiveMessageEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/network/ReceiveMessageEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.network; import me.retucio.sputnik.event.Event; import net.minecraft.client.gui.hud.MessageIndicator; diff --git a/src/main/java/me/retucio/sputnik/event/events/RemoveEntityEvent.java b/src/main/java/me/retucio/sputnik/event/events/network/RemoveEntityEvent.java similarity index 88% rename from src/main/java/me/retucio/sputnik/event/events/RemoveEntityEvent.java rename to src/main/java/me/retucio/sputnik/event/events/network/RemoveEntityEvent.java index 077c66f..04f229c 100644 --- a/src/main/java/me/retucio/sputnik/event/events/RemoveEntityEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/network/RemoveEntityEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.network; import me.retucio.sputnik.event.Event; import net.minecraft.entity.Entity; diff --git a/src/main/java/me/retucio/sputnik/event/events/SendMessageEvent.java b/src/main/java/me/retucio/sputnik/event/events/network/SendMessageEvent.java similarity index 89% rename from src/main/java/me/retucio/sputnik/event/events/SendMessageEvent.java rename to src/main/java/me/retucio/sputnik/event/events/network/SendMessageEvent.java index 0a5047c..d1b38b6 100644 --- a/src/main/java/me/retucio/sputnik/event/events/SendMessageEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/network/SendMessageEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.network; import me.retucio.sputnik.event.Event; diff --git a/src/main/java/me/retucio/sputnik/event/events/ChangeRotationEvent.java b/src/main/java/me/retucio/sputnik/event/events/render/ChangeRotationEvent.java similarity index 93% rename from src/main/java/me/retucio/sputnik/event/events/ChangeRotationEvent.java rename to src/main/java/me/retucio/sputnik/event/events/render/ChangeRotationEvent.java index 6c67419..e45d653 100644 --- a/src/main/java/me/retucio/sputnik/event/events/ChangeRotationEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/render/ChangeRotationEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.render; import me.retucio.sputnik.event.Event; diff --git a/src/main/java/me/retucio/sputnik/event/events/GetFOVEvent.java b/src/main/java/me/retucio/sputnik/event/events/render/GetFOVEvent.java similarity index 88% rename from src/main/java/me/retucio/sputnik/event/events/GetFOVEvent.java rename to src/main/java/me/retucio/sputnik/event/events/render/GetFOVEvent.java index ce42908..6ca97f1 100644 --- a/src/main/java/me/retucio/sputnik/event/events/GetFOVEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/render/GetFOVEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.render; import me.retucio.sputnik.event.Event; diff --git a/src/main/java/me/retucio/sputnik/event/events/PerspectiveChangeEvent.java b/src/main/java/me/retucio/sputnik/event/events/render/PerspectiveChangeEvent.java similarity index 91% rename from src/main/java/me/retucio/sputnik/event/events/PerspectiveChangeEvent.java rename to src/main/java/me/retucio/sputnik/event/events/render/PerspectiveChangeEvent.java index 88c752c..682ec4d 100644 --- a/src/main/java/me/retucio/sputnik/event/events/PerspectiveChangeEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/render/PerspectiveChangeEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.render; import me.retucio.sputnik.event.Event; import net.minecraft.client.option.Perspective; diff --git a/src/main/java/me/retucio/sputnik/event/events/Render2DEvent.java b/src/main/java/me/retucio/sputnik/event/events/render/Render2DEvent.java similarity index 91% rename from src/main/java/me/retucio/sputnik/event/events/Render2DEvent.java rename to src/main/java/me/retucio/sputnik/event/events/render/Render2DEvent.java index 7a73612..1a242f5 100644 --- a/src/main/java/me/retucio/sputnik/event/events/Render2DEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/render/Render2DEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.render; import me.retucio.sputnik.event.Event; import net.minecraft.client.gui.DrawContext; diff --git a/src/main/java/me/retucio/sputnik/event/events/Render3DEvent.java b/src/main/java/me/retucio/sputnik/event/events/render/Render3DEvent.java similarity index 94% rename from src/main/java/me/retucio/sputnik/event/events/Render3DEvent.java rename to src/main/java/me/retucio/sputnik/event/events/render/Render3DEvent.java index de46498..15a713e 100644 --- a/src/main/java/me/retucio/sputnik/event/events/Render3DEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/render/Render3DEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.render; import me.retucio.sputnik.event.Event; import net.minecraft.client.render.Camera; diff --git a/src/main/java/me/retucio/sputnik/event/events/RenderArmEvent.java b/src/main/java/me/retucio/sputnik/event/events/render/RenderArmEvent.java similarity index 93% rename from src/main/java/me/retucio/sputnik/event/events/RenderArmEvent.java rename to src/main/java/me/retucio/sputnik/event/events/render/RenderArmEvent.java index 6132dda..eb9a8e0 100644 --- a/src/main/java/me/retucio/sputnik/event/events/RenderArmEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/render/RenderArmEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.render; import me.retucio.sputnik.event.Event; import net.minecraft.client.util.math.MatrixStack; diff --git a/src/main/java/me/retucio/sputnik/event/events/render/RenderBlockOutlineEvent.java b/src/main/java/me/retucio/sputnik/event/events/render/RenderBlockOutlineEvent.java new file mode 100644 index 0000000..cd67acb --- /dev/null +++ b/src/main/java/me/retucio/sputnik/event/events/render/RenderBlockOutlineEvent.java @@ -0,0 +1,30 @@ +package me.retucio.sputnik.event.events.render; + +import me.retucio.sputnik.event.Event; + +public class RenderBlockOutlineEvent extends Event { + + private int color; + private float lineWidth; + + public RenderBlockOutlineEvent(int color, float lineWidth) { + this.color = color; + this.lineWidth = lineWidth; + } + + public int getColor() { + return color; + } + + public void setColor(int color) { + this.color = color; + } + + public float getLineWidth() { + return lineWidth; + } + + public void setLineWidth(float lineWidth) { + this.lineWidth = lineWidth; + } +} diff --git a/src/main/java/me/retucio/sputnik/event/events/RenderBossbarEvent.java b/src/main/java/me/retucio/sputnik/event/events/render/RenderBossbarEvent.java similarity index 97% rename from src/main/java/me/retucio/sputnik/event/events/RenderBossbarEvent.java rename to src/main/java/me/retucio/sputnik/event/events/render/RenderBossbarEvent.java index c3e0993..6067310 100644 --- a/src/main/java/me/retucio/sputnik/event/events/RenderBossbarEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/render/RenderBossbarEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.render; import me.retucio.sputnik.event.Event; import net.minecraft.client.gui.hud.ClientBossBar; diff --git a/src/main/java/me/retucio/sputnik/event/events/RenderHeldItemEvent.java b/src/main/java/me/retucio/sputnik/event/events/render/RenderHeldItemEvent.java similarity index 93% rename from src/main/java/me/retucio/sputnik/event/events/RenderHeldItemEvent.java rename to src/main/java/me/retucio/sputnik/event/events/render/RenderHeldItemEvent.java index c4b5ea4..a6f2699 100644 --- a/src/main/java/me/retucio/sputnik/event/events/RenderHeldItemEvent.java +++ b/src/main/java/me/retucio/sputnik/event/events/render/RenderHeldItemEvent.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.event.events; +package me.retucio.sputnik.event.events.render; import me.retucio.sputnik.event.Event; import net.minecraft.client.util.math.MatrixStack; diff --git a/src/main/java/me/retucio/sputnik/mixin/AbstractBoatEntityMixin.java b/src/main/java/me/retucio/sputnik/mixin/AbstractBoatEntityMixin.java index dc419be..5cd405f 100644 --- a/src/main/java/me/retucio/sputnik/mixin/AbstractBoatEntityMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/AbstractBoatEntityMixin.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.mixin; import me.retucio.sputnik.Sputnik; -import me.retucio.sputnik.event.BoatMoveEvent; +import me.retucio.sputnik.event.events.interact.BoatMoveEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.movement.BoatFly; import net.minecraft.entity.MovementType; diff --git a/src/main/java/me/retucio/sputnik/mixin/BlockCollisionSpliteratorMixin.java b/src/main/java/me/retucio/sputnik/mixin/BlockCollisionSpliteratorMixin.java index 5a6d0a5..f8fa744 100644 --- a/src/main/java/me/retucio/sputnik/mixin/BlockCollisionSpliteratorMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/BlockCollisionSpliteratorMixin.java @@ -3,7 +3,7 @@ package me.retucio.sputnik.mixin; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import me.retucio.sputnik.Sputnik; -import me.retucio.sputnik.event.events.BlockShapeEvent; +import me.retucio.sputnik.event.events.interact.BlockShapeEvent; import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/me/retucio/sputnik/mixin/BossBarHudMixin.java b/src/main/java/me/retucio/sputnik/mixin/BossBarHudMixin.java index 4781b97..62fd689 100644 --- a/src/main/java/me/retucio/sputnik/mixin/BossBarHudMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/BossBarHudMixin.java @@ -2,7 +2,7 @@ package me.retucio.sputnik.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.sugar.Local; -import me.retucio.sputnik.event.events.RenderBossbarEvent; +import me.retucio.sputnik.event.events.render.RenderBossbarEvent; import net.minecraft.client.gui.hud.BossBarHud; import net.minecraft.client.gui.hud.ClientBossBar; import net.minecraft.text.Text; diff --git a/src/main/java/me/retucio/sputnik/mixin/ChatHudMixin.java b/src/main/java/me/retucio/sputnik/mixin/ChatHudMixin.java index 9dcb2a7..7ea4f9d 100644 --- a/src/main/java/me/retucio/sputnik/mixin/ChatHudMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/ChatHudMixin.java @@ -2,7 +2,7 @@ package me.retucio.sputnik.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.sugar.Local; -import me.retucio.sputnik.event.events.ReceiveMessageEvent; +import me.retucio.sputnik.event.events.network.ReceiveMessageEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.misc.ChatPlus; import me.retucio.sputnik.util.interfaces.IChatHud; diff --git a/src/main/java/me/retucio/sputnik/mixin/ChunkOcclusionDataBuilderMixin.java b/src/main/java/me/retucio/sputnik/mixin/ChunkOcclusionDataBuilderMixin.java index b966192..b8bf7ba 100644 --- a/src/main/java/me/retucio/sputnik/mixin/ChunkOcclusionDataBuilderMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/ChunkOcclusionDataBuilderMixin.java @@ -1,6 +1,6 @@ package me.retucio.sputnik.mixin; -import me.retucio.sputnik.event.events.ChunkOcclusionEvent; +import me.retucio.sputnik.event.events.network.ChunkOcclusionEvent; import net.minecraft.client.render.chunk.ChunkOcclusionDataBuilder; import net.minecraft.util.math.BlockPos; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/me/retucio/sputnik/mixin/ClientConnectionMixin.java b/src/main/java/me/retucio/sputnik/mixin/ClientConnectionMixin.java index bdfbb17..0c447bc 100644 --- a/src/main/java/me/retucio/sputnik/mixin/ClientConnectionMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/ClientConnectionMixin.java @@ -3,8 +3,8 @@ package me.retucio.sputnik.mixin; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import me.retucio.sputnik.event.Stage; -import me.retucio.sputnik.event.events.DisconnectEvent; -import me.retucio.sputnik.event.events.PacketEvent; +import me.retucio.sputnik.event.events.network.DisconnectEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; import net.minecraft.network.ClientConnection; import net.minecraft.network.DisconnectionInfo; import net.minecraft.network.packet.Packet; diff --git a/src/main/java/me/retucio/sputnik/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/me/retucio/sputnik/mixin/ClientPlayNetworkHandlerMixin.java index dd25c53..8182001 100644 --- a/src/main/java/me/retucio/sputnik/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/ClientPlayNetworkHandlerMixin.java @@ -2,7 +2,7 @@ package me.retucio.sputnik.mixin; import com.mojang.brigadier.exceptions.CommandSyntaxException; import me.retucio.sputnik.command.CommandManager; -import me.retucio.sputnik.event.events.SendMessageEvent; +import me.retucio.sputnik.event.events.network.SendMessageEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.render.NoRender; import me.retucio.sputnik.util.ChatUtil; diff --git a/src/main/java/me/retucio/sputnik/mixin/ClientPlayerInteractionManagerMixin.java b/src/main/java/me/retucio/sputnik/mixin/ClientPlayerInteractionManagerMixin.java index 5a45d3f..faa414d 100644 --- a/src/main/java/me/retucio/sputnik/mixin/ClientPlayerInteractionManagerMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/ClientPlayerInteractionManagerMixin.java @@ -1,6 +1,6 @@ package me.retucio.sputnik.mixin; -import me.retucio.sputnik.event.events.*; +import me.retucio.sputnik.event.events.interact.*; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.camera.Freecam; import me.retucio.sputnik.module.modules.player.FastUse; diff --git a/src/main/java/me/retucio/sputnik/mixin/ClientWorldMixin.java b/src/main/java/me/retucio/sputnik/mixin/ClientWorldMixin.java index 4e73df7..20333d0 100644 --- a/src/main/java/me/retucio/sputnik/mixin/ClientWorldMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/ClientWorldMixin.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.mixin; -import me.retucio.sputnik.event.events.AddEntityEvent; -import me.retucio.sputnik.event.events.RemoveEntityEvent; +import me.retucio.sputnik.event.events.network.AddEntityEvent; +import me.retucio.sputnik.event.events.network.RemoveEntityEvent; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.Entity; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/me/retucio/sputnik/mixin/CreativeInventoryScreenMixin.java b/src/main/java/me/retucio/sputnik/mixin/CreativeInventoryScreenMixin.java new file mode 100644 index 0000000..54576e5 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/mixin/CreativeInventoryScreenMixin.java @@ -0,0 +1,28 @@ +package me.retucio.sputnik.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.sugar.Local; +import me.retucio.sputnik.mixin.accessor.KeyBindingAccessor; +import me.retucio.sputnik.module.ModuleManager; +import me.retucio.sputnik.module.modules.misc.CreativeInventoryHotbarKeybinds; +import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; +import net.minecraft.client.input.KeyInput; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import java.util.Arrays; + +import static me.retucio.sputnik.Sputnik.mc; + +@Mixin(CreativeInventoryScreen.class) +public abstract class CreativeInventoryScreenMixin { + + @ModifyExpressionValue(method = "keyPressed", at = @At(value = "INVOKE", target = "Ljava/util/OptionalInt;isPresent()Z")) + private boolean makeHotkeysWork(boolean original, @Local(argsOnly = true) KeyInput input) { + if (ModuleManager.INSTANCE.getModuleByClass(CreativeInventoryHotbarKeybinds.class).isEnabled()) + return Arrays.stream(mc.options.hotbarKeys).anyMatch( + keyBinding -> ((KeyBindingAccessor) keyBinding).getBoundKey().getCode() == input.getKeycode() + ); + return original; + } +} diff --git a/src/main/java/me/retucio/sputnik/mixin/EntityMixin.java b/src/main/java/me/retucio/sputnik/mixin/EntityMixin.java index 608718a..342f035 100644 --- a/src/main/java/me/retucio/sputnik/mixin/EntityMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/EntityMixin.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.mixin; import com.llamalad7.mixinextras.injector.ModifyReturnValue; -import me.retucio.sputnik.event.events.ChangeRotationEvent; +import me.retucio.sputnik.event.events.render.ChangeRotationEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.camera.Freecam; import me.retucio.sputnik.module.modules.camera.Freelook; @@ -20,10 +20,8 @@ import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -102,6 +100,15 @@ public abstract class EntityMixin { return original; } + @ModifyReturnValue(method = "getName", at = @At("RETURN")) + private Text showTntPrimeTime(Text original) { + if (!nametags.isEnabled() || !nametags.tntPrime.getValue()) return original; + if ((Object) this instanceof TntEntity tnt) { + return Text.of(nametags.getTntPrimeTime(tnt)); + } + return original; + } + @SuppressWarnings("ConstantConditions") @ModifyReturnValue(method = "getCustomName", at = @At("RETURN")) private Text displayEntityOwner(Text original) { diff --git a/src/main/java/me/retucio/sputnik/mixin/FontManagerMixin.java b/src/main/java/me/retucio/sputnik/mixin/FontManagerMixin.java index 5a329c6..ee053d9 100644 --- a/src/main/java/me/retucio/sputnik/mixin/FontManagerMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/FontManagerMixin.java @@ -30,8 +30,9 @@ public abstract class FontManagerMixin { if (id.equals(StyleSpriteSource.Font.DEFAULT.id())) { cir.setReturnValue(getStorageInternal( Identifier.of( - Sputnik.MOD_ID, - fonts.font.getValue()) + Sputnik.MOD_ID, + fonts.getFont() + ) )); } } diff --git a/src/main/java/me/retucio/sputnik/mixin/GameOptionsMixin.java b/src/main/java/me/retucio/sputnik/mixin/GameOptionsMixin.java index 5a36265..68b789e 100644 --- a/src/main/java/me/retucio/sputnik/mixin/GameOptionsMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/GameOptionsMixin.java @@ -1,6 +1,6 @@ package me.retucio.sputnik.mixin; -import me.retucio.sputnik.event.events.PerspectiveChangeEvent; +import me.retucio.sputnik.event.events.render.PerspectiveChangeEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.camera.Freecam; import net.minecraft.client.option.GameOptions; diff --git a/src/main/java/me/retucio/sputnik/mixin/GameRendererMixin.java b/src/main/java/me/retucio/sputnik/mixin/GameRendererMixin.java index d7e443d..4663c85 100644 --- a/src/main/java/me/retucio/sputnik/mixin/GameRendererMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/GameRendererMixin.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.mixin; -import me.retucio.sputnik.event.events.GetFOVEvent; +import me.retucio.sputnik.event.events.render.GetFOVEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.camera.Freecam; import me.retucio.sputnik.module.modules.misc.UnfocusedCpu; @@ -24,7 +24,6 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyVariable; diff --git a/src/main/java/me/retucio/sputnik/mixin/HeldItemRendererMixin.java b/src/main/java/me/retucio/sputnik/mixin/HeldItemRendererMixin.java index 9b60d00..7af9d87 100644 --- a/src/main/java/me/retucio/sputnik/mixin/HeldItemRendererMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/HeldItemRendererMixin.java @@ -1,8 +1,8 @@ package me.retucio.sputnik.mixin; import com.llamalad7.mixinextras.injector.ModifyReturnValue; -import me.retucio.sputnik.event.events.RenderHeldItemEvent; -import me.retucio.sputnik.event.events.RenderArmEvent; +import me.retucio.sputnik.event.events.render.RenderHeldItemEvent; +import me.retucio.sputnik.event.events.render.RenderArmEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.player.HandView; import net.minecraft.client.MinecraftClient; diff --git a/src/main/java/me/retucio/sputnik/mixin/InGameHudMixin.java b/src/main/java/me/retucio/sputnik/mixin/InGameHudMixin.java index 09d40d5..9f496bd 100644 --- a/src/main/java/me/retucio/sputnik/mixin/InGameHudMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/InGameHudMixin.java @@ -2,7 +2,7 @@ package me.retucio.sputnik.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import me.retucio.sputnik.Sputnik; -import me.retucio.sputnik.event.events.Render2DEvent; +import me.retucio.sputnik.event.events.render.Render2DEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.misc.ChatPlus; import me.retucio.sputnik.module.modules.camera.Freecam; diff --git a/src/main/java/me/retucio/sputnik/mixin/ItemStackMixin.java b/src/main/java/me/retucio/sputnik/mixin/ItemStackMixin.java index 292190d..b7cc5ee 100644 --- a/src/main/java/me/retucio/sputnik/mixin/ItemStackMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/ItemStackMixin.java @@ -1,6 +1,6 @@ package me.retucio.sputnik.mixin; -import me.retucio.sputnik.event.events.DamageItemEvent; +import me.retucio.sputnik.event.events.interact.DamageItemEvent; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.network.ServerPlayerEntity; diff --git a/src/main/java/me/retucio/sputnik/mixin/KeyboardMixin.java b/src/main/java/me/retucio/sputnik/mixin/KeyboardMixin.java index f92a381..9acea1c 100644 --- a/src/main/java/me/retucio/sputnik/mixin/KeyboardMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/KeyboardMixin.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.mixin; import me.retucio.sputnik.Sputnik; -import me.retucio.sputnik.event.events.KeyEvent; +import me.retucio.sputnik.event.events.input.KeyEvent; import net.minecraft.client.Keyboard; import net.minecraft.client.input.KeyInput; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/me/retucio/sputnik/mixin/MinecraftClientMixin.java b/src/main/java/me/retucio/sputnik/mixin/MinecraftClientMixin.java index bb0f71c..15c0a39 100644 --- a/src/main/java/me/retucio/sputnik/mixin/MinecraftClientMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/MinecraftClientMixin.java @@ -2,11 +2,11 @@ package me.retucio.sputnik.mixin; import com.llamalad7.mixinextras.sugar.Local; import me.retucio.sputnik.Sputnik; -import me.retucio.sputnik.event.events.JoinWorldEvent; -import me.retucio.sputnik.event.events.OpenScreenEvent; +import me.retucio.sputnik.event.events.network.JoinWorldEvent; +import me.retucio.sputnik.event.events.interact.OpenScreenEvent; import me.retucio.sputnik.event.events.ShutdownEvent; import me.retucio.sputnik.event.events.TickEvent; -import me.retucio.sputnik.event.events.UseItemEvent; +import me.retucio.sputnik.event.events.interact.UseItemEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.player.FastUse; import net.minecraft.client.MinecraftClient; @@ -14,7 +14,6 @@ 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.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; diff --git a/src/main/java/me/retucio/sputnik/mixin/MouseMixin.java b/src/main/java/me/retucio/sputnik/mixin/MouseMixin.java index c78e97f..9661020 100644 --- a/src/main/java/me/retucio/sputnik/mixin/MouseMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/MouseMixin.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.mixin; -import me.retucio.sputnik.event.events.MouseClickEvent; -import me.retucio.sputnik.event.events.MouseScrollEvent; +import me.retucio.sputnik.event.events.input.MouseClickEvent; +import me.retucio.sputnik.event.events.input.MouseScrollEvent; import net.minecraft.client.Mouse; import net.minecraft.client.input.MouseInput; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/me/retucio/sputnik/mixin/PlayerEntityMixin.java b/src/main/java/me/retucio/sputnik/mixin/PlayerEntityMixin.java index d3fe1e8..a2ee88c 100644 --- a/src/main/java/me/retucio/sputnik/mixin/PlayerEntityMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/PlayerEntityMixin.java @@ -2,7 +2,7 @@ package me.retucio.sputnik.mixin; import com.llamalad7.mixinextras.injector.ModifyReturnValue; import me.retucio.sputnik.Sputnik; -import me.retucio.sputnik.event.events.ClipAtLedgeEvent; +import me.retucio.sputnik.event.events.interact.ClipAtLedgeEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.render.Nametags; import net.minecraft.entity.EntityType; diff --git a/src/main/java/me/retucio/sputnik/mixin/ScreenMixin.java b/src/main/java/me/retucio/sputnik/mixin/ScreenMixin.java index efad3b8..80f1dfa 100644 --- a/src/main/java/me/retucio/sputnik/mixin/ScreenMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/ScreenMixin.java @@ -3,7 +3,7 @@ package me.retucio.sputnik.mixin; import com.mojang.brigadier.exceptions.CommandSyntaxException; import me.retucio.sputnik.command.CommandManager; import me.retucio.sputnik.config.ConfigManager; -import me.retucio.sputnik.event.events.ClientClickEvent; +import me.retucio.sputnik.event.events.input.ClientClickEvent; import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; diff --git a/src/main/java/me/retucio/sputnik/mixin/ShaderLoaderMixin.java b/src/main/java/me/retucio/sputnik/mixin/ShaderLoaderMixin.java new file mode 100644 index 0000000..d76625d --- /dev/null +++ b/src/main/java/me/retucio/sputnik/mixin/ShaderLoaderMixin.java @@ -0,0 +1,17 @@ +package me.retucio.sputnik.mixin; + +import me.retucio.sputnik.util.render.Pipelines; +import net.minecraft.client.gl.ShaderLoader; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ShaderLoader.class) +public abstract class ShaderLoaderMixin { + + @Inject(method = "apply(Lnet/minecraft/client/gl/ShaderLoader$Definitions;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)V", at = @At("TAIL")) + private void onReload(CallbackInfo ci) { + Pipelines.init(); + } +} \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/mixin/WorldRendererMixin.java b/src/main/java/me/retucio/sputnik/mixin/WorldRendererMixin.java index ed2b205..641db9f 100644 --- a/src/main/java/me/retucio/sputnik/mixin/WorldRendererMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/WorldRendererMixin.java @@ -3,9 +3,9 @@ package me.retucio.sputnik.mixin; import com.llamalad7.mixinextras.sugar.Local; import com.mojang.blaze3d.buffers.GpuBufferSlice; import me.retucio.sputnik.Sputnik; -import me.retucio.sputnik.event.events.Render3DEvent; +import me.retucio.sputnik.event.events.render.Render3DEvent; +import me.retucio.sputnik.event.events.render.RenderBlockOutlineEvent; import me.retucio.sputnik.module.ModuleManager; -import me.retucio.sputnik.module.modules.render.BlockOutline; import me.retucio.sputnik.module.modules.camera.Freecam; import me.retucio.sputnik.module.modules.render.NoRender; import net.minecraft.client.render.*; @@ -20,6 +20,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; import static me.retucio.sputnik.Sputnik.EVENT_BUS; import static me.retucio.sputnik.Sputnik.mc; @@ -62,18 +63,29 @@ public abstract class WorldRendererMixin { if (!noRender.blindnessEffect.getValue() || !noRender.darknessEffect.getValue()) cir.setReturnValue(null); } - - @ModifyArg(method = "renderTargetBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawBlockOutline(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;DDDLnet/minecraft/client/render/state/OutlineRenderState;IF)V")) - private int modifyBlockOutlineColor(int original) { - BlockOutline outline = ModuleManager.INSTANCE.getModuleByClass(BlockOutline.class); - if (!outline.isEnabled()) return original; - return outline.color.getRGB(); + @ModifyArgs(method = "renderTargetBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawBlockOutline(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;DDDLnet/minecraft/client/render/state/OutlineRenderState;IF)V")) + private void modifyBlockOutline(Args args) { + // SIX SEVEN!!! (me pegan en casa) + RenderBlockOutlineEvent event = EVENT_BUS.post(new RenderBlockOutlineEvent(args.get(6), args.get(7))); + if (event.getColor() != (int) args.get(6)) + args.set(6, event.getColor()); + if (event.getLineWidth() != (float) args.get(7)) + args.set(7, event.getLineWidth()); } - @ModifyArg(method = "renderTargetBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawBlockOutline(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;DDDLnet/minecraft/client/render/state/OutlineRenderState;IF)V")) - private float modifyBlockOutlineLineWidth(float original) { - BlockOutline outline = ModuleManager.INSTANCE.getModuleByClass(BlockOutline.class); - if (!outline.isEnabled()) return original; - return outline.lineWidth.getFloatValue(); - } +// @ModifyArg(method = "renderTargetBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawBlockOutline(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;DDDLnet/minecraft/client/render/state/OutlineRenderState;IF)V")) +// private int modifyBlockOutlineColor(int original) { +// RenderBlockOutlineEvent event = EVENT_BUS.post(new RenderBlockOutlineEvent(original, )) +// +// BlockOutline outline = ModuleManager.INSTANCE.getModuleByClass(BlockOutline.class); +// if (!outline.isEnabled()) return original; +// return outline.color.getRGB(); +// } +// +// @ModifyArg(method = "renderTargetBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawBlockOutline(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;DDDLnet/minecraft/client/render/state/OutlineRenderState;IF)V")) +// private float modifyBlockOutlineLineWidth(float original) { +// BlockOutline outline = ModuleManager.INSTANCE.getModuleByClass(BlockOutline.class); +// if (!outline.isEnabled()) return original; +// return outline.lineWidth.getFloatValue(); +// } } \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/mixin/accessor/FishingBobberEntityAccessor.java b/src/main/java/me/retucio/sputnik/mixin/accessor/FishingBobberEntityAccessor.java new file mode 100644 index 0000000..9ed944a --- /dev/null +++ b/src/main/java/me/retucio/sputnik/mixin/accessor/FishingBobberEntityAccessor.java @@ -0,0 +1,15 @@ +package me.retucio.sputnik.mixin.accessor; + +import net.minecraft.entity.projectile.FishingBobberEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(FishingBobberEntity.class) +public interface FishingBobberEntityAccessor { + + @Accessor("caughtFish") + boolean caughtFish(); + + @Accessor("state") + FishingBobberEntity.State getState(); +} diff --git a/src/main/java/me/retucio/sputnik/module/Category.java b/src/main/java/me/retucio/sputnik/module/Category.java index 82861b2..306d6ce 100644 --- a/src/main/java/me/retucio/sputnik/module/Category.java +++ b/src/main/java/me/retucio/sputnik/module/Category.java @@ -2,10 +2,12 @@ package me.retucio.sputnik.module; public enum Category { + COMBAT("combate"), PLAYER("jugador"), - WORLD("mundo"), MOVEMENT("movimiento"), + WORLD("mundo"), + CAMERA("cámara"), RENDER("renderizado"), diff --git a/src/main/java/me/retucio/sputnik/module/ModuleManager.java b/src/main/java/me/retucio/sputnik/module/ModuleManager.java index 98dd3b6..65b41f2 100644 --- a/src/main/java/me/retucio/sputnik/module/ModuleManager.java +++ b/src/main/java/me/retucio/sputnik/module/ModuleManager.java @@ -5,6 +5,10 @@ import me.retucio.sputnik.event.SubscribeEvent; import me.retucio.sputnik.module.modules.client.DiscordRPC; import me.retucio.sputnik.module.modules.client.HUD; import me.retucio.sputnik.module.modules.camera.*; +import me.retucio.sputnik.module.modules.combat.AttributeSwapper; +import me.retucio.sputnik.module.modules.combat.MaceKill; +import me.retucio.sputnik.module.modules.combat.ProjectileTrajectories; +import me.retucio.sputnik.module.modules.combat.SpearKill; import me.retucio.sputnik.module.modules.misc.*; import me.retucio.sputnik.module.modules.movement.*; import me.retucio.sputnik.module.modules.network.*; @@ -14,7 +18,6 @@ import me.retucio.sputnik.module.modules.render.CritsPlus; import me.retucio.sputnik.module.modules.world.*; import me.retucio.sputnik.util.MiscUtil; -import java.awt.*; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Comparator; @@ -64,6 +67,7 @@ public class ModuleManager { private void addCamera() { + add(new Autism()); add(new Freecam()); add(new Freelook()); add(new Fullbright()); @@ -75,7 +79,6 @@ public class ModuleManager { private void addClient() { add(new DiscordRPC()); add(new HUD()); - } private void addMisc() { @@ -83,6 +86,7 @@ public class ModuleManager { add(new AnvilFont()); add(new BossbarStack()); add(new ChatPlus()); + add(new CreativeInventoryHotbarKeybinds()); add(new FakePlayer()); add(new ScreenshotPlus()); add(new ShulkerPeek()); @@ -114,15 +118,20 @@ public class ModuleManager { } private void addPlayer() { + add(new AirPlace()); + add(new AntiHunger()); add(new AttributeSwapper()); + add(new AutoFish()); add(new Capes()); add(new FastUse()); add(new HandView()); add(new InventoryPlus()); add(new MaceKill()); + add(new NoFall()); add(new Offhand()); add(new PortalGUI()); add(new UIMove()); + add(new SpearKill()); add(new WarnLowDurability()); } @@ -141,10 +150,12 @@ public class ModuleManager { private void addWorld() { add(new AutoSign()); + add(new AutoTool()); add(new BlockInfo()); add(new ColoredSigns()); add(new LightOverlay()); add(new NoMiningInterruptions()); + add(new ProjectileTrajectories()); add(new Racist()); add(new StrongholdTriangulator()); add(new TimeChanger()); diff --git a/src/main/java/me/retucio/sputnik/module/modules/camera/Autism.java b/src/main/java/me/retucio/sputnik/module/modules/camera/Autism.java new file mode 100644 index 0000000..bf090ba --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/camera/Autism.java @@ -0,0 +1,67 @@ +package me.retucio.sputnik.module.modules.camera; + +import me.retucio.sputnik.event.SubscribeEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; +import me.retucio.sputnik.module.Category; +import me.retucio.sputnik.module.Module; +import me.retucio.sputnik.module.setting.settings.EnumSetting; +import me.retucio.sputnik.module.setting.settings.NumberSetting; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; + +public class Autism extends Module { + + private final NumberSetting interval = sgGeneral.add(new NumberSetting( + "intervalo", + "intervalo de rotación", + 18, + 1, + 90, + 1 + )); + + + private final EnumSetting direction = sgGeneral.add(new EnumSetting<>( + "dirección", + "dirección de la rotación", + RotationDirection.class, + RotationDirection.CLOCKWISE + )); + + private float yaw; + + public Autism() { + super("autismo", "jeje", Category.CAMERA); + } + + @Override + public void onTick() { + if (mc.player == null || mc.getNetworkHandler() == null) return; + + if (direction.is(RotationDirection.CLOCKWISE)) + yaw += interval.getFloatValue(); + if (direction.is(RotationDirection.COUNTERCLOCKWISE)) + yaw -= interval.getFloatValue(); + + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.LookAndOnGround( + yaw, + mc.player.getPitch(), + mc.player.isOnGround(), + mc.player.horizontalCollision + )); + } + + @SubscribeEvent + private void onPacketSend(PacketEvent.Send event) { + if (event.getPacket() instanceof PlayerMoveC2SPacket.LookAndOnGround packet + && packet.getYaw(yaw) != yaw) event.cancel(); + } + + private enum RotationDirection { + CLOCKWISE("sentido horario"), + COUNTERCLOCKWISE("sentido antihorario"); + + private final String name; + RotationDirection(String name) { this.name = name; } + @Override public String toString() { return name; } + } +} diff --git a/src/main/java/me/retucio/sputnik/module/modules/camera/Freecam.java b/src/main/java/me/retucio/sputnik/module/modules/camera/Freecam.java index 27c70a7..e792596 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/camera/Freecam.java +++ b/src/main/java/me/retucio/sputnik/module/modules/camera/Freecam.java @@ -2,7 +2,13 @@ package me.retucio.sputnik.module.modules.camera; import me.retucio.sputnik.event.Stage; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.*; +import me.retucio.sputnik.event.events.input.KeyEvent; +import me.retucio.sputnik.event.events.input.MouseClickEvent; +import me.retucio.sputnik.event.events.input.MouseScrollEvent; +import me.retucio.sputnik.event.events.interact.*; +import me.retucio.sputnik.event.events.network.ChunkOcclusionEvent; +import me.retucio.sputnik.event.events.network.DisconnectEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; @@ -42,22 +48,22 @@ import org.lwjgl.glfw.GLFW; public class Freecam extends Module { // ajustes - SettingGroup sgSpeed = addSg(new SettingGroup("velocidad", true)); + private final SettingGroup sgSpeed = addSg(new SettingGroup("velocidad", true)); - public BooleanSetting toggleOnDamage = sgGeneral.add(new BooleanSetting("desactivar al recibir daño", "desactiva el módulo tras recibir daño", true)); - public BooleanSetting reloadChunks = sgGeneral.add(new BooleanSetting("recargar chunks", "recargar chunks para arreglar el culling de las cuevas", true)); - public BooleanSetting renderHands = sgGeneral.add(new BooleanSetting("manos visibles", "decide si se renderizan las manos mientras la cámara esté libre", true)); - public BooleanSetting stayCrouching = sgGeneral.add(new BooleanSetting("mantenerse agachado", "mantener al jugador agachado tras entrar en el modo de cámara libre", false)); - public BooleanSetting staticView = sgGeneral.add(new BooleanSetting("visión estática", "desactiva ajustes que muevan la cámara", true)); - public BooleanSetting cancelActionPackets = sgGeneral.add(new BooleanSetting("cancelar paquetes", "evita flaggear el anticheat al interactuar con bloques / entidades", true)); - public BooleanSetting blockOutlines = sgGeneral.add(new BooleanSetting("contorno de bloques", "mostrar el contorno de los bloques estando en el modo de cámara libre", true)); + private final BooleanSetting toggleOnDamage = sgGeneral.add(new BooleanSetting("desactivar al recibir daño", "desactiva el módulo tras recibir daño", true)); + private final BooleanSetting reloadChunks = sgGeneral.add(new BooleanSetting("recargar chunks", "recargar chunks para arreglar el culling de las cuevas", true)); + public final BooleanSetting renderHands = sgGeneral.add(new BooleanSetting("manos visibles", "decide si se renderizan las manos mientras la cámara esté libre", true)); + public final BooleanSetting stayCrouching = sgGeneral.add(new BooleanSetting("mantenerse agachado", "mantener al jugador agachado tras entrar en el modo de cámara libre", false)); + private final BooleanSetting staticView = sgGeneral.add(new BooleanSetting("visión estática", "desactiva ajustes que muevan la cámara", true)); + private final BooleanSetting cancelActionPackets = sgGeneral.add(new BooleanSetting("cancelar paquetes", "evita flaggear el anticheat al interactuar con bloques / entidades", true)); + public final BooleanSetting blockOutlines = sgGeneral.add(new BooleanSetting("contorno de bloques", "mostrar el contorno de los bloques estando en el modo de cámara libre", true)); - public NumberSetting speedSetting = sgSpeed.add(new NumberSetting( + private final NumberSetting speedSetting = sgSpeed.add(new NumberSetting( "velocidad", "velocidad de movimiento de la cámara", 1, 0, 10, 0.2)); - public KeySetting scrollKey = sgSpeed.add(new KeySetting("tecla del scroll", "tecla a mantener pulsada para cambiar velocidad con el scroll", GLFW.GLFW_KEY_LEFT_CONTROL)); - public NumberSetting scrollSens = sgSpeed.add(new NumberSetting( + private final KeySetting scrollKey = sgSpeed.add(new KeySetting("tecla del scroll", "tecla a mantener pulsada para cambiar velocidad con el scroll", GLFW.GLFW_KEY_LEFT_CONTROL)); + private final NumberSetting scrollSens = sgSpeed.add(new NumberSetting( "sensibilidad del scroll", "sensibilidad de la rueda del ratón para modificar la velocidad, 0 para desactivar", 1, 0, 2, 0.1)); @@ -198,7 +204,7 @@ public class Freecam extends Module { } @SubscribeEvent - public void onSendPacket(PacketEvent.Send event) { + private void onSendPacket(PacketEvent.Send event) { if (!isEnabled() || !cancelActionPackets.getValue()) return; if (event.getStage() != Stage.PRE) return; @@ -212,7 +218,7 @@ public class Freecam extends Module { } @SubscribeEvent - public void onKey(KeyEvent event) { + private void onKey(KeyEvent event) { if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_F3)) return; if (mc.currentScreen != null) return; @@ -245,7 +251,7 @@ public class Freecam extends Module { } @SubscribeEvent - public void onMouseClick(MouseClickEvent event) { // por si el restrasado del usuario usa el ratón para moverse + private void onMouseClick(MouseClickEvent event) { // por si el restrasado del usuario usa el ratón para moverse if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_F3)) return; if (mc.currentScreen != null) return; @@ -279,7 +285,7 @@ public class Freecam extends Module { @SubscribeEvent private void onMouseScroll(MouseScrollEvent event) { - if (scrollSens.getValue() > 0 && mc.currentScreen == null && KeyUtil.isKeyDown(scrollKey.getValue())) { + if (scrollSens.getValue() > 0 && mc.currentScreen == null && scrollKey.isDown()) { speed += event.getVertical() / 4 * (scrollSens.getValue() * speed); if (speed < 0.1) speed = 0.1; event.cancel(); @@ -292,12 +298,12 @@ public class Freecam extends Module { } @SubscribeEvent - public void onLeaveGame(DisconnectEvent event) { + private void onLeaveGame(DisconnectEvent event) { toggle(); } @SubscribeEvent - public void onPacketReceive(PacketEvent.Receive event) { + private void onPacketReceive(PacketEvent.Receive event) { if (mc.player == null) return; // el jugador probablemente nunca sea nulo bajo estas circunstancias pero quién sabe if (event.getPacket() instanceof DeathMessageS2CPacket packet) { @@ -312,7 +318,7 @@ public class Freecam extends Module { } @SubscribeEvent - public void onOpenScreen(OpenScreenEvent event) { + private void onOpenScreen(OpenScreenEvent event) { unpress(); stopMoving(); prevPos.set(pos); @@ -323,22 +329,22 @@ public class Freecam extends Module { // los paquetes ya se cancelan, pero visualmente estos eventos se siguen dando @SubscribeEvent - public void onBreakBlock(BreakBlockEvent event) { + private void onBreakBlock(BreakBlockEvent event) { if (cancelActionPackets.getValue()) event.cancel(); } @SubscribeEvent - public void onPlaceBlock(PlaceBlockEvent event) { + private void onPlaceBlock(PlaceBlockEvent event) { if (cancelActionPackets.getValue()) event.cancel(); } @SubscribeEvent - public void onInteractEntity(InteractEntityEvent event) { + private void onInteractEntity(InteractEntityEvent event) { if (cancelActionPackets.getValue()) event.cancel(); } @SubscribeEvent - public void onAttack(AttackEntityEvent event) { + private void onAttack(AttackEntityEvent event) { if (cancelActionPackets.getValue()) event.cancel(); } diff --git a/src/main/java/me/retucio/sputnik/module/modules/camera/Freelook.java b/src/main/java/me/retucio/sputnik/module/modules/camera/Freelook.java index 424a715..c9bdbed 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/camera/Freelook.java +++ b/src/main/java/me/retucio/sputnik/module/modules/camera/Freelook.java @@ -16,13 +16,13 @@ import org.lwjgl.glfw.GLFW; public class Freelook extends Module { - public EnumSetting mode = sgGeneral.add(new EnumSetting<>("cámara a mover", "elige cual cámara mover con el ratón y cuál se queda estática", + public final EnumSetting mode = sgGeneral.add(new EnumSetting<>("cámara a mover", "elige cual cámara mover con el ratón y cuál se queda estática", CameraMode.class, CameraMode.CAMERA)); - public NumberSetting arrowSens = sgGeneral.add(new NumberSetting("sensibilidad de las flechas", "cuánto rotan la cámara estática las flechas (0 para desactivar)", + private final NumberSetting arrowSens = sgGeneral.add(new NumberSetting("sensibilidad de las flechas", "cuánto rotan la cámara estática las flechas (0 para desactivar)", 4, 0, 10, 0.1)); - public NumberSetting mouseSens = sgGeneral.add(new NumberSetting("sensibilidad del ratón", ".", + public final NumberSetting mouseSens = sgGeneral.add(new NumberSetting("sensibilidad del ratón", ".", 0.1, 0, 2, 0.05)); private float yaw; diff --git a/src/main/java/me/retucio/sputnik/module/modules/camera/Fullbright.java b/src/main/java/me/retucio/sputnik/module/modules/camera/Fullbright.java index 508304c..34c5528 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/camera/Fullbright.java +++ b/src/main/java/me/retucio/sputnik/module/modules/camera/Fullbright.java @@ -18,20 +18,20 @@ import java.awt.*; public class Fullbright extends Module { - public EnumSetting mode = sgGeneral.add(new EnumSetting<>("modo", "qué modo de iluminación emplear (usar poción con shaders)", Modes.class, Modes.GAMMA)); + public final EnumSetting mode = sgGeneral.add(new EnumSetting<>("modo", "qué modo de iluminación emplear (usar poción con shaders)", Modes.class, Modes.GAMMA)); - public ColorSetting color = sgGeneral.add(new ColorSetting("filtro", "filtro de color", new Color(255, 255, 255, 255), false)); + public final ColorSetting color = sgGeneral.add(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)", Category.CAMERA, GLFW.GLFW_KEY_K); + mode.onUpdate(mode -> { if (mode != Modes.POTION) disableNightVision(); }); mode.onUpdate(mode -> { boolean v = mode.equals(Modes.GAMMA); color.setVisible(v); - if (v) disableNightVision(); }); } diff --git a/src/main/java/me/retucio/sputnik/module/modules/camera/PerspectivePlus.java b/src/main/java/me/retucio/sputnik/module/modules/camera/PerspectivePlus.java index f4b7d0a..aeacd90 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/camera/PerspectivePlus.java +++ b/src/main/java/me/retucio/sputnik/module/modules/camera/PerspectivePlus.java @@ -1,36 +1,34 @@ package me.retucio.sputnik.module.modules.camera; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.MouseScrollEvent; -import me.retucio.sputnik.event.events.PerspectiveChangeEvent; +import me.retucio.sputnik.event.events.input.MouseScrollEvent; +import me.retucio.sputnik.event.events.render.PerspectiveChangeEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; import me.retucio.sputnik.module.setting.settings.BooleanSetting; import me.retucio.sputnik.module.setting.settings.KeySetting; import me.retucio.sputnik.module.setting.settings.NumberSetting; -import me.retucio.sputnik.util.KeyUtil; import org.lwjgl.glfw.GLFW; // continúa en CameraMixin public class PerspectivePlus extends Module { // ajustes + private final SettingGroup sgScroll = addSg(new SettingGroup("scrolleo", true)); - SettingGroup sgScroll = addSg(new SettingGroup("scrolleo", true)); - - public BooleanSetting clip = sgGeneral.add(new BooleanSetting( + public final BooleanSetting clip = sgGeneral.add(new BooleanSetting( "clip", "atravesar bloques con la cámara", true)); - public NumberSetting defaultDistance = sgGeneral.add(new NumberSetting( + private final NumberSetting defaultDistance = sgGeneral.add(new NumberSetting( "distancia", "distancia a la que está la cámara del jugador por defecto", 4, 1, 20, 0.2)); - public NumberSetting scrollSens = sgScroll.add(new NumberSetting( + private final NumberSetting scrollSens = sgScroll.add(new NumberSetting( "sensibilidad del scroll", "sensibilidad de la rueda del ratón (0 para desactivar)", 1, 0, 8, 0.1)); - public KeySetting scrollKey = sgScroll.add(new KeySetting("tecla del scroll", "qué tecla mantener para usar la rueda del ratón", + private final KeySetting scrollKey = sgScroll.add(new KeySetting("tecla del scroll", "qué tecla mantener para usar la rueda del ratón", GLFW.GLFW_KEY_LEFT_ALT)); private double distance; @@ -48,16 +46,16 @@ public class PerspectivePlus extends Module { } @SubscribeEvent - public void onPerspectiveChange(PerspectiveChangeEvent event) { + private void onPerspectiveChange(PerspectiveChangeEvent event) { distance = defaultDistance.getValue(); } @SubscribeEvent - public void onMouseScroll(MouseScrollEvent event) { + private void onMouseScroll(MouseScrollEvent event) { if (mc.options.getPerspective() == net.minecraft.client.option.Perspective.FIRST_PERSON || mc.currentScreen != null || scrollSens.getValue() <= 0) return; - if (KeyUtil.isKeyDown(scrollKey.getValue())) { + if (scrollKey.isDown()) { distance -= event.getVertical() / 4 * (scrollSens.getValue() * distance); event.cancel(); } diff --git a/src/main/java/me/retucio/sputnik/module/modules/camera/Rotations.java b/src/main/java/me/retucio/sputnik/module/modules/camera/Rotations.java index ca9c144..96a48d0 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/camera/Rotations.java +++ b/src/main/java/me/retucio/sputnik/module/modules/camera/Rotations.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.camera; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.ChangeRotationEvent; +import me.retucio.sputnik.event.events.render.ChangeRotationEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.settings.BooleanSetting; @@ -10,11 +10,11 @@ import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; public class Rotations extends Module { - public NumberSetting yaw = sgGeneral.add(new NumberSetting("guiñada", "eje vertical - giro horizontal (yaw)", 0, -180, 180, 1)); - public NumberSetting pitch = sgGeneral.add(new NumberSetting("cabeceo", "eje horizontal - giro vertical (pitch)", 0, -90, 90, 1)); + private final NumberSetting yaw = sgGeneral.add(new NumberSetting("guiñada", "eje vertical - giro horizontal (yaw)", 0, -180, 180, 1)); + private final NumberSetting pitch = sgGeneral.add(new NumberSetting("cabeceo", "eje horizontal - giro vertical (pitch)", 0, -90, 90, 1)); - public BooleanSetting smooth = sgGeneral.add(new BooleanSetting("evitar movimiento", "cancela todo movimiento de la cámara", false)); - public BooleanSetting serverSide = sgGeneral.add(new BooleanSetting("serverside", "espamea paquetes de rotación al servidor", false)); + private final BooleanSetting smooth = sgGeneral.add(new BooleanSetting("evitar movimiento", "cancela todo movimiento de la cámara", false)); + private final BooleanSetting serverSide = sgGeneral.add(new BooleanSetting("serverside", "espamea paquetes de rotación al servidor", false)); public Rotations() { super("rotaciones", @@ -30,15 +30,21 @@ public class Rotations extends Module { mc.player.setPitch(pitch.getFloatValue()); if (serverSide.getValue()) - mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround( - yaw.getFloatValue(), pitch.getFloatValue(), mc.player.isOnGround(), mc.player.horizontalCollision)); + mc.player.networkHandler.sendPacket( + new PlayerMoveC2SPacket.LookAndOnGround( + yaw.getFloatValue(), + pitch.getFloatValue(), + mc.player.isOnGround(), + mc.player.horizontalCollision + ) + ); } @SubscribeEvent - public void onChangeRotation(ChangeRotationEvent event) { + private void onChangeRotation(ChangeRotationEvent event) { if (smooth.getValue() && (event.getYaw() != yaw.getFloatValue() || event.getPitch() != pitch.getFloatValue())){ event.cancel(); - }} - + } + } } diff --git a/src/main/java/me/retucio/sputnik/module/modules/camera/Zoom.java b/src/main/java/me/retucio/sputnik/module/modules/camera/Zoom.java index 3fa0b97..4290cf8 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/camera/Zoom.java +++ b/src/main/java/me/retucio/sputnik/module/modules/camera/Zoom.java @@ -1,38 +1,37 @@ package me.retucio.sputnik.module.modules.camera; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.GetFOVEvent; -import me.retucio.sputnik.event.events.MouseScrollEvent; +import me.retucio.sputnik.event.events.render.GetFOVEvent; +import me.retucio.sputnik.event.events.input.MouseScrollEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; import me.retucio.sputnik.module.setting.settings.BooleanSetting; import me.retucio.sputnik.module.setting.settings.KeySetting; import me.retucio.sputnik.module.setting.settings.NumberSetting; -import me.retucio.sputnik.util.KeyUtil; import org.lwjgl.glfw.GLFW; // continúa en GameRendererMixin public class Zoom extends Module { - SettingGroup sgVisual = addSg(new SettingGroup("visual", true)); - SettingGroup sgScroll = addSg(new SettingGroup("scrolleo", true)); - SettingGroup sgCam = addSg(new SettingGroup("cámara", true)); + private final SettingGroup sgVisual = addSg(new SettingGroup("visual", true)); + private final SettingGroup sgScroll = addSg(new SettingGroup("scrolleo", true)); + private final SettingGroup sgCam = addSg(new SettingGroup("cámara", true)); - public NumberSetting defaultZoom = sgGeneral.add(new NumberSetting("zoom", "cantidad de zoom", + private final NumberSetting defaultZoom = sgGeneral.add(new NumberSetting("zoom", "cantidad de zoom", 6, 1, 10, 0.1)); - public BooleanSetting showHands = sgVisual.add(new BooleanSetting("mostrar manos", "esconde o muestra las manos al hacer zoom", true)); - public BooleanSetting showHUD = sgVisual.add(new BooleanSetting("mostrar HUD", "esconde o muestra los indicadores en pantalla", true)); + public final BooleanSetting showHands = sgVisual.add(new BooleanSetting("mostrar manos", "esconde o muestra las manos al hacer zoom", true)); + private final BooleanSetting showHUD = sgVisual.add(new BooleanSetting("mostrar HUD", "esconde o muestra los indicadores en pantalla", true)); - public NumberSetting scrollSens = sgScroll.add(new NumberSetting("sensibilidad del scroll", "sensibilidad de la rueda del ratón (0 para desactivar)", + private final NumberSetting scrollSens = sgScroll.add(new NumberSetting("sensibilidad del scroll", "sensibilidad de la rueda del ratón (0 para desactivar)", 0.4, 0, 8, 0.1)); - public KeySetting scrollKey = sgScroll.add(new KeySetting("tecla del scroll", "qué tecla mantener para usar la rueda del ratón", + private final KeySetting scrollKey = sgScroll.add(new KeySetting("tecla del scroll", "qué tecla mantener para usar la rueda del ratón", GLFW.GLFW_KEY_LEFT_CONTROL)); - public NumberSetting mouseSensMultiplier = sgCam.add(new NumberSetting("sensibilidad", "multiplicador de la sensibilidad del ratón", + private final NumberSetting mouseSensMultiplier = sgCam.add(new NumberSetting("sensibilidad", "multiplicador de la sensibilidad del ratón", 0.4, 0, 1, 0.05)); - public BooleanSetting smoothCam = sgCam.add(new BooleanSetting("cámara cinemática", "usa la cámara cinemática mientras hagas zoom", false)); + private final BooleanSetting smoothCam = sgCam.add(new BooleanSetting("cámara cinemática", "usa la cámara cinemática mientras hagas zoom", false)); private boolean prevSmoothCam; private double prevMouseSens; @@ -90,7 +89,7 @@ public class Zoom extends Module { @SubscribeEvent private void onMouseScroll(MouseScrollEvent event) { - boolean key = scrollKey.getValue() == GLFW.GLFW_KEY_UNKNOWN || KeyUtil.isKeyDown(scrollKey.getValue()); + boolean key = scrollKey.getValue() == GLFW.GLFW_KEY_UNKNOWN || scrollKey.isDown(); if (isEnabled() && scrollSens.getValue() > 0 && key) { value += event.getVertical() * 0.25 * (scrollSens.getValue() * value); if (value < 1) value = 1; diff --git a/src/main/java/me/retucio/sputnik/module/modules/client/DiscordRPC.java b/src/main/java/me/retucio/sputnik/module/modules/client/DiscordRPC.java index ed7de73..23f615a 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/client/DiscordRPC.java +++ b/src/main/java/me/retucio/sputnik/module/modules/client/DiscordRPC.java @@ -19,36 +19,36 @@ import me.retucio.sputnik.util.ChatUtil; public class DiscordRPC extends Module { - SettingGroup sgImage = addSg(new SettingGroup("imágenes", false)); - SettingGroup sgButton = addSg(new SettingGroup("botón", false)); + private final SettingGroup sgImage = addSg(new SettingGroup("imágenes", false)); + private final SettingGroup sgButton = addSg(new SettingGroup("botón", false)); // general - public StringSetting details = sgGeneral.add(new StringSetting( + private final StringSetting details = sgGeneral.add(new StringSetting( "detalles", "título", "usando el mod de putas de retucio", 40 )); - public StringSetting state = sgGeneral.add(new StringSetting( + private final StringSetting state = sgGeneral.add(new StringSetting( "estado", "subtítulo", "(se lo está pasando en grande)", 40 )); - public StringSetting startTimestamp = sgGeneral.add(new StringSetting( + private final StringSetting startTimestamp = sgGeneral.add(new StringSetting( "sello de tiempo", "sello de tiempo del comienzo de la actividad, siguiendo el unix epoch (dejar vacío para ahora)", "", 20 )); - public EnumSetting activityType = sgGeneral.add(new EnumSetting<>( + private final EnumSetting activityType = sgGeneral.add(new EnumSetting<>( "tipo de actividad", "qué tipo de actividad se está llevando a cabo", ActivityTypes.class, ActivityTypes.PLAYING )); - public StringSetting appId = sgGeneral.add(new StringSetting( + private final StringSetting appId = sgGeneral.add(new StringSetting( "id del bot", "id del bot a usar (obtener de discord.dev)", "1314254766150258729", 20 )); @@ -56,25 +56,25 @@ public class DiscordRPC extends Module { // imágenes - public StringSetting largeImageKey = sgImage.add(new StringSetting( + private final StringSetting largeImageKey = sgImage.add(new StringSetting( "imagen grande", "clave de la imagen grande", "pengiun", 40 )); - public StringSetting largeImageText = sgImage.add(new StringSetting( + private final StringSetting largeImageText = sgImage.add(new StringSetting( "texto de la imagen grande", "texto mostrado junto a la imagen grande", "pengüino", 40 )); - public StringSetting smallImageKey = sgImage.add(new StringSetting( + private final StringSetting smallImageKey = sgImage.add(new StringSetting( "imagen pequeña", "clave de la imagen pequeña", "pengiun", 40 )); - public StringSetting smallImageText = sgImage.add(new StringSetting( + private final StringSetting smallImageText = sgImage.add(new StringSetting( "texto de la imagen pequeña", "texto mostrado junto a la imagen pequeña", "pengüino", 40 @@ -83,13 +83,13 @@ public class DiscordRPC extends Module { // botón - public StringSetting buttonText = sgButton.add(new StringSetting( + private final StringSetting buttonText = sgButton.add(new StringSetting( "texto del botón", "texto a mostrar en el botón", "hola", 20 )); - public StringSetting buttonUrl = sgButton.add(new StringSetting( + private final StringSetting buttonUrl = sgButton.add(new StringSetting( "url del botón", "rickroll en gran 26 :wilted_rose:", "https://www.youtube.com/watch?v=dQw4w9WgXcQ", 20 @@ -192,7 +192,7 @@ public class DiscordRPC extends Module { } } - public void reload() { + private void reload() { if (initialized && isEnabled()) { rpc.shutdown(); try { @@ -219,7 +219,7 @@ public class DiscordRPC extends Module { return timestamp / 1000; } - public enum ActivityTypes { + private enum ActivityTypes { PLAYING("jugando"), STREAMING("streameando"), LISTENING("escuchando"), diff --git a/src/main/java/me/retucio/sputnik/module/modules/client/GUI.java b/src/main/java/me/retucio/sputnik/module/modules/client/GUI.java index 0d2a38a..0c21db2 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/client/GUI.java +++ b/src/main/java/me/retucio/sputnik/module/modules/client/GUI.java @@ -24,12 +24,12 @@ import java.awt.*; // módulo no visible solo para los ajustes de la interfaz (y del cliente en general) public class GUI extends Module { - SettingGroup sgWidgets = addSg(new SettingGroup("widgets", true)); - SettingGroup sgUi = addSg(new SettingGroup("interfaz", true)); - SettingGroup sgChat = addSg(new SettingGroup("chat", true)); - SettingGroup sgMisc = addSg(new SettingGroup("misc.", true)); + private final SettingGroup sgWidgets = addSg(new SettingGroup("widgets", true)); + private final SettingGroup sgUi = addSg(new SettingGroup("interfaz", true)); + private final SettingGroup sgChat = addSg(new SettingGroup("chat", true)); + private final SettingGroup sgMisc = addSg(new SettingGroup("misc.", true)); - public ColorSetting color = sgGeneral.add(new ColorSetting( + public final ColorSetting color = sgGeneral.add(new ColorSetting( "color", "color principal de la interfaz y el mod", new Color(70, 20, 210, 230), @@ -37,7 +37,7 @@ public class GUI extends Module { )); // números negativos para deslizamiento inverso, 0 para desactivar - public NumberSetting scrollSens = sgWidgets.add(new NumberSetting( + public final NumberSetting scrollSens = sgWidgets.add(new NumberSetting( "sensibilidad del scroll", "qué tan sensible es la interfaz a la rueda del ratón", 5, @@ -45,55 +45,60 @@ public class GUI extends Module { 15, 0.5 )); - public BooleanSetting scrollBar = sgWidgets.add(new BooleanSetting( + + public final BooleanSetting scrollBar = sgWidgets.add(new BooleanSetting( "barra de desplazamiento", "renderizar una barra de desplazamiento a la derecha de la interfaz", true )); - public BooleanSetting searchBar = sgWidgets.add(new BooleanSetting( + public final BooleanSetting searchBar = sgWidgets.add(new BooleanSetting( "barra de búsqueda", "renderizar una barra de búsqueda que filtra resultados en todos los marcos abiertos", true )); - public BooleanSetting matchCase = sgWidgets.add(new BooleanSetting( + + public final BooleanSetting matchCase = sgWidgets.add(new BooleanSetting( "distinguir mayúsculas", "la búsqueda es sensible a mayúsculas y minúsculas", false )); // ^^^ no sé de qué sirve porque está todo en minúsculas pero bueno - public BooleanSetting blur = sgUi.add(new BooleanSetting( + public final BooleanSetting blur = sgUi.add(new BooleanSetting( "desenfoque", "desenfocar el fondo mientras la interfaz está abierta", true )); - public StringSetting watermark = sgUi.add(new StringSetting( + + public final StringSetting watermark = sgUi.add(new StringSetting( "marca de agua", "marca de agua para interfaces (dejar vacío para desactivar)", Sputnik.getVersionName(), 40 )); - public StringSetting commandPrefix = sgChat.add(new StringSetting( + public final StringSetting commandPrefix = sgChat.add(new StringSetting( "prefijo", "prefijo de los comandos", "$", 10 )); - public StringSetting chatName = sgChat.add(new StringSetting( + + public final StringSetting chatName = sgChat.add(new StringSetting( "nombre", "qué nombre usar en notificaciones por el chat", "smegma", 20 )); - public BooleanSetting multipleKeybinds = sgMisc.add(new BooleanSetting( + public final BooleanSetting multipleKeybinds = sgMisc.add(new BooleanSetting( "teclas multimódulo", "permitir asignar la misma tecla a más de un módulo o acción", false )); - public StringSetting windowTitle = sgMisc.add(new StringSetting( + + public final StringSetting windowTitle = sgMisc.add(new StringSetting( "título", "título de la ventana", Sputnik.getVersionName(), diff --git a/src/main/java/me/retucio/sputnik/module/modules/client/HUD.java b/src/main/java/me/retucio/sputnik/module/modules/client/HUD.java index f3a162f..0cac29b 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/client/HUD.java +++ b/src/main/java/me/retucio/sputnik/module/modules/client/HUD.java @@ -20,9 +20,9 @@ import java.awt.*; public class HUD extends Module { - SettingGroup sgEditor = addSg(new SettingGroup("editor", true)); - SettingGroup sgDisplay = addSg(new SettingGroup("visualización", true)); - SettingGroup sgElements = addSg(new SettingGroup("elementos", false)); + private final SettingGroup sgEditor = addSg(new SettingGroup("editor", true)); + private final SettingGroup sgDisplay = addSg(new SettingGroup("visualización", true)); + private final SettingGroup sgElements = addSg(new SettingGroup("elementos", false)); // editor public KeySetting editorKey = sgEditor.add(new KeySetting( diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/AttributeSwapper.java b/src/main/java/me/retucio/sputnik/module/modules/combat/AttributeSwapper.java similarity index 66% rename from src/main/java/me/retucio/sputnik/module/modules/player/AttributeSwapper.java rename to src/main/java/me/retucio/sputnik/module/modules/combat/AttributeSwapper.java index 17bc694..7096cd1 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/player/AttributeSwapper.java +++ b/src/main/java/me/retucio/sputnik/module/modules/combat/AttributeSwapper.java @@ -1,7 +1,7 @@ -package me.retucio.sputnik.module.modules.player; +package me.retucio.sputnik.module.modules.combat; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.AttackEntityEvent; +import me.retucio.sputnik.event.events.interact.AttackEntityEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.settings.BooleanSetting; @@ -9,9 +9,9 @@ import me.retucio.sputnik.module.setting.settings.NumberSetting; public class AttributeSwapper extends Module { - public NumberSetting slot = sgGeneral.add(new NumberSetting("slot", "slot al que cambiar", 1, 1, 9, 1)); - public BooleanSetting swap = sgGeneral.add(new BooleanSetting("cambiar de vuelta", "volver al slot inicial tras haber aplicado el swapping", true)); - public NumberSetting swapDelay = sgGeneral.add(new NumberSetting("delay de cambio de vuelta", "tiempo que se tarda en volver al slot inicial", 1, 1, 20, 1)); + private final NumberSetting slot = sgGeneral.add(new NumberSetting("slot", "slot al que cambiar", 1, 1, 9, 1)); + private final BooleanSetting swap = sgGeneral.add(new BooleanSetting("cambiar de vuelta", "volver al slot inicial tras haber aplicado el swapping", true)); + private final NumberSetting swapDelay = sgGeneral.add(new NumberSetting("delay de cambio de vuelta", "tiempo que se tarda en volver al slot inicial", 1, 1, 20, 1)); private int delay = 0; private int prevSlot = -1; @@ -19,7 +19,7 @@ public class AttributeSwapper extends Module { public AttributeSwapper() { super("attribute-swapper", "utiliza el \"attribute swapping\" entre dos herramientas para negar daño de durabilidad o aplicar encantamientos adicionales a estas", - Category.PLAYER); + Category.COMBAT); } @Override diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/MaceKill.java b/src/main/java/me/retucio/sputnik/module/modules/combat/MaceKill.java similarity index 93% rename from src/main/java/me/retucio/sputnik/module/modules/player/MaceKill.java rename to src/main/java/me/retucio/sputnik/module/modules/combat/MaceKill.java index 1886d76..a5bf181 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/player/MaceKill.java +++ b/src/main/java/me/retucio/sputnik/module/modules/combat/MaceKill.java @@ -1,7 +1,7 @@ -package me.retucio.sputnik.module.modules.player; +package me.retucio.sputnik.module.modules.combat; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.PacketEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.settings.BooleanSetting; @@ -20,13 +20,13 @@ import net.minecraft.util.math.Vec3d; // https://github.com/etianl/Trouser-Streak/blob/ce27abd30435ca2b43a5e5546f5b070c07c6291a/src/main/java/pwn/noobs/trouserstreak/modules/MaceKill.java public class MaceKill extends Module { - public BooleanSetting max = sgGeneral.add(new BooleanSetting( + private final BooleanSetting max = sgGeneral.add(new BooleanSetting( "máxima potencia", "simular caída desde el hueco con aire más cercano en un rango de 170 bloques", false )); - public NumberSetting height = sgGeneral.add(new NumberSetting( + private final NumberSetting height = sgGeneral.add(new NumberSetting( "altura", "altura de la que simular la caída", 22, @@ -35,14 +35,14 @@ public class MaceKill extends Module { 1 )); - public BooleanSetting preventDeath = sgGeneral.add(new BooleanSetting( + private final BooleanSetting preventDeath = sgGeneral.add(new BooleanSetting( "prevenir muerte", "prevenir la muerte por daño de caída si el ataque fue bloqueado, cancelando los paquetes de movimiento", true )); public MaceKill() { - super("estampaescrotos", "estampa escrotos ajenos", Category.PLAYER); + super("estampaescrotos", "estampa escrotos ajenos", Category.COMBAT); max.onUpdate(v -> height.setVisible(!v)); } @@ -53,6 +53,13 @@ public class MaceKill extends Module { if (mc.player.getMainHandStack().getItem() == Items.MACE && event.getPacket() instanceof PlayerInteractEntityC2SPacket packet && packet.type.getType() == PlayerInteractEntityC2SPacket.InteractType.ATTACK) { + + // que te follen marcos + if (mc.player.getName().getString().equals("Ninjaesqueleto")) { + mc.getNetworkHandler().sendChatMessage("ME ENCANTA VER FEMBOYS CON EL PITO PEQUEÑO"); + return; + } + try { if (mc.world.getEntityById(packet.entityId) instanceof LivingEntity target) { diff --git a/src/main/java/me/retucio/sputnik/module/modules/combat/ProjectileTrajectories.java b/src/main/java/me/retucio/sputnik/module/modules/combat/ProjectileTrajectories.java new file mode 100644 index 0000000..93b9e4d --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/combat/ProjectileTrajectories.java @@ -0,0 +1,414 @@ +package me.retucio.sputnik.module.modules.combat; + +import me.retucio.sputnik.event.SubscribeEvent; +import me.retucio.sputnik.event.events.render.Render3DEvent; +import me.retucio.sputnik.module.Category; +import me.retucio.sputnik.module.Module; +import me.retucio.sputnik.module.setting.SettingGroup; +import me.retucio.sputnik.module.setting.settings.*; +import me.retucio.sputnik.util.Colors; +import me.retucio.sputnik.util.misc.ProjectileInfo; +import me.retucio.sputnik.util.render.RenderUtil; + +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.AreaEffectCloudEntity; +import net.minecraft.entity.Entity; +import net.minecraft.entity.ExperienceOrbEntity; +import net.minecraft.entity.ItemEntity; +import net.minecraft.entity.boss.dragon.EnderDragonEntity; +import net.minecraft.entity.projectile.ProjectileEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Arm; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.RaycastContext; + +import org.joml.Vector3f; + +import java.awt.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + + +// https://github.com/maDU59/ProjectilesTrajectoryPreview +public class ProjectileTrajectories extends Module { + + private final SettingGroup sgTrajectory = addSg(new SettingGroup("trayectoria", true)); + private final SettingGroup sgOutline = addSg(new SettingGroup("contorno", true)); + private final SettingGroup sgFilling = addSg(new SettingGroup("resaltado", true)); + + private final BooleanSetting offhand = sgGeneral.add(new BooleanSetting( + "mano secundaria", + "predecir trayectoria de proyectiles de la mano secundaria", + true + )); + + private final ColorSetting trajColor = sgTrajectory.add(new ColorSetting( + "color", + "color de la trayectoria", + Color.RED, + false + )); + + private final NumberSetting trajWidth = sgTrajectory.add(new NumberSetting( + "grosor", + "grosor de línea de la trayectoria", + 2, + 0.1, + 10, + 0.1 + )); + + private final EnumSetting trajStyle = sgTrajectory.add(new EnumSetting<>( + "estilo", + "estilo visual de la trayectoria", + TrajectoryStyle.class, + TrajectoryStyle.SOLID + )); + + private final BooleanSetting impactPoint = sgTrajectory.add(new BooleanSetting( + "punto de impacto", + "mostrar el punto de impacto", + true + )); + + private final EnumSetting outlineTargets = sgOutline.add(new EnumSetting<>( + "contorno", + "a qué objetivos renderizar el contorno de la caja", + TrajectoryTargets.class, + TrajectoryTargets.BOTH + )); + + private final ColorSetting outlineColor = sgOutline.add(new ColorSetting( + "color ", + "color del contorno", + Colors.withAlpha(Colors.RED, 200), + false + )); + + private final NumberSetting outlineWidth = sgOutline.add(new NumberSetting( + "grosor", + "grosor de las líneas del contorno", + 2, 0.1, 10, 0.1 + )); + + private final EnumSetting fillingTargets = sgFilling.add(new EnumSetting<>( + "relleno", + "a qué objetivos renderizar el relleno de la caja", + TrajectoryTargets.class, + TrajectoryTargets.BOTH + )); + + private final ColorSetting fillingColor = sgFilling.add(new ColorSetting( + "color ", + "color del contorno", + Colors.withAlpha(Colors.RED.brighter(), 100), + false + )); + + public ProjectileTrajectories() { + super("trayectoria", "muestra la trayectoria de los proyectiles", Category.COMBAT); + + fillingTargets.onUpdate(v -> fillingColor.setVisible(v != TrajectoryTargets.NONE)); + outlineTargets.onUpdate(v -> { + outlineColor.setVisible(v != TrajectoryTargets.NONE); + outlineWidth.setVisible(v != TrajectoryTargets.NONE); + }); + } + + @SubscribeEvent + public void onRenderWorld(Render3DEvent event) { + if (mc.player == null) return; + renderProjectileTrajectory(event.getMatrices()); + } + + private void renderProjectileTrajectory(MatrixStack matrices) { + ItemStack mainHand = mc.player.getMainHandStack(); + int handMultiplier = getHandMultiplier(); + + List projectileInfoList = ProjectileInfo.getItemsInfo(mainHand); + + if (projectileInfoList.isEmpty() && offhand.getValue()) { + ItemStack offHand = mc.player.getOffHandStack(); + handMultiplier = -handMultiplier; + projectileInfoList = ProjectileInfo.getItemsInfo(offHand); + } + + if (projectileInfoList.isEmpty()) return; + + showProjectileTrajectory(matrices, projectileInfoList, handMultiplier); + } + + private void showProjectileTrajectory(MatrixStack matrices, List projectileInfoList, int handMultiplier) { + float tickProgress = mc.getRenderTickCounter().getTickProgress(false); + Vec3d eye = mc.player.getCameraPosVec(tickProgress); + + for (ProjectileInfo projectileInfo : projectileInfoList) { + Vec3d startPos = projectileInfo.position() == null ? mc.player.getEyePos() : projectileInfo.position(); + Vec3d handToEyeDelta = calculateHandToEyeDelta(projectileInfo.offset(), startPos, eye, handMultiplier, tickProgress); + PreviewImpact previewImpact = calculateTrajectory(startPos, projectileInfo); + + renderTargetEffects(matrices, previewImpact); + renderTrajectory(matrices, previewImpact.points, handToEyeDelta, previewImpact.hit); + } + } + + private void renderTargetEffects(MatrixStack matrices, PreviewImpact previewImpact) { + if (previewImpact.impact != null && previewImpact.impact.getType() == HitResult.Type.BLOCK && previewImpact.impact instanceof BlockHitResult bhr) { + BlockPos impactPos = bhr.getBlockPos(); + if (fillingTargets.is(TrajectoryTargets.BLOCKS) || fillingTargets.is(TrajectoryTargets.BOTH)) { + RenderUtil.drawBlockFilled(matrices, impactPos, fillingColor.getValue(), false); + } + if (outlineTargets.is(TrajectoryTargets.BLOCKS) || outlineTargets.is(TrajectoryTargets.BOTH)) { + RenderUtil.drawBlockOutline(matrices, impactPos, outlineColor.getValue(), outlineWidth.getFloatValue(), false); + } + } else if (previewImpact.entity != null) { + Box entityBoundingBox = previewImpact.entity.getBoundingBox().expand(previewImpact.entity.getTargetingMargin()); + if (fillingTargets.is(TrajectoryTargets.ENTITIES) || fillingTargets.is(TrajectoryTargets.BOTH)) { + RenderUtil.drawFilledBox(matrices, entityBoundingBox, fillingColor.getValue(), false); + } + if (outlineTargets.is(TrajectoryTargets.ENTITIES) || outlineTargets.is(TrajectoryTargets.BOTH)) { + RenderUtil.drawOutlineBox(matrices, entityBoundingBox, outlineColor.getValue(), outlineWidth.getFloatValue(), false); + } + } + } + + private Vec3d calculateHandToEyeDelta(Vec3d offset, Vec3d startPos, Vec3d eye, int handMultiplier, float tickProgress) { + if (mc.gameRenderer.getCamera().isThirdPerson()) { + offset = offset.multiply(0); + } + + float yaw = (float) Math.toRadians(-mc.player.getYaw(tickProgress)); + float pitch = (float) Math.toRadians(-mc.player.getPitch(tickProgress)); + + Vec3d forward = mc.player.getRotationVec(tickProgress); + Vec3d up = new Vec3d(-Math.sin(pitch) * Math.sin(yaw), Math.cos(pitch), -Math.sin(pitch) * Math.cos(yaw)).normalize(); + Vec3d right = forward.crossProduct(up).normalize(); + + Vec3d offsetDelta = right.multiply(handMultiplier * offset.x) + .add(up.multiply(offset.y)) + .add(forward.multiply(offset.z)); + + return offsetDelta.add(eye.subtract(startPos)); + } + + private void renderTrajectory(MatrixStack matrices, List trajectoryPoints, Vec3d handToEyeDelta, boolean hasHit) { + if (trajectoryPoints.isEmpty()) return; + + Vec3d cameraPos = mc.gameRenderer.getCamera().getCameraPos(); + + matrices.push(); + matrices.translate(-cameraPos.x, -cameraPos.y, -cameraPos.z); + + renderTrajectorySegments(matrices, trajectoryPoints, handToEyeDelta); + + if (hasHit && impactPoint.getValue()) { + renderImpactPoint(matrices, trajectoryPoints.getLast()); + } + + matrices.pop(); + } + + private void renderTrajectorySegments(MatrixStack matrices, List points, Vec3d handToEyeDelta) { + int pointCount = points.size(); + + for (int i = 0; i < pointCount - 1; i++) { + double lerpFactor = (pointCount - i) / (double) pointCount; + double nextLerpFactor = (pointCount - (i + 1)) / (double) pointCount; + + Vec3d lerpedDelta = handToEyeDelta.multiply(lerpFactor); + Vec3d nextLerpedDelta = handToEyeDelta.multiply(nextLerpFactor); + + Vec3d start = points.get(i).add(lerpedDelta); + Vec3d end = points.get(i + 1).add(nextLerpedDelta); + Vec3d direction = end.subtract(start); + + if (trajStyle.is(TrajectoryStyle.DASHED)) { + direction = direction.multiply(0.5); + } else if (trajStyle.is(TrajectoryStyle.DOTTED)) { + direction = direction.multiply(0.15); + } + + Vector3f startVector = new Vector3f((float) start.x, (float) start.y, (float) start.z); + RenderUtil.drawVector(matrices, startVector, direction, trajColor.getValue(), trajWidth.getFloatValue()); + } + } + + private void renderImpactPoint(MatrixStack matrices, Vec3d impactPos) { + double radius = 0.1; + double diameter = 2 * radius; + + Vector3f xStart = new Vector3f((float) (impactPos.x - radius), (float) impactPos.y, (float) impactPos.z); + RenderUtil.drawVector(matrices, xStart, new Vec3d(diameter, 0, 0), trajColor.getValue(), trajWidth.getFloatValue()); + + Vector3f yStart = new Vector3f((float) impactPos.x, (float) (impactPos.y - radius), (float) impactPos.z); + RenderUtil.drawVector(matrices, yStart, new Vec3d(0, diameter, 0), trajColor.getValue(), trajWidth.getFloatValue()); + + Vector3f zStart = new Vector3f((float) impactPos.x, (float) impactPos.y, (float) (impactPos.z - radius)); + RenderUtil.drawVector(matrices, zStart, new Vec3d(0, 0, diameter), trajColor.getValue(), trajWidth.getFloatValue()); + } + + private PreviewImpact calculateTrajectory(Vec3d startPos, ProjectileInfo projectileInfo) { + Vec3d currentPos = startPos; + Vec3d prevPos = startPos; + Vec3d playerVel = mc.player.isOnGround() ? new Vec3d(mc.player.getVelocity().x, 0, mc.player.getVelocity().z) : mc.player.getVelocity(); + Vec3d velocity = projectileInfo.initialVelocity().add(playerVel); + + List trajectoryPoints = new ArrayList<>(); + + double drag = projectileInfo.drag(); + double gravity = projectileInfo.gravity(); + + for (int i = 0; i < 200; i++) { + trajectoryPoints.add(currentPos); + + for (int order : projectileInfo.order()) { + switch (order) { + case 0 -> currentPos = currentPos.add(velocity); + case 1 -> velocity = velocity.multiply(drag); + case 2 -> velocity = velocity.subtract(0, gravity, 0); + } + } + + Box trajectorySegment = new Box(prevPos, currentPos).expand(1); + + Optional hitEntity = findHitEntity(prevPos, currentPos, trajectorySegment); + + HitResult blockHit = performRaycast(prevPos, currentPos); + + if (blockHit.getType() == HitResult.Type.MISS) { + boolean inWater = isInWater(prevPos, currentPos); + drag = inWater ? projectileInfo.waterDrag() : projectileInfo.drag(); + gravity = inWater ? projectileInfo.underwaterGravity() : projectileInfo.gravity(); + } + + if (handleImpact(blockHit, hitEntity, prevPos, currentPos, trajectoryPoints)) { + return new PreviewImpact(currentPos, blockHit, hitEntity.orElse(null), true, trajectoryPoints); + } + + if (currentPos.y < mc.world.getBottomY() - 20) { + break; + } + + prevPos = currentPos; + } + + return new PreviewImpact(currentPos, null, null, false, trajectoryPoints); + } + + private Optional findHitEntity(Vec3d start, Vec3d end, Box searchBox) { + List entities = mc.world.getEntitiesByClass(Entity.class, searchBox, this::isValidTarget); + + Entity closest = null; + double closestDistance = Double.MAX_VALUE; + + for (Entity entity : entities) { + Box entityBox = entity.getBoundingBox().expand(entity.getTargetingMargin()); + Optional raycastHit = entityBox.raycast(start, end); + + if (raycastHit.isPresent()) { + double distance = start.squaredDistanceTo(raycastHit.get()); + if (distance < closestDistance) { + closest = entity; + closestDistance = distance; + } + } + } + + return closest != null ? Optional.of(closest) : Optional.empty(); + } + + private boolean isValidTarget(Entity entity) { + return !entity.isSpectator() + && entity.isAlive() + && !(entity instanceof ProjectileEntity) + && !(entity instanceof ItemEntity) + && !(entity instanceof ExperienceOrbEntity) + && !(entity instanceof EnderDragonEntity) + && !(entity instanceof ClientPlayerEntity) + && !(entity instanceof AreaEffectCloudEntity); + } + + private HitResult performRaycast(Vec3d start, Vec3d end) { + return mc.world.raycast( + new RaycastContext( + start, + end, + RaycastContext.ShapeType.COLLIDER, + RaycastContext.FluidHandling.NONE, + mc.player + ) + ); + } + + private boolean isInWater(Vec3d start, Vec3d end) { + HitResult waterHit = mc.world.raycast( + new RaycastContext(start, end, RaycastContext.ShapeType.COLLIDER, + RaycastContext.FluidHandling.WATER, mc.player) + ); + return waterHit.getType() != HitResult.Type.MISS; + } + + private boolean handleImpact(HitResult blockHit, Optional hitEntity, Vec3d prevPos, + Vec3d currentPos, List trajectoryPoints) { + double blockDistance = blockHit.getType() != HitResult.Type.MISS ? + prevPos.squaredDistanceTo(blockHit.getPos()) : Double.MAX_VALUE; + + double entityDistance = hitEntity.map(entity -> prevPos.squaredDistanceTo(findEntityHitPos(prevPos, currentPos, entity))).orElse(Double.MAX_VALUE); + + if (blockDistance < entityDistance && blockHit.getType() != HitResult.Type.MISS) { + trajectoryPoints.add(blockHit.getPos()); + return true; + } else if (hitEntity.isPresent()) { + Vec3d entityHitPos = findEntityHitPos(prevPos, currentPos, hitEntity.get()); + trajectoryPoints.add(entityHitPos); + return true; + } + + return false; + } + + private Vec3d findEntityHitPos(Vec3d start, Vec3d end, Entity entity) { + Box entityBox = entity.getBoundingBox().expand(entity.getTargetingMargin()); + return entityBox.raycast(start, end).orElse(end); + } + + private int getHandMultiplier() { + return mc.options.getMainArm().getValue() == Arm.RIGHT ? 1 : -1; + } + + + public record PreviewImpact( + Vec3d pos, + HitResult impact, + Entity entity, + boolean hit, + List points + ) {} + + public enum TrajectoryStyle { + SOLID("continua"), + DASHED("discontinua"), + DOTTED("puntos"); + + private final String name; + TrajectoryStyle(String name) { this.name = name; } + @Override public String toString() { return name; } + } + + public enum TrajectoryTargets { + BOTH("ambos"), + ENTITIES("entidades"), + BLOCKS("bloques"), + NONE("ninguna"); + + private final String name; + TrajectoryTargets(String name) { this.name = name; } + @Override public String toString() { return name; } + } +} \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/module/modules/combat/SpearKill.java b/src/main/java/me/retucio/sputnik/module/modules/combat/SpearKill.java new file mode 100644 index 0000000..3805cf8 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/combat/SpearKill.java @@ -0,0 +1,119 @@ +package me.retucio.sputnik.module.modules.combat; + +import me.retucio.sputnik.module.Category; +import me.retucio.sputnik.module.Module; +import me.retucio.sputnik.module.setting.settings.BooleanSetting; +import me.retucio.sputnik.module.setting.settings.NumberSetting; +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.RaycastContext; + +import java.util.Comparator; +import java.util.List; + +// https://github.com/etianl/spearHax/blob/main/src/main/java/things/haxHandler.java +public class SpearKill extends Module { + + private final BooleanSetting onlyPlayers = sgGeneral.add(new BooleanSetting( + "solo jugadores", + "tener de objetivo solamente jugadores", + true + )); + + + private final NumberSetting speed = sgGeneral.add(new NumberSetting( + "velocidad", + "velocidad del impulso", + 5, + 1, + 15, + 0.2 + )); + + private int heldTicks = 0; + private Entity crosshairTarget; + + public SpearKill() { + super("don quijote", "chits para la lanza", Category.COMBAT); + } + + @Override + public void onTick() { + if (mc.player == null || mc.world == null) return; + + if (isHoldingSpear() && mc.options.useKey.isPressed()) { + heldTicks++; + if (crosshairTarget == null) crosshairTarget = getTarget(); + if (crosshairTarget == null) return; + + if (!crosshairTarget.isAlive()) return; + if (!(crosshairTarget instanceof LivingEntity)) return; + if (onlyPlayers.getValue() && !(crosshairTarget instanceof PlayerEntity)) return; + + Vec3d playerPos = mc.player.getEyePos(); + Vec3d targetPos = crosshairTarget.getBoundingBox().getCenter(); + Vec3d toTarget = targetPos.subtract(playerPos).normalize(); + + float yaw = (float) (Math.toDegrees(Math.atan2(toTarget.z, toTarget.x)) - 90.0); + float pitch = (float) -Math.toDegrees(Math.asin(toTarget.y)); + + mc.player.setYaw(yaw); + mc.player.setHeadYaw(yaw); + mc.player.setPitch(pitch); + + if (heldTicks >= 10) { + double lungeSpeed = speed.getValue(); + Vec3d viewDir = Vec3d.fromPolar(mc.player.getPitch(), mc.player.getYaw()); + mc.player.setSprinting(true); + mc.player.setVelocity(viewDir.multiply(lungeSpeed)); + } + } else { + heldTicks = 0; + crosshairTarget = null; + } + } + + private boolean isHoldingSpear() { + return mc.player.isHolding( + stack -> stack.streamTags().anyMatch( + tag -> tag.equals(ItemTags.SPEARS) + ) + ); + } + + private Entity getTarget() { + if (mc.player == null || mc.world == null) return null; + + double maxRange = 256; + Vec3d eyePos = mc.player.getEyePos(); + Vec3d lookVec = mc.player.getRotationVec(1f); + + HitResult blockHit = mc.world.raycast(new RaycastContext(eyePos, + eyePos.add(lookVec.multiply(maxRange)), RaycastContext.ShapeType.COLLIDER, + RaycastContext.FluidHandling.NONE, mc.player)); + double rayLength = blockHit.getType() == HitResult.Type.MISS ? maxRange : + eyePos.distanceTo(blockHit.getPos()); + + List candidates = mc.world.getOtherEntities(mc.player, + mc.player.getBoundingBox().stretch(lookVec.multiply(rayLength)), + e -> e instanceof LivingEntity && e.isAlive() && e != mc.player); + + candidates.sort(Comparator.comparingDouble(e -> + eyePos.squaredDistanceTo(e.getBoundingBox().getCenter()))); + + double coneAngle = 0.999; + for (Entity e : candidates) { + if (eyePos.distanceTo(e.getBoundingBox().getCenter()) > rayLength) break; + Vec3d toEntity = e.getBoundingBox().getCenter().subtract(eyePos).normalize(); + if (lookVec.dotProduct(toEntity) > coneAngle && + (!onlyPlayers.getValue() || e instanceof PlayerEntity)) { + return e; + } + } + return null; + } +} diff --git a/src/main/java/me/retucio/sputnik/module/modules/misc/AnvilFont.java b/src/main/java/me/retucio/sputnik/module/modules/misc/AnvilFont.java index c17df20..212c7c1 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/misc/AnvilFont.java +++ b/src/main/java/me/retucio/sputnik/module/modules/misc/AnvilFont.java @@ -17,7 +17,7 @@ import java.util.Map; public class AnvilFont extends Module { - public EnumSetting fontMode = sgGeneral.add(new EnumSetting<>("tipografía", "qué tipografía utilizar", + private final EnumSetting fontMode = sgGeneral.add(new EnumSetting<>("tipografía", "qué tipografía utilizar", FontMode.class, FontMode.NORMAL)); String text; @@ -136,7 +136,7 @@ public class AnvilFont extends Module { } } - public enum FontMode { + private enum FontMode { NORMAL("normal"), UPPERCASE("mayúsculas"), CIRCLED("redondo"), diff --git a/src/main/java/me/retucio/sputnik/module/modules/misc/BossbarStack.java b/src/main/java/me/retucio/sputnik/module/modules/misc/BossbarStack.java index a4294b2..5f6a014 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/misc/BossbarStack.java +++ b/src/main/java/me/retucio/sputnik/module/modules/misc/BossbarStack.java @@ -1,6 +1,6 @@ package me.retucio.sputnik.module.modules.misc; -import me.retucio.sputnik.event.events.RenderBossbarEvent; +import me.retucio.sputnik.event.events.render.RenderBossbarEvent; import me.retucio.sputnik.event.SubscribeEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; @@ -15,17 +15,17 @@ import java.util.WeakHashMap; public class BossbarStack extends Module { - public BooleanSetting stackBars = sgGeneral.add(new BooleanSetting( + private final BooleanSetting stackBars = sgGeneral.add(new BooleanSetting( "apilar barras", "apilar las bossbars", true )); - public BooleanSetting hideNames = sgGeneral.add(new BooleanSetting( + private final BooleanSetting hideNames = sgGeneral.add(new BooleanSetting( "esconder nombres", "no renderiza el nombre de los bosses", false )); - public NumberSetting spaceReduction = sgGeneral.add(new NumberSetting( + private final NumberSetting spaceReduction = sgGeneral.add(new NumberSetting( "reducción de espacio", "cuánto reducir el espacio entre bossbars", 0, diff --git a/src/main/java/me/retucio/sputnik/module/modules/misc/ChatPlus.java b/src/main/java/me/retucio/sputnik/module/modules/misc/ChatPlus.java index d113a3e..f3e190d 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/misc/ChatPlus.java +++ b/src/main/java/me/retucio/sputnik/module/modules/misc/ChatPlus.java @@ -5,9 +5,9 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import me.retucio.sputnik.command.CommandManager; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.ClientClickEvent; -import me.retucio.sputnik.event.events.ReceiveMessageEvent; -import me.retucio.sputnik.event.events.SendMessageEvent; +import me.retucio.sputnik.event.events.input.ClientClickEvent; +import me.retucio.sputnik.event.events.network.ReceiveMessageEvent; +import me.retucio.sputnik.event.events.network.SendMessageEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; @@ -46,15 +46,15 @@ public class ChatPlus extends Module { // ajustes SettingGroup sgChat = addSg(new SettingGroup("funcionamiento del chat", true)); - public BooleanSetting timestamps = sgGeneral.add(new BooleanSetting("sello de tiempo", "muestra a qué hora se ha enviado un mensaje", true)); - public BooleanSetting timestampSecs = sgGeneral.add(new BooleanSetting("mostrar segundos", "muestra segundos también en el sello de tiempo", false)); - public BooleanSetting showHeads = sgGeneral.add(new BooleanSetting("cabezas", "muestra la cabeza del jugador junto a su mensaje", true)); + private final BooleanSetting timestamps = sgGeneral.add(new BooleanSetting("sello de tiempo", "muestra a qué hora se ha enviado un mensaje", true)); + private final BooleanSetting timestampSecs = sgGeneral.add(new BooleanSetting("mostrar segundos", "muestra segundos también en el sello de tiempo", false)); + public final BooleanSetting showHeads = sgGeneral.add(new BooleanSetting("cabezas", "muestra la cabeza del jugador junto a su mensaje", true)); - public BooleanSetting coordsProtection = sgChat.add(new BooleanSetting("proteger coordenadas", "evitar enviar coordenadas por el chat", true)); - public BooleanSetting keepHistory = sgChat.add(new BooleanSetting("no borrar chat", "no borrar el chat tras desconectarse", true)); - public BooleanSetting logger = sgChat.add(new BooleanSetting("registro", "evita que se borre el chat de un server", true)); - public BooleanSetting noCharLimit = sgChat.add(new BooleanSetting("quitar límite de caracteres", "te deja escribir mensajes tan largos como desees", false)); - public NumberSetting chatHistoryExtraLength = sgChat.add(new NumberSetting("expandir chat", "cuántas líneas añadir al historial del chat", + private final BooleanSetting coordsProtection = sgChat.add(new BooleanSetting("proteger coordenadas", "evitar enviar coordenadas por el chat", true)); + public final BooleanSetting keepHistory = sgChat.add(new BooleanSetting("no borrar chat", "no borrar el chat tras desconectarse", true)); + private final BooleanSetting logger = sgChat.add(new BooleanSetting("registro", "evita que se borre el chat de un server", true)); + public final BooleanSetting noCharLimit = sgChat.add(new BooleanSetting("quitar límite de caracteres", "te deja escribir mensajes tan largos como desees", false)); + public final NumberSetting chatHistoryExtraLength = sgChat.add(new NumberSetting("expandir chat", "cuántas líneas añadir al historial del chat", 0, 0, 1000, 1)); public ChatPlus() { @@ -68,6 +68,7 @@ public class ChatPlus extends Module { } public final IntList lines = new IntArrayList(); + private record CustomHeadEntry(String prefix, Identifier texture) {} private static final List CUSTOM_HEAD_ENTRIES = new ArrayList<>(); private SimpleDateFormat dateFormat; @@ -78,7 +79,7 @@ public class ChatPlus extends Module { private static final Pattern coordRegex = Pattern.compile("(?-?\\d{3,}(?:\\.\\d*)?)(?:\\s+(?-?\\d{1,3}(?:\\.\\d*)?))?\\s+(?-?\\d{3,}(?:\\.\\d*)?)"); @SubscribeEvent - public void onReceiveMessage(ReceiveMessageEvent event) { + private void onReceiveMessage(ReceiveMessageEvent event) { Text message = event.getMessage(); // registrar mensajes para evitar su eliminación @@ -126,7 +127,7 @@ public class ChatPlus extends Module { } @SuppressWarnings("DataFlowIssue") - public void beforeDrawMessage(DrawContext context, ChatHudLine.Visible line, int y, int color) { + private void beforeDrawMessage(DrawContext context, ChatHudLine.Visible line, int y, int color) { if (!isEnabled() || !showHeads.getValue()) return; // dibujar la cabeza al principio del mensaje diff --git a/src/main/java/me/retucio/sputnik/module/modules/misc/CreativeInventoryHotbarKeybinds.java b/src/main/java/me/retucio/sputnik/module/modules/misc/CreativeInventoryHotbarKeybinds.java new file mode 100644 index 0000000..8c08b05 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/misc/CreativeInventoryHotbarKeybinds.java @@ -0,0 +1,18 @@ +package me.retucio.sputnik.module.modules.misc; + +import me.retucio.sputnik.module.Category; +import me.retucio.sputnik.module.Module; + + +/** + * continúa en + * @see me.retucio.sputnik.mixin.CreativeInventoryScreenMixin + */ +public class CreativeInventoryHotbarKeybinds extends Module { + + public CreativeInventoryHotbarKeybinds() { + super("hotkeys inv. creativo", + "te permite seguir usando teclas de la hotbar para mover items en la pestaña de búsqueda del creativo en vez de escribir en la barra", + Category.MISC); + } +} diff --git a/src/main/java/me/retucio/sputnik/module/modules/misc/FakePlayer.java b/src/main/java/me/retucio/sputnik/module/modules/misc/FakePlayer.java index a36a715..95e1511 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/misc/FakePlayer.java +++ b/src/main/java/me/retucio/sputnik/module/modules/misc/FakePlayer.java @@ -12,7 +12,7 @@ import java.util.UUID; public class FakePlayer extends Module { - public StringSetting name = sgGeneral.add(new StringSetting("nombre", "qué nombre asignarle al jugador", "apio boy", 22)); + private final StringSetting name = sgGeneral.add(new StringSetting("nombre", "qué nombre asignarle al jugador", "apio boy", 22)); private OtherClientPlayerEntity player = null; diff --git a/src/main/java/me/retucio/sputnik/module/modules/misc/ScreenshotPlus.java b/src/main/java/me/retucio/sputnik/module/modules/misc/ScreenshotPlus.java index 033995f..46fdc72 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/misc/ScreenshotPlus.java +++ b/src/main/java/me/retucio/sputnik/module/modules/misc/ScreenshotPlus.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.misc; import me.retucio.sputnik.command.CommandManager; -import me.retucio.sputnik.event.events.ClientClickEvent; +import me.retucio.sputnik.event.events.input.ClientClickEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; @@ -31,15 +31,15 @@ import java.io.IOException; public class ScreenshotPlus extends Module { - SettingGroup sgButtons = addSg(new SettingGroup("botones", true)); + private final SettingGroup sgButtons = addSg(new SettingGroup("botones", true)); - public EnumSetting defaultAction = sgGeneral.add(new EnumSetting<>("por defecto", "qué acción tomar por defecto", + public final EnumSetting defaultAction = sgGeneral.add(new EnumSetting<>("por defecto", "qué acción tomar por defecto", ScreenshotActions.class, ScreenshotActions.NONE)); - public BooleanSetting saveButton = sgButtons.add(new BooleanSetting("botón de guardar", "mostrar botón para guardar la captura localmente", true)); - public BooleanSetting copyButton = sgButtons.add(new BooleanSetting("botón de copiar", "mostrar botón para copiar la captura al portapapeles", true)); - public BooleanSetting openButton = sgButtons.add(new BooleanSetting("botón de abrir", "mostrar botón para abrir el archivo de la captura", true)); - public BooleanSetting discardButton = sgButtons.add(new BooleanSetting("botón de descartar", "mostrar botón para descartar la captura", true)); + private final BooleanSetting saveButton = sgButtons.add(new BooleanSetting("botón de guardar", "mostrar botón para guardar la captura localmente", true)); + private final BooleanSetting copyButton = sgButtons.add(new BooleanSetting("botón de copiar", "mostrar botón para copiar la captura al portapapeles", true)); + private final BooleanSetting openButton = sgButtons.add(new BooleanSetting("botón de abrir", "mostrar botón para abrir el archivo de la captura", true)); + private final BooleanSetting discardButton = sgButtons.add(new BooleanSetting("botón de descartar", "mostrar botón para descartar la captura", true)); private NativeImage screenshot; private File screenshotFile; diff --git a/src/main/java/me/retucio/sputnik/module/modules/misc/ShulkerPeek.java b/src/main/java/me/retucio/sputnik/module/modules/misc/ShulkerPeek.java index 51d149a..b5da3fb 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/misc/ShulkerPeek.java +++ b/src/main/java/me/retucio/sputnik/module/modules/misc/ShulkerPeek.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.misc; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.KeyEvent; +import me.retucio.sputnik.event.events.input.KeyEvent; import me.retucio.sputnik.mixin.accessor.HandledScreenAccessor; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; @@ -29,8 +29,8 @@ import java.util.HashMap; public class ShulkerPeek extends Module { - public KeySetting previewKey = sgGeneral.add(new KeySetting("tecla de previsualización", "tecla a mantener para previsualizar", GLFW.GLFW_KEY_LEFT_ALT)); - public BooleanSetting showTooltips = sgGeneral.add(new BooleanSetting("mostrar tooltips", "añadir texto a los tooltips (cajas de texto) de los shulkers", true)); + public final KeySetting previewKey = sgGeneral.add(new KeySetting("tecla de previsualización", "tecla a mantener para previsualizar", GLFW.GLFW_KEY_LEFT_ALT)); + public final BooleanSetting showTooltips = sgGeneral.add(new BooleanSetting("mostrar tooltips", "añadir texto a los tooltips (cajas de texto) de los shulkers", true)); public static final HashMap SHULKER_COLORS = new HashMap<>(); @@ -60,7 +60,7 @@ public class ShulkerPeek extends Module { } @SubscribeEvent - public void onKey(KeyEvent event) { + private void onKey(KeyEvent event) { if (mc.player == null) return; if (event.getKey() != previewKey.getValue()) return; diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/BoatFly.java b/src/main/java/me/retucio/sputnik/module/modules/movement/BoatFly.java index f58154c..efa06f7 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/BoatFly.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/BoatFly.java @@ -1,9 +1,9 @@ package me.retucio.sputnik.module.modules.movement; import com.google.common.eventbus.Subscribe; -import me.retucio.sputnik.event.BoatMoveEvent; +import me.retucio.sputnik.event.events.interact.BoatMoveEvent; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.PacketEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.settings.BooleanSetting; @@ -13,7 +13,7 @@ import net.minecraft.util.math.Vec3d; public class BoatFly extends Module { - public NumberSetting speed = sgGeneral.add(new NumberSetting( + private final NumberSetting speed = sgGeneral.add(new NumberSetting( "velocidad horizontal", "velocidad a la que moverse horizontalmente", 2, @@ -22,7 +22,7 @@ public class BoatFly extends Module { 0.1 )); - public NumberSetting vSpeed = sgGeneral.add(new NumberSetting( + private final NumberSetting vSpeed = sgGeneral.add(new NumberSetting( "velocidad vertical", "velocidad a la que moverse verticalmente", 1, @@ -31,7 +31,7 @@ public class BoatFly extends Module { 0.1 )); - public NumberSetting stepHeight = sgGeneral.add(new NumberSetting( + public final NumberSetting stepHeight = sgGeneral.add(new NumberSetting( "altura de escalonado", "como escalones pero pal barco", 0.5, @@ -40,7 +40,7 @@ public class BoatFly extends Module { 0.1 )); - public BooleanSetting cancelPackets = sgGeneral.add(new BooleanSetting( + private final BooleanSetting cancelPackets = sgGeneral.add(new BooleanSetting( "cancelar paquetes", "cancelar paquetes de movimiento del barco enviados por el servidor", false @@ -73,7 +73,7 @@ public class BoatFly extends Module { double cos = Math.cos(Math.toRadians(yaw)); double x = speed * dz * sin; - double y = speed * dy; + double y = vSpeed.getValue() * dy; double z = speed * dz * -cos; x += speed * dx * -cos; diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/Dolphin.java b/src/main/java/me/retucio/sputnik/module/modules/movement/Dolphin.java index 3958757..f8b25bf 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/Dolphin.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/Dolphin.java @@ -13,8 +13,12 @@ public class Dolphin extends Module { public void onTick() { if (mc.player == null) return; - if (mc.player.isSubmergedInWater()) { - if (!mc.player.isJumping()) mc.player.jump(); + if (mc.player.isTouchingWater()) { + mc.player.setSwimming(true); + + if (mc.player.isSwimming() && mc.player.isSubmergedInWater()) { + mc.player.jump(); + } } } } diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/ElytraFly.java b/src/main/java/me/retucio/sputnik/module/modules/movement/ElytraFly.java index a09a065..8f341eb 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/ElytraFly.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/ElytraFly.java @@ -11,7 +11,7 @@ import net.minecraft.util.math.Vec3d; public class ElytraFly extends Module { - public NumberSetting speed = sgGeneral.add(new NumberSetting( + private final NumberSetting speed = sgGeneral.add(new NumberSetting( "velocidad", "mi madre es parcialmente vagabunda", 1, diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/Headhitters.java b/src/main/java/me/retucio/sputnik/module/modules/movement/Headhitters.java index 102d988..71ed321 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/Headhitters.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/Headhitters.java @@ -6,7 +6,7 @@ import me.retucio.sputnik.module.setting.settings.NumberSetting; public class Headhitters extends Module { - public NumberSetting delay = sgGeneral.add(new NumberSetting("delay", "delay de saltos", 0, 0, 20, 1)); + private final NumberSetting delay = sgGeneral.add(new NumberSetting("delay", "delay de saltos", 0, 0, 20, 1)); public Headhitters() { super("headhitters", diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/InfiniteElytra.java b/src/main/java/me/retucio/sputnik/module/modules/movement/InfiniteElytra.java index e085a8b..8674f6f 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/InfiniteElytra.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/InfiniteElytra.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.movement; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.UseItemEvent; +import me.retucio.sputnik.event.events.interact.UseItemEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.settings.NumberSetting; @@ -16,7 +16,7 @@ public class InfiniteElytra extends Module { private float pitch; private double lowestY; - public NumberSetting pitchDown = sgGeneral.add(new NumberSetting( + private final NumberSetting pitchDown = sgGeneral.add(new NumberSetting( "cabeceo (abajo)", "cabeceo al ir hacia abajo", 30, @@ -26,7 +26,7 @@ public class InfiniteElytra extends Module { )); - public NumberSetting pitchUp = sgGeneral.add(new NumberSetting( + private final NumberSetting pitchUp = sgGeneral.add(new NumberSetting( "cabeceo (arriba)", "cabeceo al ir hacia arriba", -48, @@ -35,7 +35,7 @@ public class InfiniteElytra extends Module { 1 )); - public NumberSetting pitchDownSpeed = sgGeneral.add(new NumberSetting( + private final NumberSetting pitchDownSpeed = sgGeneral.add(new NumberSetting( "velocidad de cabeceo (abajo)", "velocidad del cabeceo al ir hacia abajo", 0.5, @@ -44,7 +44,7 @@ public class InfiniteElytra extends Module { 0.1 )); - public NumberSetting pitchUpVelocity = sgGeneral.add(new NumberSetting( + private final NumberSetting pitchUpVelocity = sgGeneral.add(new NumberSetting( "velocidad de cabeceo (arriba)", "velocidad del cabeceo al ir hacia arriba", 2, @@ -53,7 +53,7 @@ public class InfiniteElytra extends Module { 0.1 )); - public NumberSetting ticksCollisionLookAhead = sgGeneral.add(new NumberSetting( + private final NumberSetting ticksCollisionLookAhead = sgGeneral.add(new NumberSetting( "precaución de colisión", "precaución de colisión en ticks", 10, @@ -102,7 +102,7 @@ public class InfiniteElytra extends Module { } @SubscribeEvent - public void onUseItem(UseItemEvent event) { + private void onUseItem(UseItemEvent event) { if (mc.player == null) return; if (mc.player.getStackInHand(event.getHand()).getItem() == Items.FIREWORK_ROCKET && !mc.player.isSpectator() && mc.player.isGliding()) { pitch = pitchUp.getFloatValue(); @@ -125,7 +125,7 @@ public class InfiniteElytra extends Module { return false; } - public enum FlyState { + private enum FlyState { NOT_FLYING, GLIDING_DOWN, PITCHING_DOWN; diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/Jesus.java b/src/main/java/me/retucio/sputnik/module/modules/movement/Jesus.java index 49e2dcd..d7b7603 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/Jesus.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/Jesus.java @@ -1,14 +1,13 @@ package me.retucio.sputnik.module.modules.movement; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.BlockShapeEvent; +import me.retucio.sputnik.event.events.interact.BlockShapeEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; import me.retucio.sputnik.module.setting.settings.BooleanSetting; import me.retucio.sputnik.module.setting.settings.EnumSetting; import me.retucio.sputnik.module.setting.settings.NumberSetting; -import me.retucio.sputnik.util.ChatUtil; import net.minecraft.block.Blocks; import net.minecraft.entity.Entity; import net.minecraft.fluid.FluidState; @@ -18,22 +17,22 @@ import net.minecraft.util.shape.VoxelShapes; public class Jesus extends Module { - SettingGroup sgBlocks = addSg(new SettingGroup("bloques", true)); + private final SettingGroup sgBlocks = addSg(new SettingGroup("bloques", true)); - public EnumSetting mode = sgGeneral.add(new EnumSetting<>( + private final EnumSetting mode = sgGeneral.add(new EnumSetting<>( "modo", "cómo caminar", JesusMode.class, JesusMode.SOLID )); - public BooleanSetting allowSneaking = sgGeneral.add(new BooleanSetting( + private final BooleanSetting allowSneaking = sgGeneral.add(new BooleanSetting( "permitir agacharse", "te permite usar el botón de agacharse para sumergirte en el agua", true )); - public NumberSetting minFallHeight = sgGeneral.add(new NumberSetting( + private final NumberSetting minFallHeight = sgGeneral.add(new NumberSetting( "distancia de caída", "distancia de caída mínima para sumergirse en vez de impactar", 3, @@ -42,19 +41,19 @@ public class Jesus extends Module { 0.1 )); - public BooleanSetting water = sgBlocks.add(new BooleanSetting( + private final BooleanSetting water = sgBlocks.add(new BooleanSetting( "agua", "permitir caminar en agua", true )); - public BooleanSetting lava = sgBlocks.add(new BooleanSetting( + private final BooleanSetting lava = sgBlocks.add(new BooleanSetting( "lava", "permitir caminar en lava", true )); - public BooleanSetting powderedSnow = sgBlocks.add(new BooleanSetting( + private final BooleanSetting powderedSnow = sgBlocks.add(new BooleanSetting( "nieve en polvo", "permitir caminar en nieve en polvo", true @@ -98,7 +97,7 @@ public class Jesus extends Module { } @SubscribeEvent - public void onBlockShape(BlockShapeEvent event) { + private void onBlockShape(BlockShapeEvent event) { if (event.getState().getBlock() == Blocks.LAVA && !lava.getValue()) return; if (event.getState().getBlock() == Blocks.WATER && !water.getValue()) return; if (event.getState().getBlock() == Blocks.POWDER_SNOW && !powderedSnow.getValue()) return; @@ -122,7 +121,7 @@ public class Jesus extends Module { return !state.isEmpty() && pos.y - blockPos.getY() <= state.getHeight(); } - public enum JesusMode { + private enum JesusMode { VIBRATE("vibrador"), SOLID("sólido"); diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/ReverseStep.java b/src/main/java/me/retucio/sputnik/module/modules/movement/ReverseStep.java index 68c3fba..bd14939 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/ReverseStep.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/ReverseStep.java @@ -11,22 +11,22 @@ import net.minecraft.world.RaycastContext; public class ReverseStep extends Module { - public NumberSetting height = sgGeneral.add(new NumberSetting( + private final NumberSetting height = sgGeneral.add(new NumberSetting( "altura", "altura máxima a bajar", 1, 0, 20, 0.1 )); - public NumberSetting velocity = sgGeneral.add(new NumberSetting( - "velocidad", "velocidad a la que caer en bps", + private final NumberSetting velocity = sgGeneral.add(new NumberSetting( + "velocidad", "velocidad a la que caer", 1, 0, 10, 0.1 )); - public BooleanSetting jumping = sgGeneral.add(new BooleanSetting( + private final BooleanSetting jumping = sgGeneral.add(new BooleanSetting( "saltar", "permitir saltar", true )); - public BooleanSetting disableInWater = sgGeneral.add(new BooleanSetting( + private final BooleanSetting disableInWater = sgGeneral.add(new BooleanSetting( "desactivar en agua", ".", true )); @@ -52,7 +52,8 @@ public class ReverseStep extends Module { double dropHeight = getHeight(); if (dropHeight > 0 && dropHeight <= height.getValue()) { - mc.player.addVelocity(0, -height.getValue() + mc.player.getVelocity().getY(), 0); + double dy = (-height.getValue() + mc.player.getVelocity().getY()) * velocity.getValue(); + mc.player.addVelocity(0, dy, 0); } } diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/SafeWalk.java b/src/main/java/me/retucio/sputnik/module/modules/movement/SafeWalk.java index fcd39b3..68cd8eb 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/SafeWalk.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/SafeWalk.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.movement; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.ClipAtLedgeEvent; +import me.retucio.sputnik.event.events.interact.ClipAtLedgeEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.settings.NumberSetting; @@ -13,7 +13,7 @@ import net.minecraft.world.RaycastContext; public class SafeWalk extends Module { - public NumberSetting fallDistance = sgGeneral.add(new NumberSetting("distancia de caída", "distancia de caída máxima permitida", 1, 0, 10, 0.1)); + private final NumberSetting fallDistance = sgGeneral.add(new NumberSetting("distancia de caída", "distancia de caída máxima permitida", 1, 0, 10, 0.1)); public SafeWalk() { super("muletas", @@ -22,7 +22,7 @@ public class SafeWalk extends Module { } @SubscribeEvent - public void onClipAtLedge(ClipAtLedgeEvent event) { + private void onClipAtLedge(ClipAtLedgeEvent event) { if (mc.player == null || mc.world == null) return; if (fallDistance.getValue() > 1) { diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/Slippy.java b/src/main/java/me/retucio/sputnik/module/modules/movement/Slippy.java index ad96147..8d935b3 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/Slippy.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/Slippy.java @@ -12,7 +12,7 @@ import java.util.Map; public class Slippy extends Module { - public NumberSetting slipperiness = sgGeneral.add(new NumberSetting( + private final NumberSetting slipperiness = sgGeneral.add(new NumberSetting( "cantidad de semen", "cuánto semen agregar a los bloques por los que pasas", 1, diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/Step.java b/src/main/java/me/retucio/sputnik/module/modules/movement/Step.java index 7572406..713cc05 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/Step.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/Step.java @@ -6,7 +6,7 @@ import me.retucio.sputnik.module.setting.settings.NumberSetting; public class Step extends Module { - public NumberSetting height = sgGeneral.add(new NumberSetting( + public final NumberSetting height = sgGeneral.add(new NumberSetting( "altura", "altura máxima a subir", 1, 0, 3, 0.1 )); diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/TridentBoost.java b/src/main/java/me/retucio/sputnik/module/modules/movement/TridentBoost.java index 0a2daa3..45764d7 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/TridentBoost.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/TridentBoost.java @@ -7,7 +7,7 @@ import me.retucio.sputnik.module.setting.settings.NumberSetting; public class TridentBoost extends Module { - public NumberSetting multiplier = sgGeneral.add(new NumberSetting( + public final NumberSetting multiplier = sgGeneral.add(new NumberSetting( "boost", "multiplicador del movimiento", 2, @@ -16,7 +16,7 @@ public class TridentBoost extends Module { 0.1 )); - public BooleanSetting outOfWater = sgGeneral.add(new BooleanSetting( + public final BooleanSetting outOfWater = sgGeneral.add(new BooleanSetting( "fuera del agua", "permitir el uso de la propulsión acuática fuera del agua", true diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/UIMove.java b/src/main/java/me/retucio/sputnik/module/modules/movement/UIMove.java similarity index 97% rename from src/main/java/me/retucio/sputnik/module/modules/player/UIMove.java rename to src/main/java/me/retucio/sputnik/module/modules/movement/UIMove.java index de6cf0e..70978c8 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/player/UIMove.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/UIMove.java @@ -1,4 +1,4 @@ -package me.retucio.sputnik.module.modules.player; +package me.retucio.sputnik.module.modules.movement; import me.retucio.sputnik.mixin.accessor.KeyBindingAccessor; import me.retucio.sputnik.module.Category; @@ -32,7 +32,7 @@ public class UIMove extends Module { public UIMove() { super("moverse en interfaz", "te permite seguir usando las teclas de movimiento aún estando en ciertas interfaces", - Category.PLAYER); + Category.MOVEMENT); screens.addOption(inventoryHandlerType, true, "inventario"); screens.addOption(clickGuiHandlerType, true, "interfaz del mod"); diff --git a/src/main/java/me/retucio/sputnik/module/modules/network/BungeecordSpoofer.java b/src/main/java/me/retucio/sputnik/module/modules/network/BungeecordSpoofer.java index ce085d1..fec3698 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/network/BungeecordSpoofer.java +++ b/src/main/java/me/retucio/sputnik/module/modules/network/BungeecordSpoofer.java @@ -7,7 +7,7 @@ import me.retucio.sputnik.util.ChatUtil; public class BungeecordSpoofer extends Module { - public StringSetting address = sgGeneral.add(new StringSetting("dirección", "la dirección IP que será enviada al server", "127.0.0.1", 15)); + public final StringSetting address = sgGeneral.add(new StringSetting("dirección", "la dirección IP que será enviada al server", "127.0.0.1", 15)); public BungeecordSpoofer() { super("spoofer de bungeecord", diff --git a/src/main/java/me/retucio/sputnik/module/modules/network/LogoutSpots.java b/src/main/java/me/retucio/sputnik/module/modules/network/LogoutSpots.java index 0dd25bb..5acb235 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/network/LogoutSpots.java +++ b/src/main/java/me/retucio/sputnik/module/modules/network/LogoutSpots.java @@ -1,8 +1,8 @@ package me.retucio.sputnik.module.modules.network; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.AddEntityEvent; -import me.retucio.sputnik.event.events.Render3DEvent; +import me.retucio.sputnik.event.events.network.AddEntityEvent; +import me.retucio.sputnik.event.events.render.Render3DEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.ModuleManager; @@ -32,20 +32,20 @@ import java.util.UUID; // lógica sutilmente robada de MeteorClient porque la mía era una mierda public class LogoutSpots extends Module { - SettingGroup sgOutlines = addSg(new SettingGroup("contorno", true)); - SettingGroup sgFilling = addSg(new SettingGroup("relleno", true)); - SettingGroup sgMisc = addSg(new SettingGroup("misc.", true)); + private final SettingGroup sgOutlines = addSg(new SettingGroup("contorno", true)); + private final SettingGroup sgFilling = addSg(new SettingGroup("relleno", true)); + private final SettingGroup sgMisc = addSg(new SettingGroup("misc.", true)); - public BooleanSetting outlines = sgOutlines.add(new BooleanSetting("contorno", "renderizar contorno de la caja (lados)", true)); - public ColorSetting outlineColor = sgOutlines.add(new ColorSetting("color del contorno", "Color de las líneas", new Color(255, 0, 0, 230), false)); - public NumberSetting lineWidth = sgOutlines.add(new NumberSetting("grosor de línea", "grosor de las líneas del contorno", 1.5, 0.5, 5, 0.1)); + private final BooleanSetting outlines = sgOutlines.add(new BooleanSetting("contorno", "renderizar contorno de la caja (lados)", true)); + private final ColorSetting outlineColor = sgOutlines.add(new ColorSetting("color del contorno", "Color de las líneas", new Color(255, 0, 0, 230), false)); + private final NumberSetting lineWidth = sgOutlines.add(new NumberSetting("grosor de línea", "grosor de las líneas del contorno", 1.5, 0.5, 5, 0.1)); - public BooleanSetting filling = sgFilling.add(new BooleanSetting("relleno", "renderizar relleno de la caja (caras)", true)); - public ColorSetting fillingColor = sgFilling.add(new ColorSetting("color del relleno", "Color de los lados", new Color(230, 0, 0, 55), false)); + private final BooleanSetting filling = sgFilling.add(new BooleanSetting("relleno", "renderizar relleno de la caja (caras)", true)); + private final ColorSetting fillingColor = sgFilling.add(new ColorSetting("color del relleno", "Color de los lados", new Color(230, 0, 0, 55), false)); - public BooleanSetting fullHeight = sgMisc.add(new BooleanSetting("hitbox completa", "renderizar la caja completa de la hitbox, o solo marcar la posición", true)); + private final BooleanSetting fullHeight = sgMisc.add(new BooleanSetting("hitbox completa", "renderizar la caja completa de la hitbox, o solo marcar la posición", true)); - public BooleanSetting dummy = sgMisc.add(new BooleanSetting("monigote", "spawnear un monigote para marcar la posición", true)); + private final BooleanSetting dummy = sgMisc.add(new BooleanSetting("monigote", "spawnear un monigote para marcar la posición", true)); private final List players = new ArrayList<>(); private final List lastPlayerList = new ArrayList<>(); @@ -152,7 +152,7 @@ public class LogoutSpots extends Module { } @SubscribeEvent - public void onEntityAdded(AddEntityEvent event) { + private void onEntityAdded(AddEntityEvent event) { if (event.getEntity() instanceof PlayerEntity player) { for (LogoutEntry entry : players) { if (entry.uuid.equals(player.getUuid())) { @@ -170,7 +170,7 @@ public class LogoutSpots extends Module { } @SubscribeEvent - public void onWorldRender(Render3DEvent event) { + private void onWorldRender(Render3DEvent event) { if (mc.player == null || mc.world == null) return; for (LogoutEntry entry : players) diff --git a/src/main/java/me/retucio/sputnik/module/modules/network/PacketDelay.java b/src/main/java/me/retucio/sputnik/module/modules/network/PacketDelay.java index 57d36c8..4be3d16 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/network/PacketDelay.java +++ b/src/main/java/me/retucio/sputnik/module/modules/network/PacketDelay.java @@ -1,8 +1,8 @@ package me.retucio.sputnik.module.modules.network; -import me.retucio.sputnik.event.events.JoinWorldEvent; +import me.retucio.sputnik.event.events.network.JoinWorldEvent; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.PacketEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.settings.EnumSetting; @@ -22,10 +22,10 @@ import java.util.concurrent.CopyOnWriteArrayList; public class PacketDelay extends Module { - public NumberSetting delay = sgGeneral.add(new NumberSetting("delay", "delay a añadir a los paquetes, en milisegundos", 1500, 0, 3000, 5)); - public EnumSetting directions = sgGeneral.add(new EnumSetting<>("dirección", "dirección de los paquetes a los que añadir delay", + private final NumberSetting delay = sgGeneral.add(new NumberSetting("delay", "delay a añadir a los paquetes, en milisegundos", 1500, 0, 3000, 5)); + private final EnumSetting directions = sgGeneral.add(new EnumSetting<>("dirección", "dirección de los paquetes a los que añadir delay", Directions.class, Directions.BOTH)); - public EnumSetting packets = sgGeneral.add(new EnumSetting<>("paquetes", "paquetes a los que aplicar el delay", + private final EnumSetting packets = sgGeneral.add(new EnumSetting<>("paquetes", "paquetes a los que aplicar el delay", Packets.class, Packets.ALL)); private final List delayedPackets = new CopyOnWriteArrayList<>(); @@ -69,7 +69,7 @@ public class PacketDelay extends Module { } @SubscribeEvent - public void onPacketSend(PacketEvent.Send event) { + private 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))) @@ -86,7 +86,7 @@ public class PacketDelay extends Module { } @SubscribeEvent - public void onPacketReceive(PacketEvent.Receive event) { + private 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))) @@ -105,7 +105,7 @@ public class PacketDelay extends Module { } @SubscribeEvent - public void onJoinWorld(JoinWorldEvent event) { + private void onJoinWorld(JoinWorldEvent event) { ChatUtil.error("delay de paquetes no funciona en un solo jugador"); toggle(); } @@ -126,7 +126,7 @@ public class PacketDelay extends Module { private record DelayedPacket(Packet packet, long scheduledTime, boolean isOutgoing, PacketListener packetListener) {} - public enum Directions { + private enum Directions { C2S("cliente a server"), S2C("server a cliente"), BOTH("ambos"); @@ -136,7 +136,7 @@ public class PacketDelay extends Module { @Override public String toString() { return name; } } - public enum Packets { + private enum Packets { KEEP_ALIVE("paquetes KeepAlive"), OTHERS("todos menos KeepAlive"), ALL("todos"); diff --git a/src/main/java/me/retucio/sputnik/module/modules/network/PacketMine.java b/src/main/java/me/retucio/sputnik/module/modules/network/PacketMine.java index bf51503..10087f9 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/network/PacketMine.java +++ b/src/main/java/me/retucio/sputnik/module/modules/network/PacketMine.java @@ -1,8 +1,8 @@ package me.retucio.sputnik.module.modules.network; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.AttackBlockEvent; -import me.retucio.sputnik.event.events.Render3DEvent; +import me.retucio.sputnik.event.events.interact.AttackBlockEvent; +import me.retucio.sputnik.event.events.render.Render3DEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; @@ -22,9 +22,9 @@ import java.util.List; public class PacketMine extends Module { - SettingGroup sgRender = addSg(new SettingGroup("renderizado", true)); + private final SettingGroup sgRender = addSg(new SettingGroup("renderizado", true)); - public NumberSetting retryTime = sgGeneral.add(new NumberSetting( + private final NumberSetting retryTime = sgGeneral.add(new NumberSetting( "delay", "delay entre reintentos de minado", 30, @@ -33,26 +33,26 @@ public class PacketMine extends Module { 1 )); - public BooleanSetting cancelOutOfReach = sgGeneral.add(new BooleanSetting( + private final BooleanSetting cancelOutOfReach = sgGeneral.add(new BooleanSetting( "cancelar fuera de alcance", "cancelar aquellos paquetes que intenten romper bloques fuera del alcance del jugador, para evitar flaggear el anticheat", true )); - public BooleanSetting render = sgRender.add(new BooleanSetting( + private final BooleanSetting render = sgRender.add(new BooleanSetting( "renderizar", "renderizar un contorno alrededor de los bloques que están siendo minados", true )); - public ColorSetting color = sgRender.add(new ColorSetting( + private final ColorSetting color = sgRender.add(new ColorSetting( "color", "color del contorno renderizado", new Color(0, 255, 0, 100), false )); - public NumberSetting lineWidth = sgRender.add(new NumberSetting( + private final NumberSetting lineWidth = sgRender.add(new NumberSetting( "grosor", "grosor de las líneas del contorno", 2, @@ -105,7 +105,7 @@ public class PacketMine extends Module { } @SubscribeEvent - public void onAttackBlock(AttackBlockEvent event) { + private void onAttackBlock(AttackBlockEvent event) { event.cancel(); if (!isMining(event.getPos())) { miningBlocks.add(new MiningBlock(event)); @@ -113,7 +113,7 @@ public class PacketMine extends Module { } @SubscribeEvent - public void onRenderWorld(Render3DEvent event) { + private void onRenderWorld(Render3DEvent event) { for (MiningBlock block : miningBlocks) { block.render(event); } diff --git a/src/main/java/me/retucio/sputnik/module/modules/network/RPackBypass.java b/src/main/java/me/retucio/sputnik/module/modules/network/RPackBypass.java index 230ff21..0454255 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/network/RPackBypass.java +++ b/src/main/java/me/retucio/sputnik/module/modules/network/RPackBypass.java @@ -14,6 +14,7 @@ import net.minecraft.text.Text; * @see me.retucio.sputnik.mixin.ServerInfoMixin */ +// https://github.com/emilyy-dev/bypass-resource-pack public class RPackBypass extends Module { public String TAG_NAME = "bypassTextures"; diff --git a/src/main/java/me/retucio/sputnik/module/modules/network/Reconnect.java b/src/main/java/me/retucio/sputnik/module/modules/network/Reconnect.java index 9484bb3..9a9d8cb 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/network/Reconnect.java +++ b/src/main/java/me/retucio/sputnik/module/modules/network/Reconnect.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.network; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.DisconnectEvent; +import me.retucio.sputnik.event.events.network.DisconnectEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import net.minecraft.client.gui.screen.multiplayer.ConnectScreen; @@ -19,7 +19,7 @@ public class Reconnect extends Module { } @SubscribeEvent - public void onDisconnect(DisconnectEvent event) { + private void onDisconnect(DisconnectEvent event) { lastServer = event.getServer(); } diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/AirPlace.java b/src/main/java/me/retucio/sputnik/module/modules/player/AirPlace.java new file mode 100644 index 0000000..791d0d0 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/player/AirPlace.java @@ -0,0 +1,147 @@ +package me.retucio.sputnik.module.modules.player; + +import me.retucio.sputnik.event.SubscribeEvent; +import me.retucio.sputnik.event.events.input.KeyEvent; +import me.retucio.sputnik.event.events.input.MouseScrollEvent; +import me.retucio.sputnik.event.events.render.Render3DEvent; +import me.retucio.sputnik.event.events.interact.UseItemEvent; +import me.retucio.sputnik.module.Category; +import me.retucio.sputnik.module.Module; +import me.retucio.sputnik.module.setting.SettingGroup; +import me.retucio.sputnik.module.setting.settings.BooleanSetting; +import me.retucio.sputnik.module.setting.settings.ColorSetting; +import me.retucio.sputnik.module.setting.settings.KeySetting; +import me.retucio.sputnik.module.setting.settings.NumberSetting; +import me.retucio.sputnik.util.Colors; +import me.retucio.sputnik.util.NetworkUtil; +import me.retucio.sputnik.util.render.RenderUtil; + +import net.minecraft.item.BlockItem; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.Vec3d; + +import org.lwjgl.glfw.GLFW; + + +public class AirPlace extends Module { + + private final SettingGroup sgScroll = addSg(new SettingGroup("scrolleo", true)); + private final SettingGroup sgRender = addSg(new SettingGroup("render", true)); + + + // general + private final NumberSetting range = sgGeneral.add(new NumberSetting( + "rango", + "distancia a la que colocar el bloque", + 1, + 4, + 4, + 1 + )); + + // scroll + private final KeySetting scrollKey = sgScroll.add(new KeySetting( + "tecla del scroll", + "tecla a mantener para que el scroll funcione", + GLFW.GLFW_KEY_LEFT_CONTROL + )); + + private final NumberSetting scrollSens = sgScroll.add(new NumberSetting( + "sens. del scroll", + "sensibilidad de la rueda del scroll (0 para desactivar)", + 1, + 0, + 5, + 0.1 + )); + + // render + private final BooleanSetting outlines = sgRender.add(new BooleanSetting( + "contorno", + "renderizar contorno de la caja de prev.", + true + )); + + private final ColorSetting outlineColor = sgRender.add(new ColorSetting( + "color del contorno", + "color a utilizar al dibujar el contorno", + Colors.withAlpha(Colors.mainColor, 150), + false + )); + + private final NumberSetting lineWidth = sgRender.add(new NumberSetting( + "grosor de línea", + "grosor de las líneas del contorno", + 1, + 0.1, + 5, + 0.1 + )); + + private final BooleanSetting filling = sgRender.add(new BooleanSetting( + "relleno", + "renderizar relleno de la caja de prev.", + true + )); + + private final ColorSetting fillingColor = sgRender.add(new ColorSetting( + "color del relleno", + "color a utilizar al dibujar el relleno", + Colors.withAlpha(Colors.mainColor.brighter(), 100), + false + )); + + private HitResult result; + private Integer rangeValue = null; + + public AirPlace() { + super("colocar en aire", "te permite colocar bloques en el aire", Category.PLAYER); + } + + @Override + public void onTick() { + if (rangeValue == null) rangeValue = range.getIntValue(); + if (mc.player == null || mc.world == null || mc.interactionManager == null || mc.getCameraEntity() == null) return; + result = mc.getCameraEntity().raycast(rangeValue, 0, false); + } + + @SubscribeEvent + private void onUseItem(UseItemEvent event) { + if (!(result instanceof BlockHitResult bhr) || !(event.getStack().getItem() instanceof BlockItem)) return; + Vec3d hitPos = Vec3d.ofCenter(bhr.getBlockPos()); + + BlockHitResult result = new BlockHitResult( + hitPos, mc.player.getMovementDirection().getOpposite(), bhr.getBlockPos(), false); + if (mc.player.canPlaceOn(bhr.getBlockPos(), bhr.getSide().getOpposite(), event.getStack()) && range.isValid(rangeValue)) + NetworkUtil.interactBlock(result, event.getHand(), true); + } + + @SubscribeEvent + private void onMouseScroll(MouseScrollEvent event) { + if (!scrollKey.isDown()) return; + rangeValue += (int) Math.round((event.getVertical() * scrollSens.getValue())); + event.cancel(); + } + + @SubscribeEvent + private void onKey(KeyEvent event) { + if (event.getKey() == scrollKey.getValue() && event.getAction() == GLFW.GLFW_RELEASE) { + rangeValue = (int) Math.clamp(rangeValue, range.getMin(), range.getMax()); + } + } + + @SubscribeEvent + private void onRenderWorld(Render3DEvent event) { + if (!(result instanceof BlockHitResult bhr) + || (mc.crosshairTarget != null + && mc.crosshairTarget.getType() != HitResult.Type.MISS) + || !mc.world.getBlockState(bhr.getBlockPos()).isReplaceable()) + return; + + if (outlines.getValue()) + RenderUtil.drawBlockOutline(event.getMatrices(), bhr.getBlockPos(), outlineColor.getValue(), lineWidth.getFloatValue(), false); + if (filling.getValue()) + RenderUtil.drawBlockFilled(event.getMatrices(), bhr.getBlockPos(), fillingColor.getValue(), false); + } +} diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/AntiHunger.java b/src/main/java/me/retucio/sputnik/module/modules/player/AntiHunger.java new file mode 100644 index 0000000..f508bb8 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/player/AntiHunger.java @@ -0,0 +1,44 @@ +package me.retucio.sputnik.module.modules.player; + +import me.retucio.sputnik.event.SubscribeEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; +import me.retucio.sputnik.module.Category; +import me.retucio.sputnik.module.Module; +import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; + +public class AntiHunger extends Module { + + public AntiHunger() { + super("anti hambre", "previene el hambre, haciéndole creer al server que nunca corres", Category.PLAYER); + } + + @SubscribeEvent + private void onPacketSend(PacketEvent.Send event) { + if (mc.player == null) return; + if (mc.player.hasVehicle() || mc.player.isTouchingWater() || mc.player.isSubmergedInWater()) return; + + if (event.getPacket() instanceof ClientCommandC2SPacket packet) { + if (packet.getMode() == ClientCommandC2SPacket.Mode.START_SPRINTING) { + event.cancel(); + if (mc.player.isGliding()) { + mc.player.stopGliding(); + } + } + } + + if (event.getPacket() instanceof PlayerMoveC2SPacket packet + && packet.isOnGround() + && mc.player.fallDistance <= 0 + && !mc.interactionManager.isBreakingBlock()) { + event.cancel(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.Full( + mc.player.getEntityPos(), + mc.player.getYaw(), + mc.player.getPitch(), + false, + mc.player.horizontalCollision + )); + } + } +} diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/AutoFish.java b/src/main/java/me/retucio/sputnik/module/modules/player/AutoFish.java new file mode 100644 index 0000000..a3e97ea --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/player/AutoFish.java @@ -0,0 +1,122 @@ +package me.retucio.sputnik.module.modules.player; + +import me.retucio.sputnik.mixin.accessor.FishingBobberEntityAccessor; +import me.retucio.sputnik.module.Category; +import me.retucio.sputnik.module.Module; +import me.retucio.sputnik.module.setting.SettingGroup; +import me.retucio.sputnik.module.setting.settings.BooleanSetting; +import me.retucio.sputnik.module.setting.settings.NumberSetting; +import me.retucio.sputnik.util.InventoryUtil; +import net.minecraft.block.Blocks; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.item.Items; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult; + +import java.util.List; + +// todo: catch delay, seleccionar la mejor caña, evitar romper la caña +public class AutoFish extends Module { + + private final SettingGroup sgRecast = addSg(new SettingGroup("recast", true)); + + private final BooleanSetting autoRecast = sgRecast.add(new BooleanSetting( + "recast", + "relanzar la caña automáticamente al pescar algo", + true + )); + + + private final NumberSetting recastDelay = sgRecast.add(new NumberSetting( + "delay ", + "delay entre que se pesca un pez y se vuelve a lanzar la caña", + 5, + 0, + 20, + 1 + )); + + + private final BooleanSetting onlyRecastIfLookingAtWater = sgRecast.add(new BooleanSetting( + "solo si mirando al agua", + "solamente hacer recast si se está mirando al agua", + true + )); + + private final NumberSetting recastRaycastDistance = sgRecast.add(new NumberSetting( + "distancia del agua", + "distancia máxima a la que puede estar el agua al que estás mirando", + 10, + 0, + 64, + 1 + )); + + private int delay = -1; + private boolean shouldRecast; + + public AutoFish() { + super("auto pesca", "pesca por ti", Category.PLAYER); + autoRecast.onUpdate(v -> { + recastDelay.setVisible(v); + onlyRecastIfLookingAtWater.setVisible(v); + recastRaycastDistance.setVisible(v); + }); + + onlyRecastIfLookingAtWater.onUpdate(v -> recastRaycastDistance.setVisible(v)); + } + + @Override + public void onTick() { + if (mc.player == null || mc.getCameraEntity() == null) return; + + if (delay >= 0) delay++; + + if (mc.player.isHolding(Items.FISHING_ROD) && mc.player.fishHook == null && autoRecast.getValue()) { + HitResult result = mc.getCameraEntity().raycast(recastRaycastDistance.getIntValue(), 0, true); + + if (onlyRecastIfLookingAtWater.getValue()) { + if (result instanceof BlockHitResult bhr && bhr.getType().equals(HitResult.Type.BLOCK)) { + if (mc.world.getBlockState(bhr.getBlockPos()).isOf(Blocks.WATER) && delay >= recastDelay.getIntValue()) { + useFishingRod(); + return; + } + } + } else { + useFishingRod(); + return; + } + } + + if (mc.player.fishHook == null) { + if (delay >= recastDelay.getIntValue() && shouldRecast) { + useFishingRod(); + } + return; + } + + FishingBobberEntityAccessor fishHook = (FishingBobberEntityAccessor) mc.player.fishHook; + + if (fishHook.caughtFish()) { + useFishingRod(); + } + } + + private void useFishingRod() { + switchToFishingRod(); + mc.doItemUse(); + delay = 0; + shouldRecast = false; + } + + private void switchToFishingRod() { + if (mc.player.getActiveItem().isOf(Items.FISHING_ROD)) return; + List slots = InventoryUtil.findItem(Items.FISHING_ROD); + for (int slot : slots) { + if (PlayerInventory.isValidHotbarIndex(slot)) { + mc.player.getInventory().setSelectedSlot(slot); + return; + } + } + } +} \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/FastUse.java b/src/main/java/me/retucio/sputnik/module/modules/player/FastUse.java index e59c2f8..4556524 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/player/FastUse.java +++ b/src/main/java/me/retucio/sputnik/module/modules/player/FastUse.java @@ -10,13 +10,13 @@ import org.lwjgl.glfw.GLFW; public class FastUse extends Module { - public BooleanSetting items = sgGeneral.add(new BooleanSetting( + private final BooleanSetting items = sgGeneral.add(new BooleanSetting( "items", "usar items precozmente", true )); - public NumberSetting itemCooldown = sgGeneral.add(new NumberSetting( + private final NumberSetting itemCooldown = sgGeneral.add(new NumberSetting( "cooldown de items", "cooldown para usar items en ticks", 0, @@ -26,13 +26,13 @@ public class FastUse extends Module { )); - public BooleanSetting blocks = sgGeneral.add(new BooleanSetting( + private final BooleanSetting blocks = sgGeneral.add(new BooleanSetting( "bloques", "colocar bloques precozmente", true )); - public NumberSetting blockCooldown = sgGeneral.add(new NumberSetting( + private final NumberSetting blockCooldown = sgGeneral.add(new NumberSetting( "cooldown de bloques", "cooldown para colocar bloques en ticks", 0, @@ -42,13 +42,13 @@ public class FastUse extends Module { )); - public BooleanSetting mining = sgGeneral.add(new BooleanSetting( + public final BooleanSetting mining = sgGeneral.add(new BooleanSetting( "minar", "minar precozmente", true )); - public NumberSetting miningCooldown = sgGeneral.add(new NumberSetting( + public final NumberSetting miningCooldown = sgGeneral.add(new NumberSetting( "cooldown al minar", "cooldown entre rotura de bloques en ticks", 5, 0, 20, 1 diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/HandView.java b/src/main/java/me/retucio/sputnik/module/modules/player/HandView.java index 0d0b950..16006d5 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/player/HandView.java +++ b/src/main/java/me/retucio/sputnik/module/modules/player/HandView.java @@ -1,17 +1,16 @@ package me.retucio.sputnik.module.modules.player; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.RenderHeldItemEvent; -import me.retucio.sputnik.event.events.RenderArmEvent; +import me.retucio.sputnik.event.events.render.RenderHeldItemEvent; +import me.retucio.sputnik.event.events.render.RenderArmEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; import me.retucio.sputnik.module.setting.settings.BooleanSetting; import me.retucio.sputnik.module.setting.settings.NumberSetting; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Hand; import net.minecraft.util.math.RotationAxis; -import org.joml.Vector3d; +import net.minecraft.util.math.Vec3d; /** continúa en: * @see me.retucio.sputnik.mixin.HeldItemRendererMixin @@ -19,80 +18,80 @@ import org.joml.Vector3d; public class HandView extends Module { - SettingGroup sgAnimations = addSg(new SettingGroup("animaciones", false)); - SettingGroup sgMainHand = addSg(new SettingGroup("mano principal", false)); - SettingGroup sgOffhand = addSg(new SettingGroup("mano secundaria", false)); - SettingGroup sgArm = addSg(new SettingGroup("brazo", false)); + private final SettingGroup sgAnimations = addSg(new SettingGroup("animaciones", false)); + private final SettingGroup sgMainHand = addSg(new SettingGroup("mano principal", false)); + private final SettingGroup sgOffhand = addSg(new SettingGroup("mano secundaria", false)); + private final SettingGroup sgArm = addSg(new SettingGroup("brazo", false)); // ajustes de animaciones - public BooleanSetting oldAnimations = sgAnimations.add(new BooleanSetting("animaciones viejas", "como las de la 1.8, al pegar", false)); - public BooleanSetting skipSwapping = sgAnimations.add(new BooleanSetting("no swap", "se salta la animación de cambiar items de mano", false)); - public BooleanSetting noFood = sgAnimations.add(new BooleanSetting("no comer", "no renderiza la animación de comer", false)); + public final BooleanSetting oldAnimations = sgAnimations.add(new BooleanSetting("animaciones viejas", "como las de la 1.8, al pegar", false)); + public final BooleanSetting skipSwapping = sgAnimations.add(new BooleanSetting("no swap", "se salta la animación de cambiar items de mano", false)); + public final BooleanSetting noFood = sgAnimations.add(new BooleanSetting("no comer", "no renderiza la animación de comer", false)); // ajustes de mano principal - public NumberSetting scaleMainX = sgMainHand.add(new NumberSetting("escala de la mano principal (X)", ".", + private final NumberSetting scaleMainX = sgMainHand.add(new NumberSetting("escala de la mano principal (X)", ".", 1, 0.01, 5, 0.1)); - public NumberSetting scaleMainY = sgMainHand.add(new NumberSetting("escala de la mano principal (Y)", ".", + private final NumberSetting scaleMainY = sgMainHand.add(new NumberSetting("escala de la mano principal (Y)", ".", 1, 0.01, 5, 0.1)); - public NumberSetting scaleMainZ = sgMainHand.add(new NumberSetting("escala de la mano principal (Z)", ".", + private final NumberSetting scaleMainZ = sgMainHand.add(new NumberSetting("escala de la mano principal (Z)", ".", 1, 0.01, 5, 0.1)); - public NumberSetting posMainX = sgMainHand.add(new NumberSetting("posición de la mano principal (X)", ".", + private final NumberSetting posMainX = sgMainHand.add(new NumberSetting("posición de la mano principal (X)", ".", 0, -3, 3, 0.1)); - public NumberSetting posMainY = sgMainHand.add(new NumberSetting("posición de la mano principal (Y)", ".", + private final NumberSetting posMainY = sgMainHand.add(new NumberSetting("posición de la mano principal (Y)", ".", 0, -3, 3, 0.1)); - public NumberSetting posMainZ = sgMainHand.add(new NumberSetting("posición de la mano principal (Z)", ".", + private final NumberSetting posMainZ = sgMainHand.add(new NumberSetting("posición de la mano principal (Z)", ".", 0, -3, 3, 0.1)); - public NumberSetting rotMainX = sgMainHand.add(new NumberSetting("rotación de la mano principal (X)", ".", + private final NumberSetting rotMainX = sgMainHand.add(new NumberSetting("rotación de la mano principal (X)", ".", 0, -180, 180, 1)); - public NumberSetting rotMainY = sgMainHand.add(new NumberSetting("rotación de la mano principal (Y)", ".", + private final NumberSetting rotMainY = sgMainHand.add(new NumberSetting("rotación de la mano principal (Y)", ".", 0, -180, 180, 1)); - public NumberSetting rotMainZ = sgMainHand.add(new NumberSetting("rotación de la mano principal (Z)", ".", + private final NumberSetting rotMainZ = sgMainHand.add(new NumberSetting("rotación de la mano principal (Z)", ".", 0, -180, 180, 1)); // ajustes de mano secundaria - public NumberSetting scaleOffX = sgOffhand.add(new NumberSetting("escala de la mano secundaria (X)", ".", + private final NumberSetting scaleOffX = sgOffhand.add(new NumberSetting("escala de la mano secundaria (X)", ".", 1, 0.01, 5, 0.1)); - public NumberSetting scaleOffY = sgOffhand.add(new NumberSetting("escala de la mano secundaria (Y)", ".", + private final NumberSetting scaleOffY = sgOffhand.add(new NumberSetting("escala de la mano secundaria (Y)", ".", 1, 0.01, 5, 0.1)); - public NumberSetting scaleOffZ = sgOffhand.add(new NumberSetting("escala de la mano secundaria (Z)", ".", + private final NumberSetting scaleOffZ = sgOffhand.add(new NumberSetting("escala de la mano secundaria (Z)", ".", 1, 0.01, 5, 0.1)); - public NumberSetting posOffX = sgOffhand.add(new NumberSetting("posición de la mano secundaria (X)", ".", + private final NumberSetting posOffX = sgOffhand.add(new NumberSetting("posición de la mano secundaria (X)", ".", 0, -3, 3, 0.1)); - public NumberSetting posOffY = sgOffhand.add(new NumberSetting("posición de la mano secundaria (Y)", ".", + private final NumberSetting posOffY = sgOffhand.add(new NumberSetting("posición de la mano secundaria (Y)", ".", 0, -3, 3, 0.1)); - public NumberSetting posOffZ = sgOffhand.add(new NumberSetting("posición de la mano secundaria (Z)", ".", + private final NumberSetting posOffZ = sgOffhand.add(new NumberSetting("posición de la mano secundaria (Z)", ".", 0, -3, 3, 0.1)); - public NumberSetting rotOffX = sgOffhand.add(new NumberSetting("rotación de la mano secundaria (X)", ".", + private final NumberSetting rotOffX = sgOffhand.add(new NumberSetting("rotación de la mano secundaria (X)", ".", 0, -180, 180, 1)); - public NumberSetting rotOffY = sgOffhand.add(new NumberSetting("rotación de la mano secundaria (Y)", ".", + private final NumberSetting rotOffY = sgOffhand.add(new NumberSetting("rotación de la mano secundaria (Y)", ".", 0, -180, 180, 1)); - public NumberSetting rotOffZ = sgOffhand.add(new NumberSetting("rotación de la mano secundaria (Z)", ".", + private final NumberSetting rotOffZ = sgOffhand.add(new NumberSetting("rotación de la mano secundaria (Z)", ".", 0, -180, 180, 1)); // brazo - public NumberSetting scaleArmX = sgArm.add(new NumberSetting("escala del brazo (X)", ".", + private final NumberSetting scaleArmX = sgArm.add(new NumberSetting("escala del brazo (X)", ".", 1, 0.01, 5, 0.1)); - public NumberSetting scaleArmY = sgArm.add(new NumberSetting("escala del brazo (Y)", ".", + private final NumberSetting scaleArmY = sgArm.add(new NumberSetting("escala del brazo (Y)", ".", 1, 0.01, 5, 0.1)); - public NumberSetting scaleArmZ = sgArm.add(new NumberSetting("escala del brazo (Z)", ".", + private final NumberSetting scaleArmZ = sgArm.add(new NumberSetting("escala del brazo (Z)", ".", 1, 0.01, 5, 0.1)); - public NumberSetting posArmX = sgArm.add(new NumberSetting("posición del brazo (X)", ".", + private final NumberSetting posArmX = sgArm.add(new NumberSetting("posición del brazo (X)", ".", 0, -3, 3, 0.1)); - public NumberSetting posArmY = sgArm.add(new NumberSetting("posición del brazo (Y)", ".", + private final NumberSetting posArmY = sgArm.add(new NumberSetting("posición del brazo (Y)", ".", 0, -3, 3, 0.1)); - public NumberSetting posArmZ = sgArm.add(new NumberSetting("posición del brazo (Z)", ".", + private final NumberSetting posArmZ = sgArm.add(new NumberSetting("posición del brazo (Z)", ".", 0, -3, 3, 0.1)); - public NumberSetting rotArmX = sgArm.add(new NumberSetting("rotación del brazo (X)", ".", + private final NumberSetting rotArmX = sgArm.add(new NumberSetting("rotación del brazo (X)", ".", 0, -180, 180, 1)); - public NumberSetting rotArmY = sgArm.add(new NumberSetting("rotación del brazo (Y)", ".", + private final NumberSetting rotArmY = sgArm.add(new NumberSetting("rotación del brazo (Y)", ".", 0, -180, 180, 1)); - public NumberSetting rotArmZ = sgArm.add(new NumberSetting("rotación del brazo (Z)", ".", + private final NumberSetting rotArmZ = sgArm.add(new NumberSetting("rotación del brazo (Z)", ".", 0, -180, 180, 1)); public HandView() { @@ -102,39 +101,39 @@ public class HandView extends Module { } @SubscribeEvent - public void onHeldItemRender(RenderHeldItemEvent event) { - if (event.getHand() == Hand.MAIN_HAND) { - scale(event.getMatrices(), new Vector3d(scaleMainX.getValue(), scaleMainY.getValue(), scaleMainZ.getValue())); - translate(event.getMatrices(), new Vector3d(posMainX.getValue(), posMainY.getValue(), posMainZ.getValue())); - rotate(event.getMatrices(), new Vector3d(rotMainX.getValue(), rotMainY.getValue(), rotMainZ.getValue())); - } - else { - scale(event.getMatrices(), new Vector3d(scaleOffX.getValue(), scaleOffY.getValue(), scaleOffZ.getValue())); - translate(event.getMatrices(), new Vector3d(posOffX.getValue(), posOffY.getValue(), posOffZ.getValue())); - rotate(event.getMatrices(), new Vector3d(rotOffX.getValue(), rotOffY.getValue(), rotOffZ.getValue())); + private void onHeldItemRender(RenderHeldItemEvent event) { + switch (event.getHand()) { + case MAIN_HAND -> { + scale(event.getMatrices(), new Vec3d(scaleMainX.getValue(), scaleMainY.getValue(), scaleMainZ.getValue())); + translate(event.getMatrices(), new Vec3d(posMainX.getValue(), posMainY.getValue(), posMainZ.getValue())); + rotate(event.getMatrices(), new Vec3d(rotMainX.getValue(), rotMainY.getValue(), rotMainZ.getValue())); + } + case OFF_HAND -> { + scale(event.getMatrices(), new Vec3d(scaleOffX.getValue(), scaleOffY.getValue(), scaleOffZ.getValue())); + translate(event.getMatrices(), new Vec3d(posOffX.getValue(), posOffY.getValue(), posOffZ.getValue())); + rotate(event.getMatrices(), new Vec3d(rotOffX.getValue(), rotOffY.getValue(), rotOffZ.getValue())); + } } } @SubscribeEvent - public void onRenderArm(RenderArmEvent event) { - scale(event.getMatrices(), new Vector3d(scaleArmX.getValue(), scaleArmY.getValue(), scaleArmZ.getValue())); - translate(event.getMatrices(), new Vector3d(posArmX.getValue(), posArmY.getValue(), posArmZ.getValue())); - rotate(event.getMatrices(), new Vector3d(rotArmX.getValue(), rotArmY.getValue(), rotArmZ.getValue())); + private void onRenderArm(RenderArmEvent event) { + scale(event.getMatrices(), new Vec3d(scaleArmX.getValue(), scaleArmY.getValue(), scaleArmZ.getValue())); + translate(event.getMatrices(), new Vec3d(posArmX.getValue(), posArmY.getValue(), posArmZ.getValue())); + rotate(event.getMatrices(), new Vec3d(rotArmX.getValue(), rotArmY.getValue(), rotArmZ.getValue())); } - private void rotate(MatrixStack matrix, Vector3d rotation) { + private void rotate(MatrixStack matrix, Vec3d rotation) { matrix.multiply(RotationAxis.POSITIVE_X.rotationDegrees((float) rotation.x)); matrix.multiply(RotationAxis.POSITIVE_Y.rotationDegrees((float) rotation.y)); matrix.multiply(RotationAxis.POSITIVE_Z.rotationDegrees((float) rotation.z)); } - private void scale(MatrixStack matrix, Vector3d scale) { + private void scale(MatrixStack matrix, Vec3d scale) { matrix.scale((float) scale.x, (float) scale.y, (float) scale.z); } - private void translate(MatrixStack matrix, Vector3d translation) { + private void translate(MatrixStack matrix, Vec3d translation) { matrix.translate((float) translation.x, (float) translation.y, (float) translation.z); } - - } diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/InventoryPlus.java b/src/main/java/me/retucio/sputnik/module/modules/player/InventoryPlus.java index b2d811e..d279d77 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/player/InventoryPlus.java +++ b/src/main/java/me/retucio/sputnik/module/modules/player/InventoryPlus.java @@ -2,8 +2,8 @@ package me.retucio.sputnik.module.modules.player; import me.retucio.sputnik.event.Event; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.KeyEvent; -import me.retucio.sputnik.event.events.MouseClickEvent; +import me.retucio.sputnik.event.events.input.KeyEvent; +import me.retucio.sputnik.event.events.input.MouseClickEvent; import me.retucio.sputnik.mixin.accessor.HandledScreenAccessor; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; @@ -16,9 +16,9 @@ import org.lwjgl.glfw.GLFW; public class InventoryPlus extends Module { - public KeySetting row1key = sgGeneral.add(new KeySetting("fila 1", "tecla para mover items a la primera fila", GLFW.GLFW_KEY_A)); - public KeySetting row2key = sgGeneral.add(new KeySetting("fila 2", "tecla para mover items a la segunda fila", GLFW.GLFW_KEY_S)); - public KeySetting row3key = sgGeneral.add(new KeySetting("fila 3", "tecla para mover items a la tercera fila", GLFW.GLFW_KEY_D)); + private final KeySetting row1key = sgGeneral.add(new KeySetting("fila 1", "tecla para mover items a la primera fila", GLFW.GLFW_KEY_A)); + private final KeySetting row2key = sgGeneral.add(new KeySetting("fila 2", "tecla para mover items a la segunda fila", GLFW.GLFW_KEY_S)); + private final KeySetting row3key = sgGeneral.add(new KeySetting("fila 3", "tecla para mover items a la tercera fila", GLFW.GLFW_KEY_D)); public InventoryPlus() { super("inventario plus", @@ -27,13 +27,13 @@ public class InventoryPlus extends Module { } @SubscribeEvent - public void onKey(KeyEvent event) { + private void onKey(KeyEvent event) { if (event.getAction() == GLFW.GLFW_RELEASE) return; processInput(event.getKey(), event); } @SubscribeEvent - public void onMouseButton(MouseClickEvent event) { + private void onMouseButton(MouseClickEvent event) { if (event.getAction() == GLFW.GLFW_RELEASE) return; processInput(event.getButton(), event); } diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/NoFall.java b/src/main/java/me/retucio/sputnik/module/modules/player/NoFall.java new file mode 100644 index 0000000..bff63f2 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/player/NoFall.java @@ -0,0 +1,118 @@ +package me.retucio.sputnik.module.modules.player; + +import me.retucio.sputnik.event.SubscribeEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; +import me.retucio.sputnik.module.Category; +import me.retucio.sputnik.module.Module; +import me.retucio.sputnik.module.setting.settings.BooleanSetting; +import me.retucio.sputnik.module.setting.settings.EnumSetting; +import me.retucio.sputnik.util.ChatUtil; +import me.retucio.sputnik.util.InventoryUtil; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult; + +// todo: implementar otros tipos de MLGs (cama, miel, slime, heno, ...) +public class NoFall extends Module { + + private boolean placed; + + private final EnumSetting mode = sgGeneral.add(new EnumSetting<>( + "modo", + "de qué manera evitar el daño de caída", + NoFallMode.class, NoFallMode.PACKET + )); + + private final BooleanSetting clutch = sgGeneral.add( new BooleanSetting( + "salvada", + "cambiar a modo paquete si no se encuentra un cubo disponible", + true + )); + + public NoFall() { + super("tobillos fuertes", "evita el daño de caída", Category.PLAYER); + } + + @Override + public void onTick() { + if (mc.player == null + || mc.world == null + || mc.getCameraEntity() == null + || mc.interactionManager == null) + return; + + if (mc.player.isOnGround()) { + placed = false; + } + + if (mode.is(NoFallMode.CLUTCH) && mc.player.fallDistance >= 3 && !mc.player.isOnGround() && !placed) { + HitResult result = mc.getCameraEntity().raycast(3, 0, false); + if (result instanceof BlockHitResult) { + // encontrar cubo + ItemStack waterBucket = InventoryUtil.getStackOfItem(Items.WATER_BUCKET); + if (waterBucket == null) { + ChatUtil.warn("cubo de agua no encontrado"); + if (clutch.getValue()) { + mode.setValue(NoFallMode.PACKET); + ChatUtil.info("cambiado a modo de paquetes"); + } + return; + } + + // mirar abajo + mc.player.setPitch(180); + + int slot = mc.player.getInventory().getSlotWithStack(waterBucket); + mc.player.getInventory().setSelectedSlot(slot); + + // colocar agua + ActionResult didPlace = mc.interactionManager.interactItem(mc.player, Hand.MAIN_HAND); + if (didPlace.isAccepted()) + placed = true; + } + } + } + + @SubscribeEvent + private void onPacketSend(PacketEvent.Send event) { + if (mc.player == null + || mc.getNetworkHandler() == null + || !mode.is(NoFallMode.PACKET) + || mc.player.getAbilities().creativeMode) + return; + + if (event.getPacket() instanceof PlayerMoveC2SPacket packet) { + if (!packet.isOnGround()) { + if (mc.player.fallDistance >= 3) { + event.cancel(); + sendOnGroundPacket(); + } + } + } + } + + private void sendOnGroundPacket() { + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.Full( + mc.player.getX(), + mc.player.getY(), + mc.player.getZ(), + mc.player.getYaw(), + mc.player.getPitch(), + true, + mc.player.horizontalCollision + )); + } + + private enum NoFallMode { + CLUTCH("waterdrop"), + PACKET("paquetes"); + + private final String name; + NoFallMode(String name) { this.name = name; } + @Override public String toString() { return name; } + } +} diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/Offhand.java b/src/main/java/me/retucio/sputnik/module/modules/player/Offhand.java index 879f791..bcdd7d8 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/player/Offhand.java +++ b/src/main/java/me/retucio/sputnik/module/modules/player/Offhand.java @@ -16,11 +16,22 @@ import net.minecraft.util.math.Direction; public class Offhand extends Module { - public OptionSetting item = sgGeneral.add(new OptionSetting<>("ítem", "ítem a equipar", - Lists.itemList, Items.TOTEM_OF_UNDYING, Lists.itemNames)); - public NumberSetting delaySetting = sgGeneral.add(new NumberSetting("delay", "delay del cambiazo (en ticks)", 0, 0, 20, 1)); - public BooleanSetting override = sgGeneral.add(new BooleanSetting("anular", "ignora que ya haya un ítem en la mano secundaria", true)); + private final OptionSetting item = sgGeneral.add(new OptionSetting<>( + "ítem", "ítem a equipar", + Lists.itemList, Items.TOTEM_OF_UNDYING, Lists.itemNames + )); + private final NumberSetting delaySetting = sgGeneral.add(new NumberSetting( + "delay", + "delay del cambiazo (en ticks)", + 0, 0, 20, 1 + )); + + private final BooleanSetting override = sgGeneral.add(new BooleanSetting( + "anular", + "ignora que ya haya un ítem en la mano secundaria", + true + )); private int delay; private boolean holdingItem; diff --git a/src/main/java/me/retucio/sputnik/module/modules/player/WarnLowDurability.java b/src/main/java/me/retucio/sputnik/module/modules/player/WarnLowDurability.java index fc1b016..c66dc0e 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/player/WarnLowDurability.java +++ b/src/main/java/me/retucio/sputnik/module/modules/player/WarnLowDurability.java @@ -22,19 +22,19 @@ import java.util.List; public class WarnLowDurability extends Module { - SettingGroup sgWarn = addSg(new SettingGroup("aviso", true)); - SettingGroup sgSound = addSg(new SettingGroup("sonido", true)); + private final SettingGroup sgWarn = addSg(new SettingGroup("aviso", true)); + private final SettingGroup sgSound = addSg(new SettingGroup("sonido", true)); - public NumberSetting limitPercentage = sgGeneral.add(new NumberSetting("porcentaje", "porcentaje de durabilidad restante a la que se te avisa", + private final NumberSetting limitPercentage = sgGeneral.add(new NumberSetting("porcentaje", "porcentaje de durabilidad restante a la que se te avisa", 5, 1, 100, 1)); - public BooleanSetting message = sgWarn.add(new BooleanSetting("enviar mensaje", "enviar un mensaje para alertar al usuario", true)); - public BooleanSetting playSound = sgWarn.add(new BooleanSetting("reproducir sonido", "reproducir un sonido para alertar al usuario", true)); + private final BooleanSetting message = sgWarn.add(new BooleanSetting("enviar mensaje", "enviar un mensaje para alertar al usuario", true)); + private final BooleanSetting playSound = sgWarn.add(new BooleanSetting("reproducir sonido", "reproducir un sonido para alertar al usuario", true)); - public OptionSetting sound = sgSound.add(new OptionSetting<>("sonido", "qué sonido reproducir", + private final OptionSetting sound = sgSound.add(new OptionSetting<>("sonido", "qué sonido reproducir", Lists.soundList, SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), Lists.soundNames)); - public NumberSetting volume = sgSound.add(new NumberSetting("volumen", "volumen del sonido", 70, 0, 125, 1)); - public NumberSetting pitch = sgSound.add(new NumberSetting("frecuencia", "altura del sonido", 70, 0, 125, 1)); + private final NumberSetting volume = sgSound.add(new NumberSetting("volumen", "volumen del sonido", 70, 0, 125, 1)); + private final NumberSetting pitch = sgSound.add(new NumberSetting("frecuencia", "altura del sonido", 70, 0, 125, 1)); private final List warned = new ArrayList<>(); private float prevPercentage = -1; diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/BlockESP.java b/src/main/java/me/retucio/sputnik/module/modules/render/BlockESP.java index 7f357be..ea95ec6 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/BlockESP.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/BlockESP.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.render; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.Render3DEvent; +import me.retucio.sputnik.event.events.render.Render3DEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; @@ -24,75 +24,70 @@ import java.util.concurrent.ConcurrentHashMap; public class BlockESP extends Module { - SettingGroup sgSearch = addSg(new SettingGroup("búsqueda", true)); - SettingGroup sgOulines = addSg(new SettingGroup("contorno", true)); - SettingGroup sgFilling = addSg(new SettingGroup("relleno", true)); - + private final SettingGroup sgSearch = addSg(new SettingGroup("búsqueda", true)); + private final SettingGroup sgOulines = addSg(new SettingGroup("contorno", true)); + private final SettingGroup sgFilling = addSg(new SettingGroup("relleno", true)); // bloques - - public ListSetting blocks = sgGeneral.add(new ListSetting<>( + private final ListSetting blocks = sgGeneral.add(new ListSetting<>( "bloques", "bloques a resaltar", Lists.blockList, Lists.allFalse(Lists.blockList), Lists.blockNames )); - public NumberSetting maxBlocks = sgGeneral.add(new NumberSetting( + private final NumberSetting maxBlocks = sgGeneral.add(new NumberSetting( "máx. bloques", "número máximo de bloques a resaltar", 500, 1, 2000, 1 )); // búsqueda - - public NumberSetting radius = sgSearch.add(new NumberSetting( + private final NumberSetting radius = sgSearch.add(new NumberSetting( "radio", "radio de búsqueda de bloques", 24, 2, 128, 1 )); - public NumberSetting searchInterval = sgSearch.add(new NumberSetting( + private final NumberSetting searchInterval = sgSearch.add(new NumberSetting( "intervalo", "intervalo de búsqueda en ticks", 10, 1, 40, 1 )); - public BooleanSetting asyncSearch = sgSearch.add(new BooleanSetting( + private final BooleanSetting asyncSearch = sgSearch.add(new BooleanSetting( "búsqueda asíncrona", "busca los bloques en un hilo separado (optimización)", true )); - public NumberSetting distanceToMove = sgSearch.add(new NumberSetting( + private final NumberSetting distanceToMove = sgSearch.add(new NumberSetting( "distancia a moverse", "distancia a moverse antes de actualizar los bloques", 3, 0, 10, 0.1 )); // contorno - - public BooleanSetting outlines = sgOulines.add(new BooleanSetting( + private final BooleanSetting outlines = sgOulines.add(new BooleanSetting( "contorno", "renderizar contorno de bloques", true )); - public ColorSetting outlineColor = sgOulines.add(new ColorSetting( + private final ColorSetting outlineColor = sgOulines.add(new ColorSetting( "color del contorno", "color del contorno", Colors.CELESTE, false )); - public NumberSetting lineWidth = sgOulines.add(new NumberSetting( + private final NumberSetting lineWidth = sgOulines.add(new NumberSetting( "grosor del contorno", "grosor de las líneas del contorno", 1, 1, 5, 0.2 )); // relleno - - public BooleanSetting fillings = sgFilling.add(new BooleanSetting( + private final BooleanSetting fillings = sgFilling.add(new BooleanSetting( "relleno", "renderizar relleno de bloques", true )); - public ColorSetting fillingColor = sgFilling.add(new ColorSetting( + private final ColorSetting fillingColor = sgFilling.add(new ColorSetting( "color del relleno", "color del relleno", new Color(57, 177, 215, 67), false )); @@ -144,7 +139,7 @@ public class BlockESP extends Module { } @SubscribeEvent - public void onRenderWorld(Render3DEvent event) { + private void onRenderWorld(Render3DEvent event) { if (mc.player == null || mc.world == null) return; // aplicar el intervalo diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/BlockOutline.java b/src/main/java/me/retucio/sputnik/module/modules/render/BlockOutline.java index 91f8d76..e6fe024 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/BlockOutline.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/BlockOutline.java @@ -1,27 +1,27 @@ package me.retucio.sputnik.module.modules.render; +import me.retucio.sputnik.event.SubscribeEvent; +import me.retucio.sputnik.event.events.render.RenderBlockOutlineEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.settings.ColorSetting; import me.retucio.sputnik.module.setting.settings.NumberSetting; import me.retucio.sputnik.util.Colors; -import java.awt.*; - /** continúa en: * @see me.retucio.sputnik.mixin.WorldRendererMixin */ public class BlockOutline extends Module { - public ColorSetting color = sgGeneral.add(new ColorSetting( + private final ColorSetting color = sgGeneral.add(new ColorSetting( "color", "color del contorno de los bloques", Colors.mainColor, true) ); - public NumberSetting lineWidth = sgGeneral.add(new NumberSetting( + private final NumberSetting lineWidth = sgGeneral.add(new NumberSetting( "grosor", "grosor de las líneas", 0.5, @@ -35,4 +35,10 @@ public class BlockOutline extends Module { "customiza el contorno de los bloques", Category.RENDER); } + + @SubscribeEvent + private void onRenderBlockOutline(RenderBlockOutlineEvent event) { + event.setColor(color.getRGB()); + event.setLineWidth(lineWidth.getFloatValue()); + } } diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/BreakingProgress.java b/src/main/java/me/retucio/sputnik/module/modules/render/BreakingProgress.java index 13f0f3e..ea729cb 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/BreakingProgress.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/BreakingProgress.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.render; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.Render3DEvent; +import me.retucio.sputnik.event.events.render.Render3DEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; @@ -14,24 +14,25 @@ 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 org.jspecify.annotations.NonNull; import java.awt.*; public class BreakingProgress extends Module { - SettingGroup sgOulines = addSg(new SettingGroup("contorno", true)); - SettingGroup sgFilling = addSg(new SettingGroup("relleno", true)); + private final SettingGroup sgOulines = addSg(new SettingGroup("contorno", true)); + private final SettingGroup sgFilling = addSg(new SettingGroup("relleno", true)); - public EnumSetting breakMode = sgGeneral.add(new EnumSetting<>("modo de minado", "elige si el cubo se encoge o se dilata", + private final EnumSetting breakMode = sgGeneral.add(new EnumSetting<>("modo de minado", "elige si el cubo se encoge o se dilata", BreakMode.class, BreakMode.INWARDS)); - public BooleanSetting outlines = sgOulines.add(new BooleanSetting("contorno", "renderizar contorno", true)); - public ColorSetting outlineColor = sgOulines.add(new ColorSetting("color del contorno", "color del contorno", + private final BooleanSetting outlines = sgOulines.add(new BooleanSetting("contorno", "renderizar contorno", true)); + private final ColorSetting outlineColor = sgOulines.add(new ColorSetting("color del contorno", "color del contorno", new Color(0, 255, 0, 200), false)); - public NumberSetting lineWidth = sgOulines.add(new NumberSetting("grosor de línea", "grosor de las líneas del contorno", 1, 1, 5, 0.1)); + private final NumberSetting lineWidth = sgOulines.add(new NumberSetting("grosor de línea", "grosor de las líneas del contorno", 1, 1, 5, 0.1)); - public BooleanSetting fillings = sgFilling.add(new BooleanSetting("relleno", "renderizar relleno", true)); - public ColorSetting fillingColor = sgFilling.add(new ColorSetting("color del relleno", "color del relleno", + private final BooleanSetting fillings = sgFilling.add(new BooleanSetting("relleno", "renderizar relleno", true)); + private final ColorSetting fillingColor = sgFilling.add(new ColorSetting("color del relleno", "color del relleno", new Color(0, 255, 0, 60), false)); @@ -42,7 +43,7 @@ public class BreakingProgress extends Module { } @SubscribeEvent - public void onRenderWorld(Render3DEvent event) { + private void onRenderWorld(Render3DEvent event) { if (mc.interactionManager == null || mc.world == null) return; if (!(mc.crosshairTarget instanceof BlockHitResult hitResult)) return; BlockPos pos = hitResult.getBlockPos(); @@ -60,6 +61,13 @@ public class BreakingProgress extends Module { ? 1f - progress : progress; + Box scaledBox = scaleBox(box, shrinkFactor); + + if (outlines.getValue()) RenderUtil.drawOutlineBox(event.getMatrices(), scaledBox, outlineColor.getValue(), lineWidth.getFloatValue(), false); + if (fillings.getValue()) RenderUtil.drawFilledBox(event.getMatrices(), scaledBox, fillingColor.getValue(), false); + } + + private static Box scaleBox(Box box, float shrinkFactor) { double centerX = (box.minX + box.maxX) / 2; double centerY = (box.minY + box.maxY) / 2; double centerZ = (box.minZ + box.maxZ) / 2; @@ -68,16 +76,13 @@ public class BreakingProgress extends Module { double shrunkY = (box.maxY - box.minY) / 2 * shrinkFactor; double shrunkZ = (box.maxZ - box.minZ) / 2 * shrinkFactor; - Box scaledBox = new Box( + return new Box( centerX - shrunkX, centerY - shrunkY, centerZ - shrunkZ, centerX + shrunkX, centerY + shrunkZ, centerZ + shrunkZ ); - - if (outlines.getValue()) RenderUtil.drawOutlineBox(event.getMatrices(), scaledBox, outlineColor.getValue(), lineWidth.getFloatValue(), false); - if (fillings.getValue()) RenderUtil.drawFilledBox(event.getMatrices(), scaledBox, fillingColor.getValue(), false); } - public enum BreakMode { + private enum BreakMode { INWARDS("para dentro"), OUTWARDS("para fuera"); diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/CritsPlus.java b/src/main/java/me/retucio/sputnik/module/modules/render/CritsPlus.java index 80c67fb..c6f4cf1 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/CritsPlus.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/CritsPlus.java @@ -12,22 +12,22 @@ import java.awt.*; /** continúa en: * @see me.retucio.sputnik.mixin.DamageParticleMixin - * @see me.retucio.sputnik.mixin.DamageParticleFactoryMixin + * @see me.retucio.sputnik.mixin.DamageParticleMixin$DamageParticleFactoryMixin */ public class CritsPlus extends Module { - SettingGroup sgAppearance = addSg(new SettingGroup("aspecto", true)); - SettingGroup sgBehaviour = addSg(new SettingGroup("funcionamiento", true)); + private final SettingGroup sgAppearance = addSg(new SettingGroup("aspecto", true)); + private final SettingGroup sgBehaviour = addSg(new SettingGroup("funcionamiento", true)); - public ColorSetting color = sgAppearance.add(new ColorSetting("color", "color de las partículas", Colors.mainColor, false)); - public NumberSetting scale = sgAppearance.add(new NumberSetting("escala", "tamaño", 1, 0, 2, 0.05)); - public NumberSetting multiplier = sgAppearance.add(new NumberSetting("múltiplo", "número por el que multiplicar la cantidad de partículas generadas", 1, 0, 10, 0.1)); + public final ColorSetting color = sgAppearance.add(new ColorSetting("color", "color de las partículas", Colors.mainColor, false)); + public final NumberSetting scale = sgAppearance.add(new NumberSetting("escala", "tamaño", 1, 0, 2, 0.05)); + public final NumberSetting multiplier = sgAppearance.add(new NumberSetting("múltiplo", "número por el que multiplicar la cantidad de partículas generadas", 1, 0, 10, 0.1)); - public NumberSetting velocityMultipler = sgBehaviour.add(new NumberSetting("dispersión", "multiplicador de la velocidad de dispersión", 1, 0, 10, 0.1)); - public NumberSetting gravity = sgBehaviour.add(new NumberSetting("gravedad", "multiplicador de fuerza de gravedad", 1, 0, 10, 0.1)); - public NumberSetting maxAge = sgBehaviour.add(new NumberSetting("vida máxima", "cuánto persiste la partícula", 10, 0, 50, 1)); - public BooleanSetting collide = sgBehaviour.add(new BooleanSetting("colisionar", "colisionar con bloques", false)); + public final NumberSetting velocityMultipler = sgBehaviour.add(new NumberSetting("dispersión", "multiplicador de la velocidad de dispersión", 1, 0, 10, 0.1)); + public final NumberSetting gravity = sgBehaviour.add(new NumberSetting("gravedad", "multiplicador de fuerza de gravedad", 1, 0, 10, 0.1)); + public final NumberSetting maxAge = sgBehaviour.add(new NumberSetting("vida máxima", "cuánto persiste la partícula", 10, 0, 50, 1)); + public final BooleanSetting collide = sgBehaviour.add(new BooleanSetting("colisionar", "colisionar con bloques", false)); public CritsPlus() { super("críticos", diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/DamageOverlay.java b/src/main/java/me/retucio/sputnik/module/modules/render/DamageOverlay.java index 67557c6..1851ecf 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/DamageOverlay.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/DamageOverlay.java @@ -17,7 +17,7 @@ import java.awt.*; public class DamageOverlay extends Module { - public ColorSetting colorSetting = sgGeneral.add(new ColorSetting( + private final ColorSetting colorSetting = sgGeneral.add(new ColorSetting( "color", "color", Colors.mainColor, diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/Fonts.java b/src/main/java/me/retucio/sputnik/module/modules/render/Fonts.java index a50cff4..49d8511 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/Fonts.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/Fonts.java @@ -9,12 +9,12 @@ import me.retucio.sputnik.util.Lists; public class Fonts extends Module { - public OptionSetting font = sgGeneral.add(new OptionSetting<>( + private final OptionSetting font = sgGeneral.add(new OptionSetting<>( "fuente", "fuente a emplear", Lists.fontList, "ubuntu") ); - public BooleanSetting reload = sgGeneral.add(new BooleanSetting( + private final BooleanSetting reload = sgGeneral.add(new BooleanSetting( "recargar", "recargar automáticamente", false )); @@ -42,4 +42,8 @@ public class Fonts extends Module { mc.reloadResources(); } } + + public String getFont() { + return font.getValue(); + } } diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/GlintPlus.java b/src/main/java/me/retucio/sputnik/module/modules/render/GlintPlus.java index 8a95af0..2b48c3b 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/GlintPlus.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/GlintPlus.java @@ -17,19 +17,19 @@ import net.minecraft.util.DyeColor; public class GlintPlus extends Module { - public BooleanSetting items = sgGeneral.add(new BooleanSetting( + private final BooleanSetting items = sgGeneral.add(new BooleanSetting( "items", "modificar el destello de encantamiento de los items", true )); - public BooleanSetting armor = sgGeneral.add(new BooleanSetting( + private final BooleanSetting armor = sgGeneral.add(new BooleanSetting( "armadura", "modificar el destello de encantamiento de la armadura", true )); - public EnumSetting glintColor = sgGeneral.add(new EnumSetting<>( + private final EnumSetting glintColor = sgGeneral.add(new EnumSetting<>( "colores", "color del glint", GlintColors.class, diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/Nametags.java b/src/main/java/me/retucio/sputnik/module/modules/render/Nametags.java index 64fae4f..2c08158 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/Nametags.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/Nametags.java @@ -2,17 +2,20 @@ package me.retucio.sputnik.module.modules.render; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import me.retucio.sputnik.Sputnik; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; import me.retucio.sputnik.module.setting.settings.BooleanSetting; import me.retucio.sputnik.module.setting.settings.EnumSetting; import me.retucio.sputnik.module.setting.settings.ListSetting; +import me.retucio.sputnik.util.ChatUtil; import me.retucio.sputnik.util.Lists; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityType; import net.minecraft.entity.LazyEntityReference; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.TntEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.PersistentProjectileEntity; @@ -42,22 +45,22 @@ public class Nametags extends Module { SettingGroup sgInfo = addSg(new SettingGroup("info. adicional", true)); Map, Boolean> defaultEntities = Lists.allFalse(Lists.entityList); - public ListSetting> entities = sgGeneral.add(new ListSetting<>("entidades", "entidades cuyo nametag será visible", + public final ListSetting> entities = sgGeneral.add(new ListSetting<>("entidades", "entidades cuyo nametag será visible", Lists.entityList, defaultEntities, Lists.entityNames)); - public ListSetting items = sgGeneral.add(new ListSetting<>("items", "te permite elegir cuáles items tienen su nombre visible", + public final ListSetting items = sgGeneral.add(new ListSetting<>("items", "te permite elegir cuáles items tienen su nombre visible", Lists.itemList, Lists.allTrue(Lists.itemList), Lists.itemNames)); - public BooleanSetting health = sgGeneral.add(new BooleanSetting("mostrar vida", "muestra la vida de una entidad en su nametag", true)); - public EnumSetting healthMode = sgGeneral.add(new EnumSetting<>("mostrar vida en", "de qué manera mostrar la vida", HealthMode.class, HealthMode.POINTS)); + public final BooleanSetting health = sgGeneral.add(new BooleanSetting("mostrar vida", "muestra la vida de una entidad en su nametag", true)); + public final EnumSetting healthMode = sgGeneral.add(new EnumSetting<>("mostrar vida en", "de qué manera mostrar la vida", HealthMode.class, HealthMode.POINTS)); - public BooleanSetting alwaysVisible = sgGeneral.add(new BooleanSetting("siempre mostrar nametags", "mostrar nametag cuando el jugador está agachado o es invisible", false)); - public BooleanSetting showSelf = sgGeneral.add(new BooleanSetting("mostrar propio", "mostrar nametag propio", false)); - - public BooleanSetting countItems = sgInfo.add(new BooleanSetting("contar items", "muestra cuánto de un item hay en un stack dropeado", true)); - public BooleanSetting showProjectileDamage = sgInfo.add(new BooleanSetting("daño del proyectil", "muestra cuánto daño hace un proyectil en su nametag", true)); - public BooleanSetting distinguishBabies = sgInfo.add(new BooleanSetting("distinguir bebés", "cambia el nametag cuando una entidad está en su fase bebé", false)); - public BooleanSetting petOwner = sgInfo.add(new BooleanSetting("mostrar dueño", "muestra el dueño de una mascota (no funciona en servers no premium)", false)); + public final BooleanSetting alwaysVisible = sgGeneral.add(new BooleanSetting("siempre mostrar nametags", "mostrar nametag cuando el jugador está agachado o es invisible", false)); + public final BooleanSetting showSelf = sgGeneral.add(new BooleanSetting("mostrar propio", "mostrar nametag propio", false)); + public final BooleanSetting countItems = sgInfo.add(new BooleanSetting("contar items", "muestra cuánto de un item hay en un stack dropeado", true)); + public final BooleanSetting showProjectileDamage = sgInfo.add(new BooleanSetting("daño del proyectil", "muestra cuánto daño hace un proyectil en su nametag", true)); + public final BooleanSetting distinguishBabies = sgInfo.add(new BooleanSetting("distinguir bebés", "cambia el nametag cuando una entidad está en su fase bebé", false)); + public final BooleanSetting petOwner = sgInfo.add(new BooleanSetting("mostrar dueño", "muestra el dueño de una mascota (no funciona en servers no premium)", false)); + public final BooleanSetting tntPrime = sgInfo.add(new BooleanSetting("temporizador de TNT", "muestra el tiempo restante para que un bloque de TNT se detone", true)); private final Map cache = new ConcurrentHashMap<>(); private static final ExecutorService executor = Executors.newCachedThreadPool(); @@ -73,6 +76,7 @@ public class Nametags extends Module { defaultEntities.replace(EntityType.ARROW, true); defaultEntities.replace(EntityType.SPECTRAL_ARROW, true); defaultEntities.replace(EntityType.TRIDENT, true); + defaultEntities.replace(EntityType.TNT, true); entities.setDefaultValue(defaultEntities); health.onUpdate(v -> healthMode.setVisible(v)); @@ -84,6 +88,8 @@ public class Nametags extends Module { || entities.get(EntityType.ARROW) || entities.get(EntityType.SPECTRAL_ARROW); showProjectileDamage.setVisible(anyProjectile); + + tntPrime.setVisible(entities.get(EntityType.TNT)); }); } @@ -107,6 +113,10 @@ public class Nametags extends Module { return finalDamage + (bonus > 0 ? " ~ " + (finalDamage + bonus) : ""); } + public String getTntPrimeTime(TntEntity tnt) { + return String.format("%.2f\"", ((float) tnt.getFuse() / 20)); + } + @SuppressWarnings("deprecation") public String getOwnerName(LazyEntityReference owner) { // si el dueño está en línea (de manera segura) @@ -140,13 +150,14 @@ public class Nametags extends Module { cache.put(uuid, name); } catch (Exception e) { - e.printStackTrace(); + Sputnik.LOGGER.error(e); cache.put(uuid, "?"); } }); return "..."; } + public enum HealthMode { POINTS("hp (puntos de vida)"), HEARTS("corazones"); diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/NoRender.java b/src/main/java/me/retucio/sputnik/module/modules/render/NoRender.java index 1b78b74..7708ea3 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/NoRender.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/NoRender.java @@ -25,41 +25,41 @@ import net.minecraft.util.Formatting; public class NoRender extends Module { - SettingGroup sgOverlays = addSg(new SettingGroup("overlays", true)); - SettingGroup sgAmbient = addSg(new SettingGroup("ambiente", true)); - SettingGroup sgEffects = addSg(new SettingGroup("efectos", true)); - SettingGroup sgUi = addSg(new SettingGroup("interfaz", true)); - SettingGroup sgText = addSg(new SettingGroup("texto", true)); - SettingGroup sgMisc = addSg(new SettingGroup("misc.", true)); + private final SettingGroup sgOverlays = addSg(new SettingGroup("overlays", true)); + private final SettingGroup sgAmbient = addSg(new SettingGroup("ambiente", true)); + private final SettingGroup sgEffects = addSg(new SettingGroup("efectos", true)); + private final SettingGroup sgUi = addSg(new SettingGroup("interfaz", true)); + private final SettingGroup sgText = addSg(new SettingGroup("texto", true)); + private final SettingGroup sgMisc = addSg(new SettingGroup("misc.", true)); - public BooleanSetting spyglassOverlay = sgOverlays.add(new BooleanSetting("catalejo", "renderizar overlay del catalejo", false)); - public BooleanSetting fluidOverlay = sgOverlays.add(new BooleanSetting("fluídos", "renderizar fluídos sobre la cámara como el agua, lava o nieve en polvo (aunque no sea un fluído)", false)); - public BooleanSetting pumpkinOverlay = sgOverlays.add(new BooleanSetting("calabaza", "renderiza el overlay de la calabaza tallada", false)); - public BooleanSetting fireOverlay = sgOverlays.add(new BooleanSetting("fuego", "renderizar llamas sobre la cámara", false)); - public BooleanSetting portalOverlay = sgOverlays.add(new BooleanSetting("portal", "renderizar el overlay del portal del nether", false)); + public final BooleanSetting spyglassOverlay = sgOverlays.add(new BooleanSetting("catalejo", "renderizar overlay del catalejo", false)); + public final BooleanSetting fluidOverlay = sgOverlays.add(new BooleanSetting("fluídos", "renderizar fluídos sobre la cámara como el agua, lava o nieve en polvo (aunque no sea un fluído)", false)); + public final BooleanSetting pumpkinOverlay = sgOverlays.add(new BooleanSetting("calabaza", "renderiza el overlay de la calabaza tallada", false)); + public final BooleanSetting fireOverlay = sgOverlays.add(new BooleanSetting("fuego", "renderizar llamas sobre la cámara", false)); + public final BooleanSetting portalOverlay = sgOverlays.add(new BooleanSetting("portal", "renderizar el overlay del portal del nether", false)); - public BooleanSetting rain = sgAmbient.add(new BooleanSetting("lluvia", "l l u v i a", true)); - public BooleanSetting snow = sgAmbient.add(new BooleanSetting("nieve", "n i e v e", true)); - public BooleanSetting endFlashes = sgAmbient.add(new BooleanSetting("flashes del end", "renderizar los recientemente añadidos flashes en el end", true)); - public ListSetting> particles = sgAmbient.add(new ListSetting<>("partículas", "lista de partículas que se renderizan", + public final BooleanSetting rain = sgAmbient.add(new BooleanSetting("lluvia", "l l u v i a", true)); + public final BooleanSetting snow = sgAmbient.add(new BooleanSetting("nieve", "n i e v e", true)); + public final BooleanSetting endFlashes = sgAmbient.add(new BooleanSetting("flashes del end", "renderizar los recientemente añadidos flashes en el end", true)); + public final ListSetting> particles = sgAmbient.add(new ListSetting<>("partículas", "lista de partículas que se renderizan", Lists.particleList, Lists.allTrue(Lists.particleList), Lists.particleNames)); - public BooleanSetting nauseaEffect = sgEffects.add(new BooleanSetting("náusea", "renderizar borrachera", false)); - public BooleanSetting blindnessEffect = sgEffects.add(new BooleanSetting("ceguera", "renderizar miopía", false)); - public BooleanSetting darknessEffect = sgEffects.add(new BooleanSetting("oscuridad", "renderizar miedo a la oscuridad", false)); + public final BooleanSetting nauseaEffect = sgEffects.add(new BooleanSetting("náusea", "renderizar borrachera", false)); + public final BooleanSetting blindnessEffect = sgEffects.add(new BooleanSetting("ceguera", "renderizar miopía", false)); + public final BooleanSetting darknessEffect = sgEffects.add(new BooleanSetting("oscuridad", "renderizar miedo a la oscuridad", false)); - public BooleanSetting scoreboard = sgUi.add(new BooleanSetting("marcador", "mostrar marcador a la derecha", false)); - public BooleanSetting titles = sgUi.add(new BooleanSetting("títulos", "mostrar títulos (del comando /title)", false)); - public BooleanSetting totemPop = sgUi.add(new BooleanSetting("tótem", "renderizar el pop del tótem", true)); + public final BooleanSetting scoreboard = sgUi.add(new BooleanSetting("marcador", "mostrar marcador a la derecha", false)); + public final BooleanSetting titles = sgUi.add(new BooleanSetting("títulos", "mostrar títulos (del comando /title)", false)); + public final BooleanSetting totemPop = sgUi.add(new BooleanSetting("tótem", "renderizar el pop del tótem", true)); - public BooleanSetting bold = sgText.add(new BooleanSetting("negrita", "letra pero §lgorda", true)); + public final BooleanSetting bold = sgText.add(new BooleanSetting("negrita", "letra pero §lgorda", true)); // public BooleanSetting italics = addSetting(new BooleanSetting("cursiva", "letra pero §otorcida", true)); - public BooleanSetting underlined = sgText.add(new BooleanSetting("subrayado", "letra pero §nen el suelo", true)); - public BooleanSetting strikethrough = sgText.add(new BooleanSetting("tachado", "letra pero §mdiscriminada", true)); - public EnumSetting color = sgText.add(new EnumSetting<>("colores", "§co§4r§6g§eu§al§2l§9o §1g§5a§dy", Colors.class, Colors.DEFAULT)); - public BooleanSetting scrambledText = sgText.add(new BooleanSetting("garabato", "engarabatar texto (o como se diga) (§kasí§r)", false)); + public final BooleanSetting underlined = sgText.add(new BooleanSetting("subrayado", "letra pero §nen el suelo", true)); + public final BooleanSetting strikethrough = sgText.add(new BooleanSetting("tachado", "letra pero §mdiscriminada", true)); + public final EnumSetting color = sgText.add(new EnumSetting<>("colores", "§co§4r§6g§eu§al§2l§9o §1g§5a§dy", Colors.class, Colors.DEFAULT)); + public final BooleanSetting scrambledText = sgText.add(new BooleanSetting("garabato", "engarabatar texto (o como se diga) (§kasí§r)", false)); - public BooleanSetting stuckArrows = sgMisc.add(new BooleanSetting("flechas clavadas", "renderizar flechas clavadas en jugadores", false)); + public final BooleanSetting stuckArrows = sgMisc.add(new BooleanSetting("flechas clavadas", "renderizar flechas clavadas en jugadores", false)); public NoRender() { super("no render", diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/Particles.java b/src/main/java/me/retucio/sputnik/module/modules/render/Particles.java index 31bfa33..d8a0ed6 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/Particles.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/Particles.java @@ -17,8 +17,8 @@ import java.util.Random; public class Particles extends Module { - SettingGroup sgDispersion = addSg(new SettingGroup("dispersión", true)); - SettingGroup sgOffset = addSg(new SettingGroup("desplazamiento", true)); + private final SettingGroup sgDispersion = addSg(new SettingGroup("dispersión", true)); + private final SettingGroup sgOffset = addSg(new SettingGroup("desplazamiento", true)); List particleList = Lists.particleList.stream() .filter(particleType -> particleType instanceof SimpleParticleType) @@ -27,10 +27,10 @@ public class Particles extends Module { Map particleNames = Lists.getMapOfLists(particleList, particleList.stream().map(particle -> Text.translatable( - Registries.PARTICLE_TYPE.getId(particle).toShortTranslationKey()).getString() - ).toList()); + Registries.PARTICLE_TYPE.getId(particle).toShortTranslationKey()).getString()) + .toList()); - public ListSetting particles = sgGeneral.add(new ListSetting<>( + private final ListSetting particles = sgGeneral.add(new ListSetting<>( "partículas", "partículas a generar", particleList, @@ -38,84 +38,81 @@ public class Particles extends Module { particleNames )); - public NumberSetting spawnInterval = sgGeneral.add(new NumberSetting( + private final NumberSetting spawnInterval = sgGeneral.add(new NumberSetting( "intervalo", "intervalo entre generaciones (en ticks)", 4, 1, 100, 1 )); - public NumberSetting particleCount = sgGeneral.add(new NumberSetting( + private final NumberSetting particleCount = sgGeneral.add(new NumberSetting( "cantidad", "partículas por generación", 10, 1, 100, 1 )); - public NumberSetting velocity = sgDispersion.add(new NumberSetting( + private final NumberSetting velocity = sgDispersion.add(new NumberSetting( "velocidad", "multiplicador de la velocidad de dispersión", 0.2, 0, 2, 0.05 )); - public NumberSetting spreadX = sgDispersion.add(new NumberSetting( + private final NumberSetting spreadX = sgDispersion.add(new NumberSetting( "dispersión X", "dispersión horizontal de posición", 0.5, 0, 5, 0.1 )); - public NumberSetting spreadY = sgDispersion.add(new NumberSetting( + private final NumberSetting spreadY = sgDispersion.add(new NumberSetting( "dispersión Y", "dispersión vertical de posición", 0.5, 0, 5, 0.1 )); - public NumberSetting spreadZ = sgDispersion.add(new NumberSetting( + private final NumberSetting spreadZ = sgDispersion.add(new NumberSetting( "dispersión Z", "dispersión de profundidad de posición", 0.5, 0, 5, 0.1 )); - public NumberSetting velocityRandomness = sgDispersion.add(new NumberSetting( + private final NumberSetting velocityRandomness = sgDispersion.add(new NumberSetting( "aleatoriedad velocidad", "variación aleatoria en la velocidad", 0.3, 0, 1, 0.05 )); - public NumberSetting positionRandomness = sgDispersion.add(new NumberSetting( + private final NumberSetting positionRandomness = sgDispersion.add(new NumberSetting( "aleatoriedad posición", "variación aleatoria en la posición", 0.2, 0, 1, 0.05 )); - public NumberSetting offsetX = sgOffset.add(new NumberSetting( + private final NumberSetting offsetX = sgOffset.add(new NumberSetting( "desplazamiento pos. X", "desplazamiento en el eje X respecto al jugador", 0, -1, 1, 0.01 )); - public NumberSetting offsetY = sgOffset.add(new NumberSetting( + private final NumberSetting offsetY = sgOffset.add(new NumberSetting( "desplazamiento pos. Y", "desplazamiento en el eje Y respecto al jugador", 0, -1, 1, 0.01 )); - public NumberSetting offsetZ = sgOffset.add(new NumberSetting( + private final NumberSetting offsetZ = sgOffset.add(new NumberSetting( "desplazamiento pos. Z", "desplazamiento en el eje Z respecto al jugador", -0.8, -1, 1, 0.01 )); - private final Random random = new Random(); private int tickCounter = 0; - public Particles() { super("partículas", "emite particulas artificiales", Category.RENDER); } - @Override public void onEnable() { tickCounter = 0; diff --git a/src/main/java/me/retucio/sputnik/module/modules/world/AutoSign.java b/src/main/java/me/retucio/sputnik/module/modules/world/AutoSign.java index e8a047d..99974c8 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/world/AutoSign.java +++ b/src/main/java/me/retucio/sputnik/module/modules/world/AutoSign.java @@ -1,8 +1,8 @@ package me.retucio.sputnik.module.modules.world; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.OpenScreenEvent; -import me.retucio.sputnik.event.events.PacketEvent; +import me.retucio.sputnik.event.events.interact.OpenScreenEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; import me.retucio.sputnik.mixin.accessor.AbstractSignEditScreenAccessor; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; @@ -14,7 +14,7 @@ import net.minecraft.util.math.BlockPos; public class AutoSign extends Module { - public String[] text = null; + private String[] text = null; public AutoSign() { super("autocartel", @@ -35,7 +35,7 @@ public class AutoSign extends Module { } @SubscribeEvent - public void onOpenScreen(OpenScreenEvent event) { + private void onOpenScreen(OpenScreenEvent event) { if (event.getScreen() instanceof AbstractSignEditScreen screen && text != null && mc != null && mc.player != null) { event.cancel(); SignBlockEntity sign = ((AbstractSignEditScreenAccessor) screen).getBlockEntity(); @@ -44,7 +44,7 @@ public class AutoSign extends Module { } @SubscribeEvent - public void onSendPacket(PacketEvent.Send event) { + private void onSendPacket(PacketEvent.Send event) { if (event.getPacket() instanceof UpdateSignC2SPacket packet) { if (text == null) text = packet.getText().clone(); else System.arraycopy(text, 0, packet.getText(), 0, 4); diff --git a/src/main/java/me/retucio/sputnik/module/modules/world/AutoTool.java b/src/main/java/me/retucio/sputnik/module/modules/world/AutoTool.java new file mode 100644 index 0000000..9e4876a --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/world/AutoTool.java @@ -0,0 +1,195 @@ +package me.retucio.sputnik.module.modules.world; + +import me.retucio.sputnik.event.SubscribeEvent; +import me.retucio.sputnik.event.events.input.KeyEvent; +import me.retucio.sputnik.event.events.input.MouseClickEvent; +import me.retucio.sputnik.mixin.accessor.KeyBindingAccessor; +import me.retucio.sputnik.module.Category; +import me.retucio.sputnik.module.Module; +import me.retucio.sputnik.module.setting.settings.BooleanSetting; +import me.retucio.sputnik.module.setting.settings.NumberSetting; +import me.retucio.sputnik.util.InventoryUtil; +import me.retucio.sputnik.util.MiscUtil; + +import net.minecraft.block.BlockState; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.ToolComponent; +import net.minecraft.item.ItemStack; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult; +import org.lwjgl.glfw.GLFW; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AutoTool extends Module { + + private final NumberSetting delaySetting = sgGeneral.add(new NumberSetting( + "delay", + "delay al cambiar de herramienta", + 0, + 0, + 20, + 1 + )); + + private final BooleanSetting switchBack = sgGeneral.add(new BooleanSetting( + "cambiar de vuelta", + "cambiar de vuelta a la herramienta inicial", + false + )); + + private final NumberSetting switchBackDelaySetting = sgGeneral.add(new NumberSetting( + "delay del cambio de vuelta", + "delay en ticks para cambiar de vuelta a la herramienta inicial", + 0, + 0, + 20, + 1 + )); + + private boolean startedMining; + private boolean finishedMining; + + private int delay = 0; + private int switchBackDelay = 0; + + private int prevSlot = -1; + + public AutoTool() { + super("auto herramienta", "cambia a la herramienta adecuada automáticamente", Category.WORLD); + switchBack.onUpdate(v -> switchBackDelaySetting.setVisible(v)); + } + + @Override + public void onEnable() { + reset(); + super.onEnable(); + } + + @Override + public void onDisable() { + reset(); + super.onDisable(); + } + + private void reset() { + startedMining = false; + finishedMining = false; + delay = 0; + switchBackDelay = 0; + prevSlot = -1; + } + + @Override + public void onTick() { + if (mc.player == null || mc.player.getInventory() == null) return; + + if (startedMining && delaySetting.getIntValue() > 0) { + delay++; + if (delay >= delaySetting.getIntValue()) { + selectFastestTool(); + startedMining = false; + delay = 0; + } + } + + if (finishedMining && switchBack.getValue() && switchBackDelaySetting.getIntValue() > 0) { + switchBackDelay++; + if (switchBackDelay >= switchBackDelaySetting.getIntValue()) { + switchBack(); + finishedMining = false; + switchBackDelay = 0; + } + } + } + + @SubscribeEvent + private void onKey(KeyEvent event) { + handle(event.getKey(), event.getAction()); + } + + @SubscribeEvent + private void onClick(MouseClickEvent event) { + handle(event.getButton(), event.getAction()); + } + + private void handle(int key, int action) { + if (mc.player == null || mc.player.getInventory() == null) return; + if (key != ((KeyBindingAccessor) mc.options.attackKey).getBoundKey().getCode()) return; + + if (action == GLFW.GLFW_PRESS) { + onStartMining(); + } else if (action == GLFW.GLFW_RELEASE) { + onFinishMining(); + } + } + + private void onStartMining() { + finishedMining = false; + switchBackDelay = 0; + + if (switchBack.getValue() && prevSlot == -1) { + prevSlot = mc.player.getInventory().getSelectedSlot(); + } + + if (delaySetting.getIntValue() == 0) { + selectFastestTool(); + } else { + startedMining = true; + delay = 0; + } + } + + private void onFinishMining() { + startedMining = false; + delay = 0; + + if (switchBack.getValue() && prevSlot != -1) { + if (switchBackDelaySetting.getIntValue() == 0) { + switchBack(); + } else { + finishedMining = true; + switchBackDelay = 0; + } + } + } + + private void selectFastestTool() { + if (mc.player == null || mc.getCameraEntity() == null || mc.world == null) return; + + HitResult result = mc.getCameraEntity().raycast(mc.player.getBlockInteractionRange(), 0, false); + if (result.getType() == HitResult.Type.MISS || !(result instanceof BlockHitResult bhr)) return; + BlockState state = mc.world.getBlockState(bhr.getBlockPos()); + + List tools = InventoryUtil.getStacksOfComponentType(DataComponentTypes.TOOL); + if (tools.isEmpty()) return; + + Map speeds = new HashMap<>(); + for (ItemStack tool : tools) { + ToolComponent toolComponent = tool.get(DataComponentTypes.TOOL); + if (toolComponent != null) { + speeds.put(toolComponent.getSpeed(state), tool); + } + } + + Float fastestSpeed = MiscUtil.getHighest(speeds.keySet().stream().toList()); + ItemStack fastestTool = speeds.get(fastestSpeed); + int slot = mc.player.getInventory().getSlotWithStack(fastestTool); + + if (slot != -1) { + if (switchBack.getValue()) prevSlot = mc.player.getInventory().getSelectedSlot(); + mc.player.getInventory().setSelectedSlot(slot); + } + } + + private void switchBack() { + if (prevSlot == -1 || prevSlot == mc.player.getInventory().getSelectedSlot()) return; + + mc.player.getInventory().setSelectedSlot(prevSlot); + prevSlot = -1; + finishedMining = false; + switchBackDelay = 0; + } +} \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/module/modules/world/BlockInfo.java b/src/main/java/me/retucio/sputnik/module/modules/world/BlockInfo.java index 300eaf5..d9987e4 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/world/BlockInfo.java +++ b/src/main/java/me/retucio/sputnik/module/modules/world/BlockInfo.java @@ -2,15 +2,12 @@ package me.retucio.sputnik.module.modules.world; import com.google.gson.Gson; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.KeyEvent; +import me.retucio.sputnik.event.events.input.KeyEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; -import me.retucio.sputnik.module.setting.SettingGroup; -import me.retucio.sputnik.module.setting.settings.BooleanSetting; import me.retucio.sputnik.module.setting.settings.EnumSetting; import me.retucio.sputnik.module.setting.settings.KeySetting; import me.retucio.sputnik.util.ChatUtil; -import me.retucio.sputnik.util.KeyUtil; import net.minecraft.block.BlockState; import net.minecraft.state.property.Property; import net.minecraft.util.hit.BlockHitResult; @@ -21,18 +18,15 @@ import org.lwjgl.glfw.GLFW; import java.util.Collection; -// copy summon / setblock command -// copy json data to clipboard -// print data (keybinds) public class BlockInfo extends Module { - public KeySetting key = sgGeneral.add(new KeySetting( + private final KeySetting key = sgGeneral.add(new KeySetting( "tecla", "tecla a pulsar para obtener la info.", GLFW.GLFW_KEY_CAPS_LOCK )); - public EnumSetting copy = sgGeneral.add(new EnumSetting<>( + private final EnumSetting copy = sgGeneral.add(new EnumSetting<>( "copiar", "copiar al portapapeles", CopyMode.class, @@ -46,7 +40,7 @@ public class BlockInfo extends Module { } @SubscribeEvent - public void onKey(KeyEvent event) { + private void onKey(KeyEvent event) { if (mc.player == null || mc.world == null) return; if (event.getKey() != key.getValue() || event.getAction() != GLFW.GLFW_PRESS) return; @@ -83,7 +77,7 @@ public class BlockInfo extends Module { } } - public enum CopyMode { + private enum CopyMode { DONT("no copiar"), COMMAND("copiar comando /setblock"), JSON("copiar contenido json"); diff --git a/src/main/java/me/retucio/sputnik/module/modules/world/ColoredSigns.java b/src/main/java/me/retucio/sputnik/module/modules/world/ColoredSigns.java index 22e5df5..58de474 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/world/ColoredSigns.java +++ b/src/main/java/me/retucio/sputnik/module/modules/world/ColoredSigns.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.world; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.PacketEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.settings.StringSetting; @@ -9,7 +9,12 @@ import net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket; public class ColoredSigns extends Module { - public StringSetting symbol = sgGeneral.add(new StringSetting("símbolo", "símbolo a reemplazar por \"§\"", "&", 5)); + private final StringSetting symbol = sgGeneral.add(new StringSetting( + "símbolo", + "símbolo a reemplazar por \"§\"", + "&", + 5 + )); public ColoredSigns() { super("carteles gays", @@ -18,7 +23,7 @@ public class ColoredSigns extends Module { } @SubscribeEvent - public void onSendPacket(PacketEvent.Send event) { + private void onSendPacket(PacketEvent.Send event) { if (event.getPacket() instanceof UpdateSignC2SPacket packet) { for (int i = 0; i < 4; i++) { packet.getText()[i] = packet.getText()[i].replace(symbol.getValue(), "\247" + "\247a"); diff --git a/src/main/java/me/retucio/sputnik/module/modules/world/LightOverlay.java b/src/main/java/me/retucio/sputnik/module/modules/world/LightOverlay.java index abc7e61..b4a5082 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/world/LightOverlay.java +++ b/src/main/java/me/retucio/sputnik/module/modules/world/LightOverlay.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.world; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.Render3DEvent; +import me.retucio.sputnik.event.events.render.Render3DEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; @@ -22,58 +22,58 @@ import java.util.concurrent.ConcurrentHashMap; public class LightOverlay extends Module { - SettingGroup sgDetection = addSg(new SettingGroup("detección", true)); - SettingGroup sgColors = addSg(new SettingGroup("colores", true)); - SettingGroup sgOptimization = addSg(new SettingGroup("optimización", true)); + private final SettingGroup sgDetection = addSg(new SettingGroup("detección", true)); + private final SettingGroup sgColors = addSg(new SettingGroup("colores", true)); + private final SettingGroup sgOptimization = addSg(new SettingGroup("optimización", true)); // detección - public NumberSetting radius = sgDetection.add(new NumberSetting( + private final NumberSetting radius = sgDetection.add(new NumberSetting( "radio", "radio a tener en cuenta al renderizar superposición", 16, 5, 128, 1)); - public NumberSetting yRadius = sgDetection.add(new NumberSetting( + private final NumberSetting yRadius = sgDetection.add(new NumberSetting( "rango vertical", "distancia vertical a tener en cuenta", 4, 1, 16, 1)); - public BooleanSetting onWater = sgDetection.add(new BooleanSetting( + private final BooleanSetting onWater = sgDetection.add(new BooleanSetting( "en agua", "mostrar también bloques cubiertos en agua", true)); - public BooleanSetting dontCullWater = sgDetection.add(new BooleanSetting( + private final BooleanSetting dontCullWater = sgDetection.add(new BooleanSetting( "evitar culling en agua", "mostrar superposición a través de bloques para poder verla desde fuera del agua", false)); // optimización, porque iba como la mierda - public NumberSetting updateInterval = sgOptimization.add(new NumberSetting( + private final NumberSetting updateInterval = sgOptimization.add(new NumberSetting( "intervalo de búsqueda", "cada cuántos ticks actualizar la búsqueda de bloques", 10, 1, 80, 1)); - public NumberSetting movementThreshold = sgOptimization.add(new NumberSetting( + private final NumberSetting movementThreshold = sgOptimization.add(new NumberSetting( "umbral de movimiento", "distancia que debe moverse el jugador antes de forzar una actualización", 3.0, 0.5, 10.0, 0.5)); - public BooleanSetting asyncSearch = sgOptimization.add(new BooleanSetting( + private final BooleanSetting asyncSearch = sgOptimization.add(new BooleanSetting( "búsqueda asíncrona", "buscar bloques en un hilo separado (reduce lag)", true)); - public BooleanSetting incrementalUpdates = sgOptimization.add(new BooleanSetting( + private final BooleanSetting incrementalUpdates = sgOptimization.add(new BooleanSetting( "actualizaciones incrementales", "actualizar solo los bloques nuevos / eliminados en lugar de recalcular todo", true)); // colores - public ColorSetting lightColor = sgColors.add(new ColorSetting( + private final ColorSetting lightColor = sgColors.add(new ColorSetting( "color de la luz", "color de los bloques con luz", new Color(0, 255, 0, 67), false)); - public ColorSetting darknessColor = sgColors.add(new ColorSetting( + private final ColorSetting darknessColor = sgColors.add(new ColorSetting( "color de oscuridad", "color de bloques con 0 luz", new Color(255, 0, 0, 67), false)); @@ -124,7 +124,7 @@ public class LightOverlay extends Module { @SubscribeEvent @SuppressWarnings("deprecation") - public void onRenderWorld(Render3DEvent event) { + private void onRenderWorld(Render3DEvent event) { if (mc.player == null || mc.world == null) return; // actualización periódica @@ -356,4 +356,4 @@ public class LightOverlay extends Module { return !aboveState.isOpaque() || !aboveState.isFullCube(mc.world, pos.up()); } -} \ No newline at end of file +} diff --git a/src/main/java/me/retucio/sputnik/module/modules/world/NoMiningInterruptions.java b/src/main/java/me/retucio/sputnik/module/modules/world/NoMiningInterruptions.java index e04f18b..7a404f1 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/world/NoMiningInterruptions.java +++ b/src/main/java/me/retucio/sputnik/module/modules/world/NoMiningInterruptions.java @@ -11,8 +11,8 @@ import net.minecraft.registry.tag.ItemTags; public class NoMiningInterruptions extends Module { - public BooleanSetting withPickaxeOnly = sgGeneral.add(new BooleanSetting("solo con pico", "ignorar entidades solamente cuando se sujeta un pico", false)); - public ListSetting> entities = sgGeneral.add(new ListSetting<>("entidades", "entidades a ignorar", + private final BooleanSetting withPickaxeOnly = sgGeneral.add(new BooleanSetting("solo con pico", "ignorar entidades solamente cuando se sujeta un pico", false)); + private final ListSetting> entities = sgGeneral.add(new ListSetting<>("entidades", "entidades a ignorar", Lists.entityList, Lists.allTrue(Lists.entityList), Lists.entityNames)); public NoMiningInterruptions() { diff --git a/src/main/java/me/retucio/sputnik/module/modules/world/Racist.java b/src/main/java/me/retucio/sputnik/module/modules/world/Racist.java index 36f1ceb..c383c16 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/world/Racist.java +++ b/src/main/java/me/retucio/sputnik/module/modules/world/Racist.java @@ -57,6 +57,4 @@ public class Racist extends Module { mc.player.setYaw((float) yaw); mc.player.setPitch((float) pitch); } - - } diff --git a/src/main/java/me/retucio/sputnik/module/modules/world/StrongholdTriangulator.java b/src/main/java/me/retucio/sputnik/module/modules/world/StrongholdTriangulator.java index 68083ba..1f300b9 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/world/StrongholdTriangulator.java +++ b/src/main/java/me/retucio/sputnik/module/modules/world/StrongholdTriangulator.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.world; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.AddEntityEvent; +import me.retucio.sputnik.event.events.network.AddEntityEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.util.ChatUtil; @@ -77,7 +77,7 @@ public class StrongholdTriangulator extends Module { } @SubscribeEvent - public void onAddEntity(AddEntityEvent event) { + private void onAddEntity(AddEntityEvent event) { if (mc.player == null || mc.world == null) return; if (mc.player.getStackInHand(Hand.MAIN_HAND).getItem() != Items.ENDER_EYE) return; @@ -124,7 +124,6 @@ public class StrongholdTriangulator extends Module { return (EyeOfEnderEntity) mc.world.getEntityById(entityId); } - private StrongholdResult getIntersection() { if (a == null || b == null) return null; diff --git a/src/main/java/me/retucio/sputnik/module/modules/world/TimeChanger.java b/src/main/java/me/retucio/sputnik/module/modules/world/TimeChanger.java index 24d05cd..3ca5553 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/world/TimeChanger.java +++ b/src/main/java/me/retucio/sputnik/module/modules/world/TimeChanger.java @@ -1,7 +1,7 @@ package me.retucio.sputnik.module.modules.world; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.PacketEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.setting.SettingGroup; @@ -10,16 +10,21 @@ import me.retucio.sputnik.module.setting.settings.EnumSetting; import me.retucio.sputnik.module.setting.settings.NumberSetting; import net.minecraft.network.packet.s2c.play.WorldTimeUpdateS2CPacket; -// continúa en ClientWorldPropertiesMixin, DimensionTypeMixin, + +/** continúa en: + * @see me.retucio.sputnik.mixin.ClientWorldPropertiesMixin + * @see me.retucio.sputnik.mixin.SkyRendererMixin + */ + public class TimeChanger extends Module { - SettingGroup sgCelestialBodies = addSg(new SettingGroup("cuerpos celeste", false)); + private final SettingGroup sgCelestialBodies = addSg(new SettingGroup("cuerpos celeste", false)); - public NumberSetting time = sgGeneral.add(new NumberSetting("hora", "hora del juego", 0, -20000, 20000, 1)); + public final NumberSetting time = sgGeneral.add(new NumberSetting("hora", "hora del juego", 0, -20000, 20000, 1)); - public BooleanSetting renderSun = sgCelestialBodies.add(new BooleanSetting("sol", "que haya sol o no", true)); - public BooleanSetting renderMoon = sgCelestialBodies.add(new BooleanSetting("luna", "que haya luna o no", true)); - public BooleanSetting renderStars = sgCelestialBodies.add(new BooleanSetting("estrellas", "que hayan estrellas o no", true)); + public final BooleanSetting renderSun = sgCelestialBodies.add(new BooleanSetting("sol", "que haya sol o no", true)); + public final BooleanSetting renderMoon = sgCelestialBodies.add(new BooleanSetting("luna", "que haya luna o no", true)); + public final BooleanSetting renderStars = sgCelestialBodies.add(new BooleanSetting("estrellas", "que hayan estrellas o no", true)); public EnumSetting moonPhase = sgCelestialBodies.add(new EnumSetting<>("fase lunar", "fase lunar actual", MoonPhases.class, MoonPhases.DEFAULT)); @@ -47,20 +52,20 @@ public class TimeChanger extends Module { super.onDisable(); } - @SubscribeEvent - public void onPacketReceive(PacketEvent.Receive event) { - if (event.getPacket() instanceof WorldTimeUpdateS2CPacket packet) { - realTime = packet.timeOfDay(); - event.cancel(); - } - } - @Override public void onTick() { if (mc.world == null) return; mc.world.getLevelProperties().setTimeOfDay(time.getLongValue()); } + @SubscribeEvent + private void onPacketReceive(PacketEvent.Receive event) { + if (event.getPacket() instanceof WorldTimeUpdateS2CPacket packet) { + realTime = packet.timeOfDay(); + event.cancel(); + } + } + public enum MoonPhases { FULL_MOON("luna llena"), WANING_GIBBOUS("menguante gibosa"), diff --git a/src/main/java/me/retucio/sputnik/module/setting/Setting.java b/src/main/java/me/retucio/sputnik/module/setting/Setting.java index 0631e10..2aa15c1 100644 --- a/src/main/java/me/retucio/sputnik/module/setting/Setting.java +++ b/src/main/java/me/retucio/sputnik/module/setting/Setting.java @@ -46,9 +46,11 @@ public abstract class Setting { } public String getName() { - return name; + return name.strip(); } + public String getTrueName() { return name; } + public String getDescription() { return description; } diff --git a/src/main/java/me/retucio/sputnik/module/setting/settings/KeySetting.java b/src/main/java/me/retucio/sputnik/module/setting/settings/KeySetting.java index 515c0ba..1349756 100644 --- a/src/main/java/me/retucio/sputnik/module/setting/settings/KeySetting.java +++ b/src/main/java/me/retucio/sputnik/module/setting/settings/KeySetting.java @@ -41,6 +41,10 @@ public class KeySetting extends Setting { super.setValue(value); } + public boolean isDown() { + return KeyUtil.isKeyDown(this.value); + } + public String getKeyName() { return KeyUtil.getKeyName(value); } diff --git a/src/main/java/me/retucio/sputnik/module/setting/settings/NumberSetting.java b/src/main/java/me/retucio/sputnik/module/setting/settings/NumberSetting.java index dd008e8..a39685d 100644 --- a/src/main/java/me/retucio/sputnik/module/setting/settings/NumberSetting.java +++ b/src/main/java/me/retucio/sputnik/module/setting/settings/NumberSetting.java @@ -64,6 +64,10 @@ public class NumberSetting extends Setting { super.setValue(value); } + public boolean isValid(double value) { + return value >= min && value <= max; + } + public double getMin() { return min; } diff --git a/src/main/java/me/retucio/sputnik/ui/hud/HudEditorScreen.java b/src/main/java/me/retucio/sputnik/ui/hud/HudEditorScreen.java index 5ce572c..2e025db 100644 --- a/src/main/java/me/retucio/sputnik/ui/hud/HudEditorScreen.java +++ b/src/main/java/me/retucio/sputnik/ui/hud/HudEditorScreen.java @@ -3,7 +3,7 @@ package me.retucio.sputnik.ui.hud; import me.retucio.sputnik.Sputnik; import me.retucio.sputnik.config.ConfigManager; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.KeyEvent; +import me.retucio.sputnik.event.events.input.KeyEvent; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.client.HUD; import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame; diff --git a/src/main/java/me/retucio/sputnik/ui/screen/ClickGUI.java b/src/main/java/me/retucio/sputnik/ui/screen/ClickGUI.java index a09dd67..71cb469 100644 --- a/src/main/java/me/retucio/sputnik/ui/screen/ClickGUI.java +++ b/src/main/java/me/retucio/sputnik/ui/screen/ClickGUI.java @@ -2,9 +2,9 @@ package me.retucio.sputnik.ui.screen; import me.retucio.sputnik.Sputnik; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.KeyEvent; -import me.retucio.sputnik.event.events.MouseClickEvent; -import me.retucio.sputnik.event.events.MouseScrollEvent; +import me.retucio.sputnik.event.events.input.KeyEvent; +import me.retucio.sputnik.event.events.input.MouseClickEvent; +import me.retucio.sputnik.event.events.input.MouseScrollEvent; import me.retucio.sputnik.event.events.sputnik.SettingsFrameEvent; import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Module; diff --git a/src/main/java/me/retucio/sputnik/ui/widgets/buttons/settings/ColorButton.java b/src/main/java/me/retucio/sputnik/ui/widgets/buttons/settings/ColorButton.java index 09206f1..5dbd857 100644 --- a/src/main/java/me/retucio/sputnik/ui/widgets/buttons/settings/ColorButton.java +++ b/src/main/java/me/retucio/sputnik/ui/widgets/buttons/settings/ColorButton.java @@ -36,7 +36,7 @@ public class ColorButton extends SettingButton { int previewX = x + 5; int previewY = y + 3; - DrawUtil.drawBorder(ctx, previewX - 1, previewY - 1, previewSize + 2, previewSize + 2, Colors.getOppositeColor(setting.getValue(), true).getRGB()); + DrawUtil.drawBorder(ctx, previewX - 1, previewY - 1, previewSize + 2, previewSize + 2, Colors.withAlpha(Colors.getOppositeColor(setting.getValue(), true), 255).getRGB()); ctx.fill(previewX, previewY, previewX + previewSize, previewY + previewSize, setting.getValue().getRGB()); // texto diff --git a/src/main/java/me/retucio/sputnik/util/ChatUtil.java b/src/main/java/me/retucio/sputnik/util/ChatUtil.java index c23dd7b..ee9a8ab 100644 --- a/src/main/java/me/retucio/sputnik/util/ChatUtil.java +++ b/src/main/java/me/retucio/sputnik/util/ChatUtil.java @@ -1,6 +1,9 @@ package me.retucio.sputnik.util; +import com.mojang.brigadier.exceptions.CommandSyntaxException; import me.retucio.sputnik.Sputnik; +import me.retucio.sputnik.command.Command; +import me.retucio.sputnik.command.CommandManager; import me.retucio.sputnik.event.SubscribeEvent; import me.retucio.sputnik.event.events.sputnik.LoadModuleManagerEvent; import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame; @@ -19,6 +22,20 @@ public class ChatUtil { prefix = Colors.getFormatting(Colors.mainColor) + "[" + ClientSettingsFrame.guiSettings.chatName.getValue() + "] "; } + public static void simulateChatMessage(String message) { + if (message.startsWith("/")) { + mc.player.networkHandler.sendChatCommand(message.substring(1)); + } else if (message.startsWith(CommandManager.INSTANCE.getPrefix())) { + try { + CommandManager.dispatch(message.substring(CommandManager.INSTANCE.getPrefix().length())); + } catch (CommandSyntaxException e) { + ChatUtil.error(e.getMessage()); + } + } else { + mc.player.networkHandler.sendChatMessage(message); + } + } + public static void addMessage(String text) { addMessage(Text.of(text)); diff --git a/src/main/java/me/retucio/sputnik/util/Colors.java b/src/main/java/me/retucio/sputnik/util/Colors.java index 9319fc9..a695643 100644 --- a/src/main/java/me/retucio/sputnik/util/Colors.java +++ b/src/main/java/me/retucio/sputnik/util/Colors.java @@ -159,4 +159,13 @@ public class Colors { alpha ); } + + public static Color withAlpha(Color c, int alpha) { + return new Color( + c.getRed(), + c.getGreen(), + c.getBlue(), + alpha + ); + } } diff --git a/src/main/java/me/retucio/sputnik/util/InventoryUtil.java b/src/main/java/me/retucio/sputnik/util/InventoryUtil.java index 563617b..c67a38b 100644 --- a/src/main/java/me/retucio/sputnik/util/InventoryUtil.java +++ b/src/main/java/me/retucio/sputnik/util/InventoryUtil.java @@ -1,15 +1,17 @@ package me.retucio.sputnik.util; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.DisconnectEvent; -import me.retucio.sputnik.event.events.OpenScreenEvent; +import me.retucio.sputnik.event.events.network.DisconnectEvent; +import me.retucio.sputnik.event.events.interact.OpenScreenEvent; import me.retucio.sputnik.mixin.accessor.KeyBindingAccessor; import net.minecraft.client.gui.screen.ingame.GenericContainerScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.component.ComponentType; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Inventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.registry.tag.TagKey; import net.minecraft.screen.GenericContainerScreenHandler; import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.screen.ScreenHandler; @@ -42,10 +44,37 @@ public class InventoryUtil { return null; } + public static List getStacksOfTag(TagKey tag) { + if (mc.player == null) return null; + List stacks = new ArrayList<>(); + for (ItemStack stack : mc.player.getInventory()) { + for (TagKey tagkey : stack.streamTags().toList()) { + if (tag.equals(tagkey)) { + stacks.add(stack); + } + } + } + return stacks; + } + + public static List getStacksOfComponentType(ComponentType componentType) { + List stacks = new ArrayList<>(); + if (mc.player == null) return stacks; + for (ItemStack stack : mc.player.getInventory()) { + if (stack.getComponents().getTypes().contains(componentType)) { + stacks.add(stack); + } + } + return stacks; + } + public static void swapSlots(int containerSlot1, int containerSlot2, HandledScreen screen) { + swapSlots(containerSlot1, containerSlot2, screen.getScreenHandler()); + } + + public static void swapSlots(int containerSlot1, int containerSlot2, ScreenHandler handler) { if (mc.player == null || mc.interactionManager == null) return; - ScreenHandler handler = screen.getScreenHandler(); int syncId = handler.syncId; mc.interactionManager.clickSlot(syncId, containerSlot1, 0, SlotActionType.PICKUP, mc.player); @@ -54,9 +83,11 @@ public class InventoryUtil { } public static void swapWithHotbar(int containerSlot, int hotbarSlot, HandledScreen screen) { - if (mc.player == null || mc.interactionManager == null) return; + swapWithHotbar(containerSlot, hotbarSlot, screen.getScreenHandler()); + } - ScreenHandler handler = screen.getScreenHandler(); + public static void swapWithHotbar(int containerSlot, int hotbarSlot, ScreenHandler handler) { + if (mc.player == null || mc.interactionManager == null) return; mc.interactionManager.clickSlot(handler.syncId, containerSlot, hotbarSlot, SlotActionType.SWAP, mc.player); } @@ -164,10 +195,13 @@ public class InventoryUtil { } public static List findMatchingItems(HandledScreen screen, ItemStack reference) { + return findMatchingItems(screen.getScreenHandler(), reference); + } + + public static List findMatchingItems(ScreenHandler handler, ItemStack reference) { List matchingSlots = new ArrayList<>(); if (reference.isEmpty()) return matchingSlots; - ScreenHandler handler = screen.getScreenHandler(); for (int i = 0; i < handler.slots.size(); i++) { ItemStack stack = handler.getSlot(i).getStack(); if (!stack.isEmpty() && ItemStack.areItemsAndComponentsEqual(reference, stack)) { @@ -178,6 +212,20 @@ public class InventoryUtil { return matchingSlots; } + public static List findItem(Item item) { + List matchingSlots = new ArrayList<>(); + PlayerInventory inv = mc.player.getInventory(); + + for (int i = 0; i < inv.size(); i++) { + ItemStack stack = inv.getStack(i); + if (!stack.isEmpty() && stack.isOf(item)) { + matchingSlots.add(i); + } + } + + return matchingSlots; + } + public static void quickMoveAll(HandledScreen screen, ItemStack reference) { if (mc.player == null || mc.interactionManager == null) return; diff --git a/src/main/java/me/retucio/sputnik/util/MiscUtil.java b/src/main/java/me/retucio/sputnik/util/MiscUtil.java index 6425709..65be1c3 100644 --- a/src/main/java/me/retucio/sputnik/util/MiscUtil.java +++ b/src/main/java/me/retucio/sputnik/util/MiscUtil.java @@ -13,6 +13,7 @@ import java.time.Instant; import java.time.LocalTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; +import java.util.List; import static me.retucio.sputnik.Sputnik.mc; @@ -34,6 +35,19 @@ public class MiscUtil { destination.z = source.z; } + @SuppressWarnings("unchecked") + public static T getHighest(List list) { + if (list.getFirst() == null || !(list.getFirst() instanceof Number value)) return null; + Number maxValue = value; + for (T t : list) { + if (((Number) t).doubleValue() > maxValue.doubleValue()) { + maxValue = (Number) t; + } + } + + return (T) maxValue; + } + public static String getCurrentFormattedTime() { return getFormattedTime(System.currentTimeMillis()); } diff --git a/src/main/java/me/retucio/sputnik/util/NetworkUtil.java b/src/main/java/me/retucio/sputnik/util/NetworkUtil.java index 8cc3b10..aae0a7c 100644 --- a/src/main/java/me/retucio/sputnik/util/NetworkUtil.java +++ b/src/main/java/me/retucio/sputnik/util/NetworkUtil.java @@ -2,12 +2,16 @@ package me.retucio.sputnik.util; import me.retucio.sputnik.event.SubscribeEvent; -import me.retucio.sputnik.event.events.PacketEvent; +import me.retucio.sputnik.event.events.network.PacketEvent; import net.minecraft.client.MinecraftClient; import net.minecraft.network.ClientConnection; import net.minecraft.network.listener.PacketListener; import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; import net.minecraft.network.packet.s2c.play.WorldTimeUpdateS2CPacket; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; import java.util.ArrayList; import java.util.List; @@ -71,4 +75,18 @@ public class NetworkUtil { public static void receivePacketNoEvent(Packet packet, PacketListener listener) { ClientConnection.handlePacket(packet, listener); } + + public static void interactBlock(BlockHitResult blockHitResult, Hand hand, boolean swing) { + boolean wasSneaking = mc.player.isSneaking(); + mc.player.setSneaking(false); + + ActionResult result = mc.interactionManager.interactBlock(mc.player, hand, blockHitResult); + + if (result.isAccepted()) { + if (swing) mc.player.swingHand(hand); + else mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(hand)); + } + + mc.player.setSneaking(wasSneaking); + } } \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/util/misc/ProjectileInfo.java b/src/main/java/me/retucio/sputnik/util/misc/ProjectileInfo.java new file mode 100644 index 0000000..e48d420 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/util/misc/ProjectileInfo.java @@ -0,0 +1,192 @@ +package me.retucio.sputnik.util.misc; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.ChargedProjectilesComponent; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.enchantment.Enchantments; +import net.minecraft.item.*; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; + +import java.util.ArrayList; +import java.util.List; + +public record ProjectileInfo ( + double gravity, double drag, Vec3d initialVelocity, Vec3d offset, Vec3d position, + double waterDrag, double underwaterGravity, List order +) { + + private static final List ORDER_MDG = List.of(0, 1, 2); // move-drag-gravity + private static final List ORDER_GMD = List.of(2, 0, 1); // gravity-move-drag + private static final List ORDER_GDM = List.of(2, 1, 0); // gravity-drag-move + + private static final MinecraftClient mc = MinecraftClient.getInstance(); + + public ProjectileInfo(double gravity, double drag, Vec3d initialVelocity, Vec3d offset, + Vec3d position, double waterDrag, List order) { + this(gravity, drag, initialVelocity, offset, position, waterDrag, gravity, order); + } + + public static List getItemsInfo(ItemStack itemStack) { + float tickProgress = mc.getRenderTickCounter().getTickProgress(false); + Vec3d position = mc.player.getCameraPosVec(tickProgress).add(0, -0.1, 0); + Item item = itemStack.getItem(); + + if (item instanceof BowItem) { + return getBowProjectileInfo(tickProgress, position); + } else if (item instanceof CrossbowItem) { + return getCrossbowProjectileInfo(tickProgress, itemStack, position); + } else if (item instanceof TridentItem) { + return getTridentProjectileInfo(tickProgress, itemStack, position); + } else if (item instanceof SnowballItem || item instanceof EggItem || item instanceof EnderPearlItem) { + return getThrowableProjectileInfo(tickProgress, position); + } else if (item instanceof WindChargeItem) { + return getWindChargeProjectileInfo(tickProgress, position); + } else if (item instanceof ThrowablePotionItem) { + return getPotionProjectileInfo(position); + } else if (item instanceof ExperienceBottleItem) { + return getExperienceBottleProjectileInfo(position); + } else if (item instanceof FishingRodItem && mc.player.fishHook == null) { + return getFishingRodProjectileInfo(tickProgress); + } + + return new ArrayList<>(); + } + + private static List getBowProjectileInfo(float tickProgress, Vec3d position) { + List list = new ArrayList<>(); + int useTicks = mc.player.getItemUseTime(); + float pull = BowItem.getPullProgress(useTicks); + + if (pull >= 0.1) { + Vec3d velocity = mc.player.getRotationVec(tickProgress).multiply(3 * pull); + Vec3d offset = new Vec3d(0.2, -0.06, 0.2); + list.add(new ProjectileInfo(0.05, 0.99, velocity, offset, position, 0.6, ORDER_MDG)); + } + return list; + } + + private static List getCrossbowProjectileInfo(float tickProgress, ItemStack itemStack, Vec3d position) { + List list = new ArrayList<>(); + double gravity = 0.05; + double drag = 0.99; + double waterDrag = 0.6; + + Vec3d velocity = mc.player.getRotationVec(tickProgress).multiply(3.15); + Vec3d offset = new Vec3d(0, -0.06, 0.03); + + ChargedProjectilesComponent projectiles = itemStack.get(DataComponentTypes.CHARGED_PROJECTILES); + if (projectiles != null) { + for (ItemStack projectile : projectiles.getProjectiles()) { + if (projectile.isOf(Items.FIREWORK_ROCKET)) { + velocity = mc.player.getRotationVec(tickProgress).multiply(1.6f); + gravity = 0; + waterDrag = drag; + } + } + } + + if (CrossbowItem.isCharged(itemStack)) { + list.add(new ProjectileInfo(gravity, drag, velocity, offset, position, waterDrag, ORDER_MDG)); + + if (hasEnchantment(itemStack, Enchantments.MULTISHOT)) { + float angle = 10f; + Vec3d vel1 = velocity.rotateY((float) Math.toRadians(angle)); + Vec3d vel2 = velocity.rotateY((float) Math.toRadians(-angle)); + list.add(new ProjectileInfo(gravity, drag, vel1, offset, position, waterDrag, ORDER_MDG)); + list.add(new ProjectileInfo(gravity, drag, vel2, offset, position, waterDrag, ORDER_MDG)); + } + } + return list; + } + + private static List getTridentProjectileInfo(float tickProgress, ItemStack itemStack, Vec3d position) { + List list = new ArrayList<>(); + int useTicks = mc.player.getItemUseTime(); + + if (useTicks >= TridentItem.MIN_DRAW_DURATION && !hasEnchantment(itemStack, Enchantments.RIPTIDE)) { + Vec3d velocity = mc.player.getRotationVec(tickProgress).multiply(TridentItem.THROW_SPEED); + Vec3d offset = new Vec3d(0.2, 0.1, 0.2); + list.add(new ProjectileInfo(0.05, 0.99, velocity, offset, position, 0.99, ORDER_MDG)); + } + return list; + } + + private static List getThrowableProjectileInfo(float tickProgress, Vec3d position) { + Vec3d velocity = mc.player.getRotationVec(tickProgress).multiply(SnowballItem.POWER); + Vec3d offset = new Vec3d(0.2, -0.06, 0.2); + + return List.of(new ProjectileInfo(0.03, 0.99, velocity, offset, position, 0.8, ORDER_GDM)); + } + + private static List getWindChargeProjectileInfo(float tickProgress, Vec3d position) { + Vec3d velocity = mc.player.getRotationVec(tickProgress).multiply(1.5f); + Vec3d offset = new Vec3d(0.2, -0.06, 0.2); + + return List.of(new ProjectileInfo(0, 1, velocity, offset, position, 1, ORDER_MDG)); + } + + private static List getPotionProjectileInfo(Vec3d position) { + Vec3d direction = angleFromRotation(mc.player.getYaw(), mc.player.getPitch()); + Vec3d velocity = direction.multiply(ThrowablePotionItem.POWER); + Vec3d offset = new Vec3d(0.2, -0.06, 0.2); + + return List.of(new ProjectileInfo(0.05, 0.99, velocity, offset, position, 0.8, ORDER_GDM)); + } + + private static List getExperienceBottleProjectileInfo(Vec3d position) { + Vec3d direction = angleFromRotation(mc.player.getYaw(), mc.player.getPitch()).normalize(); + Vec3d velocity = direction.multiply(0.7); + Vec3d offset = new Vec3d(0.2, -0.06, 0.2); + + return List.of(new ProjectileInfo(0.07, 0.99, velocity, offset, position, 0.8, ORDER_GDM)); + } + + private static List getFishingRodProjectileInfo(float tickProgress) { + Vec3d cameraPos = mc.player.getCameraPosVec(tickProgress); + + float yawRad = (float) Math.toRadians(mc.player.getYaw()); + float pitchRad = (float) Math.toRadians(mc.player.getPitch()); + + Vec3d position = new Vec3d( + cameraPos.x - MathHelper.sin(-yawRad) * 0.3, + cameraPos.y, + cameraPos.z - MathHelper.cos(-yawRad) * 0.3 + ); + + float h = MathHelper.cos(-yawRad - MathHelper.PI); + float i = MathHelper.sin(-yawRad - MathHelper.PI); + float j = -MathHelper.cos(-pitchRad); + float k = MathHelper.sin(-pitchRad); + + Vec3d velocity = new Vec3d(-i, MathHelper.clamp(-(k / j), -5f, 5f), -h); + double length = velocity.length(); + velocity = velocity.multiply(0.6 / length + 0.5); + Vec3d offset = new Vec3d(0.16, -0.06, 0.2); + + return List.of(new ProjectileInfo(0.03, 0.92, velocity, offset, position, 0.92, ORDER_GMD)); + } + + public static boolean hasEnchantment(ItemStack stack, RegistryKey enchantment) { + Registry registry = mc.player.getEntityWorld().getRegistryManager().getOrThrow(RegistryKeys.ENCHANTMENT); + RegistryEntry entry = registry.getOrThrow(enchantment); + return EnchantmentHelper.getLevel(entry, stack) > 0; + } + + private static Vec3d angleFromRotation(float yaw, float pitch) { + float yawRad = (float) Math.toRadians(yaw); + float pitchRad = (float) Math.toRadians(pitch); + + float x = -MathHelper.sin(yawRad) * MathHelper.cos(pitchRad); + float y = -MathHelper.sin(Math.toRadians(pitch - 20)); + float z = MathHelper.cos(yawRad) * MathHelper.cos(pitchRad); + + return new Vec3d(x, y, z).normalize(); + } +} \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/util/render/Pipelines.java b/src/main/java/me/retucio/sputnik/util/render/Pipelines.java index 6085de0..cbf23cc 100644 --- a/src/main/java/me/retucio/sputnik/util/render/Pipelines.java +++ b/src/main/java/me/retucio/sputnik/util/render/Pipelines.java @@ -3,51 +3,66 @@ package me.retucio.sputnik.util.render; import com.mojang.blaze3d.pipeline.BlendFunction; import com.mojang.blaze3d.pipeline.RenderPipeline; import com.mojang.blaze3d.platform.DepthTestFunction; +import com.mojang.blaze3d.systems.GpuDevice; +import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.VertexFormat; + import me.retucio.sputnik.Sputnik; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gl.UniformType; import net.minecraft.client.render.VertexFormats; +import net.minecraft.resource.Resource; +import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; +import org.apache.commons.io.IOUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + public class Pipelines { - static final RenderPipeline LINES_PIPELINE = RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET) + static List PIPELINES = new ArrayList<>(); + + static final RenderPipeline LINES_PIPELINE = add(RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET) .withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/lines")) .withVertexFormat(VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH, VertexFormat.DrawMode.LINES) .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST) .withDepthWrite(false) .withCull(false) - .build(); + .build()); - static final RenderPipeline LINES_CULL_PIPELINE = RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET) + static final RenderPipeline LINES_CULL_PIPELINE = add(RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET) .withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/lines_cull")) .withVertexFormat(VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH, VertexFormat.DrawMode.LINES) .withDepthTestFunction(DepthTestFunction.LEQUAL_DEPTH_TEST) .withDepthWrite(false) .withCull(true) - .build(); + .build()); - static final RenderPipeline QUADS_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET) + static final RenderPipeline QUADS_PIPELINE = add(RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET) .withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/quads")) .withVertexFormat(VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS) .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST) .withBlend(BlendFunction.TRANSLUCENT) .withDepthWrite(false) .withCull(false) - .build(); + .build()); - static final RenderPipeline QUADS_CULL_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET) + static final RenderPipeline QUADS_CULL_PIPELINE = add(RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET) .withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/quads_cull")) .withVertexFormat(VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS) .withDepthTestFunction(DepthTestFunction.LEQUAL_DEPTH_TEST) .withBlend(BlendFunction.TRANSLUCENT) .withDepthWrite(false) .withCull(false) - .build(); + .build()); - public static final RenderPipeline TEXT_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_TEX_COLOR_SNIPPET) + static final RenderPipeline TEXT_PIPELINE = add(RenderPipeline.builder(RenderPipelines.POSITION_TEX_COLOR_SNIPPET) .withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/text")) .withVertexFormat(VertexFormats.POSITION_TEXTURE_COLOR, VertexFormat.DrawMode.TRIANGLES) .withVertexShader(Identifier.of(Sputnik.MOD_ID, "shaders/text.vert")) @@ -57,5 +72,31 @@ public class Pipelines { .withDepthWrite(false) .withBlend(BlendFunction.TRANSLUCENT) .withCull(false) - .build(); + .build()); + + public static void init() { + for (RenderPipeline pipeline : PIPELINES) { + precompile(pipeline); + } + } + + private static RenderPipeline add(RenderPipeline pipeline) { + PIPELINES.add(pipeline); + return pipeline; + } + + public static void precompile(RenderPipeline pipeline) { + GpuDevice device = RenderSystem.getDevice(); + ResourceManager resources = MinecraftClient.getInstance().getResourceManager(); + + device.precompilePipeline(pipeline, (identifier, shaderType) -> { + Resource resource = resources.getResource(identifier).get(); + + try (InputStream in = resource.getInputStream()) { + return IOUtils.toString(in, StandardCharsets.UTF_8); + } catch (IOException e) { + throw new RuntimeException(e); + } + }); + } } \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/util/render/RenderUtil.java b/src/main/java/me/retucio/sputnik/util/render/RenderUtil.java index 303deda..ae7d332 100644 --- a/src/main/java/me/retucio/sputnik/util/render/RenderUtil.java +++ b/src/main/java/me/retucio/sputnik/util/render/RenderUtil.java @@ -6,6 +6,7 @@ import net.minecraft.client.render.*; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.*; import net.minecraft.util.shape.VoxelShape; +import org.joml.Vector3f; import java.awt.*; @@ -48,6 +49,34 @@ public class RenderUtil { drawFilledRect(matrices, x1, y, x2 + width, y + width, color); } + public static void drawVector(MatrixStack matrices, Vector3f start, Vec3d direction, Color c, float lineWidth) { + BufferBuilder buffer = tesselator.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH); + + MatrixStack.Entry pose = matrices.peek(); + + int color = c.getRGB(); + float r = ((color >> 16) & 0xFF) / 255f; + float g = ((color >> 8) & 0xFF) / 255f; + float b = (color & 0xFF) / 255f; + float a = ((color >> 24) & 0xFF) / 255f; + + float endX = start.x() + (float) direction.x; + float endY = start.y() + (float) direction.y; + float endZ = start.z() + (float) direction.z; + + buffer.vertex(pose.getPositionMatrix(), start.x(), start.y(), start.z()) + .color(r, g, b, a) + .normal(pose, (float) direction.x, (float) direction.y, (float) direction.z) + .lineWidth(lineWidth); + + buffer.vertex(pose.getPositionMatrix(), endX, endY, endZ) + .color(r, g, b, a) + .normal(pose, (float) direction.x, (float) direction.y, (float) direction.z) + .lineWidth(lineWidth); + + Layers.lines().draw(buffer.end()); + } + public static void drawVerticalLine(MatrixStack matrices, float x, float y1, float y2, Color color, float width) { if (y2 < y1) { float i = y1; diff --git a/src/main/java/me/retucio/sputnik/util/render/Textures.java b/src/main/java/me/retucio/sputnik/util/render/Textures.java index 5b15985..8a9629e 100644 --- a/src/main/java/me/retucio/sputnik/util/render/Textures.java +++ b/src/main/java/me/retucio/sputnik/util/render/Textures.java @@ -41,7 +41,7 @@ public class Textures { return false; } - public static void registerAll() { + public static void init() { for (Identifier id : textures) { register(id); } diff --git a/src/main/resources/assets/sputnik/shaders/lsd.frag b/src/main/resources/assets/sputnik/shaders/lsd.frag new file mode 100644 index 0000000..9ab4847 --- /dev/null +++ b/src/main/resources/assets/sputnik/shaders/lsd.frag @@ -0,0 +1,126 @@ +#version 330 core + +#define M_PI 3.1415926535897932384626433832795 + +layout(std140) uniform LsdUniforms { + float strength; + float seed; + float time; + float rotations; +}; + +uniform sampler2D DiffuseSampler; + +in vec2 texCoord; +out vec4 fragColor; + +vec4 permute(vec4 x){ return mod(((x*34.0)+1.0)*x, 289.0); } +vec4 taylorInvSqrt(vec4 r){ return 1.79284291400159 - 0.85373472095314 * r; } +vec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); } + +float cnoise(vec3 P){ + vec3 Pi0 = floor(P); + vec3 Pi1 = Pi0 + vec3(1.0); + Pi0 = mod(Pi0, 289.0); + Pi1 = mod(Pi1, 289.0); + vec3 Pf0 = fract(P); + vec3 Pf1 = Pf0 - vec3(1.0); + vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); + vec4 iy = vec4(Pi0.yy, Pi1.yy); + vec4 iz0 = Pi0.zzzz; + vec4 iz1 = Pi1.zzzz; + + vec4 ixy = permute(permute(ix) + iy); + vec4 ixy0 = permute(ixy + iz0); + vec4 ixy1 = permute(ixy + iz1); + + vec4 gx0 = ixy0 / 7.0; + vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5; + gx0 = fract(gx0); + vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); + vec4 sz0 = step(gz0, vec4(0.0)); + gx0 -= sz0 * (step(0.0, gx0) - 0.5); + gy0 -= sz0 * (step(0.0, gy0) - 0.5); + + vec4 gx1 = ixy1 / 7.0; + vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5; + gx1 = fract(gx1); + vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); + vec4 sz1 = step(gz1, vec4(0.0)); + gx1 -= sz1 * (step(0.0, gx1) - 0.5); + gy1 -= sz1 * (step(0.0, gy1) - 0.5); + + vec3 g000 = vec3(gx0.x, gy0.x, gz0.x); + vec3 g100 = vec3(gx0.y, gy0.y, gz0.y); + vec3 g010 = vec3(gx0.z, gy0.z, gz0.z); + vec3 g110 = vec3(gx0.w, gy0.w, gz0.w); + vec3 g001 = vec3(gx1.x, gy1.x, gz1.x); + vec3 g101 = vec3(gx1.y, gy1.y, gz1.y); + vec3 g011 = vec3(gx1.z, gy1.z, gz1.z); + vec3 g111 = vec3(gx1.w, gy1.w, gz1.w); + + vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); + g000 *= norm0.x; + g010 *= norm0.y; + g100 *= norm0.z; + g110 *= norm0.w; + vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); + g001 *= norm1.x; + g011 *= norm1.y; + g101 *= norm1.z; + g111 *= norm1.w; + + float n000 = dot(g000, Pf0); + float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); + float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); + float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); + float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); + float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); + float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); + float n111 = dot(g111, Pf1); + + vec3 fade_xyz = fade(Pf0); + vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); + vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); + float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); + return 2.2 * n_xyz; +} + + +vec3 hueShift(vec3 color, float hueAdjust){ + const vec3 kRGBToYPrime = vec3(0.299, 0.587, 0.114); + const vec3 kRGBToI = vec3(0.596, -0.275, -0.321); + const vec3 kRGBToQ = vec3(0.212, -0.523, 0.311); + + const vec3 kYIQToR = vec3 (1.0, 0.956, 0.621); + const vec3 kYIQToG = vec3 (1.0, -0.272, -0.647); + const vec3 kYIQToB = vec3 (1.0, -1.107, 1.704); + + float YPrime = dot(color, kRGBToYPrime); + float I = dot(color, kRGBToI); + float Q = dot(color, kRGBToQ); + float hue = atan(Q, I); + float chroma = sqrt(I * I + Q * Q); + + hue += hueAdjust; + + Q = chroma * sin(hue); + I = chroma * cos(hue); + + vec3 yIQ = vec3(YPrime, I, Q); + + return vec3(dot(yIQ, kYIQToR), dot(yIQ, kYIQToG), dot(yIQ, kYIQToB)); + +} + +void main() { + vec2 oneTexel = vec2(1.0) / vec2(textureSize(DiffuseSampler, 0)); + + float perlin = cnoise(vec3(texCoord/oneTexel/100.0, time)); + float ang = radians(perlin * 360.0) * rotations; + float s = sin(ang); + float c = cos(ang); + vec2 offset = vec2(s, c) * perlin; + vec4 tex = texture(DiffuseSampler, texCoord + (offset * strength * 30.0) * oneTexel); + fragColor = mix(tex, vec4(hueShift(tex.rgb, seed * 2.0 * M_PI), 1.0), strength); +} \ No newline at end of file diff --git a/src/main/resources/assets/sputnik/shaders/lsd.vert b/src/main/resources/assets/sputnik/shaders/lsd.vert new file mode 100644 index 0000000..87fcc03 --- /dev/null +++ b/src/main/resources/assets/sputnik/shaders/lsd.vert @@ -0,0 +1,11 @@ +#version 330 core + +layout(location = 0) in vec3 Position; +layout(location = 1) in vec2 TexCoord; + +out vec2 texCoord; + +void main() { + gl_Position = vec4(Position, 1.0); + texCoord = TexCoord; +} \ No newline at end of file diff --git a/src/main/resources/sputnik.accesswidener b/src/main/resources/sputnik.accesswidener index e56d4bf..28f30df 100644 --- a/src/main/resources/sputnik.accesswidener +++ b/src/main/resources/sputnik.accesswidener @@ -34,10 +34,18 @@ accessible class net/minecraft/client/particle/ParticleSpriteManager$SimpleSprit accessible field net/minecraft/client/render/WorldRenderer worldRenderState Lnet/minecraft/client/render/state/WorldRenderState; accessible method net/minecraft/client/render/RenderLayer (Ljava/lang/String;Lnet/minecraft/client/render/RenderSetup;)V accessible method net/minecraft/client/render/GameRenderer getProjectionMatrix (F)Lorg/joml/Matrix4f; +accessible method com/mojang/blaze3d/pipeline/RenderPipeline$Builder withSnippet (Lcom/mojang/blaze3d/pipeline/RenderPipeline$Snippet;)V # misc. +accessible field net/minecraft/client/MinecraftClient resourceManager Lnet/minecraft/resource/ReloadableResourceManagerImpl; accessible field net/minecraft/client/texture/TextureManager textures Ljava/util/Map; +accessible method net/minecraft/client/MinecraftClient doItemUse ()V + +accessible class net/minecraft/entity/projectile/FishingBobberEntity$State + accessible method net/minecraft/screen/ScreenHandlerType register (Ljava/lang/String;Lnet/minecraft/screen/ScreenHandlerType$Factory;)Lnet/minecraft/screen/ScreenHandlerType; +accessible method net/minecraft/client/gui/screen/ingame/HandledScreen handleHotbarKeyPressed (Lnet/minecraft/client/input/KeyInput;)Z + accessible method net/minecraft/client/Keyboard onKey (JILnet/minecraft/client/input/KeyInput;)V accessible class net/minecraft/client/MinecraftClient$LoadingContext diff --git a/src/main/resources/sputnik.mixins.json b/src/main/resources/sputnik.mixins.json index ed4e2ec..58e1220 100644 --- a/src/main/resources/sputnik.mixins.json +++ b/src/main/resources/sputnik.mixins.json @@ -3,8 +3,8 @@ "package": "me.retucio.sputnik.mixin", "compatibilityLevel": "JAVA_21", "mixins": [ - "BlockCollisionSpliteratorMixin", "AbstractBoatEntityMixin", + "BlockCollisionSpliteratorMixin", "ClientConnectionMixin", "EntityMixin", "HandshakeC2SPacketMixin", @@ -21,6 +21,7 @@ "YggdrasilUserApiServiceMixin", "accessor.AbstractBlockAccessor", "accessor.ConfirmServerResourcePackScreenAccessor", + "accessor.FishingBobberEntityAccessor", "accessor.PackAccessor", "accessor.StatusEffectInstanceAccessor" ], @@ -49,6 +50,7 @@ "ClientWorldMixin", "ClientWorldPropertiesMixin", "ConfirmScreenMixin", + "CreativeInventoryScreenMixin", "DamageParticleFactoryMixin", "DamageParticleMixin", "DisconnectedScreenMixin", @@ -75,6 +77,7 @@ "ScreenMixin", "ScreenshotRecorderMixin", "ServerInfoMixin", + "ShaderLoaderMixin", "SkyRendererMixin", "StatusEffectFogModifierMixin", "StuckArrowsFeatureRendererMixin",