RuHypixel Quickplay

This commit is contained in:
kirillsaint 2023-10-08 15:04:54 +06:00
parent 41f9a51699
commit f386320ef9
5 changed files with 180 additions and 8 deletions

View File

@ -13,6 +13,7 @@ import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.hypixel.QuickPlayMod;
import net.silentclient.client.mods.util.Server;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.MouseCursorHandler;
import org.lwjgl.input.Mouse;
@ -57,7 +58,7 @@ public class QuickplayGui extends SilentScreen {
int translatedY = r.getScaledHeight() - 24 - listHeight;
GL11.glScissor(0 * s, translatedY * s, this.width * s, listHeight * s);
for(QuickPlayMod.QuickplayModeType quickplayMode : QuickPlayMod.hypixelQuickplayModes) {
for(QuickPlayMod.QuickplayModeType quickplayMode : (Server.isRuHypixel() ? QuickPlayMod.ruhypixelQuickplayModes : QuickPlayMod.hypixelQuickplayModes)) {
int modeX = column == 1 ? modeBaseX - 155 : modeBaseX + 5;
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, modeX, modeY, 150, 30);
if(isHovered) {
@ -101,7 +102,7 @@ public class QuickplayGui extends SilentScreen {
newScrollY += amountScrolled;
else
newScrollY = 0;
if((newScrollY < ((Math.ceil(QuickPlayMod.hypixelQuickplayModes.size() / 2) + 1) * 30) && (((Math.ceil(QuickPlayMod.hypixelQuickplayModes.size() / 2) + 1) * 30) + 24) > height) || amountScrolled < 0) {
if((newScrollY < ((Math.ceil((Server.isRuHypixel() ? QuickPlayMod.ruhypixelQuickplayModes : QuickPlayMod.hypixelQuickplayModes).size() / 2) + 1) * 30) && (((Math.ceil((Server.isRuHypixel() ? QuickPlayMod.ruhypixelQuickplayModes : QuickPlayMod.hypixelQuickplayModes).size() / 2) + 1) * 30) + 24) > height) || amountScrolled < 0) {
this.scrollY = (float) newScrollY;
if(this.scrollY < 0) {
this.scrollY = 0;
@ -118,7 +119,7 @@ public class QuickplayGui extends SilentScreen {
int column = 1;
float modeY = 24 - scrollAnimation.getValue();
for(QuickPlayMod.QuickplayModeType quickplayMode : QuickPlayMod.hypixelQuickplayModes) {
for(QuickPlayMod.QuickplayModeType quickplayMode : (Server.isRuHypixel() ? QuickPlayMod.ruhypixelQuickplayModes : QuickPlayMod.hypixelQuickplayModes)) {
int modeX = column == 1 ? modeBaseX - 155 : modeBaseX + 5;
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, modeX, modeY, 150, 30);
if(isHovered) {

View File

@ -15,6 +15,7 @@ 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.mods.hypixel.QuickPlayMod;
import net.silentclient.client.mods.util.Server;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.MouseCursorHandler;
import org.lwjgl.input.Keyboard;
@ -43,7 +44,7 @@ public class QuickplayModeGui extends SilentScreen {
this.silentInputs.clear();
this.buttonList.add(new IconButton(0, this.width - 14 - 3, 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
for(QuickPlayMod.QuickplayCommandType quickplayMode : quickplayMode.modes) {
this.silentInputs.add(new Input(quickplayMode.name, Client.getInstance().getSettingsManager().getSettingByClass(QuickPlayMod.class, "Quickplay Mode:Hypixel:"+quickplayMode.command).getKeybind()));
this.silentInputs.add(new Input(quickplayMode.name, Client.getInstance().getSettingsManager().getSettingByClass(QuickPlayMod.class, String.format("Quickplay Mode:%s:%s", Server.isRuHypixel() ? "RuHypixel" : "Hypixel", quickplayMode.command)).getKeybind()));
}
}
@ -179,7 +180,7 @@ public class QuickplayModeGui extends SilentScreen {
for(QuickPlayMod.QuickplayCommandType quickplayMode : quickplayMode.modes) {
if(silentInputs.get(inputIndex).isFocused()) {
this.silentInputs.get(inputIndex).onKeyTyped(typedChar, keyCode);
Client.getInstance().getSettingsManager().getSettingByClass(QuickPlayMod.class, "Quickplay Mode:Hypixel:"+quickplayMode.command).setKeybind(this.silentInputs.get(inputIndex).getKey());
Client.getInstance().getSettingsManager().getSettingByClass(QuickPlayMod.class, String.format("Quickplay Mode:%s:%s", Server.isRuHypixel() ? "RuHypixel" : "Hypixel", quickplayMode.command)).setKeybind(this.silentInputs.get(inputIndex).getKey());
if(keyCode == Keyboard.KEY_ESCAPE) {
neededKeyCheck = false;
break;

View File

@ -20,6 +20,7 @@ import java.util.ArrayList;
public class QuickPlayMod extends Mod {
public static ArrayList<QuickplayModeType> hypixelQuickplayModes;
public static ArrayList<QuickplayModeType> ruhypixelQuickplayModes;
public static boolean sending = false;
public QuickPlayMod() {
@ -31,8 +32,13 @@ public class QuickPlayMod extends Mod {
super.setup();
setNewMod(true);
this.addKeybindSetting("Open Menu", this, Keyboard.KEY_MINUS);
initHypixelModes();
initRuHypixelModes();
}
private void initHypixelModes() {
try {
Client.logger.info("Initialising Quickplay Modes");
Client.logger.info("Initialising Hypixel Quickplay Modes");
InputStream in = getClass().getResourceAsStream("/assets/minecraft/silentclient/mods/quickplay/modes_hypixel.json");
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuffer content = new StringBuffer();
@ -45,9 +51,9 @@ public class QuickPlayMod extends Mod {
hypixelQuickplayModes = Client.getInstance().getGson().fromJson(content.toString(), listType);
for(QuickplayModeType mode : hypixelQuickplayModes) {
Client.logger.info(String.format("Initialising Quickplay Mode (%s)", mode.name));
Client.logger.info(String.format("Initialising Hypixel Quickplay Mode (%s)", mode.name));
mode.modes.forEach((command) -> {
Client.logger.info(String.format("Initialising Quickplay Mode (%s) Command (%s)", mode.name, command.name));
Client.logger.info(String.format("Initialising Hypixel Quickplay Mode (%s) Command (%s)", mode.name, command.name));
this.addKeybindSetting("Quickplay Mode:Hypixel:"+command.command, this, -1);
});
}
@ -56,6 +62,32 @@ public class QuickPlayMod extends Mod {
}
}
private void initRuHypixelModes() {
try {
Client.logger.info("Initialising RuHypixel Quickplay Modes");
InputStream in = getClass().getResourceAsStream("/assets/minecraft/silentclient/mods/quickplay/modes_ruhypixel.json");
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuffer content = new StringBuffer();
String inputLine;
while ((inputLine = reader.readLine()) != null) {
content.append(inputLine);
}
Type listType = new TypeToken<ArrayList<QuickplayModeType>>(){}.getType();
ruhypixelQuickplayModes = Client.getInstance().getGson().fromJson(content.toString(), listType);
for(QuickplayModeType mode : ruhypixelQuickplayModes) {
Client.logger.info(String.format("Initialising RuHypixel Quickplay Mode (%s)", mode.name));
mode.modes.forEach((command) -> {
Client.logger.info(String.format("Initialising RuHypixel Quickplay Mode (%s) Command (%s)", mode.name, command.name));
this.addKeybindSetting("Quickplay Mode:RuHypixel:"+command.command, this, -1);
});
}
} catch (Exception err) {
Client.logger.catching(err);
}
}
public static void runCommand(String command) {
if(sending) {
return;

View File

@ -0,0 +1,138 @@
[
{
"name": "Lobby",
"icon": "ruhypixel",
"modes": [
{
"name": "Go to Lobby",
"command": "/lobby"
}
]
},
{
"name": "Arcade",
"icon": "arcade",
"modes": [
{
"name": "Block Party",
"command": "/play BLOCK_PARTY"
},
{
"name": "Dropper",
"command": "/play DROPPER"
},
{
"name": "Murder Mystery",
"command": "/play MURDERMYSTERY_CLASSIC"
}
]
},
{
"name": "Bed Wars",
"icon": "bedwars",
"modes": [
{
"name": "Solo",
"command": "/play BEDWARS_SOLO"
},
{
"name": "Doubles",
"command": "/play BEDWARS_TEAM"
},
{
"name": "3v3v3v3",
"command": "/play BEDWARS_3v3v3v3"
},
{
"name": "4v4v4v4",
"command": "/play BEDWARS_4v4v4v4"
}
]
},
{
"name": "Duels",
"icon": "duels",
"modes": [
{
"name": "Bed Wars",
"command": "/play BEDWARS_DUELS"
},
{
"name": "Bridge",
"command": "/play DUEL_THE_BRIDGE"
},
{
"name": "Boxing",
"command": "/play DUEL_BOXING"
},
{
"name": "Classic",
"command": "/play DUEL_CLASSIC"
},
{
"name": "Combo",
"command": "/play DUEL_COMBO"
},
{
"name": "NoDebuff",
"command": "/play DUEL_NODEBUFF"
},
{
"name": "OP",
"command": "/play DUEL_OP"
},
{
"name": "Pearl Fight",
"command": "/play DUEL_PEARL_FIGHT"
},
{
"name": "Sky Wars",
"command": "/play SKYWARS_DUELS"
},
{
"name": "Stick Fight",
"command": "/play DUEL_STICK_DUELS"
},
{
"name": "Sumo",
"command": "/play DUEL_SUMO"
},
{
"name": "UHC",
"command": "/play DUEL_UHC"
}
]
},
{
"name": "SkyWars",
"icon": "skywars",
"modes": [
{
"name": "Solo",
"command": "/play SKYWARS_SOLO_INSANE"
},
{
"name": "Teams",
"command": "/play SKYWARS_TEAM_INSANE"
},
{
"name": "Ranked",
"command": "/play SKYWARS_RANKED"
}
]
},
{
"name": "TNT Games",
"icon": "tnt",
"modes": [
{
"name": "TNT Run",
"command": "/play TNT_RUN"
},
{
"name": "TNT Tag",
"command": "/play TNT_TAG"
}
]
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB