fix 1.18.2 (fixes #109)

This commit is contained in:
C10udburst
2022-03-02 17:27:52 +01:00
parent e4006cfa3b
commit 6d3f5c0856
7 changed files with 4 additions and 64 deletions

View File

@@ -89,7 +89,6 @@
## HUD
- Baritone process HUD
- CPS HUD (Ported from [AuroraKeystrokes](https://github.com/LambdAurora/AuroraKeystrokes/tree/1.16/src/main/java/me/lambdaurora/keystrokes))
## Config
- `Http Allowed` - modify what http requests can be made with Meteor's http api

View File

@@ -16,13 +16,13 @@ import meteordevelopment.meteorclient.systems.hud.HUD;
import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.meteorclient.systems.modules.Modules;
import net.minecraft.item.Items;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.invoke.MethodHandles;
public class MeteorRejectsAddon extends MeteorAddon {
public static final Logger LOG = LogManager.getLogger();
public static final Logger LOG = LoggerFactory.getLogger("Rejects");
public static final Category CATEGORY = new Category("Rejects", Items.BARRIER.getDefaultStack());
@Override
@@ -93,7 +93,6 @@ public class MeteorRejectsAddon extends MeteorAddon {
// HUD
HUD hud = Systems.get(HUD.class);
hud.elements.add(new BaritoneHud(hud));
hud.elements.add(new CpsHud(hud));
// Themes
GuiThemes.add(new MeteorRoundedGuiTheme());

View File

@@ -1,16 +0,0 @@
package anticope.rejects.gui.hud;
import anticope.rejects.utils.RejectsUtils;
import meteordevelopment.meteorclient.systems.hud.HUD;
import meteordevelopment.meteorclient.systems.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(RejectsUtils.CPS);
}
}

View File

@@ -1,22 +0,0 @@
package anticope.rejects.mixin;
import anticope.rejects.utils.RejectsUtils;
import net.minecraft.client.MinecraftClient;
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)
{
RejectsUtils.CPS++;
}
}

View File

@@ -31,7 +31,7 @@ public class CommandsMixin {
@Shadow(remap = false)
@Final
private CommandDispatcher<CommandSource> DISPATCHER = new CommandDispatcher<>();
private CommandDispatcher<CommandSource> DISPATCHER;
@Inject(method = "add", at=@At("HEAD"), remap = false, cancellable = true)
private void onAdd(Command cmd, CallbackInfo ci) {

View File

@@ -3,30 +3,11 @@ package anticope.rejects.utils;
import anticope.rejects.utils.seeds.Seeds;
import meteordevelopment.meteorclient.MeteorClient;
import java.util.Timer;
import java.util.TimerTask;
public class RejectsUtils {
public static int CPS = 0;
public static void init() {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
RejectsConfig.get().save(MeteorClient.FOLDER);
Seeds.get().save(MeteorClient.FOLDER);
}));
new Timer().scheduleAtFixedRate(newTimerTaskFromLambda(() -> CPS = 0), 0, 1000);
}
public static TimerTask newTimerTaskFromLambda(Runnable runnable)
{
return new TimerTask()
{
@Override
public void run()
{
runnable.run();
}
};
}
}

View File

@@ -10,7 +10,6 @@
"EntityAccessor",
"GameRendererMixin",
"LivingEntityRendererMixin",
"MinecraftClientMixin",
"StructureVoidBlockMixin",
"ToastManagerMixin",
"TitleScreenMixin",