Cps Hud
This commit is contained in:
@@ -17,6 +17,7 @@ import java.lang.invoke.MethodHandles;
|
|||||||
import cloudburst.rejects.commands.*;
|
import cloudburst.rejects.commands.*;
|
||||||
import cloudburst.rejects.gui.hud.*;
|
import cloudburst.rejects.gui.hud.*;
|
||||||
import cloudburst.rejects.modules.*;
|
import cloudburst.rejects.modules.*;
|
||||||
|
import cloudburst.rejects.utils.Utils;
|
||||||
|
|
||||||
public class MeteorRejectsAddon extends MeteorAddon {
|
public class MeteorRejectsAddon extends MeteorAddon {
|
||||||
public static final Logger LOG = LogManager.getLogger();
|
public static final Logger LOG = LogManager.getLogger();
|
||||||
@@ -27,6 +28,7 @@ public class MeteorRejectsAddon extends MeteorAddon {
|
|||||||
LOG.info("Initializing Meteor Rejects Addon");
|
LOG.info("Initializing Meteor Rejects Addon");
|
||||||
|
|
||||||
MeteorClient.EVENT_BUS.registerLambdaFactory("cloudburst.rejects", (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup()));
|
MeteorClient.EVENT_BUS.registerLambdaFactory("cloudburst.rejects", (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup()));
|
||||||
|
Utils.init();
|
||||||
|
|
||||||
Modules modules = Modules.get();
|
Modules modules = Modules.get();
|
||||||
modules.add(new AntiBot());
|
modules.add(new AntiBot());
|
||||||
@@ -71,6 +73,7 @@ public class MeteorRejectsAddon extends MeteorAddon {
|
|||||||
hud.elements.add(new AppleHud(hud));
|
hud.elements.add(new AppleHud(hud));
|
||||||
hud.elements.add(new CrystalHud(hud));
|
hud.elements.add(new CrystalHud(hud));
|
||||||
hud.elements.add(new ExpHud(hud));
|
hud.elements.add(new ExpHud(hud));
|
||||||
|
hud.elements.add(new CpsHud(hud));
|
||||||
|
|
||||||
GuiThemes.add(new MeteorRoundedGuiTheme());
|
GuiThemes.add(new MeteorRoundedGuiTheme());
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/main/java/cloudburst/rejects/gui/hud/CpsHud.java
Normal file
16
src/main/java/cloudburst/rejects/gui/hud/CpsHud.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package cloudburst.rejects.gui.hud;
|
||||||
|
|
||||||
|
import cloudburst.rejects.utils.Utils;
|
||||||
|
import minegame159.meteorclient.systems.modules.render.hud.HUD;
|
||||||
|
import minegame159.meteorclient.systems.modules.render.hud.modules.DoubleTextHudElement;
|
||||||
|
|
||||||
|
public class CpsHud extends DoubleTextHudElement {
|
||||||
|
public CpsHud(HUD hud) {
|
||||||
|
super(hud, "cps", "Displays your CPS.", "CPS: ", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getRight() {
|
||||||
|
return Integer.toString(Utils.CPS);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package cloudburst.rejects.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
|
||||||
|
import cloudburst.rejects.utils.Utils;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injects the CPS counter.
|
||||||
|
*/
|
||||||
|
@Mixin(MinecraftClient.class)
|
||||||
|
public class MinecraftClientMixin
|
||||||
|
{
|
||||||
|
@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;doAttack()V"))
|
||||||
|
private void onAttack(CallbackInfo ci)
|
||||||
|
{
|
||||||
|
Utils.CPS++;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/main/java/cloudburst/rejects/utils/Utils.java
Normal file
24
src/main/java/cloudburst/rejects/utils/Utils.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package cloudburst.rejects.utils;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
public class Utils {
|
||||||
|
public static int CPS = 0;
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
new Timer().scheduleAtFixedRate(newTimerTaskFromLambda(() -> CPS = 0), 0, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TimerTask newTimerTaskFromLambda(Runnable runnable)
|
||||||
|
{
|
||||||
|
return new TimerTask()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
"StructureVoidBlockMixin",
|
"StructureVoidBlockMixin",
|
||||||
"TitleScreenMixin",
|
"TitleScreenMixin",
|
||||||
"LivingEntityRendererMixin",
|
"LivingEntityRendererMixin",
|
||||||
|
"MinecraftClientMixin",
|
||||||
"GameRendererMixin",
|
"GameRendererMixin",
|
||||||
"ToastManagerMixin"
|
"ToastManagerMixin"
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user