fix tickshift
All checks were successful
/ Build BaseBand (push) Successful in 2m55s

This commit is contained in:
Daniella / Tove 2024-10-06 08:53:45 +02:00
parent 90ae96447c
commit 7f168ca5e8
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -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();
}
}