(feature) copy chat

This commit is contained in:
kirillsaint 2024-05-30 00:57:51 +06:00
parent ff5def481f
commit 9a81e6f087
19 changed files with 46 additions and 332 deletions

View File

@ -42,7 +42,6 @@ import net.silentclient.client.mods.util.Utils;
import net.silentclient.client.nanovg.UI;
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;
@ -65,7 +64,7 @@ import java.util.List;
public class Client {
public static final Logger logger = LogManager.getLogger("SC");
private final String version = "2.2.0";
private final String version = "2.2.1";
private static final Client INSTANCE = new Client();
public static final Client getInstance() {
@ -104,7 +103,6 @@ public class Client {
private AccountManager accountManager;
public ServerData lastServerData;
public TextUtils textUtils;
private SkillIssue skillIssue;
private PlayerResponse.BanInfo banInfo;
public static void memoryDebug(String paramString) {
@ -397,7 +395,6 @@ public class Client {
this.textUtils = new TextUtils(Minecraft.getMinecraft().fontRendererObj);
logger.info("STARTING > skillissue");
this.skillIssue = new SkillIssue();
logger.info("-------------------------------------------------");
memoryDebug("CLIENT_POST_INIT");
}
@ -405,7 +402,6 @@ public class Client {
public void shutdown() {
logger.info("---------[ Silent Client Stopping ]--------------");
logger.info("STOPPING > silent-socket");
skillIssue.sendDetections();
Players.unregister();
logger.info("-------------------------------------------------");
}

View File

@ -6,7 +6,6 @@ import net.silentclient.client.event.Event;
public class ConnectToServerEvent extends Event {
private final ServerData serverData;
public ConnectToServerEvent(ServerData serverData) {
this.serverData = serverData;
}

View File

@ -1,27 +0,0 @@
package net.silentclient.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiScreenServerList;
import net.minecraft.client.multiplayer.ServerData;
import java.io.IOException;
public class GuiScreenServerListInGame extends GuiScreenServerList {
public GuiScreenServerListInGame(GuiScreen p_i1031_1_, ServerData p_i1031_2_) {
super(p_i1031_1_, p_i1031_2_);
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if(button.id == 0) {
if(this.mc.theWorld != null) {
this.mc.theWorld.sendQuittingDisconnectingPacket();
this.mc.loadWorld(null);
this.mc.displayGuiScreen(null);
}
}
super.actionPerformed(button);
}
}

View File

@ -1,63 +0,0 @@
package net.silentclient.client.gui;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.util.ResourceLocation;
public class SplashScreen {
private static ResourceLocation SPLASH;
public static void update() {
if(Minecraft.getMinecraft() == null || Minecraft.getMinecraft().getLanguageManager() == null) {
return;
}
drawSplash(Minecraft.getMinecraft().getTextureManager());
}
public static void setProgress(int givenProgress, String givenText) {
update();
}
public static void drawSplash(TextureManager tm) {
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
int scaleFactor = scaledResolution.getScaleFactor();
Framebuffer framebuffer = new Framebuffer(scaledResolution.getScaledWidth() * scaleFactor, scaledResolution.getScaledHeight() * scaleFactor, true);
framebuffer.bindFramebuffer(false);
GlStateManager.matrixMode(GL11.GL_PROJECTION);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double) scaledResolution.getScaledWidth(), (double) scaledResolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.disableLighting();
GlStateManager.disableFog();
GlStateManager.disableDepth();
GlStateManager.enableTexture2D();
if(SPLASH == null) {
SPLASH = new ResourceLocation("silentclient/splash.png");
}
tm.bindTexture(SPLASH);
GlStateManager.resetColor();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Gui.drawScaledCustomSizeModalRect(0, 0, 0, 0, 1920, 1080, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), 1920, 1080);
framebuffer.unbindFramebuffer();
framebuffer.framebufferRender(scaledResolution.getScaledWidth() * scaleFactor, scaledResolution.getScaledHeight() * scaleFactor);
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(516, 0.1F);
Minecraft.getMinecraft().updateDisplay();
}
}

View File

@ -1,8 +1,13 @@
package net.silentclient.client.mods.render;
import net.minecraft.client.gui.GuiNewChat;
import net.minecraft.event.ClickEvent;
import net.minecraft.event.HoverEvent;
import net.minecraft.network.play.server.S02PacketChat;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StringUtils;
import net.silentclient.client.Client;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.EventReceivePacket;
@ -19,11 +24,13 @@ public class ChatMod extends Mod {
@Override
public void setup() {
setUpdated(true);
this.addBooleanSetting("Font Shadow", this, true);
this.addBooleanSetting("Bar Animation", this, false);
this.addBooleanSetting("Smooth", this, false);
this.addSliderSetting("Smooth Speed", this, 4, 1, 10, false);
this.addBooleanSetting("Disable Background", this, true);
this.addBooleanSetting("Copy Message Button", this, false);
this.addBooleanSetting("Anti-Spam", this, false);
}
@ -31,7 +38,23 @@ public class ChatMod extends Mod {
public void chat(EventReceivePacket event) {
if(event.getPacket() instanceof S02PacketChat && !event.isCancelable()) {
final S02PacketChat chatPacket = (S02PacketChat)event.getPacket();
if (Client.getInstance().getSettingsManager().getSettingByName(this, "Anti-Spam").getValBoolean() && chatPacket.getType() == 0) {
if(chatPacket.getType() == 2) return;
if (Client.getInstance().getSettingsManager().getSettingByName(this, "Copy Message Button").getValBoolean()) {
String unformattedText = StringUtils.stripControlCodes(chatPacket.getChatComponent().getUnformattedText());
if (!unformattedText.replace(" ", "").isEmpty()) {
ChatComponentText copyText = new ChatComponentText(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "[COPY]");
ChatStyle style = new ChatStyle()
.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.GRAY + "Copy message")))
.setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/slc$copy " + unformattedText));
copyText.setChatStyle(style);
chatPacket.getChatComponent().appendSibling(new ChatComponentText(EnumChatFormatting.RESET + " "));
chatPacket.getChatComponent().appendSibling(copyText);
}
}
if (Client.getInstance().getSettingsManager().getSettingByName(this, "Anti-Spam").getValBoolean()) {
GuiNewChat guiNewChat = mc.ingameGUI.getChatGUI();
if (lastMessage.equals(chatPacket.getChatComponent().getUnformattedText())) {
guiNewChat.deleteChatLine(line);

View File

@ -8,7 +8,7 @@ public enum Direction {
DOWN(new Vec3i(0, -1, 0)), UP(new Vec3i(0, 1, 0)), NORTH(new Vec3i(0, 0, -1)), SOUTH(new Vec3i(0, 0, 1)),
WEST(new Vec3i(-1, 0, 0)), EAST(new Vec3i(1, 0, 0));
private Direction(Vec3i normal) {
Direction(Vec3i normal) {
this.normal = normal;
}

View File

@ -1,31 +0,0 @@
package net.silentclient.client.mods.render.skins;
import net.minecraft.item.ItemStack;
import net.silentclient.client.mixin.accessors.skins.SkullSettings;
import net.silentclient.client.mods.render.skins.render.CustomizableModelPart;
import java.util.WeakHashMap;
public class SkullRendererCache {
public static boolean renderNext = false;
public static SkullSettings lastSkull = null;
public static WeakHashMap<ItemStack, SkullSettings> itemCache = new WeakHashMap<>();
public static class ItemSettings implements SkullSettings {
private CustomizableModelPart hatModel = null;
@Override
public CustomizableModelPart getHeadLayers() {
return hatModel;
}
@Override
public void setupHeadLayers(CustomizableModelPart box) {
this.hatModel = box;
}
}
}

View File

@ -21,13 +21,11 @@ import java.util.function.Supplier;
public class BodyLayerFeatureRenderer
implements LayerRenderer<AbstractClientPlayer> {
private RenderPlayer playerRenderer;
private final boolean thinArms;
private static final Minecraft mc = Minecraft.getMinecraft();
public BodyLayerFeatureRenderer(
RenderPlayer playerRenderer) {
this.playerRenderer = playerRenderer;
thinArms = ((PlayerEntityModelAccessor)playerRenderer).client$hasThinArms();
bodyLayers.add(new Layer(0, false, EnumPlayerModelParts.LEFT_PANTS_LEG, Shape.LEGS, () -> playerRenderer.getMainModel().bipedLeftLeg, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Left Leg").getValBoolean()));
bodyLayers.add(new Layer(1, false, EnumPlayerModelParts.RIGHT_PANTS_LEG, Shape.LEGS, () -> playerRenderer.getMainModel().bipedRightLeg, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Right Leg").getValBoolean()));

View File

@ -37,7 +37,7 @@ public class HeadLayerFeatureRenderer implements LayerRenderer<AbstractClientPla
}
if(mc.thePlayer.getPositionVector().squareDistanceTo(player.getPositionVector()) > Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt()*Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt())return;
ItemStack itemStack = player.getEquipmentInSlot(1); //TODO
ItemStack itemStack = player.getEquipmentInSlot(1);
if (itemStack != null && hideHeadLayers.contains(itemStack.getItem())) {
return;
}

View File

@ -17,9 +17,7 @@ public class GeneralMod extends Mod {
public boolean isEnabled() {
return true;
}
boolean lastFullscreen = false;
public GeneralMod() {
super("General", ModCategory.SETTINGS, "silentclient/icons/settings/general.png");
}

View File

@ -9,7 +9,6 @@ public class RenderMod extends Mod {
public boolean isEnabled() {
return true;
}
public RenderMod() {
super("Render", ModCategory.SETTINGS, "silentclient/icons/settings/render.png");

View File

@ -1,27 +0,0 @@
package net.silentclient.client.mods.staff;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.EventText;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
public class RadmirMod extends Mod {
public RadmirMod() {
super("Radmir Mod", ModCategory.MODS, "silentclient/mods/radmir/radmir.png");
}
@EventTarget
public void onText(EventText event) {
event.setOutputText(this.replaceWords(event.getText(), "Radmir (курица)"));
}
private String replaceWords(String input, String replacement) {
String[] words = input.split("\\s+");
for (int i = 0; i < words.length; i++) {
words[i] = replacement;
}
return String.join(" ", words);
}
}

View File

@ -11,7 +11,6 @@ public class Server {
public static boolean isHypixel() {
return hypixel;
}
public static void setHypixel(boolean hypixel) {
Server.hypixel = hypixel;
}
@ -19,7 +18,6 @@ public class Server {
public static boolean isRuHypixel() {
return ruHypixel;
}
public static void setRuHypixel(boolean ruHypixel) {
Server.ruHypixel = ruHypixel;
}

View File

@ -1,7 +1,5 @@
package net.silentclient.client.mods.world;
import java.util.ArrayList;
import net.minecraft.network.play.server.S2BPacketChangeGameState;
import net.silentclient.client.Client;
import net.silentclient.client.event.EventTarget;
@ -11,6 +9,8 @@ import net.silentclient.client.event.impl.EventReceivePacket;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import java.util.ArrayList;
public class WeatherChangerMod extends Mod {
public WeatherChangerMod() {
super("Weather", ModCategory.MODS, "silentclient/icons/mods/weatherchanger.png");
@ -68,6 +68,4 @@ public class WeatherChangerMod extends Mod {
event.setCancelled(true);
}
}
}

View File

@ -1,60 +0,0 @@
package net.silentclient.client.skillissue;
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.detections.Detection;
import net.silentclient.client.utils.Requests;
import net.silentclient.client.utils.TimerUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
public class SkillIssue {
public static final String VERSION = "1.0.0-beta.1";
private final ArrayList<Detection> detections = new ArrayList<>();
private TimerUtils timer;
public SkillIssue() {
EventManager.register(this);
Client.logger.info(String.format("[SkillIssue]: Initialising (v%s)", VERSION));
// detections.add(new Reach(this));
// detections.add(new AutoClicker(this));
timer = new TimerUtils();
}
@EventTarget
public void tickEvent(ClientTickEvent event) {
if(timer.delay(30000)) {
timer.reset();
(new Thread(this::sendDetections)).start();
}
}
public void sendDetections() {
JSONArray jsonArray = new JSONArray();
for(Detection detection : detections) {
for(String detectReason : detection.getDetections()) {
jsonArray.put(new JSONObject().put("type", detection.getName().toLowerCase()).put("message", detectReason));
}
detection.getDetections().clear();
}
if(jsonArray.isEmpty()) {
return;
}
JSONObject jsonObject = new JSONObject().put("detects", jsonArray);
Requests.post("https://api.silentclient.net/anticheat/detect", jsonObject.toString());
if(Minecraft.getMinecraft().theWorld != null) {
Client.getInstance().updateUserInformation();
}
}
public ArrayList<Detection> getDetections() {
return detections;
}
}

View File

@ -1,27 +0,0 @@
package net.silentclient.client.skillissue.detections;
import net.silentclient.client.Client;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.EntityAttackEvent;
import net.silentclient.client.skillissue.SkillIssue;
import net.silentclient.client.utils.PlayerUtils;
import org.lwjgl.input.Mouse;
public class AutoClicker extends Detection {
private long lastHit = 0;
public AutoClicker(SkillIssue skillIssue) {
super(skillIssue, "AutoClicker");
}
@EventTarget
public void onHit(EntityAttackEvent event) {
if(System.currentTimeMillis() - lastHit < 500 || !PlayerUtils.isSurvival()) {
return;
}
this.lastHit = System.currentTimeMillis();
if(!Mouse.isButtonDown(0) && Client.getInstance().getCPSTracker().getLCPS() > 10) {
this.detect(String.format("lmb is not pressed when hitting, %s cps", Client.getInstance().getCPSTracker().getLCPS()));
}
}
}

View File

@ -1,34 +0,0 @@
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.skillissue.SkillIssue;
import java.util.ArrayList;
public class Detection {
protected Minecraft mc = Minecraft.getMinecraft();
protected SkillIssue skillIssue;
private final String name;
protected ArrayList<String> detections = new ArrayList<>();
public Detection(SkillIssue skillIssue, String name) {
this.skillIssue = skillIssue;
this.name = name;
EventManager.register(this);
}
public void detect(String data) {
this.detections.add(data);
Client.logger.warn(String.format("[SkillIssue]: %s Detection: %s (vl: %s)", name, data, detections.size()));
}
public ArrayList<String> getDetections() {
return detections;
}
public String getName() {
return name;
}
}

View File

@ -1,29 +0,0 @@
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() || mc.isSingleplayer()) {
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));
}
}
}
}

View File

@ -1,23 +1,20 @@
package net.silentclient.client.utils;
import java.awt.HeadlessException;
import java.awt.Toolkit;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Util;
import net.silentclient.client.Client;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.RunCommandEvent;
import net.silentclient.client.utils.AsyncScreenshots.ImageSelection;
import org.lwjgl.Sys;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.RunCommandEvent;
import org.lwjgl.Sys;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Util;
import net.silentclient.client.Client;
import net.silentclient.client.utils.AsyncScreenshots.ImageSelection;
public class ScreenshotManager {
private File screenshot;
private BufferedImage image;
@ -46,6 +43,12 @@ public class ScreenshotManager {
@EventTarget()
public void command(RunCommandEvent event) {
if(event.getCommand().startsWith("/slc$copy ")) {
String message = event.getCommand().replace("/slc$copy ", "");
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(message), null);
event.setCancelled(true);
return;
}
switch(event.getCommand()) {
case "/$openfolder":
File file1 = new File(mc.mcDataDir, "screenshots");