Reach Detection

This commit is contained in:
kirillsaint 2023-12-31 17:43:34 +06:00
parent 4b464f0a51
commit 2ed3b9af0e
5 changed files with 99 additions and 3 deletions

View File

@ -36,6 +36,7 @@ import net.silentclient.client.mods.util.Server;
import net.silentclient.client.mods.util.Utils;
import net.silentclient.client.premium.PremiumCosmeticsGui;
import net.silentclient.client.premium.PremiumUtils;
import net.silentclient.client.skillissue.SkillIssue;
import net.silentclient.client.utils.*;
import net.silentclient.client.utils.animations.AnimationHandler;
import net.silentclient.client.utils.animations.SneakHandler;
@ -97,6 +98,7 @@ public class Client {
private AccountManager accountManager;
public ServerData lastServerData;
public TextUtils textUtils;
private SkillIssue skillIssue;
public static void memoryDebug(String paramString) {
LogManager.getLogger().info("-- Start Memory Debug -- " + paramString);
@ -352,6 +354,9 @@ public class Client {
}
Client.logger.info("STARTING > text-utils");
this.textUtils = new TextUtils(Minecraft.getMinecraft().fontRendererObj);
logger.info("STARTING > skillissue");
this.skillIssue = new SkillIssue();
logger.info("-------------------------------------------------");
memoryDebug("CLIENT_POST_INIT");
}

View File

@ -1,15 +1,15 @@
package net.silentclient.client.mods.hud;
import java.text.DecimalFormat;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.EntityAttackEvent;
import net.silentclient.client.mods.HudMod;
import net.silentclient.client.mods.ModCategory;
import java.text.DecimalFormat;
public class ReachDisplayMod extends HudMod {
private static final DecimalFormat FORMAT = new DecimalFormat("0.##");
public static final DecimalFormat FORMAT = new DecimalFormat("0.##");
private double distance = 0;
private long hitTime = -1;

View File

@ -0,0 +1,21 @@
package net.silentclient.client.skillissue;
import net.silentclient.client.Client;
import net.silentclient.client.skillissue.detections.Detection;
import net.silentclient.client.skillissue.detections.Reach;
import java.util.ArrayList;
public class SkillIssue {
public static final String VERSION = "1.0.0-beta.1";
private final ArrayList<Detection> detections = new ArrayList<>();
public SkillIssue() {
Client.logger.info(String.format("[SkillIssue]: Initialising (v%s)", VERSION));
detections.add(new Reach(this));
}
public ArrayList<Detection> getDetections() {
return detections;
}
}

View File

@ -0,0 +1,41 @@
package net.silentclient.client.skillissue.detections;
import net.minecraft.client.Minecraft;
import net.silentclient.client.Client;
import net.silentclient.client.event.EventManager;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.ClientTickEvent;
import net.silentclient.client.skillissue.SkillIssue;
public class Detection {
protected Minecraft mc = Minecraft.getMinecraft();
protected SkillIssue skillIssue;
protected int detections = 0;
protected long lastDetection = 0;
private final String name;
public Detection(SkillIssue skillIssue, String name) {
this.skillIssue = skillIssue;
this.name = name;
EventManager.register(this);
}
public void detect(String data) {
this.detections += 1;
this.lastDetection = System.currentTimeMillis();
Client.logger.warn(String.format("[SkillIssue]: %s Detection: %s (vl: %s)", name, data, detections));
}
@EventTarget
public void updateDetection(ClientTickEvent event) {
if(lastDetection != 0) {
if(System.currentTimeMillis() - lastDetection >= 600000) {
lastDetection = 0;
}
}
}
public String getName() {
return name;
}
}

View File

@ -0,0 +1,29 @@
package net.silentclient.client.skillissue.detections;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.EntityAttackEvent;
import net.silentclient.client.mods.hud.ReachDisplayMod;
import net.silentclient.client.skillissue.SkillIssue;
import net.silentclient.client.utils.PlayerUtils;
public class Reach extends Detection {
private long lastHit = 0;
public Reach(SkillIssue skillIssue) {
super(skillIssue, "Reach");
}
@EventTarget
public void totallyNoReachHax(EntityAttackEvent event) {
if(System.currentTimeMillis() - lastHit < 500 || !PlayerUtils.isSurvival()) {
return;
}
if(mc.objectMouseOver != null && mc.objectMouseOver.hitVec != null) {
this.lastHit = System.currentTimeMillis();
double distance = mc.objectMouseOver.hitVec.distanceTo(mc.thePlayer.getPositionEyes(1.0F));
if(distance > 3) {
this.detect("distance: " + ReachDisplayMod.FORMAT.format(distance));
}
}
}
}