diff --git a/build/libs/[1.8.9] BetterKeystrokes V-1.2.jar b/build/libs/[1.8.9] BetterKeystrokes V-1.2.jar index d0e81406..83fb3bbf 100644 Binary files a/build/libs/[1.8.9] BetterKeystrokes V-1.2.jar and b/build/libs/[1.8.9] BetterKeystrokes V-1.2.jar differ diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/ClickGui.java b/src/main/java/keystrokesmod/client/clickgui/raven/ClickGui.java index b5c2472d..e670d637 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/ClickGui.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/ClickGui.java @@ -24,12 +24,11 @@ public class ClickGui extends GuiScreen { private Timer aL; private Timer aE; private Timer aR; - private ScaledResolution sr; - private GuiButtonExt s; - private GuiTextField c; private final ArrayList categoryList; + public final Terminal terminal; public ClickGui() { + this.terminal = new Terminal(); this.categoryList = new ArrayList<>(); int topOffset = 5; Module.ModuleCategory[] values; @@ -42,6 +41,8 @@ public ClickGui() { categoryList.add(currentModuleCategory); topOffset += 20; } + terminal.setLocation(5, topOffset); + terminal.setSize((int) (92 * 1.5), (int) ((92 * 1.5) * 0.75)); } public void initMain() { @@ -54,10 +55,6 @@ public void initMain() { public void initGui() { super.initGui(); - this.sr = new ScaledResolution(this.mc); - (this.c = new GuiTextField(1, this.mc.fontRendererObj, 22, this.height - 100, 150, 20)).setMaxStringLength(256); - this.buttonList.add(this.s = new GuiButtonExt(2, 22, this.height - 70, 150, 20, "Send")); - this.s.visible = keystrokesmod.client.module.modules.client.CommandLine.a; } public void drawScreen(int x, int y, float p) { @@ -87,16 +84,16 @@ public void drawScreen(int x, int y, float p) { margin += 2; } }else { - mc.fontRendererObj.drawString("Raven B+ v" + clientVersion, 4, this.height - 3 - mc.fontRendererObj.FONT_HEIGHT, Utils.Client.astolfoColorsDraw(10, 14, speed)); + mc.fontRendererObj.drawString("Raven B+ v" + clientVersion + " | Config: " + Raven.configManager.getConfig().getName(), 4, this.height - 3 - mc.fontRendererObj.FONT_HEIGHT, Utils.Client.astolfoColorsDraw(10, 14, speed)); } this.drawVerticalLine(halfScreenWidth - 10 - w_c, quarterScreenHeight - 30, quarterScreenHeight + 43, Color.white.getRGB()); this.drawVerticalLine(halfScreenWidth + 10 + w_c, quarterScreenHeight - 30, quarterScreenHeight + 43, Color.white.getRGB()); - int r; + int animationProggress; if (this.aL != null) { - r = this.aL.getValueInt(0, 20, 2); - this.drawHorizontalLine(halfScreenWidth - 10, halfScreenWidth - 10 + r, quarterScreenHeight - 29, -1); - this.drawHorizontalLine(halfScreenWidth + 10, halfScreenWidth + 10 - r, quarterScreenHeight + 42, -1); + animationProggress = this.aL.getValueInt(0, 20, 2); + this.drawHorizontalLine(halfScreenWidth - 10, halfScreenWidth - 10 + animationProggress, quarterScreenHeight - 29, -1); + this.drawHorizontalLine(halfScreenWidth + 10, halfScreenWidth + 10 - animationProggress, quarterScreenHeight + 42, -1); } for (CategoryComponent category : categoryList) { @@ -104,7 +101,7 @@ public void drawScreen(int x, int y, float p) { category.up(x, y); for (Component module : category.getModules()) { - module.compute(x, y); + module.update(x, y); } } @@ -112,50 +109,21 @@ public void drawScreen(int x, int y, float p) { // PLAYER GuiInventory.drawEntityOnScreen(this.width + 15 - this.aE.getValueInt(0, 40, 2), this.height - 19 - this.fontRendererObj.FONT_HEIGHT, 40, (float)(this.width - 25 - x), (float)(this.height - 50 - y), this.mc.thePlayer); - if (keystrokesmod.client.module.modules.client.CommandLine.a) { - if (!this.s.visible) { - this.s.visible = true; - } - - r = keystrokesmod.client.module.modules.client.CommandLine.animate.isToggled() ? keystrokesmod.client.module.modules.client.CommandLine.an.getValueInt(0, 200, 2) : 200; - if (keystrokesmod.client.module.modules.client.CommandLine.b) { - r = 200 - r; - if (r == 0) { - keystrokesmod.client.module.modules.client.CommandLine.b = false; - keystrokesmod.client.module.modules.client.CommandLine.a = false; - this.s.visible = false; - } - } - - drawRect(0, 0, r, this.height, -1089466352); - this.drawHorizontalLine(0, r - 1, 0, -1); - this.drawHorizontalLine(0, r - 1, this.height - 115, -1); - drawRect(r - 1, 0, r, this.height, -1); - CommandLine.rc(this.fontRendererObj, this.height, r, this.sr.getScaleFactor()); - int x2 = r - 178; - this.c.xPosition = x2; - this.s.xPosition = x2; - this.c.drawTextBox(); - super.drawScreen(x, y, p); - } else if (keystrokesmod.client.module.modules.client.CommandLine.b) { - keystrokesmod.client.module.modules.client.CommandLine.b = false; - } - + terminal.update(x, y); + terminal.draw(); } public void mouseClicked(int x, int y, int mouseButton) throws IOException { Iterator btnCat = categoryList.iterator(); + terminal.mouseDown(x, y, mouseButton); + if(terminal.overPosition(x, y)) return; + while(true) { CategoryComponent category; do { do { if (!btnCat.hasNext()) { - if (keystrokesmod.client.module.modules.client.CommandLine.a) { - this.c.mouseClicked(x, y, mouseButton); - super.mouseClicked(x, y, mouseButton); - } - return; } @@ -183,6 +151,9 @@ public void mouseClicked(int x, int y, int mouseButton) throws IOException { } public void mouseReleased(int x, int y, int s) { + terminal.mouseReleased(x, y, s); + if(terminal.overPosition(x, y)) return; + if (s == 0) { Iterator btnCat = categoryList.iterator(); @@ -216,6 +187,7 @@ public void mouseReleased(int x, int y, int s) { } public void keyTyped(char t, int k) { + terminal.keyTyped(t, k); if (k == 1) { this.mc.displayGuiScreen(null); } else { @@ -226,17 +198,6 @@ public void keyTyped(char t, int k) { do { do { if (!btnCat.hasNext()) { - if (keystrokesmod.client.module.modules.client.CommandLine.a) { - String cm = this.c.getText(); - if (k == 28 && !cm.isEmpty()) { - CommandLine.rCMD(this.c.getText()); - this.c.setText(""); - return; - } - - this.c.textboxKeyTyped(t, k); - } - return; } @@ -245,19 +206,12 @@ public void keyTyped(char t, int k) { } while(cat.getModules().isEmpty()); for (Component c : cat.getModules()) { - c.ky(t, k); + c.keyTyped(t, k); } } } } - public void actionPerformed(GuiButton b) { - if (b == this.s) { - CommandLine.rCMD(this.c.getText()); - this.c.setText(""); - } - } - public void onGuiClosed() { this.aL = null; if (this.sf != null) { @@ -265,6 +219,7 @@ public void onGuiClosed() { this.sf = null; } Raven.configManager.save(); + Raven.clientConfig.saveConfig(); } public boolean doesGuiPauseGame() { diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/CommandLine.java b/src/main/java/keystrokesmod/client/clickgui/raven/CommandLine.java deleted file mode 100644 index cefe83c5..00000000 --- a/src/main/java/keystrokesmod/client/clickgui/raven/CommandLine.java +++ /dev/null @@ -1,108 +0,0 @@ - -package keystrokesmod.client.clickgui.raven; - -import keystrokesmod.client.main.Raven; -import keystrokesmod.client.utils.ChatHelper; -import keystrokesmod.client.utils.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class CommandLine { - private static final Minecraft mc = Minecraft.getMinecraft(); - private static boolean f = true; - private static final int maxLines = 80; - private static final List cs = Arrays.asList((new Color(170, 107, 148, 50)).getRGB(), (new Color(122, 158, 134, 50)).getRGB(), (new Color(16, 16, 16, 50)).getRGB(), (new Color(64, 114, 148, 50)).getRGB()); - private static int ccs = 0; - private static int lccs = -1; - public static List commandLineHistory = new ArrayList<>(); - - public static void rCMD(String c) { - if (!c.isEmpty()) { - String cm = c.toLowerCase(); - boolean hasArgs = c.contains(" "); - String[] args = hasArgs ? c.split(" ") : null; - - Raven.commandManager.executeCommand(cm.split(" ")[0], args); - } - } - - public static void print(String message, int breakLineMode) { - if (breakLineMode == 1 || breakLineMode == 2) { - commandLineHistory.add(""); - } - - commandLineHistory.add(message); - if (breakLineMode == 2 || breakLineMode == 3) { - commandLineHistory.add(""); - } - - while (commandLineHistory.size() > maxLines) { - commandLineHistory.remove(0); - } - } - - public static void rc(FontRenderer fr, int h, int w, int s) { - int x = w - 195; - int y = h - 130; - int sY = h - 345; - int sH = 230; - GL11.glEnable(3089); - int mw = w * s; - GL11.glScissor(0, mc.displayHeight - (sY + sH) * s, mw - (mw < 2 ? 0 : 2), mc.displayHeight); - Utils.HUD.db(1000, 1000, ccs); - rss(fr, commandLineHistory, x, y); - GL11.glDisable(3089); - } - - private static void rss(FontRenderer fr, List rs, int x, int y) { - if (f) { - f = false; - print("Welcome,", 0); - print("Use \"help\" for help.", 0); - print("&cExisting configs will", 0); - print("&cno longer work due to", 0); - print("&cthe new config system.", 0); - } - - if (!rs.isEmpty()) { - for(int i = rs.size() - 1; i >= 0; --i) { - String s = rs.get(i); - int c = -1; - if (s.contains("&a")) { - s = s.replace("&a", ""); - c = Color.green.getRGB(); - } else if (s.contains("&c")) { - s = s.replace("&c", ""); - c = Color.red.getRGB(); - } else if (s.contains("&e")) { - s = s.replace("&e", ""); - c = Color.yellow.getRGB(); - } - - fr.drawString(s, x, y, c); - y -= fr.FONT_HEIGHT + 5; - } - - } - } - - public static void setccs() { - int val = Utils.Java.rand().nextInt(cs.size()); - if (val == lccs) { - val += val == 3 ? -3 : 1; - } - - lccs = val; - ccs = cs.get(val); - } - - public static void od() { - ChatHelper.reset(); - } -} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/Component.java b/src/main/java/keystrokesmod/client/clickgui/raven/Component.java index a90f92e2..434a931c 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/Component.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/Component.java @@ -1,25 +1,17 @@ package keystrokesmod.client.clickgui.raven; -public class Component { - public void draw() { - } +public interface Component { + public void draw(); - public void compute(int mousePosX, int mousePosY) { - } + public void update(int mousePosX, int mousePosY); - public void mouseDown(int x, int y, int b) { - } + public void mouseDown(int x, int y, int b); - public void mouseReleased(int x, int y, int m) { - } + public void mouseReleased(int x, int y, int m); - public void ky(char t, int k) { - } + public void keyTyped(char t, int k); - public void setModuleStartAt(int n) { - } + public void setComponentStartAt(int n); - public int getHeight() { - return 0; - } + public int getHeight(); } diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/Terminal.java b/src/main/java/keystrokesmod/client/clickgui/raven/Terminal.java new file mode 100644 index 00000000..43f8730f --- /dev/null +++ b/src/main/java/keystrokesmod/client/clickgui/raven/Terminal.java @@ -0,0 +1,431 @@ +package keystrokesmod.client.clickgui.raven; + +import keystrokesmod.client.main.Raven; +import keystrokesmod.client.utils.CoolDown; +import keystrokesmod.client.utils.Timer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import org.apache.commons.lang3.ArrayUtils; +import org.lwjgl.opengl.GL11; +import scala.Int; +import scala.actors.threadpool.Arrays; + +import java.awt.*; +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.stream.Stream; + +public class Terminal implements Component { + private int x, y, width, height, barHeight, border; + private int minWidth, minHeight; + private int resizeButtonSize; + public boolean opened = false; + public boolean hidden = false; + private boolean resizing = false; + private boolean focused = false; + private CoolDown keyDown = new CoolDown(500); + + private int backCharsCursor = 0; + + public final int[] acceptableKeycodes = {41, 0, 2,3,4,5,6,7,8,9,10, 11, 12, 13, 26, 27, 39, 40, 0, 51, 52, 53, 41, 145, 144, 147, 146, 57, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31, 32, 33, 34, 35, 36 ,37, 38, 44, 45, 46, 47, 48, 49, 50}; + + private final Minecraft mc; + private final FontRenderer fr; + + private String inputText = ""; + private static ArrayList out = new ArrayList<>(); + private final String prefix = "$ "; + + private boolean dragging = false; + private double windowStartDragX; + private double windowStartDragY; + private double mouseStartDragX; + private double mouseStartDragY; + public Terminal(){ + this.x = 0; + this.y = 0; + this.width = 300; + this.minWidth = 184; + this.height = 214; + this.minHeight = 67; + this.barHeight = 13; + this.mc = Minecraft.getMinecraft(); + this.fr = mc.fontRendererObj; + this.border = 2; + this.resizeButtonSize = 10; + } + + public static void clearTerminal() { + out.clear(); + } + + public void show(){ + this.hidden = false; + } + + public void hide(){ + this.hidden = true; + } + + @Override + public void draw() { + if(hidden) return; + + //this.barHeight = mc.displayHeight / 90; + double desiredTextSize = barHeight * 0.65; + double scaleFactor = desiredTextSize/ fr.FONT_HEIGHT; + double coordFactor = 1/scaleFactor; + double margin = (int)((barHeight - desiredTextSize) * 0.8); + float textY = (float) ((y + margin) * coordFactor); + float textX = (float) ((x + margin) * coordFactor); + float buttonX = (float) ((x + width - margin - fr.getStringWidth(opened ? "-" : "+")) * coordFactor); + + int cursorX = 0; + int cursorY = 0; + + float outStartX = (float) ((x + margin + border)); + float outFinishX = (float) ((x + width - (margin + border))); + float outStartY = (float) ((y + barHeight + margin)); + float outFinishY = (float) ((y + height - margin - border)); + + float maxTextWidth = outFinishX - outStartX; + int maxLines = Math.floorDiv((int) (outFinishY - outStartY), (int) (desiredTextSize + margin)); + int linesPrinted = 0; + + cursorX = (int) outStartX; + + outStartX *= coordFactor; + outFinishX *= coordFactor; + outStartY *= coordFactor; + outFinishY *= coordFactor; + + Gui.drawRect(x, + y, + x + width, + y + barHeight, + 0xff2D3742 + ); + + if(opened){ + Gui.drawRect(x, + y + barHeight, + x + width, + y + height, + new Color(51, 51, 51, 210).getRGB() + ); + + Gui.drawRect(x, + y + barHeight, + x + border, + y + height, + 0xff2D3742 + ); + + Gui.drawRect(x + width, + y + barHeight, + x + width - border, + y + height, + 0xff2D3742 + ); + + Gui.drawRect(x, + y + height - border, + x + width, + y + height, + 0xff2D3742 + ); + + Gui.drawRect(x + width - resizeButtonSize, + y + height - resizeButtonSize, + x + width, + y + height, + new Color(79, 104, 158).getRGB() + ); + } + + GL11.glPushMatrix(); + GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); + fr.drawString( + "Terminal", + textX, + textY, + 0xffffff, + false + ); + + fr.drawString( + opened ? "-" : "+", + buttonX, + textY, + 0xffffff, + false + ); + + if(opened) { + ArrayList currentOut = new ArrayList<>(out); + currentOut.add(prefix + inputText); + String currentLine; + ArrayList finalOut = new ArrayList<>(); + + int end = currentOut.size() >= maxLines ? currentOut.size() - maxLines : 0; + for (int j = currentOut.size() - 1; j >= end; j--) { + currentLine = currentOut.get(j); + String[] splitUpLine = splitUpLine(currentLine, maxTextWidth, scaleFactor); + for(int i = splitUpLine.length - 1; i >= 0; i--){ + if (linesPrinted >= maxLines) { + break; + } + finalOut.add(splitUpLine[i]); + linesPrinted++; + } + } + + String[] inputTextLineSplit = splitUpLine(prefix + inputText.substring(0, inputText.length() - backCharsCursor), maxTextWidth, scaleFactor); + String finalInputLine = inputTextLineSplit[inputTextLineSplit.length - 1]; + cursorX += (int) (fr.getStringWidth(finalInputLine) * scaleFactor); + + for (int j = finalOut.size() - 1; j >= 0; j--) { + currentLine = finalOut.get(j); + int topMargin = (int) ( + ((finalOut.size() - 1 - j) * (desiredTextSize + margin) * coordFactor) + + outStartY + ); + + fr.drawString( + currentLine, + (int) outStartX, + topMargin, + new Color(32,194,14).getRGB() + ); + if(currentLine.startsWith(finalInputLine)) + cursorY = (int) (topMargin / coordFactor); + } + + + } + GL11.glPopMatrix(); + if(opened){ + Gui.drawRect( + cursorX, + cursorY, + cursorX + 1, + (int) (cursorY + desiredTextSize), + 0xffffffff + ); + } + } + + private String[] splitUpLine(String currentLine, float maxTextWidth, double scaleSize) { + if(fr.getStringWidth(currentLine) * scaleSize <= maxTextWidth){ + return new String[] {currentLine}; + } else { + for(int i = currentLine.length(); i >= 0; i--){ + String newLine = currentLine.substring(0, i); + if(fr.getStringWidth(newLine) * scaleSize <= maxTextWidth){ + return mergeArray( + new String[]{newLine}, + splitUpLine(currentLine.substring(i, currentLine.length()), maxTextWidth, scaleSize) + ); + } + } + + } + return new String[]{""}; + } + + public static void print(String message) { + out.add(message); + } + + public static String[] mergeArray(String[] arr1, String[] arr2) + { + return ArrayUtils.addAll(arr1, arr2); + } + + @Override + public void update(int x, int y) { + if(hidden) return; + if(dragging){ + this.x = (int) (windowStartDragX + (x - mouseStartDragX)); + this.y = (int) (windowStartDragY + (y - mouseStartDragY)); + } else if(resizing){ + int newWidth = Math.max(x, this.x + minWidth) - this.x; + int newHeight = Math.max(y, this.y + minHeight) - this.y; + this.width = newWidth; + this.height = newHeight; + } + } + + @Override + public void mouseDown(int x, int y, int b) { + focused = false; + if(hidden) return; + if(overToggleButton(x, y) && b == 0){ + this.opened = !opened; + } + else if(overBar(x, y)){ + if(b == 0){ + dragging = true; + mouseStartDragX = x; + mouseStartDragY = y; + windowStartDragX = this.x; + windowStartDragY = this.y; + } else if(b==1){ + this.opened = !opened; + } + } else if (overResize(x, y) && b == 0){ + this.resizing = true; + } else if(overWindow(x, y) && b == 0){ + this.focused = true; + } + } + + @Override + public void mouseReleased(int x, int y, int m) { + if(hidden) return; + if(dragging){ + dragging = false; + } else if (resizing){ + resizing = false; + } + } + + @Override + public void keyTyped(char t, int k) { + if(!focused) return; + + if(k == 28){ //enter + out.add(prefix + inputText); + proccessInput(); + inputText = ""; + backCharsCursor=0; + } else if(k == 14){ //backspace + if(inputText.substring(0, inputText.length() - backCharsCursor).length() > 0){ + if(backCharsCursor == 0){ + inputText = inputText.substring(0, inputText.length() - 1); + } else { + String deletable = inputText.substring(0, inputText.length() - backCharsCursor); + String appendable = inputText.substring(inputText.length() - backCharsCursor, inputText.length()); + if(deletable.length() > 0){ + deletable = deletable.substring(0, deletable.length() - 1); + } + inputText = deletable + appendable; + } + } + } else if(k == 15){ // tab + addCharToInput(" "); + } else if(k == 203){ + if(backCharsCursor < inputText.length()){ + backCharsCursor++; + } + } else if(k == 205){ + if(backCharsCursor > 0){ + backCharsCursor--; + } + } else { + if (!containsElement(acceptableKeycodes, k)) { + return; + } + String e = String.valueOf(t); + if(!e.isEmpty()) + addCharToInput(e); + } + //up arrow 200 + //down 208 + //left 203 + //right 205 + //enter 28 + //backspace 14 + //tab 15 + } + + private boolean containsElement(int[] acceptableKeycodes, int k) { + for(int i : acceptableKeycodes){ + if(i == k) + return true; + } + return false; + } + + private void addCharToInput(String e){ + if(backCharsCursor == 0){ + inputText += e; + } else { + String deletable = inputText.substring(0, inputText.length() - backCharsCursor); + String appendable = inputText.substring(inputText.length() - backCharsCursor, inputText.length()); + inputText = deletable + e + appendable; + } + } + + private void proccessInput() { + if (!inputText.isEmpty()) { + try{ + String command = inputText.split(" ")[0]; + boolean hasArgs = inputText.contains(" "); + String[] args = hasArgs ? inputText.substring(command.length() + 1, inputText.length()).split(" ") : new String[0]; + + Raven.commandManager.executeCommand(command, args); + } catch (IndexOutOfBoundsException fuck){} + + } + } + + @Override + public void setComponentStartAt(int n) { + + } + + @Override + public int getHeight() { + return height; + } + + public boolean overPosition(int x, int y){ + if(hidden) return false; + return opened ? overWindow(x, y) : overBar(x, y); + } + + public boolean overBar(int x, int y){ + return x >= this.x && x <= this.x + width && y >= this.y && y <= this.y + barHeight; + } + + public boolean overWindow(int x, int y){ + if(!opened) return false; + return x >= this.x && x <= this.x + width && y >= this.y && y <= this.y + height; + } + + public boolean overResize(int x, int y){ + return x >= this.x + width - resizeButtonSize && x <= this.x + width && y >= this.y + height - resizeButtonSize && y <= this.y + height; + } + + public boolean overToggleButton(int x, int y){ + return x >= this.x + width - barHeight && x <= this.x + width && y >= this.y && y <= this.y + barHeight; + } + + public void setLocation(int x, int y){ + this.x = x; + this.y = y; + } + + public void setSize(int width, int height){ + this.width = width; + this.height = height; + } + + public boolean hidden() { + return hidden; + } + + public int getY() { + return y; + } + + public int getX() { + return x; + } + + public int getWidth() { + return width; + } +} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/BindComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/BindComponent.java index b99baa2d..9fbc490b 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/components/BindComponent.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/BindComponent.java @@ -1,6 +1,98 @@ package keystrokesmod.client.clickgui.raven.components; -public class BindComponent { - public static String bind = "Bind"; - public static String binding = "Press a key..."; +import keystrokesmod.client.clickgui.raven.Component; +import keystrokesmod.client.clickgui.raven.components.BindStage; +import keystrokesmod.client.clickgui.raven.components.ModuleComponent; +import keystrokesmod.client.module.modules.client.GuiModule; +import net.minecraft.client.Minecraft; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class BindComponent implements Component { + private boolean isBinding; + private final ModuleComponent p; + private int o; + private int x; + private int y; + + public BindComponent(ModuleComponent b, int o) { + this.p = b; + this.x = b.category.getX() + b.category.getWidth(); + this.y = b.category.getY() + b.o; + this.o = o; + } + + public void setModuleStartAt(int n) { + this.o = n; + } + + public void draw() { + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + if (/*this.p.mod instanceof AutoConfig*/1>2) { + this.dr("Auto-configure modules."); + GL11.glPopMatrix(); + } else { + this.dr(this.isBinding ? BindStage.binding : BindStage.bind + ": " + Keyboard.getKeyName(this.p.mod.getKeycode())); + GL11.glPopMatrix(); + } + } + + @Override + public void update(int mousePosX, int mousePosY) { + boolean h = this.i(mousePosX, mousePosY); + this.y = this.p.category.getY() + this.o; + this.x = this.p.category.getX(); + } + + public void mouseDown(int x, int y, int b) { + if (this.i(x, y) && b == 0 && this.p.po) { + this.isBinding = !this.isBinding; + } + + } + + @Override + public void mouseReleased(int x, int y, int m) { + + } + + @Override + public void keyTyped(char t, int k) { + if (!this.p.mod.getName().equalsIgnoreCase("AutoConfig")) { + if (this.isBinding) { + if (k == 11) { + if (this.p.mod instanceof GuiModule) { + this.p.mod.setbind(54); + } else { + this.p.mod.setbind(0); + } + } else { + this.p.mod.setbind(k); + } + + this.isBinding = false; + } + + } + } + + @Override + public void setComponentStartAt(int n) { + + } + + public boolean i(int x, int y) { + return x > this.x && x < this.x + this.p.category.getWidth() && y > this.y - 1 && y < this.y + 12; + } + + public int getHeight() { + return 16; + } + + private void dr(String s) { + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(s, (float)((this.p.category.getX() + 4) * 2), (float)((this.p.category.getY() + this.o + 3) * 2), Color.HSBtoRGB((float)(System.currentTimeMillis() % 3750L) / 3750.0F, 0.8F, 0.8F)); + } } diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/BindStage.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/BindStage.java new file mode 100644 index 00000000..c5d2a494 --- /dev/null +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/BindStage.java @@ -0,0 +1,6 @@ +package keystrokesmod.client.clickgui.raven.components; + +public class BindStage { + public static String bind = "Bind"; + public static String binding = "Press a key..."; +} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/CategoryComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/CategoryComponent.java index ed904595..65f7e278 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/components/CategoryComponent.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/CategoryComponent.java @@ -133,7 +133,7 @@ public void r3nd3r() { Component c; for(Iterator var2 = this.modulesInCategory.iterator(); var2.hasNext(); o += c.getHeight()) { c = (Component)var2.next(); - c.setModuleStartAt(o); + c.setComponentStartAt(o); } } diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/DescriptionComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/DescriptionComponent.java index db0c5f58..a0357550 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/components/DescriptionComponent.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/DescriptionComponent.java @@ -8,7 +8,7 @@ import java.awt.*; -public class DescriptionComponent extends Component { +public class DescriptionComponent implements Component { private final int c = (new Color(226, 83, 47)).getRGB(); private final DescriptionSetting desc; private final ModuleComponent p; @@ -29,7 +29,32 @@ public void draw() { GL11.glPopMatrix(); } - public void setModuleStartAt(int n) { + @Override + public void update(int mousePosX, int mousePosY) { + + } + + @Override + public void mouseDown(int x, int y, int b) { + + } + + @Override + public void mouseReleased(int x, int y, int m) { + + } + + @Override + public void keyTyped(char t, int k) { + + } + + public void setComponentStartAt(int n) { this.o = n; } + + @Override + public int getHeight() { + return 0; + } } diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/ModeComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/ModeComponent.java index 36dc3bf5..039be477 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/components/ModeComponent.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/ModeComponent.java @@ -7,7 +7,7 @@ import java.awt.*; -public class ModeComponent extends Component { +public class ModeComponent implements Component { private final int c = (new Color(30, 144, 255)).getRGB(); private final ComboSetting mode; private final ModuleComponent module; @@ -34,15 +34,19 @@ public void draw() { GL11.glPopMatrix(); } - public void compute(int mousePosX, int mousePosY) { + public void update(int mousePosX, int mousePosY) { this.y = this.module.category.getY() + this.o; this.x = this.module.category.getX(); } - public void setModuleStartAt(int n) { + public void setComponentStartAt(int n) { this.o = n; } + @Override + public int getHeight() { + return 0; + } public void mouseDown(int x, int y, int b) { @@ -50,6 +54,16 @@ public void mouseDown(int x, int y, int b) { this.mode.nextMode(); } + @Override + public void mouseReleased(int x, int y, int m) { + + } + + @Override + public void keyTyped(char t, int k) { + + } + private boolean i(int x, int y) { return x > this.x && x < this.x + this.module.category.getWidth() && y > this.y && y < this.y + 11; } diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/ModuleComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/ModuleComponent.java index 98415e06..13487352 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/components/ModuleComponent.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/ModuleComponent.java @@ -3,7 +3,6 @@ import keystrokesmod.client.clickgui.raven.Component; import keystrokesmod.client.module.*; -import keystrokesmod.client.module.modules.AutoConfig; import keystrokesmod.client.module.modules.client.GuiModule; import keystrokesmod.client.module.setting.Setting; import keystrokesmod.client.module.setting.impl.*; @@ -13,7 +12,7 @@ import java.awt.*; import java.util.ArrayList; -public class ModuleComponent extends Component { +public class ModuleComponent implements Component { private final int c1 = (new Color(0, 85, 255)).getRGB(); private final int c2 = (new Color(154, 2, 255)).getRGB(); private final int c3 = (new Color(175, 143, 233) ).getRGB(); @@ -36,7 +35,7 @@ public ModuleComponent(Module mod, CategoryComponent p, int o) { SliderSetting n = (SliderSetting) v; SliderComponent s = new SliderComponent(n, this, y); this.settings.add(s); - y += 12; + y += 16; } else if (v instanceof TickSetting) { TickSetting b = (TickSetting) v; TickComponent c = new TickComponent(mod, b, this, y); @@ -51,7 +50,7 @@ public ModuleComponent(Module mod, CategoryComponent p, int o) { DoubleSliderSetting n = (DoubleSliderSetting) v; RangeSliderComponent s = new RangeSliderComponent(n, this, y); this.settings.add(s); - y += 12; + y += 16; }else if (v instanceof ComboSetting) { ComboSetting n = (ComboSetting) v; ModeComponent s = new ModeComponent(n, this, y); @@ -61,18 +60,18 @@ public ModuleComponent(Module mod, CategoryComponent p, int o) { } } - this.settings.add(new AutoConfig(this, y)); + this.settings.add(new BindComponent(this, y)); } - public void setModuleStartAt(int n) { + public void setComponentStartAt(int n) { this.o = n; int y = this.o + 16; for (Component c : this.settings) { - c.setModuleStartAt(y); + c.setComponentStartAt(y); if (c instanceof SliderComponent || c instanceof RangeSliderComponent) { y += 16; - } else if (c instanceof TickComponent || c instanceof DescriptionComponent || c instanceof ModeComponent || c instanceof AutoConfig) { + } else if (c instanceof TickComponent || c instanceof DescriptionComponent || c instanceof ModeComponent || c instanceof BindComponent) { y += 12; } } @@ -187,7 +186,7 @@ public int getHeight() { for (Component c : this.settings) { if (c instanceof SliderComponent || c instanceof RangeSliderComponent) { h += 16; - } else if (c instanceof TickComponent || c instanceof DescriptionComponent || c instanceof ModeComponent || c instanceof AutoConfig) { + } else if (c instanceof TickComponent || c instanceof DescriptionComponent || c instanceof ModeComponent || c instanceof BindComponent) { h += 12; } } @@ -197,10 +196,10 @@ public int getHeight() { } } - public void compute(int mousePosX, int mousePosY) { + public void update(int mousePosX, int mousePosY) { if (!this.settings.isEmpty()) { for (Component c : this.settings) { - c.compute(mousePosX, mousePosY); + c.update(mousePosX, mousePosY); } } @@ -231,9 +230,9 @@ public void mouseReleased(int x, int y, int m) { } - public void ky(char t, int k) { + public void keyTyped(char t, int k) { for (Component c : this.settings) { - c.ky(t, k); + c.keyTyped(t, k); } } diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/RangeSliderComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/RangeSliderComponent.java index 1e26f267..9d3cf12d 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/components/RangeSliderComponent.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/RangeSliderComponent.java @@ -9,7 +9,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; -public class RangeSliderComponent extends Component { +public class RangeSliderComponent implements Component { private final DoubleSliderSetting doubleSlider; private final ModuleComponent module; private double barWidth; @@ -49,11 +49,16 @@ public void draw(){ GL11.glPopMatrix(); } - public void setModuleStartAt(int posY) { + public void setComponentStartAt(int posY) { this.moduleStartY = posY; } - public void compute(int mousePosX, int mousePosY){ + @Override + public int getHeight() { + return 0; + } + + public void update(int mousePosX, int mousePosY){ this.sliderStartY = this.module.category.getY() + this.moduleStartY; this.sliderStartX = this.module.category.getX() + boxMargin; @@ -138,6 +143,11 @@ public void mouseReleased(int x, int y, int m) { this.mouseDown = false; } + @Override + public void keyTyped(char t, int k) { + + } + public boolean u(int x, int y) { return x > this.sliderStartX && x < this.sliderStartX + this.module.category.getWidth() / 2 + 1 && y > this.sliderStartY && y < this.sliderStartY + 16; } diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/SliderComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/SliderComponent.java index b3346698..223222e4 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/components/SliderComponent.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/SliderComponent.java @@ -10,7 +10,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; -public class SliderComponent extends Component { +public class SliderComponent implements Component { private final SliderSetting v; private final ModuleComponent p; private int o; @@ -43,11 +43,16 @@ public void draw() { GL11.glPopMatrix(); } - public void setModuleStartAt(int n) { + public void setComponentStartAt(int n) { this.o = n; } - public void compute(int mousePosX, int mousePosY) { + @Override + public int getHeight() { + return 0; + } + + public void update(int mousePosX, int mousePosY) { this.y = this.p.category.getY() + this.o; this.x = this.p.category.getX(); double d = Math.min(this.p.category.getWidth() - 8, Math.max(0, mousePosX - this.x)); @@ -88,6 +93,11 @@ public void mouseReleased(int x, int y, int m) { this.d = false; } + @Override + public void keyTyped(char t, int k) { + + } + public boolean u(int x, int y) { return x > this.x && x < this.x + this.p.category.getWidth() / 2 + 1 && y > this.y && y < this.y + 16; } diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/TickComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/TickComponent.java index c9a53d27..f87e2add 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/components/TickComponent.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/TickComponent.java @@ -10,7 +10,7 @@ import java.awt.*; -public class TickComponent extends Component { +public class TickComponent implements Component { private final int c = (new Color(20, 255, 0)).getRGB(); private final int boxC = (new Color(169,169,169)).getRGB(); private final Module mod; @@ -88,11 +88,16 @@ public void draw() { GL11.glPopMatrix(); } - public void setModuleStartAt(int n) { + public void setComponentStartAt(int n) { this.o = n; } - public void compute(int mousePosX, int mousePosY) { + @Override + public int getHeight() { + return 0; + } + + public void update(int mousePosX, int mousePosY) { this.y = this.module.category.getY() + this.o; this.x = this.module.category.getX(); } @@ -105,6 +110,16 @@ public void mouseDown(int x, int y, int b) { } + @Override + public void mouseReleased(int x, int y, int m) { + + } + + @Override + public void keyTyped(char t, int k) { + + } + public boolean i(int x, int y) { return x > this.x && x < this.x + this.module.category.getWidth() && y > this.y && y < this.y + 11; } diff --git a/src/main/java/keystrokesmod/client/command/Command.java b/src/main/java/keystrokesmod/client/command/Command.java index b674168f..0b9aaaa3 100644 --- a/src/main/java/keystrokesmod/client/command/Command.java +++ b/src/main/java/keystrokesmod/client/command/Command.java @@ -1,6 +1,6 @@ package keystrokesmod.client.command; -import keystrokesmod.client.clickgui.raven.CommandLine; +import keystrokesmod.client.clickgui.raven.Terminal; public abstract class Command { private final String name; @@ -52,8 +52,7 @@ public void onCall(String[] args) { } public void incorrectArgs() { - CommandLine.print("&cIncorrect arguments! Run", 1); - CommandLine.print("&c`help " + this.getName() + "` for usage info", 0); + Terminal.print("Incorrect arguments! Run help " + this.getName() + " for usage info"); } public String[] getAliases() { diff --git a/src/main/java/keystrokesmod/client/command/CommandManager.java b/src/main/java/keystrokesmod/client/command/CommandManager.java index 81265ee1..2d2e7aa9 100644 --- a/src/main/java/keystrokesmod/client/command/CommandManager.java +++ b/src/main/java/keystrokesmod/client/command/CommandManager.java @@ -1,6 +1,6 @@ package keystrokesmod.client.command; -import keystrokesmod.client.clickgui.raven.CommandLine; +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.commands.*; import keystrokesmod.client.main.Raven; import keystrokesmod.client.module.modules.HUD; @@ -58,9 +58,7 @@ public Command getCommandByName(String name) { } public void noSuchCommand(String name) { - CommandLine.print("&cCommand '" + name + "' not found!", 1); - CommandLine.print("&cReport this on the discord", 0); - CommandLine.print("&cif this is an error!", 0); + Terminal.print("Command '" + name + "' not found! Report this on the discord if this is an error!"); } public void executeCommand(String commandName, String[] args) { diff --git a/src/main/java/keystrokesmod/client/command/commands/Clear.java b/src/main/java/keystrokesmod/client/command/commands/Clear.java index 97913d0c..063c0a6c 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Clear.java +++ b/src/main/java/keystrokesmod/client/command/commands/Clear.java @@ -1,6 +1,6 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; public class Clear extends Command { @@ -10,6 +10,6 @@ public Clear() { @Override public void onCall(String[] args) { - CommandLine.commandLineHistory.clear(); + Terminal.clearTerminal(); } } diff --git a/src/main/java/keystrokesmod/client/command/commands/Cname.java b/src/main/java/keystrokesmod/client/command/commands/Cname.java index ade47ec6..b8351643 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Cname.java +++ b/src/main/java/keystrokesmod/client/command/commands/Cname.java @@ -1,6 +1,6 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.module.modules.other.NameHider; import keystrokesmod.client.utils.Utils; @@ -12,13 +12,12 @@ public Cname() { @Override public void onCall(String[] args) { - if (args == null) { + if (args.length == 0) { this.incorrectArgs(); return; } - NameHider.n = args[1]; - CommandLine.print("&a" + Utils.Java.uf("name") + "Nick has been set to:".substring(4), 1); - CommandLine.print("\"" + NameHider.n + "\"", 0); + NameHider.n = args[0]; + Terminal.print("Nick has been set to: " + NameHider.n); } } diff --git a/src/main/java/keystrokesmod/client/command/commands/ConfigCommand.java b/src/main/java/keystrokesmod/client/command/commands/ConfigCommand.java index 495e6105..297ab69a 100644 --- a/src/main/java/keystrokesmod/client/command/commands/ConfigCommand.java +++ b/src/main/java/keystrokesmod/client/command/commands/ConfigCommand.java @@ -1,6 +1,6 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.config.Config; import keystrokesmod.client.main.Raven; @@ -17,83 +17,71 @@ public void onCall(String[] args){ Raven.configManager.save(); // as now configs only save upon exiting the gui, this is required } - if (args == null) { - CommandLine.print("&aCurrent config: ", 1); - CommandLine.print("§3" + Raven.configManager.getConfig().getName(), 0); + if (args.length == 0) { + Terminal.print("Current config: " + Raven.configManager.getConfig().getName()); } - else if (args.length == 2) { - if (args[1].equalsIgnoreCase("list")) { + else if (args.length == 1) { + if (args[0].equalsIgnoreCase("list")) { this.listConfigs(); - } else if(args[1].equalsIgnoreCase("clear")){ - CommandLine.print("&eAre you sure you want to", 1); - CommandLine.print("&ereset the config", 0); - CommandLine.print("§3" + Raven.configManager.getConfig().getName(), 0); - CommandLine.print("&eif so, enter", 0); - CommandLine.print("§3'config clear confirm'", 0); + } else if(args[0].equalsIgnoreCase("clear")){ + Terminal.print("Are you sure you want to reset the config " + Raven.configManager.getConfig().getName() + "? If so, run \"config clear confirm\""); } else { this.incorrectArgs(); } } - else if (args.length == 3) { - if (args[1].equalsIgnoreCase("list")) { + else if (args.length == 2) { + if (args[0].equalsIgnoreCase("list")) { this.listConfigs(); } - else if (args[1].equalsIgnoreCase("load")) { + else if (args[0].equalsIgnoreCase("load")) { boolean found = false; for (Config config : Raven.configManager.getConfigs()) { - if (config.getName().equalsIgnoreCase(args[2])) { + if (config.getName().equalsIgnoreCase(args[1])) { found = true; - CommandLine.print("&aFound config with the name", 1); - CommandLine.print("&a" + args[2], 0); + Terminal.print("Found config with the name " + args[1] + "!"); Raven.configManager.setConfig(config); - CommandLine.print("&aLoaded config!", 0); + Terminal.print("Loaded config!"); } } if (!found) { - CommandLine.print("&cUnable to find a config with the name", 1); - CommandLine.print("&c" + args[2], 0); + Terminal.print("Unable to find a config with the name " + args[1]); } } - else if (args[1].equalsIgnoreCase("save")) { - CommandLine.print("&aSaving...", 1); - Raven.configManager.copyConfig(Raven.configManager.getConfig(), args[2] + ".bplus"); - CommandLine.print("&aSaved as '" + args[2] + "'", 0); - CommandLine.print("&aTo transition to config " + args[2] + " run", 0); - CommandLine.print("§3'config load " + args[2]+ "'", 0); + else if (args[0].equalsIgnoreCase("save")) { + Terminal.print("Saving..."); + Raven.configManager.copyConfig(Raven.configManager.getConfig(), args[1] + ".bplus"); + Terminal.print("Saved as \"" + args[1] + "\"! To load the config, run \"config load " + args[1] + "\""); } - else if (args[1].equalsIgnoreCase("remove")) { + else if (args[0].equalsIgnoreCase("remove")) { boolean found = false; - CommandLine.print("&aRemoving " + args[2] + "...", 1); + Terminal.print("Removing " + args[1] + "..."); for(Config config : Raven.configManager.getConfigs()){ - if(config.getName().equalsIgnoreCase(args[2])){ + if(config.getName().equalsIgnoreCase(args[1])){ Raven.configManager.deleteConfig(config); found = true; - CommandLine.print("&aRemoved " + args[2] + " successfully!", 0); - CommandLine.print("§3Current config: " + Raven.configManager.getConfig().getName(), 0); + Terminal.print("Removed " + args[1] + " successfully! Current config: " + Raven.configManager.getConfig().getName()); break; } } if(!found) { - CommandLine.print("&cFailed to delete " + args[2], 0); - CommandLine.print("&cUnable to find a config with the name", 0); - CommandLine.print("&cOr an error occurred during removal", 0); + Terminal.print("Failed to delete " + args[1] + ". Unable to find a config with the name or an error occurred during removal"); } - } else if(args[1].equalsIgnoreCase("clear")) { - if(args[2].equalsIgnoreCase("confirm")){ + } else if(args[0].equalsIgnoreCase("clear")) { + if(args[1].equalsIgnoreCase("confirm")){ Raven.configManager.resetConfig(); Raven.configManager.save(); - CommandLine.print("&aCleared config!",1); + Terminal.print("Cleared config!"); } else { - CommandLine.print("&cIt is confirm, not " + args[2], 0); + Terminal.print("It is confirm, not " + args[1]); } }else { @@ -103,12 +91,12 @@ else if (args[1].equalsIgnoreCase("remove")) { } public void listConfigs() { - CommandLine.print("&aAvailable configs: ", 1); + Terminal.print("Available configs: "); for (Config config : Raven.configManager.getConfigs()) { if (Raven.configManager.getConfig().getName().equals(config.getName())) - CommandLine.print("§3Current config: " + config.getName(), 0); + Terminal.print("Current config: " + config.getName()); else - CommandLine.print(config.getName(), 0); + Terminal.print(config.getName()); } } } diff --git a/src/main/java/keystrokesmod/client/command/commands/Debug.java b/src/main/java/keystrokesmod/client/command/commands/Debug.java index d16bb3be..7a896dbc 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Debug.java +++ b/src/main/java/keystrokesmod/client/command/commands/Debug.java @@ -1,6 +1,7 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; + +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.main.Raven; @@ -12,6 +13,6 @@ public Debug() { @Override public void onCall(String[] args) { Raven.debugger = !Raven.debugger; - CommandLine.print("Debug " + (Raven.debugger ? "enabled" : "disabled") + ".", 1); + Terminal.print((Raven.debugger ? "Enabled" : "Disabled") + " debugging."); } } diff --git a/src/main/java/keystrokesmod/client/command/commands/Discord.java b/src/main/java/keystrokesmod/client/command/commands/Discord.java index c251a4dd..7f6ea17c 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Discord.java +++ b/src/main/java/keystrokesmod/client/command/commands/Discord.java @@ -1,6 +1,7 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; + +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.main.Raven; import keystrokesmod.client.utils.Utils; @@ -16,9 +17,8 @@ public void onCall(String[] args) { boolean copied = false; boolean showed = false; int argCurrent = 0; - if(args == null) { - CommandLine.print("§3Opening Discord...", 1); - CommandLine.print("§a" + Raven.discord, 0); + if(args.length == 0) { + Terminal.print("§3Opening " + Raven.discord); Utils.Client.openWebpage(Raven.discord); opened = true; return; @@ -29,19 +29,19 @@ public void onCall(String[] args) { if (!copied) { Utils.Client.copyToClipboard(Raven.discord); copied = true; - CommandLine.print("§aCopied to clipboard!", 1); + Terminal.print("Copied " + Raven.discord + " to clipboard!"); } } else if(argument.equalsIgnoreCase("open")){ if (!opened) { Utils.Client.openWebpage(Raven.discord); opened = true; - CommandLine.print("§aOpened invite link!", 1); + Terminal.print("Opened invite link!"); } } else if(argument.equalsIgnoreCase("print")){ if (!showed){ - CommandLine.print("§a" + Raven.discord, 1); + Terminal.print(Raven.discord); showed = true; } } else { diff --git a/src/main/java/keystrokesmod/client/command/commands/Duels.java b/src/main/java/keystrokesmod/client/command/commands/Duels.java index d0f56797..e0267d6a 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Duels.java +++ b/src/main/java/keystrokesmod/client/command/commands/Duels.java @@ -1,6 +1,7 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; + +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.main.Raven; import keystrokesmod.client.module.modules.minigames.DuelsStats; @@ -14,33 +15,32 @@ public Duels() { @Override public void onCall(String[] args) { if (Utils.URLS.hypixelApiKey.isEmpty()) { - CommandLine.print("&cAPI Key is empty!", 1); - CommandLine.print("Use \"setkey [api_key]\".", 0); + Terminal.print("API Key is empty! Run \"setkey api_key\"."); return; } - if(args == null) { + if(args.length == 0) { this.incorrectArgs(); return; } String n; - n = args[1]; - CommandLine.print("Retrieving data...", 1); + n = args[0]; + Terminal.print("Retrieving data..."); Raven.getExecutor().execute(() -> { int[] s = Utils.Profiles.getHypixelStats(n, Utils.Profiles.DM.OVERALL); if (s != null) { if (s[0] == -1) { - CommandLine.print("&c" + (n.length() > 16 ? n.substring(0, 16) + "..." : n) + " does not exist!", 0); + Terminal.print((n.length() > 16 ? n.substring(0, 16) + "..." : n) + " does not exist!"); } else { double wlr = s[1] != 0 ? Utils.Java.round((double)s[0] / (double)s[1], 2) : (double)s[0]; - CommandLine.print("&e" + n + " stats:", 1); - CommandLine.print("Wins: " + s[0], 0); - CommandLine.print("Losses: " + s[1], 0); - CommandLine.print("WLR: " + wlr, 0); - CommandLine.print("Winstreak: " + s[2], 0); - CommandLine.print("Threat: " + DuelsStats.gtl(s[0], s[1], wlr, s[2]).substring(2), 0); + Terminal.print(n + " stats:"); + Terminal.print("Wins: " + s[0]); + Terminal.print("Losses: " + s[1]); + Terminal.print("WLR: " + wlr); + Terminal.print("Winstreak: " + s[2]); + Terminal.print("Threat: " + DuelsStats.gtl(s[0], s[1], wlr, s[2]).substring(2)); } } else { - CommandLine.print("&cThere was an error.", 0); + Terminal.print("There was an error."); } }); diff --git a/src/main/java/keystrokesmod/client/command/commands/F3Name.java b/src/main/java/keystrokesmod/client/command/commands/F3Name.java index 86a2ff7f..3af0dea6 100644 --- a/src/main/java/keystrokesmod/client/command/commands/F3Name.java +++ b/src/main/java/keystrokesmod/client/command/commands/F3Name.java @@ -1,6 +1,7 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; + +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.module.modules.client.ClientNameSpoof; @@ -10,17 +11,17 @@ public F3Name() { } public void onCall(String[] args){ - if(args == null){ + if(args.length == 0){ this.incorrectArgs(); return; } - StringBuilder wut = new StringBuilder(args[1]); - if(args.length > 2){ + StringBuilder wut = new StringBuilder(args[0]); + if(args.length > 1){ for(int i = 2; i < args.length; i++){ wut.append(" ").append(args[i]); } } ClientNameSpoof.newName = wut.toString(); - CommandLine.print("§aSet client name to " + wut, 1); + Terminal.print("Set client name to " + wut); } } diff --git a/src/main/java/keystrokesmod/client/command/commands/Fakechat.java b/src/main/java/keystrokesmod/client/command/commands/Fakechat.java index aac9fb87..10f5ec04 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Fakechat.java +++ b/src/main/java/keystrokesmod/client/command/commands/Fakechat.java @@ -1,6 +1,7 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; + +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.module.modules.other.FakeChat; import keystrokesmod.client.utils.Utils; @@ -12,7 +13,7 @@ public Fakechat() { @Override public void onCall(String[] args) { - if (args == null) { + if (args.length == 0) { this.incorrectArgs(); return; } @@ -21,11 +22,11 @@ public void onCall(String[] args) { String c = Utils.Java.joinStringList(args, " "); n = c.replaceFirst(FakeChat.command, "").substring(1); if (n.isEmpty() || n.equals("\\n")) { - CommandLine.print(FakeChat.c4, 1); + Terminal.print(FakeChat.c4); return; } FakeChat.msg = n; - CommandLine.print("&aMessage set!", 1); + Terminal.print("Message set!"); } } diff --git a/src/main/java/keystrokesmod/client/command/commands/Friends.java b/src/main/java/keystrokesmod/client/command/commands/Friends.java index 0ad31fe6..ab408303 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Friends.java +++ b/src/main/java/keystrokesmod/client/command/commands/Friends.java @@ -4,42 +4,38 @@ import keystrokesmod.client.module.modules.combat.AimAssist; import net.minecraft.entity.Entity; -import static keystrokesmod.client.clickgui.raven.CommandLine.print; +import static keystrokesmod.client.clickgui.raven.Terminal.print; public class Friends extends Command { public Friends() { - super("friends", "Allows you to manage and view
your friends list", 1, 2, new String[]{"add / remove / list", "Player's name"}, new String[] {"f", "amigos", "lonely4ever"}); + super("friends", "Allows you to manage and view your friends list", 1, 2, new String[]{"add / remove / list", "Player's name"}, new String[] {"f", "amigos", "lonely4ever"}); } @Override public void onCall(String[] args){ - if (args == null){ + if (args.length == 0){ listFriends(); } - else if(args[1].equalsIgnoreCase("list")) { + else if(args[0].equalsIgnoreCase("list")) { listFriends(); } - else if(args.length == 3){ - if(args[1].equalsIgnoreCase("add")){ - boolean added = AimAssist.addFriend(args[2]); + else if(args.length == 2){ + if(args[0].equalsIgnoreCase("add")){ + boolean added = AimAssist.addFriend(args[1]); if (added) { - print("&aSuccessfully added ", 1); - print(args[2], 0); - print("&ato your friends list!", 0); + print("Successfully added " + args[1] + " to your friends list!"); } else { - print("&eAn error occurred!", 1); + print("An error occurred!"); } } - else if(args[1].equalsIgnoreCase("remove")){ - boolean removed = AimAssist.removeFriend(args[2]); + else if(args[0].equalsIgnoreCase("remove")){ + boolean removed = AimAssist.removeFriend(args[1]); if (removed) { - print("&aSuccessfully removed ", 1); - print(args[2], 0); - print("&afrom your friends list!", 0); + print("Successfully removed " + args[1] + " from your friends list!"); } else { - print("&eAn error occurred!", 1); + print("An error occurred!"); } } } @@ -50,12 +46,12 @@ else if(args[1].equalsIgnoreCase("remove")){ public void listFriends(){ if(AimAssist.getFriends().isEmpty()){ - print("&eYou have no friends.", 1); + print("You have no friends. :("); } else { - print("&aHere are your friends:", 1); + print("Your friends are:"); for (Entity entity : AimAssist.getFriends()){ - print(entity.getName(), 0); + print(entity.getName()); } } } diff --git a/src/main/java/keystrokesmod/client/command/commands/Help.java b/src/main/java/keystrokesmod/client/command/commands/Help.java index c9da65d2..cf4412b6 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Help.java +++ b/src/main/java/keystrokesmod/client/command/commands/Help.java @@ -1,68 +1,58 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; + +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.main.Raven; public class Help extends Command { public Help() { - super("help", "Shows you different
command usages", 0, 1, new String[] {"name of module"}, new String[] {"?", "wtf", "what"}); + super("help", "Shows you different command usages", 0, 1, new String[] {"name of module"}, new String[] {"?", "wtf", "what"}); } @Override public void onCall(String[] args) { - if (args == null) { + if (args.length == 0) { Raven.commandManager.sort(); - CommandLine.print("Available commands:", 1); + Terminal.print("Available commands:"); int index = 1; for (Command command : Raven.commandManager.getCommandList()) { if(command.getName().equalsIgnoreCase("help")) continue; - CommandLine.print(index + ". " + command.getName(), 0); + Terminal.print(index + ") " + command.getName()); index++; } - CommandLine.print("&aRun 'help commandname' for more", 1); - CommandLine.print("&ainformation about the command", 0); - } else if (args.length == 2) { - Command command = Raven.commandManager.getCommandByName(args[1]); + Terminal.print("Run \"help commandname\" for more information about the command"); + } else if (args.length == 1) { + Command command = Raven.commandManager.getCommandByName(args[0]); if (command == null) { - CommandLine.print("&cUnable to find a command with the", 1); - CommandLine.print("&cname or alias with '" + args[1] + "'", 0); + Terminal.print("Unable to find a command with the cname or alias with " + args[0]); return; } - CommandLine.print("&a" + command.getName() + "'s info:", 1); + Terminal.print(command.getName() + "'s info:"); if(command.getAliases() != null || command.getAliases().length != 0) { - CommandLine.print(command.getName() + "'s aliases:", 0); + Terminal.print(command.getName() + "'s aliases:"); for (String alias : command.getAliases()) { - CommandLine.print("§3" + alias, 0); + Terminal.print(alias); } } if(!command.getHelp().isEmpty()) { - CommandLine.print(command.getName() + "'s description:", 1); - for (String helpText : command.getHelp().split("
")) - CommandLine.print("§3" + helpText, 0); + Terminal.print(command.getName() + "'s description:"); + Terminal.print(command.getHelp()); } if(command.getArgs() != null) { - CommandLine.print(command.getName() + "'s argument description:", 1); - CommandLine.print("§3Min args: " + command.getMinArgs() + ", max args: " + command.getMaxArgs(), 0); + Terminal.print(command.getName() + "'s argument description:"); + Terminal.print("Min args: " + command.getMinArgs() + ", max args: " + command.getMaxArgs()); int argIndex = 1; int printLine; for (String argText : command.getArgs()){ - printLine = 0; - for(String line : argText.split("
")){ - if(printLine == 1) { - CommandLine.print("§3Argument " + argIndex + ": " + line, 0); - }else{ - CommandLine.print("§" + argIndex + ": " + line, 0); - } - printLine++; - } + Terminal.print("Argument " + argIndex + ": " + argText); argIndex++; } } diff --git a/src/main/java/keystrokesmod/client/command/commands/Nick.java b/src/main/java/keystrokesmod/client/command/commands/Nick.java index 3e3a7451..1810be61 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Nick.java +++ b/src/main/java/keystrokesmod/client/command/commands/Nick.java @@ -1,6 +1,7 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; + +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.module.modules.minigames.DuelsStats; @@ -11,13 +12,12 @@ public Nick() { @Override public void onCall(String[] args){ - if (args == null) { + if (args.length == 0) { this.incorrectArgs(); return; } - DuelsStats.nk = args[1]; - CommandLine.print("&aNick has been set to:", 1); - CommandLine.print("\"" + DuelsStats.nk + "\"", 0); + DuelsStats.nk = args[0]; + Terminal.print("&aNick has been set to: " + DuelsStats.nk); } } diff --git a/src/main/java/keystrokesmod/client/command/commands/SetKey.java b/src/main/java/keystrokesmod/client/command/commands/SetKey.java index afb62139..2e22f316 100644 --- a/src/main/java/keystrokesmod/client/command/commands/SetKey.java +++ b/src/main/java/keystrokesmod/client/command/commands/SetKey.java @@ -1,39 +1,37 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; + +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.main.Raven; import keystrokesmod.client.utils.Utils; public class SetKey extends Command { public SetKey() { - super("setkey", "Sets hypixel's API key
To get a new key, run
`/api new`", 2, 2, new String[] {"hypixel", "key"}, new String[] {"apikey"}); + super("setkey", "Sets hypixel's API key. To get a new key, run `/api new`", 2, 2, new String[] {"key"}, new String[] {"apikey"}); } @Override public void onCall(String[] args) { - if(args == null || args.length == 2) { + if(args.length == 0) { this.incorrectArgs(); return; } - CommandLine.print("§3Setting...", 1); + Terminal.print("Setting..."); String n; - n = args[2]; - if (args[1].equalsIgnoreCase("paste")) { - Raven.getExecutor().execute(() -> Utils.URLS.pasteApiKey = n); - } else if (args[1].equalsIgnoreCase("hypixel")) { - Raven.getExecutor().execute(() -> { - if (Utils.URLS.isHypixelKeyValid(n)) { - Utils.URLS.hypixelApiKey = n; - CommandLine.print("&a" + "success!", 0); - Raven.clientConfig.saveConfig(); - } else { - CommandLine.print("&c" + "Invalid key.", 0); - } - - }); - } + n = args[0]; + Raven.getExecutor().execute(() -> { + if (Utils.URLS.isHypixelKeyValid(n)) { + Utils.URLS.hypixelApiKey = n; + Terminal.print("Success!"); + Raven.clientConfig.saveConfig(); + } else { + Terminal.print("Invalid key."); + } + + }); + } } diff --git a/src/main/java/keystrokesmod/client/command/commands/Shoutout.java b/src/main/java/keystrokesmod/client/command/commands/Shoutout.java index 25e3fbf5..0a5c4492 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Shoutout.java +++ b/src/main/java/keystrokesmod/client/command/commands/Shoutout.java @@ -2,7 +2,7 @@ import keystrokesmod.client.command.Command; -import static keystrokesmod.client.clickgui.raven.CommandLine.print; +import static keystrokesmod.client.clickgui.raven.Terminal.print; public class Shoutout extends Command { public Shoutout() { @@ -11,13 +11,13 @@ public Shoutout() { @Override public void onCall(String[] args){ - print("&eEveryone who made B+ possible:", 1); - print("- kopamed (client dev)", 0); - print("- hevex (weeaboo)", 0); - print("- blowsy (raven owner)", 0); - print("- jmraichdev (client dev)", 0); - print("- nighttab (website dev)", 0); - print("- mood (java help)", 0); - print("- jc (b3 b2 betta tester)", 0); + print("Everyone who made b+ possible:"); + print("- kopamed (client dev)"); + print("- hevex/blowsy (weeaboo, b3 dev) (disapproves to b+ as he earned less money because less ppl clicked on his adfly link)"); + print("- blowsy (hevex's alt)"); + print("- jmraichdev (client dev)"); + print("- nighttab (website dev)"); + print("- mood (java help)"); + print("- jc (b3 b2 betta tester, very good moaner (moans very loudly in discord vcs, giving everyone emotional motivation))"); } } diff --git a/src/main/java/keystrokesmod/client/command/commands/Update.java b/src/main/java/keystrokesmod/client/command/commands/Update.java index e7acea78..e5116280 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Update.java +++ b/src/main/java/keystrokesmod/client/command/commands/Update.java @@ -1,6 +1,7 @@ package keystrokesmod.client.command.commands; -import keystrokesmod.client.clickgui.raven.CommandLine; + +import keystrokesmod.client.clickgui.raven.Terminal; import keystrokesmod.client.command.Command; import keystrokesmod.client.main.Raven; import keystrokesmod.client.utils.Utils; @@ -20,23 +21,20 @@ public void onCall(String[] args) { Version latestVersion = Raven.versionManager.getLatestVersion(); if (latestVersion.isNewerThan(clientVersion)) { - CommandLine.print("§3Opening page...", 1); + Terminal.print("Opening page..."); URL url = null; try { url = new URL(Raven.sourceLocation); Utils.Client.openWebpage(url); Utils.Client.openWebpage(new URL(Raven.downloadLocation)); - CommandLine.print("&aOpened page successfully!", 0); + Terminal.print("Opened page successfully!"); } catch (MalformedURLException e) { e.printStackTrace(); - CommandLine.print("&cFailed to open page!", 0); - CommandLine.print("&cPlease report this bug", 0); - CommandLine.print("&cin Raven b+'s discord", 0); + Terminal.print("Failed to open page! Please report this bug in Raven b+'s discord!"); } } else { - CommandLine.print("&aNo need to upgrade,", 1); - CommandLine.print("&aYou are on the latest build", 0); + Terminal.print("No need to upgrade, You are on the latest build"); } } } diff --git a/src/main/java/keystrokesmod/client/command/commands/Uwu.java b/src/main/java/keystrokesmod/client/command/commands/Uwu.java index 6933e573..564a1a2c 100644 --- a/src/main/java/keystrokesmod/client/command/commands/Uwu.java +++ b/src/main/java/keystrokesmod/client/command/commands/Uwu.java @@ -3,12 +3,12 @@ import keystrokesmod.client.command.Command; import keystrokesmod.client.main.Raven; -import static keystrokesmod.client.clickgui.raven.CommandLine.print; +import static keystrokesmod.client.clickgui.raven.Terminal.print; public class Uwu extends Command { private static boolean u; public Uwu() { - super("uwu", "hevex added this lol", 0, 0, new String[] {}, new String[] {"hevex", "weeb", "torture", "noplsno"}); + super("uwu", "hevex/blowsy added this lol", 0, 0, new String[] {}, new String[] {"hevex", "blowsy", "weeb", "torture", "noplsno"}); u = false; } @@ -23,13 +23,13 @@ public void onCall(String[] args){ for(int i = 0; i < 4; ++i) { if (i == 0) { - print("&e" + "nya", 1); + print("&e" + "nya"); } else if (i == 1) { - print("&a" + "ichi ni san", 0); + print("&a" + "ichi ni san"); } else if (i == 2) { - print("&e" + "nya", 0); + print("&e" + "nya"); } else { - print("&a" + "arigatou!", 0); + print("&a" + "arigatou!"); } try { diff --git a/src/main/java/keystrokesmod/client/command/commands/VersionCommand.java b/src/main/java/keystrokesmod/client/command/commands/VersionCommand.java index cecc601f..20478c02 100644 --- a/src/main/java/keystrokesmod/client/command/commands/VersionCommand.java +++ b/src/main/java/keystrokesmod/client/command/commands/VersionCommand.java @@ -4,7 +4,7 @@ import keystrokesmod.client.main.Raven; import keystrokesmod.client.utils.version.Version; -import static keystrokesmod.client.clickgui.raven.CommandLine.print; +import static keystrokesmod.client.clickgui.raven.Terminal.print; public class VersionCommand extends Command { public VersionCommand() { @@ -16,8 +16,8 @@ public void onCall(String[] args) { Version clientVersion = Raven.versionManager.getClientVersion(); Version latestVersion = Raven.versionManager.getLatestVersion(); - print("&eYour build: " + clientVersion, 1); - print("&aLatest version: " + latestVersion, 0); + print("&eYour build: " + clientVersion); + print("&aLatest version: " + latestVersion); } } diff --git a/src/main/java/keystrokesmod/client/main/ClientConfig.java b/src/main/java/keystrokesmod/client/main/ClientConfig.java index ac29eb20..214da4a4 100644 --- a/src/main/java/keystrokesmod/client/main/ClientConfig.java +++ b/src/main/java/keystrokesmod/client/main/ClientConfig.java @@ -1,6 +1,7 @@ package keystrokesmod.client.main; import keystrokesmod.client.clickgui.raven.components.CategoryComponent; +import keystrokesmod.client.module.modules.client.Terminal; import keystrokesmod.keystroke.KeyStroke; import keystrokesmod.client.module.modules.HUD; import keystrokesmod.client.utils.Utils; @@ -20,6 +21,10 @@ public class ClientConfig { private final String pasteApiKeyPrefix = "paste-api~ "; private final String clickGuiPosPrefix = "clickgui-pos~ "; private final String loadedConfigPrefix = "loaded-cfg~ "; + private final String terminalPosPrefix = "terminal-pos~ "; + private final String terminalSizePrefix = "terminal-size~ "; + private final String terminalHiddenPrefix = "terminal-hidden~ "; + private final String terminalOpenedPrefix = "terminal-opened~ "; //when you are coding the config manager and life be like //public static String ip_token_discord_webhook_logger_spyware_malware_minecraft_block_hacker_sigma_miner_100_percent_haram_no_cap_m8_Kopamed_is_sexy = "https://imgur.com/a/hYd1023"; @@ -49,7 +54,7 @@ public static void saveKeyStrokeSettingsToConfigFile() { } FileWriter writer = new FileWriter(file, false); - writer.write(KeyStroke.x + "\n" + KeyStroke.y + "\n" + KeyStroke.currentColorNumber + "\n" + KeyStroke.showMouseBtn + "\n" + KeyStroke.mode + "\n" + KeyStroke.outline); + writer.write(KeyStroke.x + "\n" + KeyStroke.y + "\n" + KeyStroke.enabled + "\n" + KeyStroke.showMouseButtons + "\n" + KeyStroke.currentColorNumber + "\n" + KeyStroke.outline); writer.close(); } catch (Throwable var2) { var2.printStackTrace(); @@ -81,10 +86,10 @@ public static void applyKeyStrokeSettingsFromConfigFile() { KeyStroke.currentColorNumber = Integer.parseInt(line); break; case 4: - KeyStroke.showMouseBtn = Boolean.parseBoolean(line); + KeyStroke.showMouseButtons = Boolean.parseBoolean(line); break; case 5: - KeyStroke.mode = Boolean.parseBoolean(line); + KeyStroke.enabled = Boolean.parseBoolean(line); break; case 6: KeyStroke.outline = Boolean.parseBoolean(line); @@ -107,6 +112,10 @@ public void saveConfig() { config.add(loadedConfigPrefix + Raven.configManager.getConfig().getName()); config.add(HUD.HUDX_prefix + HUD.getHudX()); config.add(HUD.HUDY_prefix + HUD.getHudY()); + config.add(terminalPosPrefix + Raven.clickGui.terminal.getX() + "," + Raven.clickGui.terminal.getY()); + config.add(terminalSizePrefix + Raven.clickGui.terminal.getWidth() + "," + Raven.clickGui.terminal.getHeight()); + config.add(terminalOpenedPrefix + Raven.clickGui.terminal.opened); + config.add(terminalHiddenPrefix + Raven.clickGui.terminal.hidden); PrintWriter writer = null; try { @@ -147,6 +156,29 @@ public void applyConfig(){ try { HUD.setHudY(Integer.parseInt(line.replace(HUD.HUDY_prefix, ""))); } catch (Exception e) {e.printStackTrace();} + } else if(line.startsWith(terminalPosPrefix)){ + try{ + String[] split_up = line.replace(terminalPosPrefix, "").split(","); + int i1 = Integer.parseInt(split_up[0]); + int i2 = Integer.parseInt(split_up[1]); + Raven.clickGui.terminal.setLocation(i1, i2); + } catch (Exception e){} + } else if(line.startsWith(terminalSizePrefix)){ + try{ + String[] split_up = line.replace(terminalSizePrefix, "").split(","); + int i1 = Integer.parseInt(split_up[0]); + int i2 = Integer.parseInt(split_up[1]); + Raven.clickGui.terminal.setSize(i1, i2); + } catch (Exception e){} + } else if(line.startsWith(terminalOpenedPrefix)){ + try{ + Raven.clickGui.terminal.opened = Boolean.parseBoolean(line.replace(terminalOpenedPrefix, "")); + } catch (Exception e){} + } else if(line.startsWith(terminalHiddenPrefix)){ + try{ + Terminal terminalModule = (Terminal) Raven.moduleManager.getModuleByClazz(Terminal.class); + terminalModule.setToggled(!Boolean.parseBoolean(line.replace(terminalHiddenPrefix, ""))); + } catch (Exception e){} } } } diff --git a/src/main/java/keystrokesmod/client/main/Raven.java b/src/main/java/keystrokesmod/client/main/Raven.java index 7e1abb55..c8c96159 100644 --- a/src/main/java/keystrokesmod/client/main/Raven.java +++ b/src/main/java/keystrokesmod/client/main/Raven.java @@ -2,7 +2,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import keystrokesmod.client.utils.version.VersionManager; -import keystrokesmod.keystroke.KeyStrokeRenderer; import keystrokesmod.client.clickgui.raven.ClickGui; import keystrokesmod.client.command.CommandManager; import keystrokesmod.client.config.ConfigManager; @@ -25,6 +24,9 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; + +//Todo fix wtap + public class Raven { public static boolean debugger = false; @@ -58,8 +60,7 @@ public static void init() { MinecraftForge.EVENT_BUS.register(new Raven()); MinecraftForge.EVENT_BUS.register(new DebugInfoRenderer()); - MinecraftForge.EVENT_BUS.register(new mouseManager()); - MinecraftForge.EVENT_BUS.register(new KeyStrokeRenderer()); + MinecraftForge.EVENT_BUS.register(new MouseManager()); MinecraftForge.EVENT_BUS.register(new ChatHelper()); Runtime.getRuntime().addShutdownHook(new Thread(ex::shutdown)); @@ -75,7 +76,6 @@ public static void init() { mResourceLocation = null; } - ClientConfig.applyKeyStrokeSettingsFromConfigFile(); commandManager = new CommandManager(); clickGui = new ClickGui(); configManager = new ConfigManager(); diff --git a/src/main/java/keystrokesmod/client/module/ModuleManager.java b/src/main/java/keystrokesmod/client/module/ModuleManager.java index 3c71d870..3cb73fba 100644 --- a/src/main/java/keystrokesmod/client/module/ModuleManager.java +++ b/src/main/java/keystrokesmod/client/module/ModuleManager.java @@ -74,7 +74,7 @@ public ModuleManager() { addModule(new StringEncrypt()); addModule(new WaterBucket()); //addModule(new AutoConfig()); - addModule(new CommandLine()); + addModule(new Terminal()); addModule(new GuiModule()); addModule(new SelfDestruct()); addModule(new ChatLogger()); diff --git a/src/main/java/keystrokesmod/client/module/modules/AutoConfig.java b/src/main/java/keystrokesmod/client/module/modules/AutoConfig.java deleted file mode 100644 index e93e3636..00000000 --- a/src/main/java/keystrokesmod/client/module/modules/AutoConfig.java +++ /dev/null @@ -1,86 +0,0 @@ -package keystrokesmod.client.module.modules; - -import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.components.BindComponent; -import keystrokesmod.client.clickgui.raven.components.ModuleComponent; -import keystrokesmod.client.module.modules.client.GuiModule; -import net.minecraft.client.Minecraft; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; - -import java.awt.*; - -public class AutoConfig extends Component { - private boolean isBinding; - private final ModuleComponent p; - private int o; - private int x; - private int y; - - public AutoConfig(ModuleComponent b, int o) { - this.p = b; - this.x = b.category.getX() + b.category.getWidth(); - this.y = b.category.getY() + b.o; - this.o = o; - } - - public void setModuleStartAt(int n) { - this.o = n; - } - - public void draw() { - GL11.glPushMatrix(); - GL11.glScaled(0.5D, 0.5D, 0.5D); - if (/*this.p.mod instanceof AutoConfig*/1>2) { - this.dr("Auto-configure modules."); - GL11.glPopMatrix(); - } else { - this.dr(this.isBinding ? BindComponent.binding : BindComponent.bind + ": " + Keyboard.getKeyName(this.p.mod.getKeycode())); - GL11.glPopMatrix(); - } - } - - public void compute(int mousePosX, int mousePosY) { - boolean h = this.i(mousePosX, mousePosY); - this.y = this.p.category.getY() + this.o; - this.x = this.p.category.getX(); - } - - public void mouseDown(int x, int y, int b) { - if (this.i(x, y) && b == 0 && this.p.po) { - this.isBinding = !this.isBinding; - } - - } - - public void ky(char t, int keybind) { - if (!this.p.mod.getName().equalsIgnoreCase("AutoConfig")) { - if (this.isBinding) { - if (keybind == 11) { - if (this.p.mod instanceof GuiModule) { - this.p.mod.setbind(54); - } else { - this.p.mod.setbind(0); - } - } else { - this.p.mod.setbind(keybind); - } - - this.isBinding = false; - } - - } - } - - public boolean i(int x, int y) { - return x > this.x && x < this.x + this.p.category.getWidth() && y > this.y - 1 && y < this.y + 12; - } - - public int getHeight() { - return 16; - } - - private void dr(String s) { - Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(s, (float)((this.p.category.getX() + 4) * 2), (float)((this.p.category.getY() + this.o + 3) * 2), Color.HSBtoRGB((float)(System.currentTimeMillis() % 3750L) / 3750.0F, 0.8F, 0.8F)); - } -} diff --git a/src/main/java/keystrokesmod/client/module/modules/client/ClientNameSpoof.java b/src/main/java/keystrokesmod/client/module/modules/client/ClientNameSpoof.java index 7db628fc..0aef90bf 100644 --- a/src/main/java/keystrokesmod/client/module/modules/client/ClientNameSpoof.java +++ b/src/main/java/keystrokesmod/client/module/modules/client/ClientNameSpoof.java @@ -10,6 +10,6 @@ public class ClientNameSpoof extends Module { public ClientNameSpoof(){ super("ClientNameSpoofer", ModuleCategory.client); - this.registerSetting(desc = new DescriptionSetting(Utils.Java.uf("command") + ": f3name [name]")); + this.registerSetting(desc = new DescriptionSetting(Utils.Java.capitalizeWord("command") + ": f3name [name]")); } } diff --git a/src/main/java/keystrokesmod/client/module/modules/client/CommandLine.java b/src/main/java/keystrokesmod/client/module/modules/client/CommandLine.java deleted file mode 100644 index a5443618..00000000 --- a/src/main/java/keystrokesmod/client/module/modules/client/CommandLine.java +++ /dev/null @@ -1,62 +0,0 @@ -package keystrokesmod.client.module.modules.client; - -import com.google.gson.JsonObject; -import keystrokesmod.client.module.Module; -import keystrokesmod.client.module.setting.Setting; -import keystrokesmod.client.module.setting.impl.TickSetting; -import keystrokesmod.client.utils.Timer; - -public class CommandLine extends Module { - public static boolean a = false; - public static boolean b = false; - public static Timer an; - public static TickSetting animate; - - public CommandLine() { - super("Command line", ModuleCategory.client); - this.registerSetting(animate = new TickSetting("Animate", true)); - } - - public void onEnable() { - keystrokesmod.client.clickgui.raven.CommandLine.setccs(); - a = true; - b = false; - (an = new Timer(500.0F)).start(); - } - - public void onDisable() { - b = true; - if (an != null) { - an.start(); - } - - keystrokesmod.client.clickgui.raven.CommandLine.od(); - } - - @Override - public void applyConfigFromJson(JsonObject data){ - try { - this.keycode = data.get("keycode").getAsInt(); - // no need to set this to disabled - JsonObject settingsData = data.get("settings").getAsJsonObject(); - for (Setting setting : getSettings()) { - if (settingsData.has(setting.getName())) { - setting.applyConfigFromJson( - settingsData.get(setting.getName()).getAsJsonObject() - ); - } - } - } catch (NullPointerException ignored){ - - } - } - - @Override - public void resetToDefaults() { - this.keycode = defualtKeyCode; - - for(Setting setting : this.settings){ - setting.resetToDefaults(); - } - } -} diff --git a/src/main/java/keystrokesmod/client/module/modules/client/SelfDestruct.java b/src/main/java/keystrokesmod/client/module/modules/client/SelfDestruct.java index 0e0fef61..27aaee50 100644 --- a/src/main/java/keystrokesmod/client/module/modules/client/SelfDestruct.java +++ b/src/main/java/keystrokesmod/client/module/modules/client/SelfDestruct.java @@ -4,10 +4,9 @@ import keystrokesmod.client.module.Module; import keystrokesmod.client.utils.ChatHelper; import keystrokesmod.client.utils.DebugInfoRenderer; -import keystrokesmod.client.utils.mouseManager; +import keystrokesmod.client.utils.MouseManager; import keystrokesmod.keystroke.KeyStrokeRenderer; import net.minecraftforge.common.MinecraftForge; -import org.lwjgl.input.Keyboard; public class SelfDestruct extends Module { public SelfDestruct() { @@ -34,7 +33,7 @@ public void onEnable() { // dude your event system doesnt even work bruh MinecraftForge.EVENT_BUS.unregister(new Raven()); MinecraftForge.EVENT_BUS.unregister(new DebugInfoRenderer()); - MinecraftForge.EVENT_BUS.unregister(new mouseManager()); + MinecraftForge.EVENT_BUS.unregister(new MouseManager()); MinecraftForge.EVENT_BUS.unregister(new KeyStrokeRenderer()); MinecraftForge.EVENT_BUS.unregister(new ChatHelper()); } diff --git a/src/main/java/keystrokesmod/client/module/modules/client/Terminal.java b/src/main/java/keystrokesmod/client/module/modules/client/Terminal.java new file mode 100644 index 00000000..bf266716 --- /dev/null +++ b/src/main/java/keystrokesmod/client/module/modules/client/Terminal.java @@ -0,0 +1,79 @@ +package keystrokesmod.client.module.modules.client; + +import com.google.gson.JsonObject; +import keystrokesmod.client.clickgui.raven.ClickGui; +import keystrokesmod.client.main.Raven; +import keystrokesmod.client.module.Module; +import keystrokesmod.client.module.setting.Setting; +import keystrokesmod.client.module.setting.impl.SliderSetting; +import keystrokesmod.client.module.setting.impl.TickSetting; +import keystrokesmod.client.utils.Timer; +import keystrokesmod.client.utils.Utils; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +public class Terminal extends Module { + public static boolean visible = false; + public static boolean b = false; + public static Timer animation; + public static TickSetting animate; + public static SliderSetting opacity; + + public Terminal() { + super("Terminal", ModuleCategory.client); + withEnabled(true); + + this.registerSetting(opacity = new SliderSetting("Terminal background opacity", 100, 0, 255, 1)); + } + + public void onEnable() { + Raven.clickGui.terminal.show(); + //keystrokesmod.client.clickgui.raven.CommandLine.setccs(); + //visible = true; + //b = false; + (animation = new Timer(500.0F)).start(); + } + + @SubscribeEvent + public void tick(TickEvent.PlayerTickEvent e){ + if(Utils.Player.isPlayerInGame() && enabled && mc.currentScreen instanceof ClickGui && Raven.clickGui.terminal.hidden()) + Raven.clickGui.terminal.show(); + } + + public void onDisable() { + Raven.clickGui.terminal.hide(); + //b = true; + if (animation != null) { + animation.start(); + } + + //keystrokesmod.client.clickgui.raven.CommandLine.od(); + } + + @Override + public void applyConfigFromJson(JsonObject data){ + try { + this.keycode = data.get("keycode").getAsInt(); + // no need to set this to disabled + JsonObject settingsData = data.get("settings").getAsJsonObject(); + for (Setting setting : getSettings()) { + if (settingsData.has(setting.getName())) { + setting.applyConfigFromJson( + settingsData.get(setting.getName()).getAsJsonObject() + ); + } + } + } catch (NullPointerException ignored){ + + } + } + + @Override + public void resetToDefaults() { + this.keycode = defualtKeyCode; + + for(Setting setting : this.settings){ + setting.resetToDefaults(); + } + } +} diff --git a/src/main/java/keystrokesmod/client/module/modules/client/UpdateCheck.java b/src/main/java/keystrokesmod/client/module/modules/client/UpdateCheck.java index ea963dbf..2c8a9005 100644 --- a/src/main/java/keystrokesmod/client/module/modules/client/UpdateCheck.java +++ b/src/main/java/keystrokesmod/client/module/modules/client/UpdateCheck.java @@ -27,7 +27,7 @@ public class UpdateCheck extends Module { public UpdateCheck() { super("Update", ModuleCategory.client); - this.registerSetting(howToUse = new DescriptionSetting(Utils.Java.uf("command") + ": update")); + this.registerSetting(howToUse = new DescriptionSetting(Utils.Java.capitalizeWord("command") + ": update")); this.registerSetting(copyToClipboard = new TickSetting("Copy to clipboard", true)); this.registerSetting(openLink = new TickSetting("Open dl in browser", true)); diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/AimAssist.java b/src/main/java/keystrokesmod/client/module/modules/combat/AimAssist.java index 68d25805..aeb334c8 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/AimAssist.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/AimAssist.java @@ -2,6 +2,7 @@ import keystrokesmod.client.main.Raven; import keystrokesmod.client.module.Module; +import keystrokesmod.client.module.modules.player.RightClicker; import keystrokesmod.client.module.setting.impl.SliderSetting; import keystrokesmod.client.module.setting.impl.TickSetting; import keystrokesmod.client.module.modules.world.AntiBot; diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/AutoBlock.java b/src/main/java/keystrokesmod/client/module/modules/combat/AutoBlock.java index 4209430f..f0376b41 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/AutoBlock.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/AutoBlock.java @@ -30,7 +30,7 @@ public void yes(TickEvent.RenderTickEvent e){ return; if(engaged){ - if((engagedTime.hasTimeElapsed() || !Mouse.isButtonDown(0)) && duration.getInputMin() <= engagedTime.getElapsedTime()){ + if((engagedTime.hasFinished() || !Mouse.isButtonDown(0)) && duration.getInputMin() <= engagedTime.getElapsedTime()){ engaged = false; release(); } diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/BlockHit.java b/src/main/java/keystrokesmod/client/module/modules/combat/BlockHit.java index 98e9aff4..e71c277b 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/BlockHit.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/BlockHit.java @@ -60,7 +60,7 @@ public void onTick(TickEvent.RenderTickEvent e) { return; } if(waitingForPostDelay){ - if(postDelayTimer.hasTimeElapsed()){ + if(postDelayTimer.hasFinished()){ executingAction = true; startCombo(); waitingForPostDelay = false; @@ -71,7 +71,7 @@ public void onTick(TickEvent.RenderTickEvent e) { } if(executingAction) { - if(actionTimer.hasTimeElapsed()){ + if(actionTimer.hasFinished()){ executingAction = false; finishCombo(); return; diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/ClickAssist.java b/src/main/java/keystrokesmod/client/module/modules/combat/ClickAssist.java index ded1ec84..56c33e15 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/ClickAssist.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/ClickAssist.java @@ -5,7 +5,7 @@ import keystrokesmod.client.module.setting.impl.SliderSetting; import keystrokesmod.client.module.setting.impl.TickSetting; import keystrokesmod.client.utils.Utils; -import keystrokesmod.client.utils.mouseManager; +import keystrokesmod.client.utils.MouseManager; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.MouseEvent; @@ -96,7 +96,7 @@ public void onMouseUpdate(MouseEvent ev) { } } - if (above5.isToggled() && mouseManager.getRightClickCounter() <= 5) { + if (above5.isToggled() && MouseManager.getRightClickCounter() <= 5) { this.fix(1); return; } diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/LeftClicker.java b/src/main/java/keystrokesmod/client/module/modules/combat/LeftClicker.java index 642daee1..e4491b64 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/LeftClicker.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/LeftClicker.java @@ -1,6 +1,7 @@ package keystrokesmod.client.module.modules.combat; import keystrokesmod.client.module.Module; +import keystrokesmod.client.module.modules.player.RightClicker; import keystrokesmod.client.module.setting.impl.*; import keystrokesmod.client.utils.Utils; import net.minecraft.block.Block; @@ -29,7 +30,7 @@ public class LeftClicker extends Module { public static SliderSetting jitterLeft; public static TickSetting weaponOnly; public static TickSetting breakBlocks; - public static DoubleSliderSetting leftCPS; + public static DoubleSliderSetting leftCPS, breakBlocksDelay;; public static TickSetting inventoryFill; public static ComboSetting clickStyle, clickTimings; @@ -38,7 +39,9 @@ public class LeftClicker extends Module { private long lastClick; private long leftHold; private boolean allowedClick; - public static boolean autoClickerEnabled; + public static boolean autoClickerEnabled, breakTimeDone; + private double breakBlockFinishWaitTime; + private boolean watingForBreakTimeout; private boolean leftDown; private long leftDownTime; private long leftUpTime; @@ -314,19 +317,17 @@ private void inInvClick(GuiScreen guiScreen) { public boolean breakBlock() { if (breakBlocks.isToggled() && mc.objectMouseOver != null) { BlockPos p = mc.objectMouseOver.getBlockPos(); + if (p != null) { Block bl = mc.theWorld.getBlockState(p).getBlock(); if (bl != Blocks.air && !(bl instanceof BlockLiquid)) { - - if(!breakHeld) { + if (!breakHeld) { int e = mc.gameSettings.keyBindAttack.getKeyCode(); KeyBinding.setKeyBindState(e, true); KeyBinding.onTick(e); breakHeld = true; } return true; - - } if(breakHeld) { breakHeld = false; diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/STap.java b/src/main/java/keystrokesmod/client/module/modules/combat/STap.java index 3785e79a..568a6ac4 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/STap.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/STap.java @@ -50,7 +50,7 @@ public void onTick(TickEvent.RenderTickEvent e) { return; if(waitingForPostDelay){ - if(postDelayTimer.hasTimeElapsed()){ + if(postDelayTimer.hasFinished()){ waitingForPostDelay = false; comboing = true; startCombo(); @@ -60,7 +60,7 @@ public void onTick(TickEvent.RenderTickEvent e) { } if(comboing) { - if(actionTimer.hasTimeElapsed()){ + if(actionTimer.hasFinished()){ comboing = false; finishCombo(); return; diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/ShiftTap.java b/src/main/java/keystrokesmod/client/module/modules/combat/ShiftTap.java index 52d266de..f19d55bd 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/ShiftTap.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/ShiftTap.java @@ -51,7 +51,7 @@ public void onTick(TickEvent.RenderTickEvent e) { return; if(waitingForPostDelay){ - if(postDelayTimer.hasTimeElapsed()){ + if(postDelayTimer.hasFinished()){ waitingForPostDelay = false; comboing = true; startCombo(); @@ -61,7 +61,7 @@ public void onTick(TickEvent.RenderTickEvent e) { } if(comboing) { - if(actionTimer.hasTimeElapsed()){ + if(actionTimer.hasFinished()){ comboing = false; finishCombo(); return; diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/WTap.java b/src/main/java/keystrokesmod/client/module/modules/combat/WTap.java index 4b6ecad2..93ac7eeb 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/WTap.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/WTap.java @@ -51,7 +51,7 @@ public void onTick(TickEvent.RenderTickEvent e) { return; if(waitingForPostDelay){ - if(postDelayTimer.hasTimeElapsed()){ + if(postDelayTimer.hasFinished()){ waitingForPostDelay = false; comboing = true; startCombo(); @@ -61,7 +61,7 @@ public void onTick(TickEvent.RenderTickEvent e) { } if(comboing) { - if(actionTimer.hasTimeElapsed()){ + if(actionTimer.hasFinished()){ comboing = false; finishCombo(); return; diff --git a/src/main/java/keystrokesmod/client/module/modules/minigames/MurderMystery.java b/src/main/java/keystrokesmod/client/module/modules/minigames/MurderMystery.java index acd82261..ed2aa41c 100644 --- a/src/main/java/keystrokesmod/client/module/modules/minigames/MurderMystery.java +++ b/src/main/java/keystrokesmod/client/module/modules/minigames/MurderMystery.java @@ -7,10 +7,7 @@ import keystrokesmod.client.module.modules.world.AntiBot; import keystrokesmod.client.utils.Utils; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemAxe; -import net.minecraft.item.ItemBow; -import net.minecraft.item.ItemSword; +import net.minecraft.item.*; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -63,7 +60,7 @@ public void o(RenderWorldLastEvent e) { String c4 = "&7[&cALERT&7]"; if (entity.getHeldItem() != null && entity.getHeldItem().hasDisplayName()) { Item i = entity.getHeldItem().getItem(); - if (i instanceof ItemSword || i instanceof ItemAxe || entity.getHeldItem().getDisplayName().contains("aKnife")) { + if (i instanceof ItemSword || i instanceof ItemAxe || entity.getHeldItem().getDisplayName().contains("Knife")) { if (!mur.contains(entity)) { mur.add(entity); diff --git a/src/main/java/keystrokesmod/client/module/modules/other/FakeChat.java b/src/main/java/keystrokesmod/client/module/modules/other/FakeChat.java index f86a3d0b..c1fa8723 100644 --- a/src/main/java/keystrokesmod/client/module/modules/other/FakeChat.java +++ b/src/main/java/keystrokesmod/client/module/modules/other/FakeChat.java @@ -13,7 +13,7 @@ public class FakeChat extends Module { public FakeChat() { super("Fake Chat", ModuleCategory.other); - this.registerSetting(a = new DescriptionSetting(Utils.Java.uf("command") + ": " + command + " [msg]")); + this.registerSetting(a = new DescriptionSetting(Utils.Java.capitalizeWord("command") + ": " + command + " [msg]")); } public void onEnable() { diff --git a/src/main/java/keystrokesmod/client/module/modules/other/NameHider.java b/src/main/java/keystrokesmod/client/module/modules/other/NameHider.java index d23ff8db..4edec58a 100644 --- a/src/main/java/keystrokesmod/client/module/modules/other/NameHider.java +++ b/src/main/java/keystrokesmod/client/module/modules/other/NameHider.java @@ -11,7 +11,7 @@ public class NameHider extends Module { public NameHider() { super("Name Hider", ModuleCategory.other); - this.registerSetting(a = new DescriptionSetting(Utils.Java.uf("command") + ": cname [name]")); + this.registerSetting(a = new DescriptionSetting(Utils.Java.capitalizeWord("command") + ": cname [name]")); } public static String getUnformattedTextForChat(String s) { diff --git a/src/main/java/keystrokesmod/client/module/modules/player/AutoTool.java b/src/main/java/keystrokesmod/client/module/modules/player/AutoTool.java index 6fa7fac9..ae513d18 100644 --- a/src/main/java/keystrokesmod/client/module/modules/player/AutoTool.java +++ b/src/main/java/keystrokesmod/client/module/modules/player/AutoTool.java @@ -5,7 +5,6 @@ import keystrokesmod.client.module.modules.combat.LeftClicker; import keystrokesmod.client.module.setting.impl.DoubleSliderSetting; import keystrokesmod.client.module.setting.impl.TickSetting; -import keystrokesmod.client.module.modules.combat.RightClicker; import keystrokesmod.client.utils.CoolDown; import keystrokesmod.client.utils.Utils; import net.minecraft.block.Block; @@ -77,7 +76,7 @@ public void onRenderTick(TickEvent.RenderTickEvent e) { delay.setCooldown((long)ThreadLocalRandom.current().nextDouble(mineDelay.getInputMin(), mineDelay.getInputMax() + 0.01)); delay.start(); } else { - if(isWaiting && delay.hasTimeElapsed()) { + if(isWaiting && delay.hasFinished()) { isWaiting = false; previousSlot = Utils.Player.getCurrentPlayerSlot(); mining = true; diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/RightClicker.java b/src/main/java/keystrokesmod/client/module/modules/player/RightClicker.java similarity index 95% rename from src/main/java/keystrokesmod/client/module/modules/combat/RightClicker.java rename to src/main/java/keystrokesmod/client/module/modules/player/RightClicker.java index 799aec07..7c0b88e3 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/RightClicker.java +++ b/src/main/java/keystrokesmod/client/module/modules/player/RightClicker.java @@ -1,4 +1,4 @@ -package keystrokesmod.client.module.modules.combat; +package keystrokesmod.client.module.modules.player; import keystrokesmod.client.main.Raven; import keystrokesmod.client.module.*; @@ -34,6 +34,7 @@ public class RightClicker extends Module { public static TickSetting onlyBlocks; public static TickSetting preferFastPlace; public static TickSetting noBlockSword; + public static TickSetting ignoreRods; public static TickSetting allowEat, allowBow; public static SliderSetting rightClickDelay; public static DoubleSliderSetting rightCPS; @@ -47,29 +48,25 @@ public class RightClicker extends Module { private long rightl; private double rightm; private boolean rightn; - - private boolean watingForBreakTimeout; - private double breakBlockFinishWaitTime; private long lastClick; - private long leftHold, rightHold; + private long rightHold; private boolean rightClickWaiting; private double rightClickWaitStartTime; private boolean allowedClick; - public static boolean breakTimeDone; - private boolean leftDown; private boolean rightDown; public RightClicker() { - super("Right Clicker", ModuleCategory.combat); + super("Right Clicker", ModuleCategory.player); this.registerSetting(rightCPS = new DoubleSliderSetting("RightCPS", 12, 16, 1,60, 0.5)); this.registerSetting(jitterRight = new SliderSetting("Jitter right", 0.0D, 0.0D, 3.0D, 0.1D)); this.registerSetting(rightClickDelay = new SliderSetting("Rightclick delay (ms)", 85D, 0D, 500D, 1.0D)); this.registerSetting(noBlockSword = new TickSetting("Don't rightclick sword", true)); + this.registerSetting(ignoreRods = new TickSetting("Ignore rods", true)); this.registerSetting(onlyBlocks = new TickSetting("Only rightclick with blocks", false)); this.registerSetting(preferFastPlace = new TickSetting("Prefer fast place", false)); - this.registerSetting(allowEat = new TickSetting("Allow eat", true)); + this.registerSetting(allowEat = new TickSetting("Allow eat & drink", true)); this.registerSetting(allowBow = new TickSetting("Allow bow", true)); this.registerSetting(clickTimings = new ComboSetting("Click event", ClickEvent.Render)); @@ -235,7 +232,13 @@ public boolean rightClickAllowed() { ItemStack item = mc.thePlayer.getHeldItem(); if (item != null) { if (allowEat.isToggled()) { - if ((item.getItem() instanceof ItemFood)) { + if ((item.getItem() instanceof ItemFood) || item.getItem() instanceof ItemPotion || item.getItem() instanceof ItemBucketMilk) { + return false; + } + } + + if(ignoreRods.isToggled()){ + if(item.getItem() instanceof ItemFishingRod){ return false; } } @@ -248,11 +251,7 @@ public boolean rightClickAllowed() { if (onlyBlocks.isToggled()) { if (!(item.getItem() instanceof ItemBlock)) { - if (item.getItem() instanceof IThrowableItem) { - if (!((IThrowableItem)item.getItem()).isThrowable(item)) return false; - } else { - return false; - } + return false; } } diff --git a/src/main/java/keystrokesmod/client/module/modules/player/SafeWalk.java b/src/main/java/keystrokesmod/client/module/modules/player/SafeWalk.java index eca82261..62d7ce9d 100644 --- a/src/main/java/keystrokesmod/client/module/modules/player/SafeWalk.java +++ b/src/main/java/keystrokesmod/client/module/modules/player/SafeWalk.java @@ -6,6 +6,7 @@ import keystrokesmod.client.module.setting.impl.DoubleSliderSetting; import keystrokesmod.client.module.setting.impl.SliderSetting; import keystrokesmod.client.module.setting.impl.TickSetting; +import keystrokesmod.client.utils.CoolDown; import keystrokesmod.client.utils.Utils; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.settings.KeyBinding; @@ -28,13 +29,18 @@ public class SafeWalk extends Module { public static DoubleSliderSetting pitchRange; public static SliderSetting blockShowMode; public static DescriptionSetting blockShowModeDesc; + public static DoubleSliderSetting shiftTime; + private static boolean shouldBridge = false; private static boolean isShifting = false; + private boolean allowedShift; + private CoolDown shiftTimer = new CoolDown(0); public SafeWalk() { - super("SafeWalk", ModuleCategory.player); + super("SafeWalk",ModuleCategory.player); this.registerSetting(doShift = new TickSetting("Shift", false)); this.registerSetting(shiftOnJump = new TickSetting("Shift during jumps", false)); + this.registerSetting(shiftTime = new DoubleSliderSetting("Shift time: (s)", 140, 200, 0, 280, 5)); this.registerSetting(onHold = new TickSetting("On shift hold", false)); this.registerSetting(blocksOnly = new TickSetting("Blocks only", true)); this.registerSetting(showBlockAmount = new TickSetting("Show amount of blocks", true)); @@ -65,6 +71,9 @@ public void p(PlayerTickEvent e) { if (!Utils.Player.isPlayerInGame()) { return; } + + boolean shiftTimeSettingActive = shiftTime.getInputMax() > 0; + if(doShift.isToggled()) { if(lookDown.isToggled()) { if(mc.thePlayer.rotationPitch < pitchRange.getInputMin() || mc.thePlayer.rotationPitch > pitchRange.getInputMax()) { @@ -81,40 +90,47 @@ public void p(PlayerTickEvent e) { return; } } + + if (blocksOnly.isToggled()) { + ItemStack i = mc.thePlayer.getHeldItem(); + if (i == null || !(i.getItem() instanceof ItemBlock)) { + if (isShifting) { + isShifting = false; + this.setShift(false); + } + + return; + } + } + if (mc.thePlayer.onGround) { if (Utils.Player.playerOverAir()) { - if (blocksOnly.isToggled()) { - ItemStack i = mc.thePlayer.getHeldItem(); - if (i == null || !(i.getItem() instanceof ItemBlock)) { - if (isShifting) { - isShifting = false; - this.setShift(false); - } - - return; - } + // code fo the timer + if(shiftTimeSettingActive){ // making sure that the player has set the value so some number + shiftTimer.setCooldown(Utils.Java.randomInt(shiftTime.getInputMin(), shiftTime.getInputMax() + 0.1)); + shiftTimer.start(); } isShifting = true; this.setShift(true); shouldBridge = true; } - else if (mc.thePlayer.isSneaking() && !Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode()) && onHold.isToggled()) { + else if (mc.thePlayer.isSneaking() && !Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode()) && onHold.isToggled()) { // if player is smeaking and shiftDown and holdSetting turned on isShifting = false; shouldBridge = false; this.setShift(false); } - else if(onHold.isToggled() && !Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) { + else if(onHold.isToggled() && !Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) { // if shiftDown and holdSetting turned on isShifting = false; shouldBridge = false; this.setShift(false); } - else if(mc.thePlayer.isSneaking() && (Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode()) && onHold.isToggled())) { + else if(mc.thePlayer.isSneaking() && (Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode()) && onHold.isToggled()) && (!shiftTimeSettingActive|| shiftTimer.hasFinished())) { isShifting = false; this.setShift(false); shouldBridge = true; } - else if(mc.thePlayer.isSneaking() && !onHold.isToggled()) { + else if(mc.thePlayer.isSneaking() && !onHold.isToggled() && (!shiftTimeSettingActive|| shiftTimer.hasFinished())) { isShifting = false; this.setShift(false); shouldBridge = true; @@ -138,7 +154,7 @@ else if (shouldBridge && Utils.Player.playerOverAir() && shiftOnJump.isToggled() } @SubscribeEvent - public void onRenderTick(TickEvent.RenderTickEvent e) { + public void r(TickEvent.RenderTickEvent e) { if(!showBlockAmount.isToggled() || !Utils.Player.isPlayerInGame()) return; if (e.phase == TickEvent.Phase.END) { if (mc.currentScreen == null) { @@ -189,8 +205,8 @@ private void setShift(boolean sh) { KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), sh); } - public enum BlockAmountInfo { + public static enum BlockAmountInfo { BLOCKS_IN_TOTAL, - BLOCKS_IN_CURRENT_STACK + BLOCKS_IN_CURRENT_STACK; } } diff --git a/src/main/java/keystrokesmod/client/module/modules/render/AntiShuffle.java b/src/main/java/keystrokesmod/client/module/modules/render/AntiShuffle.java index e50011a6..f3dd207c 100644 --- a/src/main/java/keystrokesmod/client/module/modules/render/AntiShuffle.java +++ b/src/main/java/keystrokesmod/client/module/modules/render/AntiShuffle.java @@ -10,7 +10,7 @@ public class AntiShuffle extends Module { public AntiShuffle() { super("AntiShuffle", ModuleCategory.render); - this.registerSetting(a = new DescriptionSetting(Utils.Java.uf("remove") + " &k")); + this.registerSetting(a = new DescriptionSetting(Utils.Java.capitalizeWord("remove") + " &k")); } public static String getUnformattedTextForChat(String s) { diff --git a/src/main/java/keystrokesmod/client/tweaker/ASMEventHandler.java b/src/main/java/keystrokesmod/client/tweaker/ASMEventHandler.java index 4a6e8862..bc761ad4 100644 --- a/src/main/java/keystrokesmod/client/tweaker/ASMEventHandler.java +++ b/src/main/java/keystrokesmod/client/tweaker/ASMEventHandler.java @@ -3,7 +3,6 @@ import keystrokesmod.client.main.Raven; import keystrokesmod.client.module.Module; import keystrokesmod.client.module.modules.combat.LeftClicker; -import keystrokesmod.client.module.modules.combat.RightClicker; import keystrokesmod.client.module.modules.combat.Reach; import keystrokesmod.client.module.modules.movement.KeepSprint; import keystrokesmod.client.module.modules.movement.NoSlow; diff --git a/src/main/java/keystrokesmod/client/utils/ChatHelper.java b/src/main/java/keystrokesmod/client/utils/ChatHelper.java index 383105f9..7adca710 100644 --- a/src/main/java/keystrokesmod/client/utils/ChatHelper.java +++ b/src/main/java/keystrokesmod/client/utils/ChatHelper.java @@ -1,6 +1,6 @@ package keystrokesmod.client.utils; -import keystrokesmod.client.clickgui.raven.CommandLine; +import keystrokesmod.client.clickgui.raven.Terminal; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -20,9 +20,9 @@ public void onChatMessageReceived(ClientChatReceivedEvent event) { } public static void checkPing() { - CommandLine.print("§3Checking...", 1); + Terminal.print("Checking..."); if (e) { - CommandLine.print("§cPlease wait.", 0); + Terminal.print("Please wait."); } else { Utils.mc.thePlayer.sendChatMessage("/..."); e = true; @@ -36,7 +36,7 @@ private void getPing() { ping = 0; } - CommandLine.print("Your ping: " + ping + "ms", 0); + Terminal.print("Your ping: " + ping + "ms"); reset(); } diff --git a/src/main/java/keystrokesmod/client/utils/CoolDown.java b/src/main/java/keystrokesmod/client/utils/CoolDown.java index 63b55a6f..2b72071c 100644 --- a/src/main/java/keystrokesmod/client/utils/CoolDown.java +++ b/src/main/java/keystrokesmod/client/utils/CoolDown.java @@ -13,7 +13,7 @@ public void start(){ //Utils.Player.sendMessageToSelf("Time started " + lasts/1000); } - public boolean hasTimeElapsed(){ + public boolean hasFinished(){ if(System.currentTimeMillis() >= start + lasts) { //Utils.Player.sendMessageToSelf("Time finished"); return true; diff --git a/src/main/java/keystrokesmod/client/utils/mouseManager.java b/src/main/java/keystrokesmod/client/utils/MouseManager.java similarity index 98% rename from src/main/java/keystrokesmod/client/utils/mouseManager.java rename to src/main/java/keystrokesmod/client/utils/MouseManager.java index 7497705d..4be9e11d 100644 --- a/src/main/java/keystrokesmod/client/utils/mouseManager.java +++ b/src/main/java/keystrokesmod/client/utils/MouseManager.java @@ -10,7 +10,7 @@ import java.util.ArrayList; import java.util.List; -public class mouseManager { +public class MouseManager { private static final List leftClicks = new ArrayList<>(); private static final List rightClicks = new ArrayList<>(); public static long leftClickTimer = 0L; diff --git a/src/main/java/keystrokesmod/client/utils/Utils.java b/src/main/java/keystrokesmod/client/utils/Utils.java index 69a5c885..a5874330 100644 --- a/src/main/java/keystrokesmod/client/utils/Utils.java +++ b/src/main/java/keystrokesmod/client/utils/Utils.java @@ -9,7 +9,6 @@ import keystrokesmod.client.module.modules.combat.LeftClicker; import keystrokesmod.client.module.setting.impl.DoubleSliderSetting; import keystrokesmod.client.module.setting.impl.SliderSetting; -import keystrokesmod.client.module.modules.combat.RightClicker; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -606,7 +605,7 @@ public static String str(String s) { return v.toString(); } - public static String uf(String s) { + public static String capitalizeWord(String s) { return s.substring(0, 1).toUpperCase() + s.substring(1); } @@ -648,6 +647,10 @@ public static JsonObject getStringAsJson(String text) { public static String randomChoice(String[] strings) { return strings[rand.nextInt(strings.length)]; } + + public static int randomInt(double inputMin, double v) { + return (int)(Math.random() * (v - inputMin) + inputMin); + } } public static class URLS { diff --git a/src/main/java/keystrokesmod/keystroke/KeyStroke.java b/src/main/java/keystrokesmod/keystroke/KeyStroke.java index 5fa7f1eb..6051f574 100644 --- a/src/main/java/keystrokesmod/keystroke/KeyStroke.java +++ b/src/main/java/keystrokesmod/keystroke/KeyStroke.java @@ -3,21 +3,17 @@ public class KeyStroke { public static int x; public static int y; - public static int currentColorNumber; - - public static boolean showMouseBtn; - public static boolean mode; + public static boolean showMouseButtons; + public static boolean enabled; public static boolean outline; public KeyStroke() { x = 0; y = 0; - currentColorNumber = 0; - - showMouseBtn = false; - mode = true; + showMouseButtons = false; + enabled = true; outline = false; } } diff --git a/src/main/java/keystrokesmod/keystroke/KeystrokeCommand.java b/src/main/java/keystrokesmod/keystroke/KeyStrokeCommand.java similarity index 68% rename from src/main/java/keystrokesmod/keystroke/KeystrokeCommand.java rename to src/main/java/keystrokesmod/keystroke/KeyStrokeCommand.java index b5af4e12..3f793237 100644 --- a/src/main/java/keystrokesmod/keystroke/KeystrokeCommand.java +++ b/src/main/java/keystrokesmod/keystroke/KeyStrokeCommand.java @@ -1,16 +1,18 @@ +//Deobfuscated with https://github.com/PetoPetko/Minecraft-Deobfuscator3000 using mappings "1.8.9"! + package keystrokesmod.keystroke; -import net.minecraft.client.Minecraft; +import keystrokesmod.client.main.Raven; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; -public class KeystrokeCommand extends CommandBase { +public class KeyStrokeCommand extends CommandBase { public String getCommandName() { return "keystrokesmod"; } public void processCommand(ICommandSender sender, String[] args) { - Minecraft.getMinecraft().displayGuiScreen(new KeyStrokeConfigGui()); + KeyStrokeMod.toggleKeyStrokeConfigGui(); } public String getCommandUsage(ICommandSender sender) { diff --git a/src/main/java/keystrokesmod/keystroke/KeyStrokeConfigGui.java b/src/main/java/keystrokesmod/keystroke/KeyStrokeConfigGui.java index 2069c6f4..1c1ced1b 100644 --- a/src/main/java/keystrokesmod/keystroke/KeyStrokeConfigGui.java +++ b/src/main/java/keystrokesmod/keystroke/KeyStrokeConfigGui.java @@ -1,89 +1,76 @@ +//Deobfuscated with https://github.com/PetoPetko/Minecraft-Deobfuscator3000 using mappings "1.8.9"! package keystrokesmod.keystroke; +import java.io.IOException; + import keystrokesmod.client.main.ClientConfig; import keystrokesmod.client.main.Raven; -import keystrokesmod.client.module.ModuleManager; -import keystrokesmod.client.module.modules.client.GuiModule; -import keystrokesmod.client.utils.mouseManager; +import keystrokesmod.client.utils.MouseManager; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; -import java.io.IOException; - public class KeyStrokeConfigGui extends GuiScreen { - private static KeyStrokeRenderer keySrokeRenderer; - private static final String[] colors = new String[]{"White", "Red", "Green", "Blue", "Yellow", "Purple", "Rainbow"}; private GuiButton modeBtn; private GuiButton textColorBtn; private GuiButton showMouseBtn; private GuiButton outlineBtn; - private GuiButton clickGui; private boolean d = false; private int lx; private int ly; - public KeyStrokeConfigGui() { - KeyStrokeConfigGui.keySrokeRenderer = new KeyStrokeRenderer(); - } - public void initGui() { - this.buttonList.add(this.modeBtn = new GuiButton(0, this.width / 2 - 70, this.height / 2 - 28, 140, 20, "Mod: " + (KeyStroke.mode ? "Enabled" : "Disabled"))); + KeyStroke st = KeyStrokeMod.getKeyStroke(); + this.buttonList.add(this.modeBtn = new GuiButton(0, this.width / 2 - 70, this.height / 2 - 28, 140, 20, "Mod: " + (KeyStroke.enabled ? "Enabled" : "Disabled"))); this.buttonList.add(this.textColorBtn = new GuiButton(1, this.width / 2 - 70, this.height / 2 - 6, 140, 20, "Text color: " + colors[KeyStroke.currentColorNumber])); - this.buttonList.add(this.showMouseBtn = new GuiButton(2, this.width / 2 - 70, this.height / 2 + 16, 140, 20, "Show mouse buttons: " + (KeyStroke.showMouseBtn ? "On" : "Off"))); + this.buttonList.add(this.showMouseBtn = new GuiButton(2, this.width / 2 - 70, this.height / 2 + 16, 140, 20, "Show mouse buttons: " + (KeyStroke.showMouseButtons ? "On" : "Off"))); this.buttonList.add(this.outlineBtn = new GuiButton(3, this.width / 2 - 70, this.height / 2 + 38, 140, 20, "Outline: " + (KeyStroke.outline ? "On" : "Off"))); - GuiModule gui = (GuiModule) Raven.moduleManager.getModuleByClazz(GuiModule.class); - if (gui != null && gui.getKeycode() != 54) { - this.buttonList.add(this.clickGui = new GuiButton(3, this.width / 2 - 70, this.height / 2 + 60, 140, 20, "ClickGui")); - } } public void drawScreen(int mouseX, int mouseY, float partialTicks) { - keySrokeRenderer.renderKeystrokes(); + KeyStrokeMod.getKeyStrokeRenderer().renderKeystrokes(); super.drawScreen(mouseX, mouseY, partialTicks); } protected void actionPerformed(GuiButton button) { + KeyStroke st = KeyStrokeMod.getKeyStroke(); if (button == this.modeBtn) { - KeyStroke.mode = !KeyStroke.mode; - this.modeBtn.displayString = "Mod: " + (KeyStroke.mode ? "Enabled" : "Disabled"); + KeyStroke.enabled = !KeyStroke.enabled; + this.modeBtn.displayString = "Mod: " + (KeyStroke.enabled ? "Enabled" : "Disabled"); } else if (button == this.textColorBtn) { KeyStroke.currentColorNumber = KeyStroke.currentColorNumber == 6 ? 0 : KeyStroke.currentColorNumber + 1; this.textColorBtn.displayString = "Text color: " + colors[KeyStroke.currentColorNumber]; } else if (button == this.showMouseBtn) { - KeyStroke.showMouseBtn = !KeyStroke.showMouseBtn; - this.showMouseBtn.displayString = "Show mouse buttons: " + (KeyStroke.showMouseBtn ? "On" : "Off"); + KeyStroke.showMouseButtons = !KeyStroke.showMouseButtons; + this.showMouseBtn.displayString = "Show mouse buttons: " + (KeyStroke.showMouseButtons ? "On" : "Off"); } else if (button == this.outlineBtn) { KeyStroke.outline = !KeyStroke.outline; this.outlineBtn.displayString = "Outline: " + (KeyStroke.outline ? "On" : "Off"); - } else if(button == this.clickGui){ - mc.currentScreen = null; - mc.displayGuiScreen(Raven.clickGui); - Raven.clickGui.initMain(); } - } protected void mouseClicked(int mouseX, int mouseY, int button) { try { super.mouseClicked(mouseX, mouseY, button); - } catch (IOException ignored) {} + } catch (IOException var9) { + } if (button == 0) { - mouseManager.addLeftClick(); + MouseManager.addLeftClick(); + KeyStroke st = KeyStrokeMod.getKeyStroke(); int startX = KeyStroke.x; int startY = KeyStroke.y; int endX = startX + 74; - int endY = startY + (KeyStroke.showMouseBtn ? 74 : 50); + int endY = startY + (KeyStroke.showMouseButtons ? 74 : 50); if (mouseX >= startX && mouseX <= endX && mouseY >= startY && mouseY <= endY) { this.d = true; this.lx = mouseX; this.ly = mouseY; } } else if (button == 1) { - mouseManager.addRightClick(); + MouseManager.addRightClick(); } } @@ -96,6 +83,7 @@ protected void mouseReleased(int mouseX, int mouseY, int action) { protected void mouseClickMove(int mouseX, int mouseY, int lastButtonClicked, long timeSinceMouseClick) { super.mouseClickMove(mouseX, mouseY, lastButtonClicked, timeSinceMouseClick); if (this.d) { + KeyStroke st = KeyStrokeMod.getKeyStroke(); KeyStroke.x = KeyStroke.x + mouseX - this.lx; KeyStroke.y = KeyStroke.y + mouseY - this.ly; this.lx = mouseX; @@ -108,7 +96,6 @@ public boolean doesGuiPauseGame() { } public void onGuiClosed() { - Raven.clientConfig.saveConfig(); ClientConfig.saveKeyStrokeSettingsToConfigFile(); } } diff --git a/src/main/java/keystrokesmod/keystroke/KeyStrokeKeyRenderer.java b/src/main/java/keystrokesmod/keystroke/KeyStrokeKeyRenderer.java index 0b6bda81..bf15c7d1 100644 --- a/src/main/java/keystrokesmod/keystroke/KeyStrokeKeyRenderer.java +++ b/src/main/java/keystrokesmod/keystroke/KeyStrokeKeyRenderer.java @@ -1,12 +1,12 @@ +//Deobfuscated with https://github.com/PetoPetko/Minecraft-Deobfuscator3000 using mappings "1.8.9"! package keystrokesmod.keystroke; +import java.awt.Color; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import org.lwjgl.input.Keyboard; -import java.awt.*; - public class KeyStrokeKeyRenderer { private final Minecraft a = Minecraft.getMinecraft(); private final KeyBinding keyBinding; diff --git a/src/main/java/keystrokesmod/keystroke/KeyStrokeMod.java b/src/main/java/keystrokesmod/keystroke/KeyStrokeMod.java index af50e1e5..17b3ab0b 100644 --- a/src/main/java/keystrokesmod/keystroke/KeyStrokeMod.java +++ b/src/main/java/keystrokesmod/keystroke/KeyStrokeMod.java @@ -1,9 +1,14 @@ package keystrokesmod.keystroke; +import keystrokesmod.client.main.ClientConfig; import keystrokesmod.client.main.Raven; +import net.minecraft.client.Minecraft; import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; @Mod( modid = "keystrokesmod", @@ -12,11 +17,37 @@ acceptedMinecraftVersions = "[1.8.9]", clientSideOnly = true ) + public class KeyStrokeMod { + private static KeyStroke keyStroke; + private static KeyStrokeRenderer keyStrokeRenderer = new KeyStrokeRenderer(); + private static boolean isKeyStrokeConfigGuiToggled = false; @Mod.EventHandler public void init(FMLInitializationEvent event) { - ClientCommandHandler.instance.registerCommand(new KeystrokeCommand()); - + ClientCommandHandler.instance.registerCommand(new KeyStrokeCommand()); + MinecraftForge.EVENT_BUS.register(new KeyStrokeRenderer()); + MinecraftForge.EVENT_BUS.register(this); + ClientConfig.applyKeyStrokeSettingsFromConfigFile(); Raven.init(); } + + public static KeyStroke getKeyStroke() { + return keyStroke; + } + + public static KeyStrokeRenderer getKeyStrokeRenderer() { + return keyStrokeRenderer; + } + + public static void toggleKeyStrokeConfigGui() { + isKeyStrokeConfigGuiToggled = true; + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent e){ + if (isKeyStrokeConfigGuiToggled) { + isKeyStrokeConfigGuiToggled = false; + Minecraft.getMinecraft().displayGuiScreen(new KeyStrokeConfigGui()); + } + } } diff --git a/src/main/java/keystrokesmod/keystroke/KeyStrokeMouse.java b/src/main/java/keystrokesmod/keystroke/KeyStrokeMouse.java index f3e5301e..b40cd43a 100644 --- a/src/main/java/keystrokesmod/keystroke/KeyStrokeMouse.java +++ b/src/main/java/keystrokesmod/keystroke/KeyStrokeMouse.java @@ -1,21 +1,21 @@ package keystrokesmod.keystroke; -import keystrokesmod.client.utils.mouseManager; +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; + +import keystrokesmod.client.utils.MouseManager; import net.minecraft.client.Minecraft; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - public class KeyStrokeMouse { private static final String[] a = new String[]{"LMB", "RMB"}; private final Minecraft b = Minecraft.getMinecraft(); private final int c; private final int d; private final int e; - private final List f = new ArrayList<>(); + private final List f = new ArrayList(); private boolean g = true; private long h = 0L; @@ -59,8 +59,8 @@ public void n(int o, int p, int color) { } this.b.fontRendererObj.drawString(s, o + this.d + 8, p + this.e + 4, -16777216 + ((int)((double)t * j) << 16) + ((int)((double)u * j) << 8) + (int)((double)v * j)); - String w = mouseManager.getLeftClickCounter() + " CPS"; - String x = mouseManager.getRightClickCounter() + " CPS"; + String w = MouseManager.getLeftClickCounter() + " CPS"; + String x = MouseManager.getRightClickCounter() + " CPS"; int y = this.b.fontRendererObj.getStringWidth(w); int z = this.b.fontRendererObj.getStringWidth(x); boolean a2 = this.c == 0; diff --git a/src/main/java/keystrokesmod/keystroke/KeyStrokeRenderer.java b/src/main/java/keystrokesmod/keystroke/KeyStrokeRenderer.java index 52911d3e..064f063c 100644 --- a/src/main/java/keystrokesmod/keystroke/KeyStrokeRenderer.java +++ b/src/main/java/keystrokesmod/keystroke/KeyStrokeRenderer.java @@ -1,14 +1,13 @@ - package keystrokesmod.keystroke; +import java.awt.Color; +import java.io.IOException; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent; -import java.awt.*; -import java.io.IOException; - public class KeyStrokeRenderer { private static final int[] a = new int[]{16777215, 16711680, 65280, 255, 16776960, 11141290}; private final Minecraft mc = Minecraft.getMinecraft(); @@ -40,11 +39,12 @@ public void onRenderTick(RenderTickEvent e) { } public void renderKeystrokes() { - if (KeyStroke.mode) { + KeyStroke f = KeyStrokeMod.getKeyStroke(); + if (KeyStroke.enabled) { int x = KeyStroke.x; int y = KeyStroke.y; int g = this.getColor(KeyStroke.currentColorNumber); - boolean h = KeyStroke.showMouseBtn; + boolean h = KeyStroke.showMouseButtons; ScaledResolution res = new ScaledResolution(this.mc); int width = 74; int height = h ? 74 : 50; @@ -77,14 +77,24 @@ private int getColor(int index) { } private void drawMovementKeys(int x, int y, int textColor) { - for (KeyStrokeKeyRenderer key : this.b) { + KeyStrokeKeyRenderer[] var4 = this.b; + int var5 = var4.length; + + for(int var6 = 0; var6 < var5; ++var6) { + KeyStrokeKeyRenderer key = var4[var6]; key.renderKey(x, y, textColor); } + } private void drawMouseButtons(int x, int y, int textColor) { - for (KeyStrokeMouse button : this.c) { + KeyStrokeMouse[] var4 = this.c; + int var5 = var4.length; + + for(int var6 = 0; var6 < var5; ++var6) { + KeyStrokeMouse button = var4[var6]; button.n(x, y, textColor); } + } } diff --git a/src/main/resources/assets/keystrokes/version b/src/main/resources/assets/keystrokes/version index dcb2becb..12fd56c0 100644 --- a/src/main/resources/assets/keystrokes/version +++ b/src/main/resources/assets/keystrokes/version @@ -1 +1 @@ -1-0-22 \ No newline at end of file +1-0-23 \ No newline at end of file