mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 06:51:32 +01:00
Guess The Build Mod
This commit is contained in:
parent
b539f0715c
commit
41d9ff1ee4
@ -646,7 +646,7 @@ public class Client {
|
||||
}
|
||||
|
||||
public boolean isTest() {
|
||||
return getBuildData().getBranch().equals("test");
|
||||
return getBuildData().getBranch().equals("TEST2");
|
||||
}
|
||||
|
||||
public boolean isDebug() {
|
||||
|
@ -2,10 +2,7 @@ package net.silentclient.client.mods;
|
||||
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.mods.hud.*;
|
||||
import net.silentclient.client.mods.hypixel.AutoGGMod;
|
||||
import net.silentclient.client.mods.hypixel.AutoTipMod;
|
||||
import net.silentclient.client.mods.hypixel.LevelHeadMod;
|
||||
import net.silentclient.client.mods.hypixel.QuickPlayMod;
|
||||
import net.silentclient.client.mods.hypixel.*;
|
||||
import net.silentclient.client.mods.hypixel.togglechat.ToggleChatMod;
|
||||
import net.silentclient.client.mods.player.*;
|
||||
import net.silentclient.client.mods.render.*;
|
||||
@ -13,9 +10,6 @@ import net.silentclient.client.mods.settings.CosmeticsMod;
|
||||
import net.silentclient.client.mods.settings.FPSBoostMod;
|
||||
import net.silentclient.client.mods.settings.GeneralMod;
|
||||
import net.silentclient.client.mods.settings.RenderMod;
|
||||
import net.silentclient.client.mods.staff.DebugNpcMod;
|
||||
import net.silentclient.client.mods.staff.FPSSpoofer;
|
||||
import net.silentclient.client.mods.staff.HitDelayFixMod;
|
||||
import net.silentclient.client.mods.staff.TestMod;
|
||||
import net.silentclient.client.mods.world.FullBrightMod;
|
||||
import net.silentclient.client.mods.world.PlayerCounterMod;
|
||||
@ -179,9 +173,7 @@ public class ModInstances {
|
||||
mods.add(new BlockInfoMod());
|
||||
if(Client.getInstance().isDebug() || Client.getInstance().isTest()) {
|
||||
mods.add(new TestMod());
|
||||
mods.add(new DebugNpcMod());
|
||||
mods.add(new HitDelayFixMod());
|
||||
mods.add(new FPSSpoofer());
|
||||
mods.add(new GuessTheBuildMod());
|
||||
}
|
||||
mods.add(new NewMotionBlurMod());
|
||||
if(Client.getInstance().getBuildData().getBranch().equals("fushka")) {
|
||||
|
@ -0,0 +1,122 @@
|
||||
package net.silentclient.client.mods.hypixel;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import net.minecraft.network.play.server.S02PacketChat;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.event.EventTarget;
|
||||
import net.silentclient.client.event.impl.EventReceivePacket;
|
||||
import net.silentclient.client.gui.hud.ScreenPosition;
|
||||
import net.silentclient.client.mods.ModCategory;
|
||||
import net.silentclient.client.mods.ModDraggable;
|
||||
import net.silentclient.client.mods.util.Server;
|
||||
import net.silentclient.client.utils.GTBHelper;
|
||||
import net.silentclient.client.utils.Requests;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class GuessTheBuildMod extends ModDraggable {
|
||||
|
||||
public static ArrayList<String> words;
|
||||
public static List<String> lastWords = null;
|
||||
private String lastActionBar = "";
|
||||
|
||||
public GuessTheBuildMod() {
|
||||
super("Guess The Build", ModCategory.MODS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
super.setup();
|
||||
words = new ArrayList<>();
|
||||
try {
|
||||
InputStream in = getClass().getResourceAsStream("/assets/minecraft/silentclient/mods/guessthebuild/words.txt");
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
StringBuffer content = new StringBuffer();
|
||||
String inputLine;
|
||||
while ((inputLine = reader.readLine()) != null) {
|
||||
content.append(inputLine);
|
||||
}
|
||||
|
||||
words = new ArrayList<>(Arrays.asList(content.toString().split("\n")));
|
||||
in.close();
|
||||
} catch (Exception e1) {
|
||||
Client.logger.catching(e1);
|
||||
}
|
||||
}
|
||||
|
||||
@EventTarget
|
||||
public void onMessage(EventReceivePacket event) {
|
||||
if(event.getPacket() instanceof S02PacketChat) {
|
||||
final S02PacketChat chatPacket = (S02PacketChat) event.getPacket();
|
||||
if(chatPacket.getType() == 2 && Server.isHypixel()) {
|
||||
if(chatPacket.getChatComponent() != null) {
|
||||
String actionBar = chatPacket.getChatComponent().getFormattedText();
|
||||
if (!GTBHelper.isGTBActionBar(actionBar)) {
|
||||
lastWords = null;
|
||||
return;
|
||||
}
|
||||
|
||||
actionBar = EnumChatFormatting.getTextWithoutFormattingCodes(actionBar).replace("The theme is ", "");
|
||||
|
||||
if (actionBar.equals(lastActionBar)) return;
|
||||
lastActionBar = actionBar;
|
||||
|
||||
(new Thread(() -> {
|
||||
try {
|
||||
String arrayString = Requests.get("https://hypixel.silentclient.net/guessthebuild/check?word=" + lastActionBar);
|
||||
GsonBuilder builder = new GsonBuilder();
|
||||
Gson gson = builder.create();
|
||||
|
||||
Type listType = new TypeToken<ArrayList<String>>(){}.getType();
|
||||
ArrayList<String> response = gson.fromJson(arrayString, listType);
|
||||
lastWords = response;
|
||||
} catch (Exception err) {
|
||||
lastWords = null;
|
||||
}
|
||||
})).start();
|
||||
} else {
|
||||
lastWords = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return font.FONT_HEIGHT + ((lastWords != null ? lastWords.size() : 0) * font.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean render(ScreenPosition pos) {
|
||||
if(lastWords != null) {
|
||||
int y = 0;
|
||||
font.drawString("Words:", 0, y, -1, true);
|
||||
y += font.FONT_HEIGHT;
|
||||
for(String word : lastWords) {
|
||||
font.drawString(word, 0, y, -1, true);
|
||||
y += font.FONT_HEIGHT;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderDummy(ScreenPosition pos) {
|
||||
super.renderDummy(pos);
|
||||
font.drawString("Words:", 0, 0, -1, true);
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package net.silentclient.client.utils;
|
||||
|
||||
public class GTBHelper {
|
||||
public static Boolean isGTBActionBar(final String actionBar) {
|
||||
return actionBar.contains("§b")
|
||||
&& actionBar.contains("§e")
|
||||
&& actionBar.contains("_");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user