diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/gui/InfoOverlay.java b/src/main/java/me/zeroeightsix/kami/module/modules/gui/InfoOverlay.java index a3ac104ee..a7495b565 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/gui/InfoOverlay.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/gui/InfoOverlay.java @@ -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 tps = register(Settings.b("Ticks Per Second", false)); public Setting fps = register(Settings.b("Frames Per Second", true)); public Setting speed = register(Settings.b("Speed", true)); + public Setting timerSpeed = register(Settings.b("Timer Speed", false)); public Setting ping = register(Settings.b("Latency", false)); public Setting durability = register(Settings.b("Item Damage", false)); public Setting memory = register(Settings.b("Memory Used", false)); @@ -35,6 +37,8 @@ public class InfoOverlay extends Module { public Setting timeTypeSetting = register(Settings.e("Time Format", TimeType.HHMMSS)); public Setting 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"); } diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/movement/TimerSpeed.java b/src/main/java/me/zeroeightsix/kami/module/modules/movement/TimerSpeed.java new file mode 100644 index 000000000..362acd244 --- /dev/null +++ b/src/main/java/me/zeroeightsix/kami/module/modules/movement/TimerSpeed.java @@ -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 minimumSpeed = register(Settings.floatBuilder("Minimum Speed").withMinimum(0.0F).withMaximum(10.0F).withValue(4.0F)); + private Setting maxSpeed = register(Settings.floatBuilder("Max Speed").withMinimum(0.0F).withMaximum(10.0F).withValue(7.0F)); + private Setting attemptSpeed = register(Settings.floatBuilder("Attempt Speed").withMinimum(1.0F).withMaximum(10.0F).withValue(4.2F)); + private Setting 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; + } + +}