add timerspeed uwu ty tbm

This commit is contained in:
Bella 2020-01-28 14:05:02 -05:00
parent 86d8917613
commit 13d5664354
2 changed files with 56 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package me.zeroeightsix.kami.module.modules.gui;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.modules.movement.TimerSpeed;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.util.InfoCalculator;
@ -26,6 +27,7 @@ public class InfoOverlay extends Module {
public Setting<Boolean> tps = register(Settings.b("Ticks Per Second", false));
public Setting<Boolean> fps = register(Settings.b("Frames Per Second", true));
public Setting<Boolean> speed = register(Settings.b("Speed", true));
public Setting<Boolean> timerSpeed = register(Settings.b("Timer Speed", false));
public Setting<Boolean> ping = register(Settings.b("Latency", false));
public Setting<Boolean> durability = register(Settings.b("Item Damage", false));
public Setting<Boolean> memory = register(Settings.b("Memory Used", false));
@ -35,6 +37,8 @@ public class InfoOverlay extends Module {
public Setting<TimeType> timeTypeSetting = register(Settings.e("Time Format", TimeType.HHMMSS));
public Setting<TimeUnit> timeUnitSetting = register(Settings.e("Time Unit", TimeUnit.h12));
private String formatted = textColour(secondColour.getValue()) + ":" + textColour(firstColour.getValue());
public enum SpeedUnit {
MpS, KmH
}
@ -85,10 +89,13 @@ public class InfoOverlay extends Module {
}
private String formatTimeColour() {
String formatted = textColour(secondColour.getValue()) + ":" + textColour(firstColour.getValue());
return InfoCalculator.time().replace(":", formatted);
}
private String formatTimerSpeed() {
return TimerSpeed.returnGui().replace(".", formatted);
}
private String textColour(ColourCode c) {
switch (c) {
case BLACK: return TextFormatting.BLACK.toString();
@ -117,7 +124,7 @@ public class InfoOverlay extends Module {
infoContents.add(textColour(firstColour.getValue()) + KamiMod.KAMI_KANJI + textColour(secondColour.getValue()) + " " + KamiMod.MODVER);
}
if (username.getValue()) {
infoContents.add(textColour(firstColour.getValue()) + "Welcome " + textColour(secondColour.getValue()) + " " + mc.player.getName() + "!");
infoContents.add(textColour(firstColour.getValue()) + "Welcome" + textColour(secondColour.getValue()) + " " + mc.player.getName() + "!");
}
if (time.getValue()) {
infoContents.add(textColour(firstColour.getValue()) + formatTimeColour());
@ -131,6 +138,9 @@ public class InfoOverlay extends Module {
if (speed.getValue()) {
infoContents.add(textColour(firstColour.getValue()) + InfoCalculator.speed() + textColour(secondColour.getValue()) + " " + unitType(speedUnit.getValue()));
}
if (timerSpeed.getValue()) {
infoContents.add(textColour(firstColour.getValue()) + formatTimerSpeed() + textColour(secondColour.getValue()) + "t");
}
if (ping.getValue()) {
infoContents.add(textColour(firstColour.getValue()) + InfoCalculator.ping() + textColour(secondColour.getValue()) + " ms");
}

View File

@ -0,0 +1,44 @@
package me.zeroeightsix.kami.module.modules.movement;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.Module.Category;
import me.zeroeightsix.kami.module.Module.Info;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.util.InfoCalculator;
/**
* @author TBM
* Updated by S-B99 on 28/01/20
*/
@Info(name = "TimerSpeed", description = "Automatically change Timer Speed", category = Category.MISC)
public class TimerSpeed extends Module {
private float tickDelay = 0.0f;
private static float curSpeed = 0.0f;
private Setting<Float> minimumSpeed = register(Settings.floatBuilder("Minimum Speed").withMinimum(0.0F).withMaximum(10.0F).withValue(4.0F));
private Setting<Float> maxSpeed = register(Settings.floatBuilder("Max Speed").withMinimum(0.0F).withMaximum(10.0F).withValue(7.0F));
private Setting<Float> attemptSpeed = register(Settings.floatBuilder("Attempt Speed").withMinimum(1.0F).withMaximum(10.0F).withValue(4.2F));
private Setting<Float> fastSpeed = register(Settings.floatBuilder("Fast Speed").withMinimum(1.0F).withMaximum(10.0F).withValue(5.0F));
public static String returnGui() {
return "" + InfoCalculator.round(curSpeed, 2);
}
public void onUpdate() {
if (tickDelay == minimumSpeed.getValue()) {
curSpeed = fastSpeed.getValue();
mc.timer.tickLength = 50.0F / fastSpeed.getValue();
}
if (tickDelay >= maxSpeed.getValue()) {
tickDelay = 0;
curSpeed = attemptSpeed.getValue();
mc.timer.tickLength = 50.0F / attemptSpeed.getValue();
}
++tickDelay;
}
public void onDisable() {
mc.timer.tickLength = 50.0F;
}
}