From 80168292466bcaa4375446a21314888d050ade73 Mon Sep 17 00:00:00 2001 From: Jess Date: Sun, 6 Oct 2024 07:39:54 +0100 Subject: [PATCH] Add TickShift --- .../java/de/com/baseband/client/Setup.java | 1 + .../feature/modules/movement/TickShift.java | 84 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 Client/src/main/java/de/com/baseband/client/feature/modules/movement/TickShift.java diff --git a/Client/src/main/java/de/com/baseband/client/Setup.java b/Client/src/main/java/de/com/baseband/client/Setup.java index 8e58ca9..52a016f 100644 --- a/Client/src/main/java/de/com/baseband/client/Setup.java +++ b/Client/src/main/java/de/com/baseband/client/Setup.java @@ -84,6 +84,7 @@ public class Setup { new Spotify(), new SwingSpeed(), new Test(), + new TickShift(), new Timer(), new Toggle(), new TPAccept(), diff --git a/Client/src/main/java/de/com/baseband/client/feature/modules/movement/TickShift.java b/Client/src/main/java/de/com/baseband/client/feature/modules/movement/TickShift.java new file mode 100644 index 0000000..aa44292 --- /dev/null +++ b/Client/src/main/java/de/com/baseband/client/feature/modules/movement/TickShift.java @@ -0,0 +1,84 @@ +package de.com.baseband.client.feature.modules.movement; + +import de.com.baseband.client.event.Listen; +import de.com.baseband.client.feature.Feature; +import de.com.baseband.client.feature.Features; +import de.com.baseband.client.feature.category.Movement; +import de.com.baseband.client.feature.modules.client.Timer; +import de.com.baseband.client.registry.annotation.Config; +import de.com.baseband.client.registry.annotation.Description; +import de.com.baseband.client.registry.annotation.Range; +import de.com.baseband.client.registry.annotation.Requires; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; + +@Movement +@Requires(Timer.class) +public class TickShift extends Feature { + + boolean canTimer = false; + int tick = 0; + + @Config("Factor") + @Range("0.1..3.0") + @Description("The amount to multiply the Client TPS by. Example: 2 is double speed.") + float factor = 1f; + + @Config("Ticks") + @Range("1..100") + @Description("How many ticks to set the Client TPS (20 TPS * Factor) for.") + int ticks = 20; + + @Override + public String toString() { + return "TickShift"; + } + + public void onEnable() { + canTimer = false; + tick = 0; + } + + public void onDisable() { + Features.getFeature(Timer.class).timerLock = false; + Features.getFeature(Timer.class).multiplierLock = 20f; + } + + + + public void onTick() { + meta = String.valueOf(tick); + if (tick <= 0) { + tick = 0; + canTimer = false; + Features.getFeature(Timer.class).multiplierLock = 20f; + } + + if (tick > 0 && isEntityMoving(mc.player)) { + tick--; + Features.getFeature(Timer.class).multiplierLock = (20f * factor); + //ticksPassed++; + } + + if (!isEntityMoving(mc.player)) { + Features.getFeature(Timer.class).multiplierLock = 20f; + tick++; + } + + if (tick >= ticks) { + Features.getFeature(Timer.class).multiplierLock = 20f; + tick = ticks; + } + } + + + public boolean isEntityMoving(Entity entity) { + if (entity == null) { + return false; + } + if (entity instanceof EntityPlayer) { + return mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown() || mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown(); + } + return entity.motionX != 0.0 || entity.motionY != 0.0 || entity.motionZ != 0.0; + } +}