From 7f168ca5e8f5fbff3135c1c7dd5250468d623d29 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Sun, 6 Oct 2024 08:53:45 +0200 Subject: [PATCH] fix tickshift --- .../feature/modules/movement/TickShift.java | 53 ++++--------------- 1 file changed, 9 insertions(+), 44 deletions(-) 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 index aa44292..57ec8b3 100644 --- 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 @@ -1,6 +1,5 @@ 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; @@ -9,25 +8,22 @@ 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; + public float factor = 1f; @Config("Ticks") - @Range("1..100") + @Range("1..200") @Description("How many ticks to set the Client TPS (20 TPS * Factor) for.") - int ticks = 20; + public int ticks = 20; @Override public String toString() { @@ -35,50 +31,19 @@ public class TickShift extends Feature { } public void onEnable() { - canTimer = false; - tick = 0; + Features.getFeature(Timer.class).timerLock = true; + Features.getFeature(Timer.class).multiplierLock = (20f * factor); + tick = ticks; } public void onDisable() { Features.getFeature(Timer.class).timerLock = false; - Features.getFeature(Timer.class).multiplierLock = 20f; + Features.getFeature(Timer.class).multiplierLock = null; } - - 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; + if(tick-- <= 0) + toggle(); } }