From bab752c5899970daa786571299b699ea1da77c71 Mon Sep 17 00:00:00 2001 From: retuci0 Date: Sun, 1 Mar 2026 22:38:57 +0100 Subject: [PATCH] v3.8 --- cambios.md | 11 +- gradle.properties | 2 +- src/main/java/me/retucio/sputnik/Sputnik.java | 1 + .../event/interact/KnockbackEvent.java | 46 ++++++++ ...EntityVelocityUpdateS2CPacketAccessor.java | 14 +++ .../accessors/ExplosionS2CPacketAccessor.java | 16 +++ .../mixin/mixins/entity/EntityMixin.java | 10 ++ .../mixins/entity/LivingEntityMixin.java | 18 +++ .../retucio/sputnik/module/ModuleManager.java | 3 + .../module/modules/movement/HitboxDesync.java | 46 ++++++++ .../module/modules/movement/Scaffold.java | 100 ++++++++++++----- .../module/modules/movement/Velocity.java | 97 ++++++++++++++++ .../module/modules/render/Breadcrumbs.java | 105 ++++++++++++++++++ .../module/modules/render/Tracers.java | 2 +- .../retucio/sputnik/ui/hud/HudRenderer.java | 3 +- .../ui/hud/elements/UptimeElement.java | 37 ++++++ .../me/retucio/sputnik/util/MiscUtil.java | 10 ++ .../me/retucio/sputnik/util/NetworkUtil.java | 3 +- .../sputnik/util/render/RenderUtil.java | 10 ++ src/main/resources/fabric.mod.json | 2 +- src/main/resources/sputnik.mixins.json | 2 + 21 files changed, 500 insertions(+), 38 deletions(-) create mode 100644 src/main/java/me/retucio/sputnik/event/interact/KnockbackEvent.java create mode 100644 src/main/java/me/retucio/sputnik/mixin/accessors/EntityVelocityUpdateS2CPacketAccessor.java create mode 100644 src/main/java/me/retucio/sputnik/mixin/accessors/ExplosionS2CPacketAccessor.java create mode 100644 src/main/java/me/retucio/sputnik/module/modules/movement/HitboxDesync.java create mode 100644 src/main/java/me/retucio/sputnik/module/modules/movement/Velocity.java create mode 100644 src/main/java/me/retucio/sputnik/module/modules/render/Breadcrumbs.java create mode 100644 src/main/java/me/retucio/sputnik/ui/hud/elements/UptimeElement.java diff --git a/cambios.md b/cambios.md index d4ac97c..416abc6 100644 --- a/cambios.md +++ b/cambios.md @@ -1,4 +1,4 @@ -# v3.7 +# v3.8 ## novedades @@ -6,13 +6,14 @@ #### módulos nuevos: -- trazos: dibuja líneas apuntando a entidades cercanas +- desync de hitbox: exploit chino para meterse en bloques +- recorrido: muestra tu recorrido +- retroceso: modifica el retroceso a tomar ### arreglos / mejoras -- la config. ya funciona de nuevo -- la escucha de eventos ha sido arreglada, arreglando cosas como la ruedita del zoom y algunos comandos -- selección de minado ya no crashea al no usar pico +- rotar, de andamios, ahora solo rota server-side +- mostrar últimos bloques colocados en andamios ## problemas reconocidos diff --git a/gradle.properties b/gradle.properties index 7d83cec..a8f4219 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,6 +10,6 @@ fabric_api_version=0.140.2+1.21.11 neutrino_version=1.1.0 -mod_version=3.7 +mod_version=3.8 maven_group=me.retucio archives_base_name=sputnik \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/Sputnik.java b/src/main/java/me/retucio/sputnik/Sputnik.java index 6253f97..255fd4a 100644 --- a/src/main/java/me/retucio/sputnik/Sputnik.java +++ b/src/main/java/me/retucio/sputnik/Sputnik.java @@ -59,6 +59,7 @@ public class Sputnik implements ClientModInitializer { public static final Sputnik INSTANCE = new Sputnik(); public static final EventBus EVENT_BUS = new EventBus(); public static final Logger LOGGER = LogManager.getLogger(Sputnik.class); + public static final long LAUNCH_TIME = System.currentTimeMillis(); public static MinecraftClient mc; // id y versión diff --git a/src/main/java/me/retucio/sputnik/event/interact/KnockbackEvent.java b/src/main/java/me/retucio/sputnik/event/interact/KnockbackEvent.java new file mode 100644 index 0000000..189831b --- /dev/null +++ b/src/main/java/me/retucio/sputnik/event/interact/KnockbackEvent.java @@ -0,0 +1,46 @@ +package me.retucio.sputnik.event.interact; + +import com.github.retucio.neutrino.Event; +import net.minecraft.entity.LivingEntity; + +public class KnockbackEvent extends Event { + + private double strength; + private double x, z; + private final LivingEntity target; + + public KnockbackEvent(LivingEntity target, double z, double x, double strength) { + this.target = target; + this.z = z; + this.x = x; + this.strength = strength; + } + + public double getStrength() { + return strength; + } + + public void setStrength(double strength) { + this.strength = strength; + } + + public double getX() { + return x; + } + + public void setX(double x) { + this.x = x; + } + + public double getZ() { + return z; + } + + public void setZ(double z) { + this.z = z; + } + + public LivingEntity getTarget() { + return target; + } +} diff --git a/src/main/java/me/retucio/sputnik/mixin/accessors/EntityVelocityUpdateS2CPacketAccessor.java b/src/main/java/me/retucio/sputnik/mixin/accessors/EntityVelocityUpdateS2CPacketAccessor.java new file mode 100644 index 0000000..e241a1b --- /dev/null +++ b/src/main/java/me/retucio/sputnik/mixin/accessors/EntityVelocityUpdateS2CPacketAccessor.java @@ -0,0 +1,14 @@ +package me.retucio.sputnik.mixin.accessors; + +import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket; +import net.minecraft.util.math.Vec3d; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(EntityVelocityUpdateS2CPacket.class) +public interface EntityVelocityUpdateS2CPacketAccessor { + + @Mutable @Accessor("velocity") + void setVelocity(Vec3d velocity); +} diff --git a/src/main/java/me/retucio/sputnik/mixin/accessors/ExplosionS2CPacketAccessor.java b/src/main/java/me/retucio/sputnik/mixin/accessors/ExplosionS2CPacketAccessor.java new file mode 100644 index 0000000..0d70091 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/mixin/accessors/ExplosionS2CPacketAccessor.java @@ -0,0 +1,16 @@ +package me.retucio.sputnik.mixin.accessors; + +import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket; +import net.minecraft.util.math.Vec3d; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.gen.Accessor; + +import java.util.Optional; + +@Mixin(ExplosionS2CPacket.class) +public interface ExplosionS2CPacketAccessor { + + @Mutable @Accessor("playerKnockback") + void setKnockback(Optional kb); +} diff --git a/src/main/java/me/retucio/sputnik/mixin/mixins/entity/EntityMixin.java b/src/main/java/me/retucio/sputnik/mixin/mixins/entity/EntityMixin.java index 2386e88..39c6bf7 100644 --- a/src/main/java/me/retucio/sputnik/mixin/mixins/entity/EntityMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/mixins/entity/EntityMixin.java @@ -2,12 +2,14 @@ package me.retucio.sputnik.mixin.mixins.entity; import com.llamalad7.mixinextras.injector.ModifyReturnValue; import me.retucio.sputnik.event.render.ChangeRotationEvent; +import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.camera.Freecam; import me.retucio.sputnik.module.modules.camera.Freelook; import me.retucio.sputnik.module.modules.camera.Rotations; import me.retucio.sputnik.module.modules.misc.AntiInvis; import me.retucio.sputnik.module.modules.movement.BoatFly; +import me.retucio.sputnik.module.modules.movement.Velocity; import me.retucio.sputnik.module.modules.render.Nametags; import net.minecraft.entity.*; import net.minecraft.entity.passive.TameableEntity; @@ -20,6 +22,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.gen.Invoker; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -169,4 +173,10 @@ public abstract class EntityMixin { cir.setReturnValue(boatFly.stepHeight.getFloatValue()); } } + + @Inject(method = "pushAwayFrom", at = @At("HEAD"), cancellable = true) + private void onPushed(Entity entity, CallbackInfo ci) { + Velocity velocity = ModuleManager.INSTANCE.getModuleByClass(Velocity.class); + if (velocity.isEnabled() && !velocity.push.getValue() && (Object) this == mc.player) ci.cancel(); + } } \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/mixin/mixins/entity/LivingEntityMixin.java b/src/main/java/me/retucio/sputnik/mixin/mixins/entity/LivingEntityMixin.java index 048c5a4..bb94368 100644 --- a/src/main/java/me/retucio/sputnik/mixin/mixins/entity/LivingEntityMixin.java +++ b/src/main/java/me/retucio/sputnik/mixin/mixins/entity/LivingEntityMixin.java @@ -1,12 +1,16 @@ package me.retucio.sputnik.mixin.mixins.entity; +import com.llamalad7.mixinextras.sugar.Local; import me.retucio.sputnik.module.ModuleManager; import me.retucio.sputnik.module.modules.movement.ElytraBounce; import me.retucio.sputnik.module.modules.movement.Step; +import me.retucio.sputnik.module.modules.movement.Velocity; import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; +import net.minecraft.util.math.Vec3d; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; @@ -56,4 +60,18 @@ public abstract class LivingEntityMixin { Step step = ModuleManager.INSTANCE.getModuleByClass(Step.class); if (step.isEnabled()) cir.setReturnValue(step.height.getFloatValue()); } + + @Inject(method = "takeKnockback", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;setVelocity(DDD)V"), cancellable = true) + private void onTakeKb(double strength, double x, double z, CallbackInfo ci, @Local(ordinal = 0) Vec3d vec3d, @Local(ordinal = 1) Vec3d vec3d2) { + Velocity velocity = ModuleManager.INSTANCE.getModuleByClass(Velocity.class); + if (!velocity.isEnabled() || velocity.hits.getValue()) return; + boolean onGround = ((LivingEntity) (Object) this).isOnGround(); + + double kbX = (velocity.xPercentage.getValue() / 100) * (vec3d.x / 2 - vec3d2.x); + double kbY = (velocity.yPercentage.getValue() / 100) * ((onGround ? Math.min(0.4, vec3d.y / 2 + strength) : vec3d.y)); + double kbZ = (velocity.zPercentage.getValue() / 100) * (vec3d.z / 2 - vec3d2.z); + + ci.cancel(); + ((Entity) (Object) this).addVelocity(kbX, kbY, kbZ); + } } \ No newline at end of file diff --git a/src/main/java/me/retucio/sputnik/module/ModuleManager.java b/src/main/java/me/retucio/sputnik/module/ModuleManager.java index fbf5433..5a5f0ff 100644 --- a/src/main/java/me/retucio/sputnik/module/ModuleManager.java +++ b/src/main/java/me/retucio/sputnik/module/ModuleManager.java @@ -112,6 +112,7 @@ public class ModuleManager { add(new ElytraBounce()); add(new ElytraFly()); add(new Headhitters()); + add(new HitboxDesync()); add(new InfiniteElytra()); add(new Jesus()); add(new ReverseStep()); @@ -120,6 +121,7 @@ public class ModuleManager { add(new Slippy()); add(new Step()); add(new TridentBoost()); + add(new Velocity()); } private void addNetwork() { @@ -149,6 +151,7 @@ public class ModuleManager { private void addRender() { add(new BlockESP()); add(new BlockOutline()); + add(new Breadcrumbs()); add(new BreakingProgress()); add(new CritsPlus()); add(new DamageOverlay()); diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/HitboxDesync.java b/src/main/java/me/retucio/sputnik/module/modules/movement/HitboxDesync.java new file mode 100644 index 0000000..448eed5 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/HitboxDesync.java @@ -0,0 +1,46 @@ +package me.retucio.sputnik.module.modules.movement; + +import me.retucio.sputnik.module.Category; +import me.retucio.sputnik.module.Module; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; + + +/** + * @link + * @author retucio + */ + +public class HitboxDesync extends Module { + + private final double MAGIC_OFFSET = 0.200009968835369999878673424677777777777761; + + public HitboxDesync() { + super("desync de hitbox", "exploit chino", Category.MOVEMENT); + keyMode.setDefaultValue(KeyModes.HOLD); + } + + @Override + public void onTick() { + if (mc.world == null || mc.player == null) return; + + Direction dir = mc.player.getFacing(); + Box box = mc.player.getBoundingBox(); + Vec3d center = box.getCenter(); + Vec3d offset = new Vec3d(dir.getOffsetX(), dir.getOffsetY(), dir.getOffsetZ()); + Vec3d posVec = merge(new Vec3d(Math.floor(center.x) + 0.5, Math.floor(center.y), Math.floor(center.z) + 0.5) + .add(new Vec3d( + offset.x * MAGIC_OFFSET, + offset.y * MAGIC_OFFSET, + offset.z * MAGIC_OFFSET + )), dir); + + mc.player.setPos(posVec.x == 0 ? mc.player.getX() : posVec.x, mc.player.getY(), posVec.z == 0 ? mc.player.getZ() : posVec.z); + toggle(); + } + + private Vec3d merge(Vec3d a, Direction facing) { + return new Vec3d(a.x * Math.abs(facing.getOffsetX()), a.y * Math.abs(facing.getOffsetY()), a.z * Math.abs(facing.getOffsetZ())); + } +} diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/Scaffold.java b/src/main/java/me/retucio/sputnik/module/modules/movement/Scaffold.java index a58a283..047fd79 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/movement/Scaffold.java +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/Scaffold.java @@ -10,10 +10,7 @@ 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.InventoryUtil; -import me.retucio.sputnik.util.Lists; -import me.retucio.sputnik.util.NetworkUtil; +import me.retucio.sputnik.util.*; import me.retucio.sputnik.util.render.RenderUtil; import net.minecraft.block.Block; import net.minecraft.block.FallingBlock; @@ -25,6 +22,9 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; +import java.awt.*; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; public class Scaffold extends Module { @@ -79,7 +79,7 @@ public class Scaffold extends Module { 0, 4, 0.1 - )); + )).visibility(extend::getValue); /* torre */ @@ -97,13 +97,13 @@ public class Scaffold extends Module { 0, 1, 0.01 - )); + )).visibility(tower::getValue); private final BooleanSetting towerWhileMoving = sgBridge.add(new BooleanSetting( "torre moviéndose", "te permite hacer una torre mientras te mueves", false - )); + )).visibility(tower::getValue); /* otros */ @@ -140,7 +140,7 @@ public class Scaffold extends Module { "color a usar al renderizar el contorno", Colors.mainColor, false - )); + )).visibility(outlines::getValue); private final NumberSetting lineWidth = sgRender.add(new NumberSetting( "grosor de línea", @@ -149,7 +149,7 @@ public class Scaffold extends Module { 0.1, 10, 0.1 - )); + )).visibility(outlines::getValue); private final BooleanSetting fillings = sgRender.add(new BooleanSetting( "relleno", @@ -162,35 +162,44 @@ public class Scaffold extends Module { "color a uisar al renderizar el relleno", Colors.withAlpha(Colors.mainColor, 60), false + )).visibility(fillings::getValue); + + private final BooleanSetting showLastPlaced = sgRender.add(new BooleanSetting( + "mostrar últimos bloques", + "mostrar los últimos bloques colocados", + true )); + private final BooleanSetting fade = sgRender.add(new BooleanSetting( + "gradiente", + "gradiente de opacidad de los últimos bloques colocados", + true + )).visibility(showLastPlaced::getValue); + + private final NumberSetting lifeTime = sgRender.add(new NumberSetting( + "esperanza de vida", + "esperanza de vida de los últimos bloques colocados (renderizado)", + 1, + 0, + 5, + 0.1 + )).visibility(showLastPlaced::getValue); + private final BlockPos.Mutable bp = new BlockPos.Mutable(); + private final List lastPlacedBlocks = new ArrayList<>(); private Integer mjY = null; public Scaffold() { super("andamios", "pone bloques bajo tus pies de manera automática", Category.MOVEMENT); - - extend.onUpdate(extendDistance::visibility); - - tower.onUpdate(v -> { - towerSpeed.visibility(v); - towerWhileMoving.visibility(v); - }); - - outlines.onUpdate(v -> { - outlineColor.visibility(v); - lineWidth.visibility(v); - }); - - fillings.onUpdate(fillingColor::visibility); } @Override public void onDisable() { mjY = null; + super.onDisable(); } @Override @@ -205,6 +214,11 @@ public class Scaffold extends Module { pos = pos.add(dir.x, 0, dir.z); } + lastPlacedBlocks.removeIf(block -> { + block.age++; + return block.age >= block.lifeTime; + }); + // seleccionar nivel Y double y; if (mjBridge.getValue() && mjY != null && isMoving()) { @@ -233,7 +247,7 @@ public class Scaffold extends Module { if (tower.getValue() && mc.options.jumpKey.isPressed() && !mc.options.sneakKey.isPressed() - && !mc.player.getInventory().getSelectedStack().isEmpty() + && mc.player.getInventory().getSelectedStack().getItem() instanceof BlockItem && !mc.world.isAir(mc.player.getBlockPos().down())) { Vec3d velocity = mc.player.getVelocity(); Box playerBox = mc.player.getBoundingBox(); @@ -252,8 +266,25 @@ public class Scaffold extends Module { @EventListener private void onRenderWorld(Render3DEvent event) { - if (outlines.getValue()) RenderUtil.drawBlockOutline(event.getMatrices(), bp, outlineColor.getValue(), lineWidth.getFloatValue(), false); if (fillings.getValue()) RenderUtil.drawBlockFilled(event.getMatrices(), bp, fillingColor.getValue(), false); + if (outlines.getValue()) RenderUtil.drawBlockOutline(event.getMatrices(), bp, outlineColor.getValue(), lineWidth.getFloatValue(), false); + + if (!showLastPlaced.getValue()) return; + for (PlacedBlock block : lastPlacedBlocks) { + if (bp.asVector3i().equals(block.pos.asVector3i())) continue; + if (fillings.getValue()) { + Color fc = fade.getValue() + ? Colors.withAlpha(fillingColor.getValue(), (int) ((1 - ((float) block.age / (float) block.lifeTime)) * fillingColor.getA())) + : fillingColor.getValue(); + RenderUtil.drawBlockFilled(event.getMatrices(), block.pos, fc, false); + } + if (outlines.getValue()) { + Color oc = fade.getValue() + ? Colors.withAlpha(outlineColor.getValue(), (int) ((1 - ((float) block.age / (float) block.lifeTime)) * outlineColor.getA())) + : outlineColor.getValue(); + RenderUtil.drawBlockOutline(event.getMatrices(), block.pos, oc, lineWidth.getFloatValue(), false); + } + } } @EventListener @@ -292,15 +323,30 @@ public class Scaffold extends Module { mc.player.getInventory().setSelectedSlot(slot); } + // colocar bloque - NetworkUtil.placeBlock( + if (NetworkUtil.placeBlock( pos, Hand.MAIN_HAND, mc.player.getInventory().getSelectedSlot(), rotate.getValue(), false, true, true - ); + )) { + lastPlacedBlocks.add(new PlacedBlock(pos.toImmutable(), lifeTime.getIntValue() * 20)); + } + } + + private static class PlacedBlock { + BlockPos pos; + final int lifeTime; + int age; + + PlacedBlock(BlockPos pos, int lifeTime) { + this.pos = pos; + this.lifeTime = lifeTime; + this.age = 0; + } } // método helper para ver si un bloque cumple con el filtro diff --git a/src/main/java/me/retucio/sputnik/module/modules/movement/Velocity.java b/src/main/java/me/retucio/sputnik/module/modules/movement/Velocity.java new file mode 100644 index 0000000..9d78985 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/movement/Velocity.java @@ -0,0 +1,97 @@ +package me.retucio.sputnik.module.modules.movement; + +import com.github.retucio.neutrino.EventListener; +import me.retucio.sputnik.event.network.PacketEvent; +import me.retucio.sputnik.mixin.accessors.EntityVelocityUpdateS2CPacketAccessor; +import me.retucio.sputnik.mixin.accessors.ExplosionS2CPacketAccessor; +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.network.packet.s2c.play.EntityVelocityUpdateS2CPacket; +import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket; +import net.minecraft.util.math.Vec3d; + +import java.util.Optional; + + +/** continúa en: + * @see me.retucio.sputnik.mixin.mixins.entity.EntityMixin + * @see me.retucio.sputnik.mixin.mixins.entity.LivingEntityMixin + * + * @author retucio + */ + +public class Velocity extends Module { + + private final SettingGroup sgTypes = addSg(new SettingGroup("tipos", true)); + + public final NumberSetting xPercentage = sgGeneral.add(new NumberSetting( + "X (%)", + "porcentaje de retroceso en el eje X a tomar", + 0, + 0, + 100, + 1 + )); + + public final NumberSetting yPercentage = sgGeneral.add(new NumberSetting( + "Y (%)", + "porcentaje de retroceso vertical (Y) a tomar", + 0, + 0, + 100, + 1 + )); + + public final NumberSetting zPercentage = sgGeneral.add(new NumberSetting( + "horizontal (%)", + "porcentaje de retroceso en el eje Z a tomar", + 0, + 0, + 100, + 1 + )); + + private final BooleanSetting explosions = sgGeneral.add(new BooleanSetting( + "explosiones", + "tomar retroceso de explosiones", + false + )); + + public final BooleanSetting hits = sgTypes.add(new BooleanSetting( + "hits", + "tomar retroceso de golpes", + false + )); + + public final BooleanSetting push = sgTypes.add(new BooleanSetting( + "empujar", + "tomar retroceso de cuando te empuja una entidad", + false + )); + + public Velocity() { + super("retroceso", "te hace estar gordo", Category.MOVEMENT); + } + + @EventListener + private void onReceivePacket(PacketEvent.Receive event) { + if (event.getPacket() instanceof ExplosionS2CPacket explosionPacket && !explosions.getValue()) { + explosionPacket.playerKnockback().ifPresent(kb -> ((ExplosionS2CPacketAccessor) (Object) explosionPacket).setKnockback(Optional.of(new Vec3d( + kb.x * xPercentage.getValue() / 100, + kb.y * yPercentage.getValue() / 100, + kb.z * zPercentage.getValue() / 100 + )))); + } else if (event.getPacket() instanceof EntityVelocityUpdateS2CPacket velocityPacket) { + Vec3d kb = velocityPacket.getVelocity(); + ((EntityVelocityUpdateS2CPacketAccessor) velocityPacket).setVelocity(new Vec3d( + kb.x * xPercentage.getValue() / 100, + kb.y * yPercentage.getValue() / 100, + kb.z * zPercentage.getValue() / 100 + )); + } + } + +} diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/Breadcrumbs.java b/src/main/java/me/retucio/sputnik/module/modules/render/Breadcrumbs.java new file mode 100644 index 0000000..8c13022 --- /dev/null +++ b/src/main/java/me/retucio/sputnik/module/modules/render/Breadcrumbs.java @@ -0,0 +1,105 @@ +package me.retucio.sputnik.module.modules.render; + +import com.github.retucio.neutrino.EventListener; +import me.retucio.sputnik.event.render.Render3DEvent; +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.ColorSetting; +import me.retucio.sputnik.module.setting.settings.NumberSetting; +import me.retucio.sputnik.util.Colors; +import me.retucio.sputnik.util.MiscUtil; +import me.retucio.sputnik.util.render.RenderUtil; +import net.minecraft.util.math.Vec3d; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + + +/** + * @author retucio + */ + +public class Breadcrumbs extends Module { + + private final NumberSetting lifeTime = sgGeneral.add(new NumberSetting( + "esperanza de vida", + "cuánto duran los trazos", + 10, + 0.1, + 40, + 0.1 + )); + + private final ColorSetting color = sgGeneral.add(new ColorSetting( + "color", + "color a usar", + Colors.withAlpha(Colors.mainColor, 102), + true + )); + + private final NumberSetting lineWidth = sgGeneral.add(new NumberSetting( + "grosor", + "grosor de las líneas", + 1, + 0.1, + 10, + 0.1 + )); + + private final BooleanSetting fade = sgGeneral.add(new BooleanSetting( + "gradiente", + "gradiente de opacidad del recorrido basado en el tiempo pasado", + true + )); + + private final List crumbs = new ArrayList<>(); + private Vec3d lastPos = null; + + public Breadcrumbs() { + super("recorrido", "muestra tu recorrido", Category.RENDER); + } + + @Override + public void onDisable() { + crumbs.clear(); + lastPos = null; + super.onDisable(); + } + + @EventListener + private void onRenderWorld(Render3DEvent event) { + Iterator iterator = crumbs.iterator(); + while (iterator.hasNext()) { + Breadcrumb crumb = iterator.next(); + + Color c = fade.getValue() ? Colors.withAlpha(color.getValue(), (int) ((1 - ((float) crumb.age / (float) crumb.lifeTime)) * 255)) : color.getValue(); + RenderUtil.drawLine(event.getMatrices(), crumb.from, crumb.to, c, lineWidth.getFloatValue()); + + crumb.age++; + if (crumb.age >= crumb.lifeTime) { + iterator.remove(); + } + } + + if (lastPos != null) { + crumbs.add(new Breadcrumb(lastPos, mc.player.getEntityPos(), (int) (lifeTime.getValue() * 20))); + } + lastPos = mc.player.getEntityPos(); + } + + + private static class Breadcrumb { + Vec3d from, to; + int lifeTime, age; + + public Breadcrumb(Vec3d from, Vec3d to, int lifeTime) { + this.from = from; + this.to = to; + this.lifeTime = lifeTime; + this.age = 0; + } + } +} diff --git a/src/main/java/me/retucio/sputnik/module/modules/render/Tracers.java b/src/main/java/me/retucio/sputnik/module/modules/render/Tracers.java index 68d8649..eb9194b 100644 --- a/src/main/java/me/retucio/sputnik/module/modules/render/Tracers.java +++ b/src/main/java/me/retucio/sputnik/module/modules/render/Tracers.java @@ -97,7 +97,7 @@ public class Tracers extends Module { for (Entity entity : mc.world.getEntities()) { Color color = getColor(entity); if (color == null) continue; - Vec3d interpolatedPos = entity.getLerpedPos(event.getTickDelta()); + Vec3d interpolatedPos = entity.getLerpedPos(event.getTickDelta()).add(0, mc.player.getEyeHeight(mc.player.getPose()), 0); RenderUtil.drawTracer(event.getMatrices(), interpolatedPos, color, lineWidth.getFloatValue()); } } diff --git a/src/main/java/me/retucio/sputnik/ui/hud/HudRenderer.java b/src/main/java/me/retucio/sputnik/ui/hud/HudRenderer.java index 87c25e8..321cd00 100644 --- a/src/main/java/me/retucio/sputnik/ui/hud/HudRenderer.java +++ b/src/main/java/me/retucio/sputnik/ui/hud/HudRenderer.java @@ -34,9 +34,10 @@ public class HudRenderer { addElement(new FpsElement(), positions, visibilities); addElement(new TpsElement(), positions, visibilities); addElement(new CustomTextElement(), positions, visibilities); - addElement(new TimeElement(), positions, visibilities); addElement(new PingElement(), positions, visibilities); addElement(new RotationElement(), positions, visibilities); + addElement(new TimeElement(), positions, visibilities); + addElement(new UptimeElement(), positions, visibilities); addElement(new DynoElement(), positions, visibilities); addElement(new EchestElement(), positions, visibilities); diff --git a/src/main/java/me/retucio/sputnik/ui/hud/elements/UptimeElement.java b/src/main/java/me/retucio/sputnik/ui/hud/elements/UptimeElement.java new file mode 100644 index 0000000..23ba91b --- /dev/null +++ b/src/main/java/me/retucio/sputnik/ui/hud/elements/UptimeElement.java @@ -0,0 +1,37 @@ +package me.retucio.sputnik.ui.hud.elements; + +import me.retucio.sputnik.Sputnik; +import me.retucio.sputnik.module.ModuleManager; +import me.retucio.sputnik.module.modules.client.HUD; +import me.retucio.sputnik.ui.hud.TextHudElement; +import net.minecraft.text.Text; + +import java.util.List; + +public class UptimeElement extends TextHudElement { + + public UptimeElement() { + super("uptime", mc.getWindow().getScaledWidth() - 50, mc.getWindow().getScaledHeight() - 2 * (mc.textRenderer.fontHeight + 2)); + } + + @Override + public String getText(float delta, HUD hud) { + long seconds = (System.currentTimeMillis() - Sputnik.LAUNCH_TIME) / 1000; + int minutes = (int) seconds / 60; + int hours = minutes / 60; + seconds %= 60; + minutes %= 60; + + return String.format("%sh %smin %ss", hours, minutes, seconds); + } + + @Override + public String getPreviewText() { + return getText(mc.getRenderTickCounter().getDynamicDeltaTicks(), ModuleManager.INSTANCE.getModuleByClass(HUD.class)); + } + + @Override + public List getTooltip() { + return List.of(Text.of("tiempo jugando")); + } +} diff --git a/src/main/java/me/retucio/sputnik/util/MiscUtil.java b/src/main/java/me/retucio/sputnik/util/MiscUtil.java index 743b23f..b128127 100644 --- a/src/main/java/me/retucio/sputnik/util/MiscUtil.java +++ b/src/main/java/me/retucio/sputnik/util/MiscUtil.java @@ -6,6 +6,7 @@ import me.retucio.sputnik.module.modules.client.HUD; import net.minecraft.client.gui.screen.Screen; import net.minecraft.util.math.Vec3d; import org.joml.Vector3d; +import org.joml.Vector3f; import org.lwjgl.glfw.GLFW; import java.time.Instant; @@ -97,4 +98,13 @@ public class MiscUtil { } } } + + + public static Vec3d vec3dOf(Vector3f v) { + return new Vec3d(v.x, v.y, v.z); + } + + public static Vector3f vec3fOf(Vec3d v) { + return new Vector3f((float) v.x, (float) v.y, (float) v.z); + } } diff --git a/src/main/java/me/retucio/sputnik/util/NetworkUtil.java b/src/main/java/me/retucio/sputnik/util/NetworkUtil.java index 56a4658..95019d4 100644 --- a/src/main/java/me/retucio/sputnik/util/NetworkUtil.java +++ b/src/main/java/me/retucio/sputnik/util/NetworkUtil.java @@ -126,8 +126,7 @@ public class NetworkUtil { int prevSlot = mc.player.getInventory().getSelectedSlot(); if (rotate) { - mc.player.setYaw((float) EntityUtil.getYaw(hitPos)); - mc.player.setPitch((float) EntityUtil.getPitch(hitPos)); + EntityUtil.lookAtServer(hitPos); } InventoryUtil.swapWithHotbar(mc.player.getInventory().getSelectedSlot(), slot); 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 ea43fa3..9f6e3cd 100644 --- a/src/main/java/me/retucio/sputnik/util/render/RenderUtil.java +++ b/src/main/java/me/retucio/sputnik/util/render/RenderUtil.java @@ -19,6 +19,16 @@ public class RenderUtil { /* líneas */ + public static void drawLine(MatrixStack matrices, Vec3d from, Vec3d to, Color color, float lineWidth) { + BufferBuilder buffer = tessellator.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH); + Vec3d cam = mc.gameRenderer.getCamera().getCameraPos(); + + buffer.vertex(matrices.peek(), (float) (from.x - cam.x), (float) (from.y - cam.y), (float) (from.z - cam.z)).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth); + buffer.vertex(matrices.peek(), (float) (to.x - cam.x), (float) (to.y - cam.y), (float) (to.z - cam.z)).color(color.getRGB()).normal(-1, -1, -1).lineWidth(lineWidth); + + Layers.lines().draw(buffer.end()); + } + // https://github.com/TheF1xer/GateClient-1.12.2/blob/main/src/main/java/me/thef1xer/gateclient/util/RenderUtil.java public static void drawTracer(MatrixStack matrices, Vec3d pos, Color color, float lineWidth) { BufferBuilder buffer = tessellator.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f0e66e5..6443b8f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -8,7 +8,7 @@ "el prepu" ], "contact": { - "homepage": "https://github.com/retuci0", + "homepage": "https://retucio.me/projects/sputnik.html", "sources": "https://github.com/retuci0/sputnik" }, "license": "CC0-1.0", diff --git a/src/main/resources/sputnik.mixins.json b/src/main/resources/sputnik.mixins.json index f8d6267..5c398e0 100644 --- a/src/main/resources/sputnik.mixins.json +++ b/src/main/resources/sputnik.mixins.json @@ -5,6 +5,8 @@ "mixins": [ "accessors.AbstractBlockAccessor", "accessors.ConfirmServerResourcePackScreenAccessor", + "accessors.EntityVelocityUpdateS2CPacketAccessor", + "accessors.ExplosionS2CPacketAccessor", "accessors.FishingBobberEntityAccessor", "accessors.PackAccessor", "accessors.StatusEffectInstanceAccessor",