Add TickShift
All checks were successful
/ Build BaseBand (push) Successful in 2m36s

This commit is contained in:
Jess H 2024-10-06 07:39:54 +01:00
parent 2d713a68e8
commit 8016829246
Signed by: UnixSystemV
GPG key ID: 9B21C50B68D67F19
2 changed files with 85 additions and 0 deletions

View file

@ -84,6 +84,7 @@ public class Setup {
new Spotify(),
new SwingSpeed(),
new Test(),
new TickShift(),
new Timer(),
new Toggle(),
new TPAccept(),

View file

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