mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:01:32 +01:00
(feature) emote binding
This commit is contained in:
parent
3d56d76f2b
commit
706dce8031
@ -12,6 +12,7 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.minecraft.util.Session;
|
import net.minecraft.util.Session;
|
||||||
import net.silentclient.client.config.ConfigManager;
|
import net.silentclient.client.config.ConfigManager;
|
||||||
import net.silentclient.client.cosmetics.Cosmetics;
|
import net.silentclient.client.cosmetics.Cosmetics;
|
||||||
|
import net.silentclient.client.emotes.EmotesMod;
|
||||||
import net.silentclient.client.event.EventManager;
|
import net.silentclient.client.event.EventManager;
|
||||||
import net.silentclient.client.event.EventTarget;
|
import net.silentclient.client.event.EventTarget;
|
||||||
import net.silentclient.client.event.impl.*;
|
import net.silentclient.client.event.impl.*;
|
||||||
@ -589,6 +590,11 @@ public class Client {
|
|||||||
Server.setRuHypixel(Server.checkIsRuHypixel());
|
Server.setRuHypixel(Server.checkIsRuHypixel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventTarget
|
||||||
|
public void onClick(KeyEvent event) {
|
||||||
|
EmotesMod.onClick(event);
|
||||||
|
}
|
||||||
|
|
||||||
// Instances
|
// Instances
|
||||||
public String getApiUrl() {
|
public String getApiUrl() {
|
||||||
return "http://localhost:" + getUserData().server_port;
|
return "http://localhost:" + getUserData().server_port;
|
||||||
|
@ -3,7 +3,6 @@ package net.silentclient.client.emotes;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.silentclient.client.Client;
|
|
||||||
import net.silentclient.client.emotes.emoticons.Emote;
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
|
|
||||||
public class EmoteManager {
|
public class EmoteManager {
|
||||||
@ -19,11 +18,7 @@ public class EmoteManager {
|
|||||||
Emote emote = PlayerModelManager.get().registry.get(s);
|
Emote emote = PlayerModelManager.get().registry.get(s);
|
||||||
if (EmoteControllerManager.controllers.get(entityPlayer.getName()) != null) {
|
if (EmoteControllerManager.controllers.get(entityPlayer.getName()) != null) {
|
||||||
EmoteControllerManager.controllers.get(entityPlayer.getName()).setEmote(entityPlayer, emote);
|
EmoteControllerManager.controllers.get(entityPlayer.getName()).setEmote(entityPlayer, emote);
|
||||||
} else {
|
|
||||||
Client.logger.info("emote player controller is null");
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Client.logger.info("entity player or emote is null");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,8 +40,6 @@ public class EmoteManager {
|
|||||||
{
|
{
|
||||||
EntityPlayer entityplayer = (EntityPlayer)world.playerEntities.get(i);
|
EntityPlayer entityplayer = (EntityPlayer)world.playerEntities.get(i);
|
||||||
|
|
||||||
Client.logger.info(entityplayer.getName());
|
|
||||||
|
|
||||||
if (name.equalsIgnoreCase(entityplayer.getName()))
|
if (name.equalsIgnoreCase(entityplayer.getName()))
|
||||||
{
|
{
|
||||||
return entityplayer;
|
return entityplayer;
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
package net.silentclient.client.emotes;
|
package net.silentclient.client.emotes;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.silentclient.client.Client;
|
import net.silentclient.client.Client;
|
||||||
|
import net.silentclient.client.emotes.config.EmotesConfig;
|
||||||
|
import net.silentclient.client.emotes.config.EmotesConfigType;
|
||||||
import net.silentclient.client.emotes.socket.EmoteSocket;
|
import net.silentclient.client.emotes.socket.EmoteSocket;
|
||||||
|
import net.silentclient.client.event.EventManager;
|
||||||
|
import net.silentclient.client.event.impl.KeyEvent;
|
||||||
import net.silentclient.client.mods.Mod;
|
import net.silentclient.client.mods.Mod;
|
||||||
import net.silentclient.client.mods.ModCategory;
|
import net.silentclient.client.mods.ModCategory;
|
||||||
import net.silentclient.client.mods.Setting;
|
import net.silentclient.client.mods.Setting;
|
||||||
@ -10,6 +15,8 @@ import org.lwjgl.input.Keyboard;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class EmotesMod extends Mod {
|
public class EmotesMod extends Mod {
|
||||||
|
public static boolean sending = false;
|
||||||
|
|
||||||
public EmotesMod() {
|
public EmotesMod() {
|
||||||
super("Emotes", ModCategory.SETTINGS, "silentclient/emotes/icons/default.png");
|
super("Emotes", ModCategory.SETTINGS, "silentclient/emotes/icons/default.png");
|
||||||
}
|
}
|
||||||
@ -26,6 +33,12 @@ public class EmotesMod extends Mod {
|
|||||||
perspectives.add("Third Person");
|
perspectives.add("Third Person");
|
||||||
|
|
||||||
this.addModeSetting("Default Emote Perspective", this, "Second Person", perspectives);
|
this.addModeSetting("Default Emote Perspective", this, "Second Person", perspectives);
|
||||||
|
|
||||||
|
try {
|
||||||
|
EmotesConfig.init();
|
||||||
|
} catch (Exception err) {
|
||||||
|
Client.logger.catching(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,14 +51,42 @@ public class EmotesMod extends Mod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onClick(KeyEvent event) {
|
||||||
|
if(!Client.getInstance().getSettingsManager().getSettingByClass(EmotesMod.class, "Emotes").getValBoolean()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().currentScreen == null && !sending) {
|
||||||
|
EmotesConfigType.Bind bind = EmotesConfig.getBinds().get(event.getKey());
|
||||||
|
if(bind != null) {
|
||||||
|
EmotesMod.sending = true;
|
||||||
|
(new Thread("EMOTES BIND:" + bind.emoteId) {
|
||||||
|
public void run() {
|
||||||
|
Client.logger.info("bind found");
|
||||||
|
EmoteSocket.get().startEmote(bind.emoteId);
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000L);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Client.logger.catching(e);
|
||||||
|
}
|
||||||
|
EmotesMod.sending = false;
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
} else {
|
||||||
|
Client.logger.info("bind not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChangeSettingValue(Setting setting) {
|
public void onChangeSettingValue(Setting setting) {
|
||||||
super.onChangeSettingValue(setting);
|
super.onChangeSettingValue(setting);
|
||||||
if(setting.getName().equals("Emotes")) {
|
if(setting.getName().equals("Emotes")) {
|
||||||
if(setting.getValBoolean()) {
|
if(setting.getValBoolean()) {
|
||||||
EmoteSocket.get().connect();
|
EmoteSocket.get().connect();
|
||||||
|
EventManager.register(this);
|
||||||
} else {
|
} else {
|
||||||
EmoteSocket.get().disconnect();
|
EmoteSocket.get().disconnect();
|
||||||
|
EventManager.unregister(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,68 @@
|
|||||||
package net.silentclient.client.emotes.config;
|
package net.silentclient.client.emotes.config;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.silentclient.client.Client;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class EmotesConfig {
|
public class EmotesConfig {
|
||||||
|
public static File configFile;
|
||||||
|
public static EmotesConfigType config;
|
||||||
|
public static HashMap<Integer, EmotesConfigType.Bind> binds;
|
||||||
|
|
||||||
|
public static void init() throws IOException {
|
||||||
|
configFile = new File(Minecraft.getMinecraft().mcDataDir, "slc-emotes.json");
|
||||||
|
if(!configFile.exists()) {
|
||||||
|
configFile.createNewFile();
|
||||||
|
config = EmotesConfigType.getDefault();
|
||||||
|
save();
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
InputStream in = Files.newInputStream(configFile.toPath());
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||||
|
StringBuilder content = new StringBuilder();
|
||||||
|
String inputLine;
|
||||||
|
while ((inputLine = reader.readLine()) != null) {
|
||||||
|
content.append(inputLine);
|
||||||
|
}
|
||||||
|
config = Client.getInstance().getGson().fromJson(content.toString(), EmotesConfigType.class);
|
||||||
|
in.close();
|
||||||
|
} catch (Exception err) {
|
||||||
|
Client.logger.catching(err);
|
||||||
|
config = EmotesConfigType.getDefault();
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void save() {
|
||||||
|
try {
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(configFile);
|
||||||
|
byte[] strToBytes = Client.getInstance().getGson().toJson(config).toString().getBytes();
|
||||||
|
outputStream.write(strToBytes);
|
||||||
|
|
||||||
|
outputStream.close();
|
||||||
|
} catch (Exception err) {
|
||||||
|
Client.logger.catching(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateHashMap() {
|
||||||
|
HashMap<Integer, EmotesConfigType.Bind> map = new HashMap<>();
|
||||||
|
for (EmotesConfigType.Bind bind : config.getBinds()) {
|
||||||
|
map.put(bind.keyId, bind);
|
||||||
|
}
|
||||||
|
binds = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<Integer, EmotesConfigType.Bind> getBinds() {
|
||||||
|
return binds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EmotesConfigType getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package net.silentclient.client.emotes.config;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class EmotesConfigType {
|
||||||
|
public ArrayList<EmotesConfigType.Bind> binds;
|
||||||
|
|
||||||
|
public ArrayList<Bind> getBinds() {
|
||||||
|
return binds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBind(int emoteId, int keyId) {
|
||||||
|
int removeIndex = findBindByEmoteId(emoteId);
|
||||||
|
if(removeIndex >= 0) {
|
||||||
|
binds.remove(removeIndex);
|
||||||
|
}
|
||||||
|
if(keyId == -1) {
|
||||||
|
removeBind(emoteId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EmotesConfigType.Bind bind = new Bind();
|
||||||
|
bind.emoteId = emoteId;
|
||||||
|
bind.keyId = keyId;
|
||||||
|
|
||||||
|
binds.add(bind);
|
||||||
|
EmotesConfig.updateHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeBind(int emoteId) {
|
||||||
|
int removeIndex = findBindByEmoteId(emoteId);
|
||||||
|
if(removeIndex >= 0) {
|
||||||
|
binds.remove(removeIndex);
|
||||||
|
}
|
||||||
|
EmotesConfig.updateHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int findBindByEmoteId(int emoteId) {
|
||||||
|
int index = -1;
|
||||||
|
for (Bind bind : binds) {
|
||||||
|
index++;
|
||||||
|
if (bind.emoteId == emoteId) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1; // Если элемент не найден
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Bind {
|
||||||
|
public int emoteId;
|
||||||
|
public int keyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EmotesConfigType getDefault() {
|
||||||
|
EmotesConfigType config = new EmotesConfigType();
|
||||||
|
config.binds = new ArrayList<>();
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
@ -6,13 +6,17 @@ import net.minecraft.client.gui.ScaledResolution;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.silentclient.client.Client;
|
import net.silentclient.client.Client;
|
||||||
import net.silentclient.client.emotes.PlayerModelManager;
|
import net.silentclient.client.emotes.PlayerModelManager;
|
||||||
|
import net.silentclient.client.emotes.config.EmotesConfig;
|
||||||
|
import net.silentclient.client.emotes.config.EmotesConfigType;
|
||||||
import net.silentclient.client.emotes.emoticons.Emote;
|
import net.silentclient.client.emotes.emoticons.Emote;
|
||||||
import net.silentclient.client.emotes.socket.EmoteSocket;
|
import net.silentclient.client.emotes.socket.EmoteSocket;
|
||||||
import net.silentclient.client.gui.SilentScreen;
|
import net.silentclient.client.gui.SilentScreen;
|
||||||
import net.silentclient.client.gui.elements.IconButton;
|
import net.silentclient.client.gui.elements.IconButton;
|
||||||
|
import net.silentclient.client.gui.elements.Input;
|
||||||
import net.silentclient.client.gui.font.SilentFontRenderer;
|
import net.silentclient.client.gui.font.SilentFontRenderer;
|
||||||
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
|
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
|
||||||
import net.silentclient.client.gui.theme.Theme;
|
import net.silentclient.client.gui.theme.Theme;
|
||||||
|
import net.silentclient.client.gui.theme.input.DefaultInputTheme;
|
||||||
import net.silentclient.client.gui.util.RenderUtil;
|
import net.silentclient.client.gui.util.RenderUtil;
|
||||||
import net.silentclient.client.utils.MenuBlurUtils;
|
import net.silentclient.client.utils.MenuBlurUtils;
|
||||||
import net.silentclient.client.utils.MouseCursorHandler;
|
import net.silentclient.client.utils.MouseCursorHandler;
|
||||||
@ -24,6 +28,7 @@ import org.lwjgl.opengl.GL11;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class EmoteMenuGui extends SilentScreen {
|
public class EmoteMenuGui extends SilentScreen {
|
||||||
private ScrollHelper scrollHelper = new ScrollHelper();
|
private ScrollHelper scrollHelper = new ScrollHelper();
|
||||||
@ -41,6 +46,12 @@ public class EmoteMenuGui extends SilentScreen {
|
|||||||
int y = this.height / 2 - (height / 2);
|
int y = this.height / 2 - (height / 2);
|
||||||
this.buttonList.add(new IconButton(0, x + width - 14 - 3, y + 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
|
this.buttonList.add(new IconButton(0, x + width - 14 - 3, y + 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
|
||||||
|
|
||||||
|
HashMap<Integer, EmotesConfigType.Bind> emoteBinds = new HashMap<>();
|
||||||
|
|
||||||
|
for(EmotesConfigType.Bind bind : EmotesConfig.getConfig().getBinds()) {
|
||||||
|
emoteBinds.put(bind.emoteId, bind);
|
||||||
|
}
|
||||||
|
|
||||||
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
|
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
|
||||||
String emoteName = PlayerModelManager.get().map.get(emote.id);
|
String emoteName = PlayerModelManager.get().map.get(emote.id);
|
||||||
if(emoteName == null) {
|
if(emoteName == null) {
|
||||||
@ -50,6 +61,8 @@ public class EmoteMenuGui extends SilentScreen {
|
|||||||
if(emoteInstance == null) {
|
if(emoteInstance == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
EmotesConfigType.Bind bind = emoteBinds.get(emote.id);
|
||||||
|
this.silentInputs.add(new Input(emote.name, bind != null ? bind.keyId : -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +93,7 @@ public class EmoteMenuGui extends SilentScreen {
|
|||||||
int emoteX = x + 3;
|
int emoteX = x + 3;
|
||||||
float emoteY = y + 20 + scrollY;
|
float emoteY = y + 20 + scrollY;
|
||||||
int emoteIndex = 0;
|
int emoteIndex = 0;
|
||||||
|
int realEmoteIndex = 0;
|
||||||
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
|
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
|
||||||
String emoteName = PlayerModelManager.get().map.get(emote.id);
|
String emoteName = PlayerModelManager.get().map.get(emote.id);
|
||||||
if(emoteName == null) {
|
if(emoteName == null) {
|
||||||
@ -90,7 +104,11 @@ public class EmoteMenuGui extends SilentScreen {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, emoteX, emoteY, 80, 80) && !MouseUtils.isInside(mouseX, mouseY, emoteX + 80 - 3 - 10, emoteY + 3, 10, 10);
|
Input input = this.silentInputs.get(realEmoteIndex);
|
||||||
|
|
||||||
|
input.render(mouseX, mouseY, emoteX + 3, emoteY + 80 - 3 - 15, 74, true, new DefaultInputTheme(), true);
|
||||||
|
|
||||||
|
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, emoteX, emoteY, 80, 80) && !MouseUtils.isInside(mouseX, mouseY, emoteX + 80 - 3 - 10, emoteY + 3, 10, 10) && !input.isHovered();
|
||||||
if(isHovered) {
|
if(isHovered) {
|
||||||
cursorType = MouseCursorHandler.CursorType.POINTER;
|
cursorType = MouseCursorHandler.CursorType.POINTER;
|
||||||
RenderUtil.drawRoundedRect(emoteX, emoteY, 80, 80, 3, new Color(255, 255, 255, 30).getRGB());
|
RenderUtil.drawRoundedRect(emoteX, emoteY, 80, 80, 3, new Color(255, 255, 255, 30).getRGB());
|
||||||
@ -110,9 +128,10 @@ public class EmoteMenuGui extends SilentScreen {
|
|||||||
|
|
||||||
RenderUtil.drawImage(new ResourceLocation(favorite ? "silentclient/icons/star.png" : "silentclient/icons/star_outline.png"), emoteX + 80 - 3 - 10, emoteY + 3, 10, 10);
|
RenderUtil.drawImage(new ResourceLocation(favorite ? "silentclient/icons/star.png" : "silentclient/icons/star_outline.png"), emoteX + 80 - 3 - 10, emoteY + 3, 10, 10);
|
||||||
|
|
||||||
RenderUtil.drawImage(emoteInstance.icon.icon, emoteX + 3 + 37 - 28 , emoteY + 16, 56, 56);
|
RenderUtil.drawImage(emoteInstance.icon.icon, emoteX + 3 + 37 - 19, emoteY + 16, 39, 39);
|
||||||
|
|
||||||
emoteIndex += 1;
|
emoteIndex += 1;
|
||||||
|
realEmoteIndex++;
|
||||||
if(emoteIndex == 3) {
|
if(emoteIndex == 3) {
|
||||||
emoteIndex = 0;
|
emoteIndex = 0;
|
||||||
emoteX = x + 3;
|
emoteX = x + 3;
|
||||||
@ -145,6 +164,7 @@ public class EmoteMenuGui extends SilentScreen {
|
|||||||
int emoteX = x + 3;
|
int emoteX = x + 3;
|
||||||
float emoteY = (int) (y + 20 + scrollHelper.getScroll());
|
float emoteY = (int) (y + 20 + scrollHelper.getScroll());
|
||||||
int emoteIndex = 0;
|
int emoteIndex = 0;
|
||||||
|
int realEmoteIndex = 0;
|
||||||
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
|
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
|
||||||
String emoteName = PlayerModelManager.get().map.get(emote.id);
|
String emoteName = PlayerModelManager.get().map.get(emote.id);
|
||||||
if(emoteName == null) {
|
if(emoteName == null) {
|
||||||
@ -154,8 +174,9 @@ public class EmoteMenuGui extends SilentScreen {
|
|||||||
if(emoteInstance == null) {
|
if(emoteInstance == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, emoteX, emoteY, 80, 80) && !MouseUtils.isInside(mouseX, mouseY, emoteX + 80 - 3 - 10, emoteY + 3, 10, 10);
|
Input input = this.silentInputs.get(realEmoteIndex);
|
||||||
|
input.onClick(mouseX, mouseY, emoteX + 3, (int) (emoteY + 80 - 3 - 15), 74, true);
|
||||||
|
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, emoteX, emoteY, 80, 80) && !MouseUtils.isInside(mouseX, mouseY, emoteX + 80 - 3 - 10, emoteY + 3, 10, 10) && !input.isHovered();
|
||||||
if(isHovered) {
|
if(isHovered) {
|
||||||
EmoteSocket.get().startEmote(emote.getId());
|
EmoteSocket.get().startEmote(emote.getId());
|
||||||
mc.displayGuiScreen(null);
|
mc.displayGuiScreen(null);
|
||||||
@ -168,6 +189,7 @@ public class EmoteMenuGui extends SilentScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
emoteIndex += 1;
|
emoteIndex += 1;
|
||||||
|
realEmoteIndex++;
|
||||||
if(emoteIndex == 3) {
|
if(emoteIndex == 3) {
|
||||||
emoteIndex = 0;
|
emoteIndex = 0;
|
||||||
emoteX = x + 3;
|
emoteX = x + 3;
|
||||||
@ -188,9 +210,33 @@ public class EmoteMenuGui extends SilentScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
||||||
if (keyCode == Keyboard.KEY_ESCAPE) {
|
int inputIndex = 0;
|
||||||
mc.displayGuiScreen(null);
|
boolean neededKeyCheck = true;
|
||||||
|
|
||||||
|
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
|
||||||
|
String emoteName = PlayerModelManager.get().map.get(emote.id);
|
||||||
|
if(emoteName == null) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
Emote emoteInstance = PlayerModelManager.get().getEmote(emoteName);
|
||||||
|
if(emoteInstance == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(silentInputs.get(inputIndex).isFocused()) {
|
||||||
|
this.silentInputs.get(inputIndex).onKeyTyped(typedChar, keyCode);
|
||||||
|
EmotesConfig.getConfig().addBind(emote.id, this.silentInputs.get(inputIndex).getKey());
|
||||||
|
EmotesConfig.save();
|
||||||
|
if(keyCode == Keyboard.KEY_ESCAPE) {
|
||||||
|
neededKeyCheck = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inputIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (neededKeyCheck && keyCode == Keyboard.KEY_ESCAPE) {
|
||||||
|
mc.displayGuiScreen(null);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,7 +71,7 @@ public class Input {
|
|||||||
|
|
||||||
public void render(int mouseX, int mouseY, float x, float y, int width, boolean small, IInputTheme theme, boolean center) {
|
public void render(int mouseX, int mouseY, float x, float y, int width, boolean small, IInputTheme theme, boolean center) {
|
||||||
int borderColor = theme.getBorderColor().getRGB();
|
int borderColor = theme.getBorderColor().getRGB();
|
||||||
if(MouseUtils.isInside(mouseX, mouseY, x, y, width, 20)) {
|
if(MouseUtils.isInside(mouseX, mouseY, x, y, width, small ? 15 : 20)) {
|
||||||
borderColor = theme.getHoveredBorderColor().getRGB();
|
borderColor = theme.getHoveredBorderColor().getRGB();
|
||||||
this.hovered = true;
|
this.hovered = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -17,11 +17,13 @@ import java.io.InputStream;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class QuickPlayMod extends Mod {
|
public class QuickPlayMod extends Mod {
|
||||||
public static ArrayList<QuickplayModeType> hypixelQuickplayModes;
|
public static ArrayList<QuickplayModeType> hypixelQuickplayModes;
|
||||||
public static ArrayList<QuickplayModeType> ruhypixelQuickplayModes;
|
public static ArrayList<QuickplayModeType> ruhypixelQuickplayModes;
|
||||||
public static boolean sending = false;
|
public static boolean sending = false;
|
||||||
|
public static HashMap<Integer, Setting> hashMap;
|
||||||
|
|
||||||
public QuickPlayMod() {
|
public QuickPlayMod() {
|
||||||
super("Quickplay", ModCategory.MODS, "silentclient/icons/mods/quickplay.png");
|
super("Quickplay", ModCategory.MODS, "silentclient/icons/mods/quickplay.png");
|
||||||
@ -46,7 +48,8 @@ public class QuickPlayMod extends Mod {
|
|||||||
content.append(inputLine);
|
content.append(inputLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
Type listType = new TypeToken<ArrayList<QuickplayModeType>>(){}.getType();
|
Type listType = new TypeToken<ArrayList<QuickplayModeType>>() {
|
||||||
|
}.getType();
|
||||||
hypixelQuickplayModes = Client.getInstance().getGson().fromJson(content.toString(), listType);
|
hypixelQuickplayModes = Client.getInstance().getGson().fromJson(content.toString(), listType);
|
||||||
|
|
||||||
for (QuickplayModeType mode : hypixelQuickplayModes) {
|
for (QuickplayModeType mode : hypixelQuickplayModes) {
|
||||||
@ -61,6 +64,23 @@ public class QuickPlayMod extends Mod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateHashMap() {
|
||||||
|
HashMap<Integer, Setting> map = new HashMap<>();
|
||||||
|
for(Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(this)) {
|
||||||
|
if (setting.isKeybind()) {
|
||||||
|
map.put(setting.getKeybind(), setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hashMap = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeSettingValue(Setting setting) {
|
||||||
|
super.onChangeSettingValue(setting);
|
||||||
|
updateHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
private void initRuHypixelModes() {
|
private void initRuHypixelModes() {
|
||||||
try {
|
try {
|
||||||
Client.logger.info("Initialising RuHypixel Quickplay Modes");
|
Client.logger.info("Initialising RuHypixel Quickplay Modes");
|
||||||
@ -108,8 +128,8 @@ public class QuickPlayMod extends Mod {
|
|||||||
@EventTarget
|
@EventTarget
|
||||||
public void onClick(KeyEvent event) {
|
public void onClick(KeyEvent event) {
|
||||||
if(mc.thePlayer != null && mc.theWorld != null && mc.currentScreen == null) {
|
if(mc.thePlayer != null && mc.theWorld != null && mc.currentScreen == null) {
|
||||||
for(Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(this)) {
|
Setting setting = hashMap.get(event.getKey());
|
||||||
if(setting.isKeybind()) {
|
if(setting != null) {
|
||||||
if(setting.getName().equals("Open Menu")) {
|
if(setting.getName().equals("Open Menu")) {
|
||||||
// Open Menu
|
// Open Menu
|
||||||
if(setting.isKeyDown() && (Server.isHypixel() || Server.isRuHypixel())) {
|
if(setting.isKeyDown() && (Server.isHypixel() || Server.isRuHypixel())) {
|
||||||
@ -127,7 +147,6 @@ public class QuickPlayMod extends Mod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public class QuickplayModeType {
|
public class QuickplayModeType {
|
||||||
public String name;
|
public String name;
|
||||||
|
@ -27,11 +27,13 @@ import org.lwjgl.input.Keyboard;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class AutoTextMod extends Mod {
|
public class AutoTextMod extends Mod {
|
||||||
|
|
||||||
public ArrayList<AutoTextCommand> commands = new ArrayList<AutoTextCommand>();
|
public ArrayList<AutoTextCommand> commands = new ArrayList<AutoTextCommand>();
|
||||||
|
public HashMap<Integer, AutoTextCommand> commandsMap = new HashMap<>();
|
||||||
public boolean sending = false;
|
public boolean sending = false;
|
||||||
private int componentHeight = 0;
|
private int componentHeight = 0;
|
||||||
|
|
||||||
@ -182,13 +184,14 @@ public class AutoTextMod extends Mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.commands = newCommands;
|
this.commands = newCommands;
|
||||||
|
updateHashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventTarget
|
@EventTarget
|
||||||
public void onClick(KeyEvent event) {
|
public void onClick(KeyEvent event) {
|
||||||
if(mc.thePlayer != null && mc.theWorld != null && mc.currentScreen == null && !sending && !isForceDisabled()) {
|
if(mc.thePlayer != null && mc.theWorld != null && mc.currentScreen == null && !sending && !isForceDisabled()) {
|
||||||
for(AutoTextCommand command : commands) {
|
AutoTextCommand command = commandsMap.get(event.getKey());
|
||||||
if(command.getKey() == event.getKey()) {
|
if(command != null) {
|
||||||
Client.getInstance().getModInstances().getAutoText().sending = true;
|
Client.getInstance().getModInstances().getAutoText().sending = true;
|
||||||
(new Thread("ATC: " + command.getCommand()) {
|
(new Thread("ATC: " + command.getCommand()) {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -196,8 +199,7 @@ public class AutoTextMod extends Mod {
|
|||||||
try {
|
try {
|
||||||
Thread.sleep(2000L);
|
Thread.sleep(2000L);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
Client.logger.catching(e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
Client.getInstance().getModInstances().getAutoText().sending = false;
|
Client.getInstance().getModInstances().getAutoText().sending = false;
|
||||||
}
|
}
|
||||||
@ -205,10 +207,10 @@ public class AutoTextMod extends Mod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void addCommand(String command, int key) {
|
public void addCommand(String command, int key) {
|
||||||
this.commands.add(new AutoTextCommand(command, key));
|
this.commands.add(new AutoTextCommand(command, key));
|
||||||
|
updateHashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<AutoTextCommand> getCommands() {
|
public ArrayList<AutoTextCommand> getCommands() {
|
||||||
@ -235,6 +237,14 @@ public class AutoTextMod extends Mod {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateHashMap() {
|
||||||
|
HashMap<Integer, AutoTextCommand> map = new HashMap<>();
|
||||||
|
for (AutoTextCommand bind : commands) {
|
||||||
|
map.put(bind.key, bind);
|
||||||
|
}
|
||||||
|
commandsMap = map;
|
||||||
|
}
|
||||||
|
|
||||||
public class AutoTextAddCommandGui extends SilentScreen {
|
public class AutoTextAddCommandGui extends SilentScreen {
|
||||||
private final GuiScreen parentScreen;
|
private final GuiScreen parentScreen;
|
||||||
|
|
||||||
@ -311,6 +321,7 @@ public class AutoTextMod extends Mod {
|
|||||||
this.silentInputs.get(1).onClick(mouseX, mouseY, x + 3, y + 46, this.modalWidth - 6);
|
this.silentInputs.get(1).onClick(mouseX, mouseY, x + 3, y + 46, this.modalWidth - 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuiClosed() {
|
public void onGuiClosed() {
|
||||||
MenuBlurUtils.unloadBlur();
|
MenuBlurUtils.unloadBlur();
|
||||||
|
Loading…
Reference in New Issue
Block a user