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 f163e348..6eac97dc 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/NotificationRenderer.java b/src/main/java/keystrokesmod/client/NotificationRenderer.java index 23fd7253..43c931e7 100644 --- a/src/main/java/keystrokesmod/client/NotificationRenderer.java +++ b/src/main/java/keystrokesmod/client/NotificationRenderer.java @@ -1,6 +1,6 @@ package keystrokesmod.client; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import keystrokesmod.client.module.Module; import keystrokesmod.client.module.modules.client.GuiModule; import keystrokesmod.client.lib.me.superblaubeere27.client.notifications.Notification; @@ -9,7 +9,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; public class NotificationRenderer { - @FMLEvent + @SubscribeEvent public void onRender(TickEvent.RenderTickEvent event) { if (GuiModule.toggleNotification.isToggled()) NotificationManager.render(); } diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/CategoryComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/CategoryComponent.java deleted file mode 100644 index 96c152a9..00000000 --- a/src/main/java/keystrokesmod/client/clickgui/raven/CategoryComponent.java +++ /dev/null @@ -1,141 +0,0 @@ -package keystrokesmod.client.clickgui.raven; - -import keystrokesmod.client.clickgui.theme.Theme; -import keystrokesmod.client.main.Raven; -import keystrokesmod.client.module.Module; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; - -import java.util.Iterator; - -public class CategoryComponent extends Component { - public Module.ModuleCategory category; - private boolean opened = false; - private final String name; - private boolean dragging; - - public CategoryComponent(Module.ModuleCategory category) { - this(category.name()); - this.category = category; - - for(Iterator var3 = Raven.moduleManager.getModulesInCategory(category).iterator(); var3.hasNext();) { - Module mod = var3.next(); - ModuleComponent b = new ModuleComponent(mod, this); - this.add(b); - } - } - - public CategoryComponent(String name) { - this.name = name; - } - - public String getName(){ - return name; - } - - public boolean isOpened() { - return opened; - } - - public void setOpened(boolean on) { - this.opened = on; - } - - @Override - public void paint(FontRenderer fr) { - Theme currentTheme = Raven.clickGui.getTheme(); - Gui.drawRect((int)this.getX(), - (int)this.getY(), - (int) (this.getX() + this.getWidth()), - (int) (this.getY() + this.getHeight()), - currentTheme.getBackgroundColour().getRGB()); - - float textMargin = (float)this.getWidth() * 0.0625f; - double desiredTextSize = this.getHeight() * 0.6; - double scaleFactor = desiredTextSize/ fr.FONT_HEIGHT; - double coordFactor = 1/scaleFactor; - String status = this.opened ? "-" : "+"; - - GL11.glPushMatrix(); - GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); - double retard = this.getX() + this.getWidth() - textMargin - fr.getStringWidth(status) * scaleFactor; - fr.drawString(status, (float)(retard * coordFactor), (float)((this.getY() + this.getHeight() * 0.2) * coordFactor), currentTheme.getContrastColour().getRGB(), false); - fr.drawString(getName(), (float)((this.getX() + textMargin) * coordFactor), (float)((this.getY() + this.getHeight() * 0.2) * coordFactor), currentTheme.getHeadingColour().getRGB(), false); - GL11.glPopMatrix(); - - if(opened){ - for(Component component : this.getComponents()){ - component.paint(fr); - } - } - - - } - - @Override - public void update(int x, int y) { - ClickGui clickGui = Raven.clickGui; - if(this.mouseOver(x, y)){ - clickGui.setTooltip("Left Click to see the modules, CTRL and drag to move", this); - } else if(!this.mouseOver(x, y) && clickGui.getTooltipSetter() == this){ - clickGui.clearTooltip(); - } - - if(draggable && dragging){ - double xt = windowStartDragX + (x - mouseStartDragX); - double yt = windowStartDragY + (y - mouseStartDragY); - this.setLocation(xt, yt); - } - - if(opened){ - double renderY = this.getY() + this.getHeight(); - for(Component component: this.getComponents()){ - if(component instanceof ModuleComponent){ - ModuleComponent moduleComponent = (ModuleComponent) component; - moduleComponent.setLocation(this.getX() + 1, renderY); - moduleComponent.update(x, y); - renderY += moduleComponent.isOpened() ? moduleComponent.getFullHeight() : moduleComponent.getHeight(); - //System.out.println(moduleComponent.getModule().getName() + " " + moduleComponent.isOpened() + " " + moduleComponent.getFullHeight() + " " + moduleComponent.getHeight()); - } - } - } - } - - @Override - public void mouseDown(int x, int y, int mb) { - this.mouseDown = true; - - if(opened){ - for(Component component : this.getComponents()){ - component.mouseDown(x, y, mb); - } - } - - if(draggable && mouseOver(x, y) && Keyboard.isKeyDown(29)){ - this.dragging = true; - this.mouseStartDragX = x; - this.mouseStartDragY = y; - this.windowStartDragX = getX(); - this.windowStartDragY = getY(); - } else if(mouseOver(x, y)){ - this.opened = !opened; - } - - - } - - @Override - public void mouseReleased(int x, int y, int mb) { - this.mouseDown = false; - if(draggable) - this.dragging = false; - - if(opened) { - for (Component component : this.getComponents()) { - component.mouseReleased(x, y, mb); - } - } - } -} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/ClickGui.java b/src/main/java/keystrokesmod/client/clickgui/raven/ClickGui.java index 64b326f9..b5c2472d 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/ClickGui.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/ClickGui.java @@ -1,70 +1,36 @@ package keystrokesmod.client.clickgui.raven; -import keystrokesmod.client.clickgui.raven.settings.BindComponent; -import keystrokesmod.client.clickgui.theme.Theme; -import keystrokesmod.client.clickgui.theme.themes.RavenB3; -import keystrokesmod.client.clickgui.theme.themes.Vape; +import keystrokesmod.client.clickgui.raven.components.CategoryComponent; import keystrokesmod.client.main.Raven; import keystrokesmod.client.module.Module; -import keystrokesmod.client.module.ModuleManager; import keystrokesmod.client.utils.Timer; import keystrokesmod.client.utils.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiTextField; -import net.minecraft.client.gui.ScaledResolution; +import keystrokesmod.client.utils.version.Version; +import net.minecraft.client.gui.*; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraftforge.fml.client.config.GuiButtonExt; import java.awt.*; import java.io.IOException; import java.util.ArrayList; +import java.util.Iterator; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; public class ClickGui extends GuiScreen { - public int barWidth = 1; - private ScheduledFuture scheduledFuture; - private Timer timerTopEntrance; - private Timer timerLeftEntrance; - private Timer timerBottomEntrance; - private Timer timerRightEntrance; - private ScaledResolution scaledResolution; - private GuiButtonExt commandLineSendButton; - private GuiTextField commandLineTestField; - - - private final Theme theme = new Vape(); - private final boolean inBindingProcess = false; - private String tooltip; - private final String defaultTooltip; - private final Terminal terminal; - private FontRenderer fontRenderer; - private Object setter; - - - - private final ArrayList moduleCategories; + private ScheduledFuture sf; + private Timer aT; + private Timer aL; + private Timer aE; + private Timer aR; + private ScaledResolution sr; + private GuiButtonExt s; + private GuiTextField c; + private final ArrayList categoryList; public ClickGui() { - this.moduleCategories = new ArrayList<>(); - this.tooltip = ""; - this.terminal = new Terminal(); - - if(Raven.versionManager.getLatestVersion().isNewerThan(Raven.versionManager.getClientVersion())){ - this.defaultTooltip = "Raven B+ v" + Raven.versionManager.getClientVersion().toString() + " is outdated! Please update to the latest version " + Raven.versionManager.getLatestVersion().toString(); - } else { - this.defaultTooltip = "Raven B+ v" + Raven.versionManager.getClientVersion().toString(); - } - - for(Module.ModuleCategory moduleCategory : Module.ModuleCategory.values()){ - CategoryComponent categoryComponent = new CategoryComponent(moduleCategory); - categoryComponent.setDraggable(true); - moduleCategories.add(categoryComponent); - } - + this.categoryList = new ArrayList<>(); int topOffset = 5; Module.ModuleCategory[] values; int categoryAmount = (values = Module.ModuleCategory.values()).length; @@ -72,77 +38,36 @@ public ClickGui() { for(int category = 0; category < categoryAmount; ++category) { Module.ModuleCategory moduleCategory = values[category]; CategoryComponent currentModuleCategory = new CategoryComponent(moduleCategory); - - moduleCategories.add(currentModuleCategory); - } - } - - public void firstRun() { - this.scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - - int categoryNumber = Module.ModuleCategory.values().length; - double marginX = scaledResolution.getScaledWidth() * 0.01; - double marginY = scaledResolution.getScaledHeight() * 0.01; - double totalMarginSpace = (categoryNumber + 1) * marginX; - double catWidth = (width - totalMarginSpace) / categoryNumber; - double catHeight = catWidth / 6; - double currentX = marginX; - - for(CategoryComponent categoryComponent : moduleCategories){ - categoryComponent.setLocation(currentX, marginY); - categoryComponent.setSize(92, 13); - categoryComponent.onResize(); - categoryComponent.setOpened(true); - currentX += catWidth + marginX; + currentModuleCategory.setY(topOffset); + categoryList.add(currentModuleCategory); + topOffset += 20; } } public void initMain() { - this.fontRenderer = mc.fontRendererObj; - (this.timerTopEntrance = this.timerBottomEntrance = this.timerRightEntrance = new Timer(500.0F)).start(); - this.scheduledFuture = Raven.getExecutor().schedule(() -> ( - this.timerLeftEntrance = new Timer(650.0F) + (this.aT = this.aE = this.aR = new Timer(500.0F)).start(); + this.sf = Raven.getExecutor().schedule(() -> ( + this.aL = new Timer(650.0F) ).start(), 650L, TimeUnit.MILLISECONDS); } 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) { - ScaledResolution sr = new ScaledResolution(mc); - double width = sr.getScaledWidth(); - double height = sr.getScaledHeight(); - - double marginX = width * 0.01; - double marginY = height * 0.01; - - double desiredTextSize = height * 0.024; - double scaleFactor = desiredTextSize / fontRenderer.FONT_HEIGHT; - double coordFactor = 1/scaleFactor; - - double desiredTooltipSize = desiredTextSize * 0.5; - double tooltipScaleFactor = desiredTooltipSize / fontRenderer.FONT_HEIGHT; - double tooltipCoordFactor = 1/tooltipScaleFactor; - - double barHeight = desiredTextSize * 1.6; - double barTextY = (height - barHeight + (barHeight - desiredTextSize) / 2); - double dateX = (width - (fontRenderer.getStringWidth(Utils.Java.getDate()) * scaleFactor + marginX)); - double tooltipX = 0; - double tooltipSize = fontRenderer.getStringWidth(tooltip.isEmpty() ? defaultTooltip : tooltip) * (tooltip.isEmpty() ? scaleFactor : tooltipScaleFactor); - tooltipX = (width - tooltipSize) / 2; - - - double entitySize = width * 0.05; - double entityX = width - marginX - entitySize; - double entityY = height - barHeight - 1 - marginY - entitySize; - - drawRect(0, 0, this.width, this.height, theme.getBackdropColour().getRGB()); + Version clientVersion = Raven.versionManager.getClientVersion(); + Version latestVersion = Raven.versionManager.getLatestVersion(); + drawRect(0, 0, this.width, this.height, (int)(this.aR.getValueFloat(0.0F, 0.7F, 2) * 255.0F) << 24); int quarterScreenHeight = this.height / 4; int halfScreenWidth = this.width / 2; - int w_c = 30 - this.timerTopEntrance.getValueInt(0, 30, 3); + int w_c = 30 - this.aT.getValueInt(0, 30, 3); this.drawCenteredString(this.fontRendererObj, "r", halfScreenWidth + 1 - w_c, quarterScreenHeight - 25, Utils.Client.rainbowDraw(2L, 1500L)); this.drawCenteredString(this.fontRendererObj, "a", halfScreenWidth - w_c, quarterScreenHeight - 15, Utils.Client.rainbowDraw(2L, 1200L)); this.drawCenteredString(this.fontRendererObj, "v", halfScreenWidth - w_c, quarterScreenHeight - 5, Utils.Client.rainbowDraw(2L, 900L)); @@ -150,118 +75,203 @@ public void drawScreen(int x, int y, float p) { this.drawCenteredString(this.fontRendererObj, "n", halfScreenWidth - w_c, quarterScreenHeight + 15, Utils.Client.rainbowDraw(2L, 300L)); this.drawCenteredString(this.fontRendererObj, "b+", halfScreenWidth + 1 + w_c, quarterScreenHeight + 30, Utils.Client.rainbowDraw(2L, 0L)); - fontRenderer.drawString(tooltip.isEmpty() ? defaultTooltip : tooltip, (float) (tooltipX * coordFactor), (float)(barTextY * coordFactor), theme.getTextColour().getRGB(), false); + float speed = 4890; + if(latestVersion.isNewerThan(clientVersion)){ + int margin = 2; + int rows = 1; + for (int i = Raven.updateText.length-1; i >= 0; i--) { + String up = Raven.updateText[i]; + mc.fontRendererObj.drawString(up, halfScreenWidth - this.fontRendererObj.getStringWidth(up) / 2, this.height - this.fontRendererObj.FONT_HEIGHT * rows - margin, Utils.Client.astolfoColorsDraw(10, 28, speed)); + rows++; + margin += 2; + } + }else { + mc.fontRendererObj.drawString("Raven B+ v" + clientVersion, 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; - if (this.timerLeftEntrance != null) { - r = this.timerLeftEntrance.getValueInt(0, 20, 2); + 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); } - for (CategoryComponent category : moduleCategories) { - category.update(x, y); - category.paint(fontRenderer); + for (CategoryComponent category : categoryList) { + category.rf(this.fontRendererObj); + category.up(x, y); + + for (Component module : category.getModules()) { + module.compute(x, y); + } } // PLAYER - GuiInventory.drawEntityOnScreen(this.width + 15 - this.timerBottomEntrance.getValueInt(0, 40, 2), this.height - 19 - this.fontRendererObj.FONT_HEIGHT, 40, (float)(this.width - 25 - x), (float)(this.height - 50), this.mc.thePlayer); + 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; + } + } public void mouseClicked(int x, int y, int mouseButton) throws IOException { - int categoryNumber = moduleCategories.size(); + Iterator btnCat = categoryList.iterator(); + + 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; + } - terminal.mouseDown(x, y, mouseButton); + category = btnCat.next(); + if (category.insideArea(x, y) && !category.i(x, y) && !category.mousePressed(x, y) && mouseButton == 0) { + category.mousePressed(true); + category.xx = x - category.getX(); + category.yy = y - category.getY(); + } - for(int i = 0; i < categoryNumber; i++){ - CategoryComponent categoryComponent = moduleCategories.get(i); - categoryComponent.mouseDown(x, y, mouseButton); + if (category.mousePressed(x, y) && mouseButton == 0) { + category.setOpened(!category.isOpened()); + } + + if (category.i(x, y) && mouseButton == 0) { + category.cv(!category.p()); + } + } while(!category.isOpened()); + } while(category.getModules().isEmpty()); + + for (Component c : category.getModules()) { + c.mouseDown(x, y, mouseButton); + } } } public void mouseReleased(int x, int y, int s) { - int categoryNumber = moduleCategories.size(); + if (s == 0) { + Iterator btnCat = categoryList.iterator(); + + CategoryComponent c4t; + while(btnCat.hasNext()) { + c4t = btnCat.next(); + c4t.mousePressed(false); + } + + btnCat = categoryList.iterator(); + + while(true) { + do { + do { + if (!btnCat.hasNext()) { + return; + } - terminal.mouseReleased(x, y, s); + c4t = btnCat.next(); + } while(!c4t.isOpened()); + } while(c4t.getModules().isEmpty()); - for(int i = 0; i < categoryNumber; i++){ - CategoryComponent categoryComponent = moduleCategories.get(i); - categoryComponent.mouseReleased(x, y, s); + for (Component c : c4t.getModules()) { + c.mouseReleased(x, y, s); + } + } + } + if(Raven.clientConfig != null){ + Raven.clientConfig.saveConfig(); } } - public void keyTyped(char typedChar, int keyCode) { - if(!binding()){ - try { - super.keyTyped(typedChar, keyCode); - } catch (IOException e) { - e.printStackTrace(); + public void keyTyped(char t, int k) { + if (k == 1) { + this.mc.displayGuiScreen(null); + } else { + Iterator btnCat = categoryList.iterator(); + + while(true) { + CategoryComponent cat; + 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; + } + + cat = btnCat.next(); + } while(!cat.isOpened()); + } while(cat.getModules().isEmpty()); + + for (Component c : cat.getModules()) { + c.ky(t, k); + } } } + } - for(CategoryComponent categoryComponent : moduleCategories){ - categoryComponent.keyTyped(typedChar, keyCode); + public void actionPerformed(GuiButton b) { + if (b == this.s) { + CommandLine.rCMD(this.c.getText()); + this.c.setText(""); } } public void onGuiClosed() { - this.timerLeftEntrance = null; - if (this.scheduledFuture != null) { - this.scheduledFuture.cancel(true); - this.scheduledFuture = null; - } - - for(Module module : ModuleManager.getModules()){ - module.onGuiClose(); + this.aL = null; + if (this.sf != null) { + this.sf.cancel(true); + this.sf = null; } - Raven.configManager.save(); } - public boolean doesGuiPauseGame() { + public boolean doesGuiPauseGame() { return false; } public ArrayList getCategoryList() { - return moduleCategories; - } - - public Theme getTheme() { - return theme; - } - - public void setTooltip(String tooltip, Object setter) { - this.tooltip = tooltip; - this.setter = setter; - } - - public Object getTooltipSetter() { - return setter; - } - - public String getTooltip(){ - return tooltip; - } - - public void clearTooltip(){ - this.tooltip = ""; - } - - private boolean binding() { - for (CategoryComponent categoryComponent : moduleCategories) { - for (Component module : categoryComponent.getComponents()) { - for (Component setting : module.getComponents()) { - if (setting instanceof BindComponent) { - if (((BindComponent) setting).isListening()) - return true; - } - } - } - } - return false; + return categoryList; } } diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/Component.java b/src/main/java/keystrokesmod/client/clickgui/raven/Component.java index d9bd755d..a90f92e2 100644 --- a/src/main/java/keystrokesmod/client/clickgui/raven/Component.java +++ b/src/main/java/keystrokesmod/client/clickgui/raven/Component.java @@ -1,182 +1,25 @@ package keystrokesmod.client.clickgui.raven; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import org.lwjgl.input.Keyboard; - -import java.awt.*; -import java.util.ArrayList; - -public abstract class Component { - private ArrayList components = new ArrayList(); - - private boolean locationSet = false; - private double x; - private double y; - - private boolean sizeSet = false; - private double width; - private double height; - - private boolean bgSet = false; - private Color background; - protected boolean - mouseDown = false; - - protected boolean draggable = false; - protected boolean dragging = false; - protected double windowStartDragX; - protected double windowStartDragY; - protected double mouseStartDragX; - protected double mouseStartDragY; - private boolean visible = true; - - public double getX() { - if(!locationSet) - throw new NullPointerException("You havent set the location retard"); - return x; - } - - public double getY() { - if(!locationSet) - throw new NullPointerException("You havent set the location retard"); - return y; - } - - public double getWidth() { - if(!sizeSet) - throw new NullPointerException("You havent set the size retard"); - return width; - } - - public double getHeight() { - if(!sizeSet) - throw new NullPointerException("You havent set the size retard"); - return height; +public class Component { + public void draw() { } - public void setLocation(double x, double y){ - this.locationSet = true; - this.x = x; - this.y = y; + public void compute(int mousePosX, int mousePosY) { } - public void setSize(double width, double height){ - this.sizeSet = true; - this.width = width; - this.height = height; + public void mouseDown(int x, int y, int b) { } - public Color getColor() { - if(!bgSet) - throw new NullPointerException("You havent set the color retard"); - return background; + public void mouseReleased(int x, int y, int m) { } - public void setColor(Color background) { - this.bgSet = true; - this.background = background; + public void ky(char t, int k) { } - public void paint(FontRenderer fr){ - for(Component component: this.getComponents()){ - component.paint(fr); - } + public void setModuleStartAt(int n) { } - public void add(Component component){ - this.components.add(component); - } - - public ArrayList getComponents() { - return components; - } - - public void setComponents(ArrayList c){ - this.components = c; - } - - public void clearComponents(){ - this.components.clear(); - } - - public void update(int x, int y){ - if(draggable && dragging){ - this.x = windowStartDragX + (x - mouseStartDragX); - this.y = windowStartDragX + (x - mouseStartDragX); - } - - for(Component component : components){ - component.update(x, y); - } - } - - public boolean isMouseDown() { - return mouseDown; - } - - public void mouseDown(int x, int y, int mb) { - this.mouseDown = true; - - if(draggable && mouseOver(x, y) && Keyboard.isKeyDown(29)){ - this.dragging = true; - this.mouseStartDragX = x; - this.mouseStartDragY = y; - this.windowStartDragX = getX(); - this.windowStartDragY = getY(); - } - - for(Component component : components){ - component.mouseDown(x, y, mb); - } - } - - public void mouseReleased(int x, int y, int mb) { - this.mouseDown = false; - if(draggable) - this.dragging = false; - for(Component component : components){ - component.mouseReleased(x, y, mb); - } - } - - public boolean mouseOver(int x, int y){ - return x >= this.getX() && x <= this.getX() + this.getWidth() && y >= this.getY() && y <= this.getY() + this.getHeight(); - } - - public boolean isOpened() { - return false; - } - - public boolean isDraggable() { - return draggable; - } - - public void setDraggable(boolean draggable) { - this.draggable = draggable; - } - - public void stopDragging(){ - this.dragging = false; - } - - public void onResize(){ - for (Component component : components){ - component.onResize(); - } - } - - public boolean isVisible() { - return visible; - } - - public void setVisible(boolean visible) { - this.visible = visible; - } - - public void keyTyped(char typedChar, int keyCode){ - for(Component component : components) - component.keyTyped(typedChar,keyCode); + public int getHeight() { + return 0; } } - diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/ModuleComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/ModuleComponent.java deleted file mode 100644 index 91ff191a..00000000 --- a/src/main/java/keystrokesmod/client/clickgui/raven/ModuleComponent.java +++ /dev/null @@ -1,129 +0,0 @@ -package keystrokesmod.client.clickgui.raven; - -import keystrokesmod.client.clickgui.raven.settings.BindComponent; -import keystrokesmod.client.clickgui.raven.settings.RangeSliderComponent; -import keystrokesmod.client.clickgui.raven.settings.SliderComponent; -import keystrokesmod.client.clickgui.theme.Theme; -import keystrokesmod.client.main.Raven; -import keystrokesmod.client.module.Module; -import keystrokesmod.client.module.setting.Setting; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import org.lwjgl.Sys; -import org.lwjgl.opengl.GL11; - -public class ModuleComponent extends Component { - private final CategoryComponent categoryComponent; - private final Module module; - private boolean opened = false; - - public ModuleComponent(Module mod, CategoryComponent categoryComponent) { - this.module = mod; - this.categoryComponent = categoryComponent; - for(Setting setting : module.getSettings()){ - this.add(setting.createComponent(this)); - } - this.add(new BindComponent(this)); - // todo add TOGGLETYPE setting and HUDSHOW SETTING - } - - @Override - public void paint(FontRenderer fr) { - Theme currentTheme = Raven.clickGui.getTheme(); - float textMargin = (float)this.getWidth() * 0.0625f; - double desiredTextSize = this.getHeight() * 0.6; - double scaleFactor = desiredTextSize/ fr.FONT_HEIGHT; - double coordFactor = 1/scaleFactor; - double textY = this.getY() + (this.getHeight() - desiredTextSize) * 0.5; - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + this.getWidth()), - (int)(this.getY() + this.getHeight()), - module.isEnabled() ? currentTheme.getAccentColour().getRGB() : currentTheme.getSecondBackgroundColour().getRGB() - ); - - - GL11.glPushMatrix(); - GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); - fr.drawString(module.getName(), (float)((this.getX() + textMargin) * coordFactor), (float)(textY * coordFactor), module.isEnabled() ? currentTheme.getSecondBackgroundColour().getRGB() : currentTheme.getTextColour().getRGB(), false); - GL11.glPopMatrix(); - if(opened){ - for(Component component: this.getComponents()){ - if(component.isVisible()) - component.paint(fr); - } - } - } - - @Override - public void update(int x, int y) { - double startX = this.getX(); - double currentY = this.getY() + this.getHeight(); - - if(opened) { - for (Component component : getComponents()) { - component.setLocation(startX, currentY); - if(component.isVisible()){ - component.update(x, y); - currentY += component.getHeight(); - } - } - } - } - - @Override - public void onResize() { - Theme currentTheme = Raven.clickGui.getTheme(); - this.setSize(categoryComponent.getWidth() - 2, categoryComponent.getHeight() * 0.65); - for(Component component : this.getComponents()){ - double multiplier = 0.65; - if(component instanceof SliderComponent || component instanceof RangeSliderComponent) - multiplier *= 1.65; - component.setSize(this.getWidth(), this.getHeight() * multiplier); - component.setColor(currentTheme.getSelectionBackgroundColour()); //todo change this bruh - } - } - - @Override - public void mouseDown(int x, int y, int mb) { - if(opened) { - for (Component component : this.getComponents()) { - if(component.isVisible()) - component.mouseDown(x, y, mb); - } - } - - if(mouseOver(x, y) && mb == 0){ - module.toggle(); - } else if(mouseOver(x, y) && mb == 1) { - this.opened = !opened; - } - - this.mouseDown = true; - } - - public double getFullHeight() { - double totalY = this.getHeight(); - for (Component component : this.getComponents()){ - if(component.isVisible()) - totalY += component.getHeight(); - } - - return totalY; - } - - public Module getModule(){ - return module; - } - - @Override - public boolean isOpened() { - return opened; - } - - private boolean hasSettings(){ - return !module.getSettings().isEmpty(); - } -} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/Terminal.java b/src/main/java/keystrokesmod/client/clickgui/raven/Terminal.java deleted file mode 100644 index 20e4d3d1..00000000 --- a/src/main/java/keystrokesmod/client/clickgui/raven/Terminal.java +++ /dev/null @@ -1,58 +0,0 @@ -package keystrokesmod.client.clickgui.raven; - -import keystrokesmod.client.main.Raven; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; - -public class Terminal extends Component { - - //TODO: Use siccors to curt text into the box - // add programs - // add drag panel - // add close - // add custom clr and shit to the config interfacae - - private final boolean hasFocus = false; - private final double heightRatio = 0.32; - private final double widthRatio = 0.32; - - @Override - public void update(int x, int y) { - if(!this.isVisible()) - return; - super.update(x, y); - } - - @Override - public void paint(FontRenderer fr) { - if(!this.isVisible()) - return; - Gui.drawRect((int)this.getX(), (int)this.getY(), (int)(this.getX() + this.getWidth()), (int)(this.getY() + this.getHeight()), this.getColor().getRGB()); - for(Component component: this.getComponents()){ - component.paint(fr); - } - } - - @Override - public void mouseDown(int x, int y, int mb) { - if(!this.isVisible()) - return; - super.mouseDown(x, y, mb); - } - - @Override - public void mouseReleased(int x, int y, int mb) { - if(!this.isVisible()) - return; - super.mouseReleased(x, y, mb); - } - - @Override - public void onResize() { - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - this.setSize(widthRatio * sr.getScaledWidth(), heightRatio * sr.getScaledHeight()); - super.onResize(); - } -} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/BindComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/BindComponent.java new file mode 100644 index 00000000..b99baa2d --- /dev/null +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/BindComponent.java @@ -0,0 +1,6 @@ +package keystrokesmod.client.clickgui.raven.components; + +public class BindComponent { + 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 new file mode 100644 index 00000000..ed904595 --- /dev/null +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/CategoryComponent.java @@ -0,0 +1,181 @@ + +package keystrokesmod.client.clickgui.raven.components; + +import keystrokesmod.client.clickgui.raven.Component; +import keystrokesmod.client.main.Raven; +import keystrokesmod.client.module.Module; +import keystrokesmod.client.module.modules.client.GuiModule; +import net.minecraft.client.gui.FontRenderer; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Iterator; + +public class CategoryComponent { + public ArrayList modulesInCategory = new ArrayList<>(); + public Module.ModuleCategory categoryName; + private boolean categoryOpened; + private int width; + private int y; + private int x; + private final int bh; + public boolean inUse; + public int xx; + public int yy; + public boolean n4m = false; + public String pvp; + public boolean pin = false; + private int chromaSpeed; + private double marginY, marginX; + + public CategoryComponent(Module.ModuleCategory category) { + this.categoryName = category; + this.width = 92; + this.x = 5; + this.y = 5; + this.bh = 13; + this.xx = 0; + this.categoryOpened = false; + this.inUse = false; + this.chromaSpeed = 3; + int tY = this.bh + 3; + this.marginX = 80; + this.marginY = 4.5; + + for(Iterator var3 = Raven.moduleManager.getModulesInCategory(this.categoryName).iterator(); var3.hasNext(); tY += 16) { + Module mod = var3.next(); + ModuleComponent b = new ModuleComponent(mod, this, tY); + this.modulesInCategory.add(b); + } + + } + + public ArrayList getModules() { + return this.modulesInCategory; + } + + public void setX(int n) { + this.x = n; + if(Raven.clientConfig != null){ + Raven.clientConfig.saveConfig(); + } + } + + public void setY(int y) { + this.y = y; + if(Raven.clientConfig != null){ + Raven.clientConfig.saveConfig(); + } + } + + public void mousePressed(boolean d) { + this.inUse = d; + } + + public boolean p() { + return this.pin; + } + + public void cv(boolean on) { + this.pin = on; + } + + public boolean isOpened() { + return this.categoryOpened; + } + + public void setOpened(boolean on) { + this.categoryOpened = on; + if(Raven.clientConfig != null){ + Raven.clientConfig.saveConfig(); + } + } + + public void rf(FontRenderer renderer) { + this.width = 92; + if (!this.modulesInCategory.isEmpty() && this.categoryOpened) { + int categoryHeight = 0; + + Component moduleRenderManager; + for(Iterator moduleInCategoryIterator = this.modulesInCategory.iterator(); moduleInCategoryIterator.hasNext(); categoryHeight += moduleRenderManager.getHeight()) { + moduleRenderManager = (Component)moduleInCategoryIterator.next(); + } + + //drawing the background for every module in the category + net.minecraft.client.gui.Gui.drawRect(this.x - 1, this.y, this.x + this.width + 1, this.y + this.bh + categoryHeight + 4, (new Color(0, 0, 0, (int)(GuiModule.backgroundOpacity.getInput()/100 * 255))).getRGB()); + } + + if(GuiModule.categoryBackground.isToggled()) + TickComponent.renderMain((float)(this.x - 2), (float)this.y, (float)(this.x + this.width + 2), (float)(this.y + this.bh + 3), -1); + renderer.drawString(this.n4m ? this.pvp : this.categoryName.name(), (float)(this.x + 2), (float)(this.y + 4), Color.getHSBColor((float)(System.currentTimeMillis() % (7500L / (long)this.chromaSpeed)) / (7500.0F / (float)this.chromaSpeed), 1.0F, 1.0F).getRGB(), false); + //renderer.drawString(this.n4m ? this.pvp : this.categoryName.name(), (float)(this.x + 2), (float)(this.y + 4), ay.astolfoColorsDraw(10, 14), false); + if (!this.n4m) { + GL11.glPushMatrix(); + //Opened/closed unicode... :yes: :holsum: :evil: + renderer.drawString(this.categoryOpened ? "-" : "+", (float)(this.x + marginX), (float)((double)this.y + marginY), Color.white.getRGB(), false); + GL11.glPopMatrix(); + if (this.categoryOpened && !this.modulesInCategory.isEmpty()) { + Iterator var5 = this.modulesInCategory.iterator(); + + while(var5.hasNext()) { + Component c2 = (Component)var5.next(); + c2.draw(); + } + } + + } + } + + public void r3nd3r() { + int o = this.bh + 3; + + Component c; + for(Iterator var2 = this.modulesInCategory.iterator(); var2.hasNext(); o += c.getHeight()) { + c = (Component)var2.next(); + c.setModuleStartAt(o); + } + + } + + public int getX() { + return this.x; + } + + public int getY() { + return this.y; + } + + public int getWidth() { + return this.width; + } + + public void up(int x, int y) { + if (this.inUse) { + this.setX(x - this.xx); + this.setY(y - this.yy); + } + + } + + public boolean i(int x, int y) { + return x >= this.x + 92 - 13 && x <= this.x + this.width && (float)y >= (float)this.y + 2.0F && y <= this.y + this.bh + 1; + } + + public boolean mousePressed(int x, int y) { + return x >= this.x + 77 && x <= this.x + this.width - 6 && (float)y >= (float)this.y + 2.0F && y <= this.y + this.bh + 1; + } + + public boolean insideArea(int x, int y) { + return x >= this.x && x <= this.x + this.width && y >= this.y && y <= this.y + this.bh; + } + + public String getName() { + return String.valueOf(modulesInCategory); + } + + public void setLocation(int parseInt, int parseInt1) { + this.x = parseInt; + this.y = parseInt1; + } +} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/DescriptionComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/DescriptionComponent.java new file mode 100644 index 00000000..db0c5f58 --- /dev/null +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/DescriptionComponent.java @@ -0,0 +1,35 @@ + +package keystrokesmod.client.clickgui.raven.components; + +import keystrokesmod.client.clickgui.raven.Component; +import keystrokesmod.client.module.setting.impl.DescriptionSetting; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class DescriptionComponent extends Component { + private final int c = (new Color(226, 83, 47)).getRGB(); + private final DescriptionSetting desc; + private final ModuleComponent p; + private int o; + + public DescriptionComponent(DescriptionSetting desc, ModuleComponent b, int o) { + this.desc = desc; + this.p = b; + int x = b.category.getX() + b.category.getWidth(); + int y = b.category.getY() + b.o; + this.o = o; + } + + public void draw() { + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + Minecraft.getMinecraft().fontRendererObj.drawString(this.desc.getDesc(), (float)((this.p.category.getX() + 4) * 2), (float)((this.p.category.getY() + this.o + 4) * 2), this.c, true); + GL11.glPopMatrix(); + } + + public void setModuleStartAt(int n) { + this.o = n; + } +} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/ModeComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/ModeComponent.java new file mode 100644 index 00000000..6278242f --- /dev/null +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/ModeComponent.java @@ -0,0 +1,51 @@ +package keystrokesmod.client.clickgui.raven.components; + +import keystrokesmod.client.clickgui.raven.Component; +import keystrokesmod.client.module.setting.impl.ComboSetting; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class ModeComponent extends Component { + private final int c = (new Color(30, 144, 255)).getRGB(); + private final ComboSetting mode; + private final ModuleComponent p; + private final int x; + private final int y; + private int o; + private boolean registeredClick = false; + private boolean md = false; + + public ModeComponent(ComboSetting desc, ModuleComponent b, int o) { + this.mode = desc; + this.p = b; + this.x = b.category.getX() + b.category.getWidth(); + this.y = b.category.getY() + b.o; + this.o = o; + } + + public void draw() { + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + int bruhWidth = (int) (Minecraft.getMinecraft().fontRendererObj.getStringWidth(this.mode.getName() + ": ") * 0.5); + Minecraft.getMinecraft().fontRendererObj.drawString(this.mode.getName() + ": ", (float) ((this.p.category.getX() + 4) * 2), (float) ((this.p.category.getY() + this.o + 4) * 2), 0xffffffff, true); + Minecraft.getMinecraft().fontRendererObj.drawString(String.valueOf(this.mode.getMode()), (float) ((this.p.category.getX() + 4 + bruhWidth) * 2), (float) ((this.p.category.getY() + this.o + 4) * 2), this.c, true); + GL11.glPopMatrix(); + } + + public void setModuleStartAt(int n) { + this.o = n; + } + + + public void mouseDown(int x, int y, int b) { + System.out.println("before cchange: " + this.mode.getMode()); + this.mode.nextMode(); + System.out.println("after cchange: " + this.mode.getMode()); + } + + private boolean i(int x, int y) { + return x > this.x && x < this.x + this.p.category.getWidth() && y > this.y && y < this.y + 11; + } +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/ModuleComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/ModuleComponent.java new file mode 100644 index 00000000..de5f99bd --- /dev/null +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/ModuleComponent.java @@ -0,0 +1,240 @@ + +package keystrokesmod.client.clickgui.raven.components; + +import keystrokesmod.client.clickgui.raven.Component; +import keystrokesmod.client.module.*; +import keystrokesmod.client.module.modules.client.GuiModule; +import keystrokesmod.client.module.setting.Setting; +import keystrokesmod.client.module.setting.impl.*; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; + +public class ModuleComponent extends 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(); + public Module mod; + public CategoryComponent category; + public int o; + private final ArrayList settings; + public boolean po; + + public ModuleComponent(Module mod, CategoryComponent p, int o) { + this.mod = mod; + this.category = p; + this.o = o; + this.settings = new ArrayList<>(); + this.po = false; + int y = o + 12; + if (!mod.getSettings().isEmpty()) { + for (Setting v : mod.getSettings()) { + if (v instanceof SliderSetting) { + SliderSetting n = (SliderSetting) v; + SliderComponent s = new SliderComponent(n, this, y); + this.settings.add(s); + y += 12; + } else if (v instanceof TickSetting) { + TickSetting b = (TickSetting) v; + TickComponent c = new TickComponent(mod, b, this, y); + this.settings.add(c); + y += 12; + } else if (v instanceof DescriptionSetting) { + DescriptionSetting d = (DescriptionSetting) v; + DescriptionComponent m = new DescriptionComponent(d, this, y); + this.settings.add(m); + y += 12; + } else if (v instanceof DoubleSliderSetting) { + DoubleSliderSetting n = (DoubleSliderSetting) v; + RangeSliderComponent s = new RangeSliderComponent(n, this, y); + this.settings.add(s); + y += 12; + }else if (v instanceof ComboSetting) { + ComboSetting n = (ComboSetting) v; + ModeComponent s = new ModeComponent(n, this, y); + this.settings.add(s); + y += 12; + } + } + } + } + + public void setModuleStartAt(int n) { + this.o = n; + int y = this.o + 16; + + for (Component c : this.settings) { + c.setModuleStartAt(y); + if (c instanceof SliderComponent || c instanceof RangeSliderComponent) { + y += 16; + } else if (c instanceof TickComponent || c instanceof DescriptionComponent || c instanceof ModeComponent) { + y += 12; + } + } + } + + public static void e() { + GL11.glDisable(2929); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glDepthMask(true); + GL11.glEnable(2848); + GL11.glHint(3154, 4354); + GL11.glHint(3155, 4354); + } + + public static void f() { + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glEnable(2929); + GL11.glDisable(2848); + GL11.glHint(3154, 4352); + GL11.glHint(3155, 4352); + GL11.glEdgeFlag(true); + } + + public static void g(int h) { + float a = 0.0F; + float r = 0.0F; + float g = 0.0F; + float b = 0.0F; + if (GuiModule.guiTheme.getInput() == 1.0D) { + a = (float)(h >> 14 & 255) / 255.0F; + r = (float)(h >> 5 & 255) / 255.0F; + g = (float)(h >> 5 & 255) / 2155.0F; + b = (float)(h & 255); + } else if (GuiModule.guiTheme.getInput() == 2.0D) { + a = (float)(h >> 14 & 255) / 255.0F; + r = (float)(h >> 5 & 255) / 2155.0F; + g = (float)(h >> 5 & 255) / 255.0F; + b = (float)(h & 255); + } else if (GuiModule.guiTheme.getInput() == 3.0D) { + } + + GL11.glColor4f(r, g, b, a); + } + + public static void v(float x, float y, float x1, float y1, int t, int b) { + e(); + GL11.glShadeModel(7425); + GL11.glBegin(7); + g(t); + GL11.glVertex2f(x, y1); + GL11.glVertex2f(x1, y1); + g(b); + GL11.glVertex2f(x1, y); + GL11.glVertex2f(x, y); + GL11.glEnd(); + GL11.glShadeModel(7424); + f(); + } + + public void draw() { + v((float)this.category.getX(), (float)(this.category.getY() + this.o), (float)(this.category.getX() + this.category.getWidth()), (float)(this.category.getY() + 15 + this.o), this.mod.isEnabled() ? this.c2 : -12829381, this.mod.isEnabled() ? this.c2 : -12302777); + GL11.glPushMatrix(); + // module text button + int button_rgb; + switch ((int) GuiModule.guiTheme.getInput()) { + case 4: + if (this.mod.isEnabled()) { + button_rgb = this.c3; + } else if (this.mod.canBeEnabled()) { + button_rgb = Color.lightGray.getRGB(); + } else { + button_rgb = new Color(102, 102, 102).getRGB(); + } + break; + case 3: + if (this.mod.isEnabled()) { + button_rgb = this.c1; + } else if (this.mod.canBeEnabled()) { + button_rgb = Color.lightGray.getRGB(); + } else { + button_rgb = new Color(102, 102, 102).getRGB(); + } + break; + default: + if (this.mod.canBeEnabled()) { + button_rgb = Color.lightGray.getRGB(); + } else { + button_rgb = new Color(102, 102, 102).getRGB(); + } + break; + } + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.mod.getName(), (float)(this.category.getX() + this.category.getWidth() / 2 - Minecraft.getMinecraft().fontRendererObj.getStringWidth(this.mod.getName()) / 2), (float)(this.category.getY() + this.o + 4), button_rgb); + GL11.glPopMatrix(); + if (this.po && !this.settings.isEmpty()) { + for (Component c : this.settings) { + c.draw(); + } + } + + } + + public int getHeight() { + if (!this.po) { + return 16; + } else { + int h = 16; + + 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) { + h += 12; + } + } + + return h; + + } + } + + public void compute(int mousePosX, int mousePosY) { + if (!this.settings.isEmpty()) { + for (Component c : this.settings) { + c.compute(mousePosX, mousePosY); + } + } + + } + + public void mouseDown(int x, int y, int b) { + if (mod.canBeEnabled()) { + if (this.ii(x, y) && b == 0) { + this.mod.toggle(); + } + } + + if (this.ii(x, y) && b == 1) { + this.po = !this.po; + this.category.r3nd3r(); + } + + for (Component c : this.settings) { + c.mouseDown(x, y, b); + } + + } + + public void mouseReleased(int x, int y, int m) { + for (Component c : this.settings) { + c.mouseReleased(x, y, m); + } + + } + + public void ky(char t, int k) { + for (Component c : this.settings) { + c.ky(t, k); + } + + } + + public boolean ii(int x, int y) { + return x > this.category.getX() && x < this.category.getX() + this.category.getWidth() && y > this.category.getY() + this.o && y < this.category.getY() + 16 + this.o; + } +} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/RangeSliderComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/RangeSliderComponent.java new file mode 100644 index 00000000..77358fb6 --- /dev/null +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/RangeSliderComponent.java @@ -0,0 +1,156 @@ +package keystrokesmod.client.clickgui.raven.components; + +import keystrokesmod.client.clickgui.raven.Component; +import keystrokesmod.client.module.setting.impl.DoubleSliderSetting; +import keystrokesmod.client.utils.Utils; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +public class RangeSliderComponent extends Component { + private final DoubleSliderSetting doubleSlider; + private final ModuleComponent module; + private double barWidth; + private double blankWidth; + private int sliderStartX; + private int sliderStartY; + private int moduleStartY; + private boolean mouseDown, inMotion; + private Helping mode = Helping.NONE; + + private final int boxMargin = 4; + private final int boxHeight = 4; + private final int textSize = 11; + + public RangeSliderComponent(DoubleSliderSetting doubleSlider, ModuleComponent module, int moduleStartY){ + this.doubleSlider = doubleSlider; + this.module = module; + this.sliderStartX = this.module.category.getX() + boxMargin; + this.sliderStartY = moduleStartY + module.category.getY(); + this.moduleStartY = moduleStartY; + } + + public void draw(){ + //drawing the grey box lol + net.minecraft.client.gui.Gui.drawRect(this.module.category.getX() + boxMargin, this.module.category.getY() + this.moduleStartY + textSize, this.module.category.getX() - boxMargin + this.module.category.getWidth(), this.module.category.getY() + this.moduleStartY + textSize + boxHeight, -12302777); + int startToDrawFrom = this.module.category.getX() + boxMargin + (int) this.blankWidth; + int finishDrawingAt = startToDrawFrom + (int)this.barWidth; + int middleThing = (int)Utils.Java.round(this.barWidth/2, 0) + this.module.category.getX() + (int) this.blankWidth + boxMargin - 1; + + //drwing the main colourded bar + net.minecraft.client.gui.Gui.drawRect(startToDrawFrom, this.module.category.getY() + this.moduleStartY + textSize, finishDrawingAt, this.module.category.getY() + this.moduleStartY + textSize + boxHeight, Utils.Client.astolfoColorsDraw(14, 10)); + net.minecraft.client.gui.Gui.drawRect(middleThing, this.module.category.getY() + this.moduleStartY + textSize - 1, middleThing+(middleThing%2==0? 2:1), this.module.category.getY() + this.moduleStartY + textSize + boxHeight + 1, 0xff1D1D1F); + //drawing le text + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.doubleSlider.getName() + ": " + this.doubleSlider.getInputMin() + ", " + this.doubleSlider.getInputMax(), (float)((int)((float)(this.module.category.getX() + 4) * 2.0F)), (float)((int)((float)(this.module.category.getY() + this.moduleStartY + 3) * 2.0F)), -1); + GL11.glPopMatrix(); + } + + public void setModuleStartAt(int posY) { + this.moduleStartY = posY; + } + + public void compute(int mousePosX, int mousePosY){ + this.sliderStartY = this.module.category.getY() + this.moduleStartY; + this.sliderStartX = this.module.category.getX() + boxMargin; + + double mousePressedAt = Math.min(this.module.category.getWidth() - boxMargin*2 /*we make it so that the mouse press HAS to be inside the box*/, Math.max(0, mousePosX - this.sliderStartX)); + this.blankWidth = (double)(this.module.category.getWidth() - boxMargin*2) //the bar width in pixels + * (this.doubleSlider.getInputMin() - this.doubleSlider.getMin()) //bar width in int terms + / (this.doubleSlider.getMax() - this.doubleSlider.getMin()); + this.barWidth = (double)(this.module.category.getWidth() - boxMargin*2) //the bar width of the lsider + * (this.doubleSlider.getInputMax() - this.doubleSlider.getInputMin()) //bar width in int terms + / (this.doubleSlider.getMax() - this.doubleSlider.getMin());//divided by total width of grey bar + //divided by total width of grey bar + + + + // if(this.module.category.inUse && this.mode==Helping.NONE){ + if(this.mouseDown) { + + if (mousePressedAt > blankWidth + barWidth / 2 || mode == Helping.MAX) { + //manipulate max slider + if (this.mode == Helping.NONE) this.mode = Helping.MAX; + if(this.mode == Helping.MAX){ + if (mousePressedAt <= blankWidth) { + this.doubleSlider.setValueMax(this.doubleSlider.getInputMin()); + } else { + double n = r(mousePressedAt + / (double) (this.module.category.getWidth() - boxMargin * 2) + * (this.doubleSlider.getMax() - this.doubleSlider.getMin()) + + this.doubleSlider.getMin(), 2); + this.doubleSlider.setValueMax(n); + } + } + //this.mode = Helping.MAX; + } + + if (mousePressedAt < blankWidth + barWidth / 2 || mode == Helping.MIN) { + //manipulate min slider + if (this.mode == Helping.NONE) this.mode = Helping.MIN; + if(this.mode == Helping.MIN) { + if (mousePressedAt == 0.0D) { + this.doubleSlider.setValueMin(this.doubleSlider.getMin()); + } else if(mousePressedAt >= barWidth + blankWidth){ + this.doubleSlider.setValueMin(this.doubleSlider.getMax()); + }else { + double n = r(mousePressedAt + / (double) (this.module.category.getWidth() - boxMargin*2) + * (this.doubleSlider.getMax() - this.doubleSlider.getMin()) + + this.doubleSlider.getMin(), 2); + this.doubleSlider.setValueMin(n); + } + } + } + } else { + if(mode != Helping.NONE) mode = Helping.NONE; + } + + // } + + } + + private static double r(double v, int p) { + if (p < 0) { + return 0.0D; + } else { + BigDecimal bd = new BigDecimal(v); + bd = bd.setScale(p, RoundingMode.HALF_UP); + return bd.doubleValue(); + } + } + + public void mouseDown(int x, int y, int b) { + if (this.u(x, y) && b == 0 && this.module.po) { + this.mouseDown = true; + } + + if (this.i(x, y) && b == 0 && this.module.po) { + this.mouseDown = true; + } + + // Put breakpoints instead of doing that: + //System.out.println("Clicked"); + } + + public void mouseReleased(int x, int y, int m) { + this.mouseDown = false; + } + + 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; + } + + public boolean i(int x, int y) { + return x > this.sliderStartX + this.module.category.getWidth() / 2 && x < this.sliderStartX + this.module.category.getWidth() && y > this.sliderStartY && y < this.sliderStartY + 16; + } + + public enum Helping { + MIN, + MAX, + NONE + } +} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/components/SliderComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/components/SliderComponent.java new file mode 100644 index 00000000..b3346698 --- /dev/null +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/SliderComponent.java @@ -0,0 +1,98 @@ + +package keystrokesmod.client.clickgui.raven.components; + +import keystrokesmod.client.clickgui.raven.Component; +import keystrokesmod.client.module.setting.impl.SliderSetting; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.math.BigDecimal; +import java.math.RoundingMode; + +public class SliderComponent extends Component { + private final SliderSetting v; + private final ModuleComponent p; + private int o; + private int x; + private int y; + private boolean d = false; + private double w; + private final int msl = 84; + + public SliderComponent(SliderSetting v, ModuleComponent b, int o) { + this.v = v; + this.p = b; + this.x = b.category.getX() + b.category.getWidth(); + this.y = b.category.getY() + b.o; + this.o = o; + } + + public void draw() { + net.minecraft.client.gui.Gui.drawRect(this.p.category.getX() + 4, this.p.category.getY() + this.o + 11, this.p.category.getX() + 4 + this.p.category.getWidth() - 8, this.p.category.getY() + this.o + 15, -12302777); + int l = this.p.category.getX() + 4; + int r = this.p.category.getX() + 4 + (int)this.w; + if (r - l > 84) { + r = l + 84; + } + + net.minecraft.client.gui.Gui.drawRect(l, this.p.category.getY() + this.o + 11, r, this.p.category.getY() + this.o + 15, Color.getHSBColor((float)(System.currentTimeMillis() % 11000L) / 11000.0F, 0.75F, 0.9F).getRGB()); + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.v.getName() + ": " + this.v.getInput(), (float)((int)((float)(this.p.category.getX() + 4) * 2.0F)), (float)((int)((float)(this.p.category.getY() + this.o + 3) * 2.0F)), -1); + GL11.glPopMatrix(); + } + + public void setModuleStartAt(int n) { + this.o = n; + } + + public void compute(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)); + this.w = (double)(this.p.category.getWidth() - 8) * (this.v.getInput() - this.v.getMin()) / (this.v.getMax() - this.v.getMin()); + if (this.d) { + if (d == 0.0D) { + this.v.setValue(this.v.getMin()); + } else { + double n = r(d / (double)(this.p.category.getWidth() - 8) * (this.v.getMax() - this.v.getMin()) + this.v.getMin(), 2); + this.v.setValue(n); + } + } + + } + + private static double r(double v, int p) { + if (p < 0) { + return 0.0D; + } else { + BigDecimal bd = new BigDecimal(v); + bd = bd.setScale(p, RoundingMode.HALF_UP); + return bd.doubleValue(); + } + } + + public void mouseDown(int x, int y, int b) { + if (this.u(x, y) && b == 0 && this.p.po) { + this.d = true; + } + + if (this.i(x, y) && b == 0 && this.p.po) { + this.d = true; + } + + } + + public void mouseReleased(int x, int y, int m) { + this.d = false; + } + + 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; + } + + public boolean i(int x, int y) { + return x > this.x + this.p.category.getWidth() / 2 && x < this.x + this.p.category.getWidth() && 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 new file mode 100644 index 00000000..c9a53d27 --- /dev/null +++ b/src/main/java/keystrokesmod/client/clickgui/raven/components/TickComponent.java @@ -0,0 +1,111 @@ + +package keystrokesmod.client.clickgui.raven.components; + +import keystrokesmod.client.clickgui.raven.Component; +import keystrokesmod.client.module.Module; +import keystrokesmod.client.module.setting.impl.TickSetting; +import keystrokesmod.client.module.modules.client.GuiModule; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class TickComponent extends 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; + private final TickSetting cl1ckbUtt0n; + private final ModuleComponent module; + private int o; + private int x; + private int y; + private int boxSize = 6; + + public TickComponent(Module mod, TickSetting op, ModuleComponent b, int o) { + this.mod = mod; + this.cl1ckbUtt0n = op; + this.module = b; + this.x = b.category.getX() + b.category.getWidth(); + this.y = b.category.getY() + b.o; + this.o = o; + } + + public static void e() { + GL11.glDisable(2929); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glDepthMask(true); + GL11.glEnable(2848); + GL11.glHint(3154, 4354); + GL11.glHint(3155, 4354); + } + + public static void renderMain() { + GL11.glEnable(3553); + GL11.glEnable(2929); + GL11.glDisable(2848); + GL11.glHint(3154, 4352); + GL11.glHint(3155, 4352); + } + + public static void renderMain(float x, float y, float x1, float y1, int c) { + e(); + colour(c); + renderMain(x, y, x1, y1); + renderMain(); + } + + public static void renderMain(float x, float y, float x1, float y1) { + GL11.glBegin(7); + GL11.glVertex2f(x, y1); + GL11.glVertex2f(x1, y1); + GL11.glVertex2f(x1, y); + GL11.glVertex2f(x, y); + GL11.glEnd(); + } + + public static void colour(int h) { + float a1pha = (float)(h >> 24 & 255) / 350.0F; + GL11.glColor4f(0.0F, 0.0F, 0.0F, a1pha); + } + + public void draw() { + // drawing main bg rect + if (GuiModule.guiTheme.getInput() == 4) { + net.minecraft.client.gui.Gui.drawRect(this.module.category.getX() + 4, this.module.category.getY() + this.o + 4, this.module.category.getX() + 4 + boxSize, this.module.category.getY() + this.o + 4 + boxSize, this.boxC); + if(this.cl1ckbUtt0n.isToggled()){ + net.minecraft.client.gui.Gui.drawRect(this.module.category.getX() + 5, this.module.category.getY() + this.o + 5, this.module.category.getX() + 5 + boxSize-2, this.module.category.getY() + this.o + 5 + boxSize-2, this.c); + } + } + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + if(GuiModule.guiTheme.getInput() == 4){ + Minecraft.getMinecraft().fontRendererObj.drawString(this.cl1ckbUtt0n.isToggled() ? " " + this.cl1ckbUtt0n.getName() : " " + this.cl1ckbUtt0n.getName(), (float)((this.module.category.getX() + 4) * 2), (float)((this.module.category.getY() + this.o + 5) * 2), this.cl1ckbUtt0n.isToggled() ? this.c : -1, false); + }else { + Minecraft.getMinecraft().fontRendererObj.drawString(this.cl1ckbUtt0n.isToggled() ? "[+] " + this.cl1ckbUtt0n.getName() : "[-] " + this.cl1ckbUtt0n.getName(), (float)((this.module.category.getX() + 4) * 2), (float)((this.module.category.getY() + this.o + 5) * 2), this.cl1ckbUtt0n.isToggled() ? this.c : -1, false); + } + + GL11.glPopMatrix(); + } + + public void setModuleStartAt(int n) { + this.o = n; + } + + public void compute(int mousePosX, int mousePosY) { + this.y = this.module.category.getY() + this.o; + this.x = this.module.category.getX(); + } + + public void mouseDown(int x, int y, int b) { + if (this.i(x, y) && b == 0 && this.module.po) { + this.cl1ckbUtt0n.toggle(); + this.mod.guiButtonToggled(this.cl1ckbUtt0n); + } + + } + + 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/clickgui/raven/settings/BindComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/settings/BindComponent.java deleted file mode 100644 index cfbe9231..00000000 --- a/src/main/java/keystrokesmod/client/clickgui/raven/settings/BindComponent.java +++ /dev/null @@ -1,96 +0,0 @@ -package keystrokesmod.client.clickgui.raven.settings; - -import keystrokesmod.client.clickgui.raven.ClickGui; -import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.theme.Theme; -import keystrokesmod.client.main.Raven; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import org.lwjgl.opengl.GL11; - -public class BindComponent extends Component { - private final ModuleComponent moduleComponent; - private final String bindText = "Bind: "; - private boolean listening = false; - - public BindComponent(ModuleComponent moduleComponent){ - this.moduleComponent = moduleComponent; - } - - @Override - public void paint(FontRenderer fr) { - Theme currentTheme = Raven.clickGui.getTheme(); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + this.getWidth()), - (int)(this.getY() + this.getHeight()), - currentTheme.getSelectionBackgroundColour().getRGB() - ); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + Raven.clickGui.barWidth), - (int)(this.getY() + this.getHeight()), - currentTheme.getAccentColour().getRGB() - ); - - float textMargin = (float)this.getWidth() * 0.0625f; - double desiredTextSize = this.getHeight() * 0.6; - double scaleFactor = desiredTextSize/ fr.FONT_HEIGHT; - double coordFactor = 1/scaleFactor; - double textY = this.getY() + (this.getHeight() - desiredTextSize) * 0.5; - String bindedTo = listening ? "Press ESC to unbind" : moduleComponent.getModule().getBindAsString(); - - - GL11.glPushMatrix(); - GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); - float endText = (float)(this.getX() + this.getWidth() - fr.getStringWidth(bindedTo) * scaleFactor - textMargin); - - fr.drawString( - bindText, - (float)((this.getX() + textMargin) * coordFactor), - (float)(textY * coordFactor), - currentTheme.getTextColour().getRGB(), - false - ); - - fr.drawString( - bindedTo, - (float)(endText * coordFactor), - (float)(textY * coordFactor), - listening ? currentTheme.getContrastColour().getRGB() : currentTheme.getAccentColour().getRGB(), - false - ); - GL11.glPopMatrix(); - - for(Component component: this.getComponents()){ - component.paint(fr); - } - } - - @Override - public void mouseDown(int x, int y, int mb) { - if(mb == 0 && mouseOver(x, y)) { - this.listening = true; - moduleComponent.getModule().clearBinds(); - } - super.mouseDown(x, y, mb); - } - - @Override - public void keyTyped(char typedChar, int keyCode) { - if(listening){ - listening = false; - moduleComponent.getModule().setbind(keyCode); - } - super.keyTyped(typedChar, keyCode); - } - - public boolean isListening(){ - return listening; - } -} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/settings/ComboComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/settings/ComboComponent.java deleted file mode 100644 index 4f242afb..00000000 --- a/src/main/java/keystrokesmod/client/clickgui/raven/settings/ComboComponent.java +++ /dev/null @@ -1,89 +0,0 @@ -package keystrokesmod.client.clickgui.raven.settings; - -import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.theme.Theme; -import keystrokesmod.client.main.Raven; -import keystrokesmod.client.module.Module; -import keystrokesmod.client.module.setting.impl.ComboSetting; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import org.lwjgl.opengl.GL11; - -public class ComboComponent extends Component { - private final ModuleComponent moduleComponent; - private final Module module; - private final ComboSetting comboSetting; - - public ComboComponent(ComboSetting comboSetting, ModuleComponent moduleComponent){ - this.comboSetting = comboSetting; - this.moduleComponent = moduleComponent; - this.module = moduleComponent.getModule(); - } - - @Override - public void paint(FontRenderer fr) { - Theme theme = Raven.clickGui.getTheme(); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + this.getWidth()), - (int)(this.getY() + this.getHeight()), - theme.getSelectionBackgroundColour().getRGB() - ); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + Raven.clickGui.barWidth), - (int)(this.getY() + this.getHeight()), - theme.getAccentColour().getRGB() - ); - - float textMargin = (float)this.getWidth() * 0.0625f; - double desiredTextSize = this.getHeight() * 0.6; - double scaleFactor = desiredTextSize/ fr.FONT_HEIGHT; - double coordFactor = 1/scaleFactor; - double textY = this.getY() + (this.getHeight() - desiredTextSize) * 0.5; - String parent = comboSetting.getName() + ":"; - String value = comboSetting.getMode() + ""; - - - GL11.glPushMatrix(); - GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); - fr.drawString( - parent, - (float)((this.getX() + textMargin) * coordFactor), - (float)(textY * coordFactor), - theme.getTextColour().getRGB(), - false - ); - double strLen = fr.getStringWidth(value) * scaleFactor; - fr.drawString( - value, - (float)((this.getX() + this.getWidth() - textMargin - strLen) * coordFactor), - (float)(textY * coordFactor), - theme.getAccentColour().getRGB(), - false - ); - GL11.glPopMatrix(); - - for(Component component: this.getComponents()){ - component.paint(fr); - } - } - - @Override - public void mouseDown(int x, int y, int mb) { - if(mouseOver(x, y)) - comboSetting.nextMode(); - - super.mouseDown(x, y, mb); - } - - @Override - public boolean isVisible() { - return true; - } -} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/settings/DescriptionComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/settings/DescriptionComponent.java deleted file mode 100644 index a4aa93fb..00000000 --- a/src/main/java/keystrokesmod/client/clickgui/raven/settings/DescriptionComponent.java +++ /dev/null @@ -1,70 +0,0 @@ -package keystrokesmod.client.clickgui.raven.settings; - -import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.theme.Theme; -import keystrokesmod.client.main.Raven; -import keystrokesmod.client.module.Module; -import keystrokesmod.client.module.setting.impl.DescriptionSetting; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import org.lwjgl.opengl.GL11; - -public class DescriptionComponent extends Component { - private final DescriptionSetting descriptionSetting; - private final ModuleComponent moduleComponent; - private final Module module; - - public DescriptionComponent(DescriptionSetting descriptionSetting, ModuleComponent moduleComponent){ - this.descriptionSetting = descriptionSetting; - this.moduleComponent = moduleComponent; - this.module = moduleComponent.getModule(); - } - - @Override - public boolean isVisible() { - return true; - } - - @Override - public void paint(FontRenderer fr) { - Theme theme = Raven.clickGui.getTheme(); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + this.getWidth()), - (int)(this.getY() + this.getHeight()), - theme.getSelectionBackgroundColour().getRGB() - ); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + Raven.clickGui.barWidth), - (int)(this.getY() + this.getHeight()), - theme.getAccentColour().getRGB() - ); - - float textMargin = (float)this.getWidth() * 0.0625f; - double desiredTextSize = this.getHeight() * 0.6; - double scaleFactor = desiredTextSize/ fr.FONT_HEIGHT; - double coordFactor = 1/scaleFactor; - double textY = this.getY() + (this.getHeight() - desiredTextSize) * 0.5; - - GL11.glPushMatrix(); - GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); - fr.drawString( - descriptionSetting.getDesc(), - (float)((this.getX() + textMargin) * coordFactor), - (float)(textY * coordFactor), - theme.getContrastColour().getRGB(), - false - ); - GL11.glPopMatrix(); - - for(Component component: this.getComponents()){ - component.paint(fr); - } - } -} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/settings/RangeSliderComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/settings/RangeSliderComponent.java deleted file mode 100644 index d9f9c77c..00000000 --- a/src/main/java/keystrokesmod/client/clickgui/raven/settings/RangeSliderComponent.java +++ /dev/null @@ -1,206 +0,0 @@ -package keystrokesmod.client.clickgui.raven.settings; - -import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.theme.Theme; -import keystrokesmod.client.main.Raven; -import keystrokesmod.client.module.Module; -import keystrokesmod.client.module.setting.impl.DoubleSliderSetting; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import org.lwjgl.opengl.GL11; - -public class RangeSliderComponent extends Component { - private final DoubleSliderSetting rangeSetting; - private final ModuleComponent moduleComponent; - private final Module module; - private boolean draggingThumb; - private DragType dragType = DragType.NONE; - - public RangeSliderComponent(DoubleSliderSetting rangeSetting, ModuleComponent moduleComponent){ - this.rangeSetting = rangeSetting; - this.moduleComponent = moduleComponent; - this.module = moduleComponent.getModule(); - } - - @Override - public boolean isVisible() { - return true; - } - - @Override - public void paint(FontRenderer fr) { - Theme theme = Raven.clickGui.getTheme(); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + this.getWidth()), - (int)(this.getY() + this.getHeight()), - theme.getSelectionBackgroundColour().getRGB() - ); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + Raven.clickGui.barWidth), - (int)(this.getY() + this.getHeight()), - theme.getAccentColour().getRGB() - ); - - double ogSize = this.getHeight() / 1.65; - float textMargin = (float)this.getWidth() * 0.0625f; - double desiredTextSize = ogSize * 0.6; - double scaleFactor = desiredTextSize/ fr.FONT_HEIGHT; - double coordFactor = 1/scaleFactor; - - double barSpace = this.getHeight() - ogSize; - int barHeight = 1; // pixels - int barY = (int)(this.getY() + ogSize + (int)(barSpace - barHeight) * 0.5); - - String parent = rangeSetting.getName() + ":"; - String value = rangeSetting.getInputMin() + ", " + rangeSetting.getInputMax(); - - double text1Y = this.getY() + (ogSize - desiredTextSize) * 0.5; - double parentX = (this.getX() + textMargin); - - int thumbSize = barHeight * 3; - int barLength = (int)(this.getWidth() - textMargin * 2); - double barStart = this.getX() // x - + textMargin // base margin - + ((rangeSetting.getInputMin() - rangeSetting.getMin())// finding out the percentage of the bar - / (rangeSetting.getMax() - - rangeSetting.getMin())) - * barLength; - - double barWidth = ((rangeSetting.getInputMax() - rangeSetting.getInputMin()) / - (rangeSetting.getMax() - rangeSetting.getMin())) * - barLength; - - Gui.drawRect( //drawing the background - (int)(this.getX() + textMargin), - barY, - (int)(this.getX() + textMargin + barLength), - barY + barHeight, - theme.getSelectionForegroundColour().getRGB() - ); - - Gui.drawRect( - (int)(barStart), - barY, - (int)(barStart + barWidth), - barY + barHeight, - theme.getAccentColour().getRGB() - ); - - Gui.drawRect( - (int)(barStart - thumbSize * 0.5), - (int)(barY - thumbSize * 0.5), - (int)(barStart + thumbSize * 0.5), - (int)(barY + barHeight + thumbSize * 0.5), - theme.getSecondBackgroundColour().getRGB() - ); - - Gui.drawRect( - (int)(barStart + barWidth - thumbSize * 0.5), - (int)(barY - thumbSize * 0.5), - (int)(barStart + barWidth + thumbSize * 0.5), - (int)(barY + barHeight + thumbSize * 0.5), - theme.getSecondBackgroundColour().getRGB() - ); - - - GL11.glPushMatrix(); - GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); - fr.drawString( - parent, - (float)(parentX * coordFactor), - (float)(text1Y * coordFactor), - theme.getTextColour().getRGB(), - false - ); - double fatFuck = fr.getStringWidth(parent + " ") * scaleFactor; - fr.drawString( - value, - (float)((parentX + fatFuck) * coordFactor), - (float)(text1Y * coordFactor), - theme.getAccentColour().getRGB(), - false - ); - GL11.glPopMatrix(); - - - for(Component component: this.getComponents()){ - component.paint(fr); - } - } - - @Override - public void update(int x, int y) { - super.update(x, y); - float textMargin = (float)this.getWidth() * 0.0625f; - int barLength = (int)(this.getWidth() - textMargin * 2); - - double barMinX = this.getX() // x - + textMargin // base margin - + ((rangeSetting.getInputMin() - rangeSetting.getMin()) // finding out the percentage of the bar - / (rangeSetting.getMax() - - rangeSetting.getMin())) - * barLength; - - double barWidth = ((rangeSetting.getInputMax() - rangeSetting.getInputMin()) / - (rangeSetting.getMax() - rangeSetting.getMin())) * - barLength; - - double barMaxX = barWidth + barMinX; - - if(draggingThumb){ - // calculate to which thumb the mouse is closest to - if(dragType == DragType.NONE){ - // first frame before the drag - double distanceToMin = x - barMinX; - double distanceToMax = barMaxX - x; - if(distanceToMin < distanceToMax){ - this.dragType = DragType.MIN; - } else { - this.dragType = DragType.MAX; - } - } - - if(dragType == DragType.MIN){ - double mousePosX = Math.min(barMaxX, Math.max(this.getX() + textMargin, x)) - (this.getX() + textMargin); - double percentage = mousePosX / barLength; - rangeSetting.setValueMin(percentage * (rangeSetting.getMax() - rangeSetting.getMin()) + rangeSetting.getMin()); - }else if(dragType == DragType.MAX){ - double mousePosX = Math.min(this.getX() + this.getWidth() - textMargin, Math.max(barMinX, x)) - (this.getX() + textMargin); - double percentage = mousePosX / barLength; - rangeSetting.setValueMax(percentage * (rangeSetting.getMax() - rangeSetting.getMin()) + rangeSetting.getMin()); - } - } - - - } - - @Override - public void mouseDown(int x, int y, int mb) { - super.mouseDown(x, y, mb); - if(mouseOver(x, y)) - this.draggingThumb = true; - - } - - @Override - public void mouseReleased(int x, int y, int mb) { - super.mouseReleased(x, y, mb); - this.draggingThumb = false; - this.dragType = DragType.NONE; - } - - public enum DragType { - MIN, - MAX, - NONE - } - - -} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/settings/SliderComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/settings/SliderComponent.java deleted file mode 100644 index bc3c9ece..00000000 --- a/src/main/java/keystrokesmod/client/clickgui/raven/settings/SliderComponent.java +++ /dev/null @@ -1,147 +0,0 @@ -package keystrokesmod.client.clickgui.raven.settings; - -import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.theme.Theme; -import keystrokesmod.client.main.Raven; -import keystrokesmod.client.module.Module; -import keystrokesmod.client.module.setting.impl.SliderSetting; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import org.lwjgl.opengl.GL11; - -public class SliderComponent extends Component { - private final SliderSetting numberSetting; - private final ModuleComponent moduleComponent; - private final Module module; - private boolean draggingThumb = false; - - public SliderComponent(SliderSetting numberSetting, ModuleComponent moduleComponent){ - this.numberSetting = numberSetting; - this.moduleComponent = moduleComponent; - this.module = moduleComponent.getModule(); - } - - @Override - public boolean isVisible() { - return true; - } - - @Override - public void paint(FontRenderer fr) { - Theme theme = Raven.clickGui.getTheme(); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + this.getWidth()), - (int)(this.getY() + this.getHeight()), - theme.getSelectionBackgroundColour().getRGB() - ); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + Raven.clickGui.barWidth), - (int)(this.getY() + this.getHeight()), - theme.getAccentColour().getRGB() - ); - - double ogSize = this.getHeight() / 1.65; - float textMargin = (float)this.getWidth() * 0.0625f; - double desiredTextSize = ogSize * 0.6; - double scaleFactor = desiredTextSize/ fr.FONT_HEIGHT; - double coordFactor = 1/scaleFactor; - - double barSpace = this.getHeight() - ogSize; - int barHeight = 1; // pixels - int barY = (int)(this.getY() + ogSize + (int)(barSpace - barHeight) * 0.5); - - String parent = numberSetting.getName() + ":"; - String value = numberSetting.getInput() + ""; - - double text1Y = this.getY() + (ogSize - desiredTextSize) * 0.5; - double parentX = (this.getX() + textMargin); - - int thumbSize = barHeight * 3; - int barLength = (int)(this.getWidth() - textMargin * 2); - double barWidth = ((numberSetting.getInput() - numberSetting.getMin()) / - (numberSetting.getMax() - numberSetting.getMin())) * - barLength; - - Gui.drawRect( //drawing the background - (int)(this.getX() + textMargin), - barY, - (int)(this.getX() + textMargin + barLength), - barY + barHeight, - theme.getSelectionForegroundColour().getRGB() - ); - - Gui.drawRect( - (int)(this.getX() + textMargin), - barY, - (int)(this.getX() + textMargin + barWidth), - barY + barHeight, - theme.getAccentColour().getRGB() - ); - - Gui.drawRect( - (int)(this.getX() + textMargin + barWidth - thumbSize * 0.5), - (int)(barY - thumbSize * 0.5), - (int)(this.getX() + textMargin + barWidth + thumbSize * 0.5), - (int)(barY + barHeight + thumbSize * 0.5), - theme.getSecondBackgroundColour().getRGB() - ); - - - GL11.glPushMatrix(); - GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); - fr.drawString( - parent, - (float)(parentX * coordFactor), - (float)(text1Y * coordFactor), - theme.getTextColour().getRGB(), - false - ); - double fatFuck = fr.getStringWidth(parent + " ") * scaleFactor; - fr.drawString( - value, - (float)((parentX + fatFuck) * coordFactor), - (float)(text1Y * coordFactor), - theme.getAccentColour().getRGB(), - false - ); - GL11.glPopMatrix(); - - - for(Component component: this.getComponents()){ - component.paint(fr); - } - } - - @Override - public void update(int x, int y) { - float textMargin = (float)this.getWidth() * 0.0625f; - int barLength = (int)(this.getWidth() - textMargin * 2); - - if(draggingThumb){ - double mousePosX = Math.min(this.getX() + this.getWidth() - textMargin, Math.max(this.getX() + textMargin, x)) - (this.getX() + textMargin); - double percentage = mousePosX / barLength; - numberSetting.setValue(((numberSetting.getMax() - numberSetting.getMin() )* percentage) + numberSetting.getMin()); - } - super.update(x, y); - } - - @Override - public void mouseDown(int x, int y, int mb) { - super.mouseDown(x, y, mb); - if(mouseOver(x, y)) - this.draggingThumb = true; - } - - @Override - public void mouseReleased(int x, int y, int mb) { - super.mouseReleased(x, y, mb); - this.draggingThumb = false; - } -} diff --git a/src/main/java/keystrokesmod/client/clickgui/raven/settings/TickComponent.java b/src/main/java/keystrokesmod/client/clickgui/raven/settings/TickComponent.java deleted file mode 100644 index f3ba67eb..00000000 --- a/src/main/java/keystrokesmod/client/clickgui/raven/settings/TickComponent.java +++ /dev/null @@ -1,104 +0,0 @@ -package keystrokesmod.client.clickgui.raven.settings; - -import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.theme.Theme; -import keystrokesmod.client.main.Raven; -import keystrokesmod.client.module.Module; -import keystrokesmod.client.module.setting.impl.TickSetting; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import org.lwjgl.opengl.GL11; - -public class TickComponent extends Component { - private final TickSetting booleanSetting; - private final ModuleComponent moduleComponent; - private final Module module; - - public TickComponent(TickSetting booleanSetting, ModuleComponent moduleComponent){ - this.booleanSetting = booleanSetting; - this.moduleComponent = moduleComponent; - this.module = moduleComponent.getModule(); - } - - @Override - public boolean isVisible() { - return true; - } - - @Override - public void paint(FontRenderer fr) { - Theme theme = Raven.clickGui.getTheme(); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + this.getWidth()), - (int)(this.getY() + this.getHeight()), - theme.getSelectionBackgroundColour().getRGB() - ); - - Gui.drawRect( - (int)this.getX(), - (int)this.getY(), - (int)(this.getX() + Raven.clickGui.barWidth), - (int)(this.getY() + this.getHeight()), - theme.getAccentColour().getRGB() - ); - - float textMargin = (float)this.getWidth() * 0.0625f; - double desiredTextSize = this.getHeight() * 0.6; - double scaleFactor = desiredTextSize/ fr.FONT_HEIGHT; - double coordFactor = 1/scaleFactor; - double textY = this.getY() + (this.getHeight() - desiredTextSize) * 0.5; - - int tickSize = (int)(this.getHeight() * 0.6); - int margin = (int)(tickSize * 0.2); - int bgHeight = margin * 2 + tickSize; - int bgWidth = (int)(1.61 * bgHeight); - - int bgX = (int)(this.getX() + this.getWidth() - bgWidth - textMargin); - int bgY = (int) (this.getY() + (this.getHeight() - bgHeight) / 2); - int tickY = bgY + margin; - int tickX = booleanSetting.isToggled() ? (bgX + bgWidth - margin - tickSize) : (bgX + margin); - - Gui.drawRect( - bgX, - bgY, - bgX + bgWidth, - bgY + bgHeight, - theme.getSecondBackgroundColour().getRGB() - ); - - - Gui.drawRect( - tickX, - tickY, - tickX + tickSize, - tickY + tickSize, - booleanSetting.isToggled() ? theme.getAccentColour().getRGB() : theme.getSelectionBackgroundColour().getRGB() - ); - - GL11.glPushMatrix(); - GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); - fr.drawString( - booleanSetting.getName(), - (float)((this.getX() + textMargin) * coordFactor), - (float)(textY * coordFactor), - theme.getTextColour().getRGB(), - false - ); - GL11.glPopMatrix(); - - for(Component component: this.getComponents()){ - component.paint(fr); - } - } - - @Override - public void mouseDown(int x, int y, int mb) { - if(mouseOver(x, y)) - booleanSetting.toggle(); - super.mouseDown(x, y, mb); - } -} diff --git a/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/EventManager.java b/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/EventManager.java deleted file mode 100644 index 025fddbc..00000000 --- a/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/EventManager.java +++ /dev/null @@ -1,55 +0,0 @@ -package keystrokesmod.client.lib.fr.jmraich.rax.event; - -import net.minecraftforge.fml.common.eventhandler.Event; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class EventManager { - private static final List fmlEventHandlers; - - static { - fmlEventHandlers = Collections.synchronizedList(new ArrayList<>()); - } - - /** - * Register an object into the event sub-system - * @param INSTANCE target object to register - * @return false if no handler method have been found - */ - public static boolean register(Object INSTANCE) { - try { - fmlEventHandlers.add(FMLEventHandler.getFMLEventHandlerOfObject(INSTANCE)); - return true; - } catch (NoSuchMethodException e) { - return false; - } - } - - /** - * Unregister an object from the event sub-system - * @param INSTANCE target object to unregister - * @return false if no it wasn't registered - */ - public static boolean unregister(Object INSTANCE) { - for (FMLEventHandler fmlEventHandler : fmlEventHandlers) { - if (fmlEventHandler.getINSTANCE() == INSTANCE) { - fmlEventHandlers.remove(fmlEventHandler); - return true; - } - } - - return false; - } - - - /** - * Distribute an event into the event sub-system - * @param event event to distribute - * @param event to distribute - */ - public static void callEvent(E event) { - fmlEventHandlers.forEach(fmlEventHandler -> fmlEventHandler.call(event)); - } -} diff --git a/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/EventTransmitter.java b/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/EventTransmitter.java deleted file mode 100644 index 025965a7..00000000 --- a/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/EventTransmitter.java +++ /dev/null @@ -1,18 +0,0 @@ -package keystrokesmod.client.lib.fr.jmraich.rax.event; - -import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -/** - * FML events to sub-system - */ -public class EventTransmitter { - /** - * Transmit all events to the event sub-system - * @param e any forge event - */ - @SubscribeEvent - public void onEvent(Event e) { - EventManager.callEvent(e); - } -} diff --git a/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/FMLEvent.java b/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/FMLEvent.java deleted file mode 100644 index 8d52e493..00000000 --- a/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/FMLEvent.java +++ /dev/null @@ -1,21 +0,0 @@ -package keystrokesmod.client.lib.fr.jmraich.rax.event; - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -/** - * Used to replace "net.minecraftforge.fml.common.eventhandler.SubscribeEvent" - * in the event sub-system - * - * note : both of "SubscribeEvent" and "FMLEvent" work with this sub system but only "SubscribeEvent" works with FML's one - */ -@Documented -@Retention(value = RUNTIME) -@Target(value = METHOD) -public @interface FMLEvent { - -} diff --git a/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/FMLEventHandler.java b/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/FMLEventHandler.java deleted file mode 100644 index 6723e69a..00000000 --- a/src/main/java/keystrokesmod/client/lib/fr/jmraich/rax/event/FMLEventHandler.java +++ /dev/null @@ -1,88 +0,0 @@ -package keystrokesmod.client.lib.fr.jmraich.rax.event; - -import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; - -public class FMLEventHandler { - private final HashMap, ArrayList> EVENTS; - private final Object INSTANCE; - - /** - * Default constructor - * @param INSTANCE listener's instance - * @param EVENTS event in listener's clazz and methods which implement them - */ - private FMLEventHandler(Object INSTANCE, HashMap, ArrayList> EVENTS) { - this.EVENTS = EVENTS; - this.INSTANCE = INSTANCE; - } - - /** - * Get instance of current listener - * @return current listener's instance - */ - public Object getINSTANCE() { - return INSTANCE; - } - - /** - * Dispatch an FML event into the sub*system - * @param event event - * @param event - */ - public void call(E event) { - Class eventClazz = event.getClass(); - - if (!EVENTS.containsKey(eventClazz)) return; - - EVENTS.get(eventClazz).forEach(method -> { - if (!event.isCanceled()) { - try { - method.invoke(this.getINSTANCE(), event); - } catch (IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); - } - } - }); - } - - - /** - * Generate a "FMLEventHandler" instance from an Objecy - * @param INSTANCE listener's instance - * @return null if there is no listening methods (aka method annotated with "SubscribeEvent" or "FMLEvent") - */ - public static FMLEventHandler getFMLEventHandlerOfObject(Object INSTANCE) throws NoSuchMethodException { - HashMap, ArrayList> EVENT_METHODS = new HashMap<>(); - - for (Method m : INSTANCE.getClass().getDeclaredMethods()) { - if ( - !m.isAnnotationPresent(SubscribeEvent.class) && // default FML annotation - !m.isAnnotationPresent(FMLEvent.class) // custom annotation - ) continue; - - Class eventClazz = m.getParameterTypes()[0]; - if ( - m.getParameterCount() == 1 && - Event.class.isAssignableFrom(eventClazz) - ) { - if (!m.isAccessible()) m.setAccessible(true); - - ArrayList methodsOfEvent = EVENT_METHODS.getOrDefault(eventClazz, new ArrayList<>()); - methodsOfEvent.add(m); - EVENT_METHODS.put((Class) eventClazz, methodsOfEvent); - } - } - - if (EVENT_METHODS.size() > 0) { - return new FMLEventHandler(INSTANCE, EVENT_METHODS); - } else { - throw new NoSuchMethodException("No handling methods"); - } - } -} diff --git a/src/main/java/keystrokesmod/client/main/ClientConfig.java b/src/main/java/keystrokesmod/client/main/ClientConfig.java index 623be226..b27b3c80 100644 --- a/src/main/java/keystrokesmod/client/main/ClientConfig.java +++ b/src/main/java/keystrokesmod/client/main/ClientConfig.java @@ -1,6 +1,6 @@ package keystrokesmod.client.main; -import keystrokesmod.client.clickgui.raven.CategoryComponent; +import keystrokesmod.client.clickgui.raven.components.CategoryComponent; import keystrokesmod.keystroke.KeyStroke; import keystrokesmod.client.module.modules.HUD; import keystrokesmod.client.utils.Utils; @@ -168,11 +168,15 @@ private List parseConfigFile() { } private void loadClickGuiCoords(String decryptedString) { + //clickgui config + // categoryname:x:y:opened + ////System.out.println(decryptedString); for (String what : decryptedString.split("/")){ for (CategoryComponent cat : Raven.clickGui.getCategoryList()) { - if(what.startsWith(cat.getName())){ + if(what.startsWith(cat.categoryName.name())){ List cfg = Utils.Java.StringListToList(what.split("~")); - cat.setLocation(Integer.parseInt(cfg.get(1)), Integer.parseInt(cfg.get(2))); + cat.setX(Integer.parseInt(cfg.get(1))); + cat.setY(Integer.parseInt(cfg.get(2))); cat.setOpened(Boolean.parseBoolean(cfg.get(3))); } } @@ -182,7 +186,7 @@ private void loadClickGuiCoords(String decryptedString) { public String getClickGuiPos() { StringBuilder posConfig = new StringBuilder(); for (CategoryComponent cat : Raven.clickGui.getCategoryList()) { - posConfig.append(cat.getName()); + posConfig.append(cat.categoryName.name()); posConfig.append("~"); posConfig.append(cat.getX()); posConfig.append("~"); diff --git a/src/main/java/keystrokesmod/client/main/Raven.java b/src/main/java/keystrokesmod/client/main/Raven.java index 0ed516a7..cd97e768 100644 --- a/src/main/java/keystrokesmod/client/main/Raven.java +++ b/src/main/java/keystrokesmod/client/main/Raven.java @@ -1,8 +1,6 @@ package keystrokesmod.client.main; -import keystrokesmod.client.lib.fr.jmraich.rax.event.EventManager; -import keystrokesmod.client.lib.fr.jmraich.rax.event.EventTransmitter; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import keystrokesmod.client.utils.version.VersionManager; import keystrokesmod.keystroke.KeyStrokeRenderer; import keystrokesmod.client.NotificationRenderer; @@ -18,6 +16,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; @@ -50,7 +49,6 @@ public class Raven { public static final String osName, osArch; - public static final EventTransmitter eventTransmitter = new EventTransmitter(); static { osName = System.getProperty("os.name").toLowerCase(); @@ -61,15 +59,12 @@ public class Raven { } public static void init() { - MinecraftForge.EVENT_BUS.register(eventTransmitter); - EventManager.register(new Raven()); - EventManager.register(new DebugInfoRenderer()); - EventManager.register(new mouseManager()); - EventManager.register(new KeyStrokeRenderer()); - EventManager.register(new ChatHelper()); - - EventManager.register(new NotificationRenderer()); + 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 ChatHelper()); Runtime.getRuntime().addShutdownHook(new Thread(ex::shutdown)); @@ -89,10 +84,8 @@ public static void init() { ClientConfig.applyKeyStrokeSettingsFromConfigFile(); commandManager = new CommandManager(); clickGui = new ClickGui(); - System.out.println("Creating config manager"); configManager = new ConfigManager(); clientConfig = new ClientConfig(); - clickGui.firstRun(); clientConfig.applyConfig(); ex.execute(() -> { @@ -104,7 +97,7 @@ public static void init() { }); } - @FMLEvent + @SubscribeEvent public void onTick(ClientTickEvent event) { if (event.phase == Phase.END) { if (Utils.Player.isPlayerInGame()) { @@ -122,8 +115,8 @@ public void onTick(ClientTickEvent event) { } } - @FMLEvent @SuppressWarnings("unused") + @SubscribeEvent public void onChatMessageReceived(ClientChatReceivedEvent event) { if (Utils.Player.isPlayerInGame()) { String msg = event.message.getUnformattedText(); diff --git a/src/main/java/keystrokesmod/client/module/Module.java b/src/main/java/keystrokesmod/client/module/Module.java index e819dab7..1321f81a 100644 --- a/src/main/java/keystrokesmod/client/module/Module.java +++ b/src/main/java/keystrokesmod/client/module/Module.java @@ -1,12 +1,12 @@ package keystrokesmod.client.module; import com.google.gson.JsonObject; -import keystrokesmod.client.lib.fr.jmraich.rax.event.EventManager; import keystrokesmod.client.NotificationRenderer; import keystrokesmod.client.module.modules.HUD; import keystrokesmod.client.module.setting.Setting; import keystrokesmod.client.module.setting.impl.TickSetting; import net.minecraft.client.Minecraft; +import net.minecraftforge.common.MinecraftForge; import org.lwjgl.input.Keyboard; import java.util.ArrayList; @@ -60,16 +60,19 @@ public JsonObject getConfigAsJson(){ } public void applyConfigFromJson(JsonObject data){ - this.keycode = data.get("keycode").getAsInt(); - setToggled(data.get("enabled").getAsBoolean()); - - JsonObject settingsData = data.get("settings").getAsJsonObject(); - for(Setting setting : getSettings()){ - if(settingsData.has(setting.getName())){ - setting.applyConfigFromJson( - settingsData.get(setting.getName()).getAsJsonObject() - ); + try { + this.keycode = data.get("keycode").getAsInt(); + setToggled(data.get("enabled").getAsBoolean()); + 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){ + } } @@ -103,9 +106,8 @@ public void enable() { ModuleManager.sort(); } - EventManager.register(this); - this.onEnable(); + MinecraftForge.EVENT_BUS.register(this); } public void disable() { @@ -115,9 +117,8 @@ public void disable() { NotificationRenderer.moduleStateChanged(this); } ModuleManager.enModsList.remove(this); - EventManager.unregister(this); this.onDisable(); - + MinecraftForge.EVENT_BUS.unregister(this); } public void setToggled(boolean enabled) { @@ -127,6 +128,11 @@ public void setToggled(boolean enabled) { enable(); else disable(); + if(enabled){ + enable(); + } else{ + disable(); + } } public String getName() { @@ -164,7 +170,7 @@ public void onDisable() { } public void toggle() { - if (this.isEnabled()) { + if (this.enabled) { this.disable(); } else { this.enable(); diff --git a/src/main/java/keystrokesmod/client/module/modules/HUD.java b/src/main/java/keystrokesmod/client/module/modules/HUD.java index 41479430..3fb33b38 100644 --- a/src/main/java/keystrokesmod/client/module/modules/HUD.java +++ b/src/main/java/keystrokesmod/client/module/modules/HUD.java @@ -10,7 +10,7 @@ import net.minecraft.client.gui.*; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.client.config.GuiButtonExt; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent; @@ -67,17 +67,8 @@ public void guiButtonToggled(TickSetting b) { } } - @FMLEvent - public void L(RenderGameOverlayEvent e){ - if(e.type == RenderGameOverlayEvent.ElementType.CROSSHAIRS) { - - } - } - - @FMLEvent + @SubscribeEvent public void a(RenderTickEvent ev) { - // IK THIS METHOD IS INNEFECTIVE I WILL OPTIMISE IT LATER DONT BULLY ME - if (ev.phase == Phase.END && Utils.Player.isPlayerInGame()) { if (mc.currentScreen != null || mc.gameSettings.showDebugInfo) { return; @@ -105,7 +96,9 @@ else if(positionMode == Utils.HUD.PositionMode.DOWNLEFT || positionMode == Utils ModuleManager.sortLongShort(); } } - List en = new ArrayList<>(Raven.moduleManager.getModules()); + + + List en = new ArrayList<>(ModuleManager.getModules()); if(en.isEmpty()) return; int textBoxWidth = ModuleManager.getLongestActiveModule(mc.fontRendererObj); @@ -136,6 +129,7 @@ else if(positionMode == Utils.HUD.PositionMode.DOWNLEFT || positionMode == Utils for (Module m : en) { if (m.isEnabled() && m != this) { + System.out.println(m.getName()); if (HUD.positionMode == Utils.HUD.PositionMode.DOWNRIGHT || HUD.positionMode == Utils.HUD.PositionMode.UPRIGHT) { if (ColourModes.values()[(int) colourMode.getInput() - 1] == ColourModes.RAVEN) { mc.fontRendererObj.drawString(m.getName(), (float) hudX + (textBoxWidth - mc.fontRendererObj.getStringWidth(m.getName())), (float) y, Utils.Client.rainbowDraw(2L, del), dropShadow.isToggled()); diff --git a/src/main/java/keystrokesmod/client/module/modules/client/FPSSpoofer.java b/src/main/java/keystrokesmod/client/module/modules/client/FPSSpoofer.java index a842e461..4fd551f8 100644 --- a/src/main/java/keystrokesmod/client/module/modules/client/FPSSpoofer.java +++ b/src/main/java/keystrokesmod/client/module/modules/client/FPSSpoofer.java @@ -4,7 +4,7 @@ import keystrokesmod.client.module.setting.impl.DescriptionSetting; import keystrokesmod.client.module.setting.impl.DoubleSliderSetting; import net.minecraft.client.Minecraft; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.ReflectionHelper; @@ -37,7 +37,7 @@ public void onEnable(){ ticksPassed = 0; } - @FMLEvent + @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event){ if(event.phase == TickEvent.Phase.START){ //if(ticksPassed % 20 == 0) { 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 4e04f6f6..9124f4f1 100644 --- a/src/main/java/keystrokesmod/client/module/modules/client/SelfDestruct.java +++ b/src/main/java/keystrokesmod/client/module/modules/client/SelfDestruct.java @@ -2,6 +2,10 @@ import keystrokesmod.client.main.Raven; import keystrokesmod.client.module.Module; +import keystrokesmod.client.utils.ChatHelper; +import keystrokesmod.client.utils.DebugInfoRenderer; +import keystrokesmod.client.utils.mouseManager; +import keystrokesmod.keystroke.KeyStrokeRenderer; import net.minecraftforge.common.MinecraftForge; import org.lwjgl.input.Keyboard; @@ -26,6 +30,10 @@ public void onEnable() { so we don't need to care anymore about the state of the mod... if it has been self-destructed events won't be called including if they're still registered */ - MinecraftForge.EVENT_BUS.unregister(Raven.eventTransmitter); + MinecraftForge.EVENT_BUS.unregister(new Raven()); + MinecraftForge.EVENT_BUS.unregister(new DebugInfoRenderer()); + 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/UpdateCheck.java b/src/main/java/keystrokesmod/client/module/modules/client/UpdateCheck.java index 6a1e85d8..880b9ac1 100644 --- a/src/main/java/keystrokesmod/client/module/modules/client/UpdateCheck.java +++ b/src/main/java/keystrokesmod/client/module/modules/client/UpdateCheck.java @@ -5,7 +5,7 @@ import keystrokesmod.client.module.setting.impl.DescriptionSetting; import keystrokesmod.client.module.setting.impl.TickSetting; import keystrokesmod.client.utils.Utils; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import keystrokesmod.client.utils.version.Version; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -65,7 +65,7 @@ public UpdateCheck() { }; } - @FMLEvent + @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent e) { if (f == null) { f = executor.submit(task); 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 95139532..5e31c893 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/AutoBlock.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/AutoBlock.java @@ -6,7 +6,7 @@ import keystrokesmod.client.utils.CoolDown; import keystrokesmod.client.utils.Utils; import net.minecraft.client.settings.KeyBinding; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Mouse; @@ -24,7 +24,7 @@ public AutoBlock(){ this.registerSetting(chance = new SliderSetting("Chance %", 100, 0, 100, 1)); } - @FMLEvent + @SubscribeEvent public void yes(TickEvent.RenderTickEvent e){ if(!Utils.Player.isPlayerInGame()) return; diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/AutoClicker.java b/src/main/java/keystrokesmod/client/module/modules/combat/AutoClicker.java index 3fe126a8..b7d41e61 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/AutoClicker.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/AutoClicker.java @@ -16,7 +16,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.*; import net.minecraft.util.BlockPos; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent; import net.minecraftforge.fml.relauncher.ReflectionHelper; @@ -147,7 +147,7 @@ public void guiUpdate() { timingsDesc.setDesc(Utils.md + Utils.Modes.ClickTimings.values()[(int)(clickTimings.getInput() - 1.0D)].name()); } - @FMLEvent + @SubscribeEvent public void onRenderTick(RenderTickEvent ev) { if(!Utils.Client.currentScreenMinecraft() && !(Minecraft.getMinecraft().currentScreen instanceof GuiInventory) // to make it work in survival inventory @@ -167,7 +167,7 @@ else if (Utils.Modes.ClickTimings.values()[(int)clickTimings.getInput() - 1] == } } - @FMLEvent + @SubscribeEvent public void onTick(TickEvent.PlayerTickEvent ev) { if(!Utils.Client.currentScreenMinecraft() && !(Minecraft.getMinecraft().currentScreen instanceof GuiInventory) && !(Minecraft.getMinecraft().currentScreen instanceof GuiChest) // to make it work in chests diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/AutoWeapon.java b/src/main/java/keystrokesmod/client/module/modules/combat/AutoWeapon.java index 71f3a947..ec83f4f9 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/AutoWeapon.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/AutoWeapon.java @@ -4,7 +4,7 @@ import keystrokesmod.client.module.setting.impl.TickSetting; import keystrokesmod.client.utils.Utils; import net.minecraft.entity.Entity; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Mouse; @@ -20,7 +20,7 @@ public AutoWeapon(){ this.registerSetting(goBackToPrevSlot = new TickSetting("Revert to old slot", true)); } - @FMLEvent + @SubscribeEvent public void datsDaSoundOfDaPolis(TickEvent.RenderTickEvent ev){ if(!Utils.Player.isPlayerInGame() || mc.currentScreen != null) return; 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 b712cc82..eda3a9c1 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/BlockHit.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/BlockHit.java @@ -11,7 +11,7 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -46,7 +46,7 @@ public void guiUpdate() { } - @FMLEvent + @SubscribeEvent public void onTick(TickEvent.RenderTickEvent e) { if(!Utils.Player.isPlayerInGame()) return; diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/BurstClicker.java b/src/main/java/keystrokesmod/client/module/modules/combat/BurstClicker.java index c19323ee..19ea4a61 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/BurstClicker.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/BurstClicker.java @@ -8,7 +8,7 @@ import keystrokesmod.client.utils.Utils; import net.minecraft.client.settings.KeyBinding; import net.minecraft.item.ItemBlock; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent; import java.lang.reflect.InvocationTargetException; @@ -91,7 +91,7 @@ public void onDisable() { this.l_r = false; } - @FMLEvent + @SubscribeEvent public void r(RenderTickEvent ev) { if (Utils.Player.isPlayerInGame()) { if (this.l_c) { 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 0d897dcc..2c903732 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/ClickAssist.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/ClickAssist.java @@ -9,7 +9,7 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.MouseEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.input.Mouse; import java.awt.*; @@ -54,7 +54,7 @@ public void onDisable() { this.bot = null; } - @FMLEvent + @SubscribeEvent public void onMouseUpdate(MouseEvent ev) { if (ev.button >= 0 && ev.buttonstate && chance.getInput() != 0.0D && Utils.Player.isPlayerInGame()) { if (mc.currentScreen == null && !mc.thePlayer.isEating() && !mc.thePlayer.isBlocking()) { diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/DelayRemover.java b/src/main/java/keystrokesmod/client/module/modules/combat/DelayRemover.java index 4958b5bd..8fa35128 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/DelayRemover.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/DelayRemover.java @@ -4,7 +4,7 @@ import keystrokesmod.client.module.setting.impl.DescriptionSetting; import keystrokesmod.client.utils.Utils; import net.minecraft.client.Minecraft; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; import net.minecraftforge.fml.relauncher.ReflectionHelper; @@ -28,7 +28,7 @@ public boolean canBeEnabled() { return this.leftClickCounterField != null; } - @FMLEvent + @SubscribeEvent public void playerTickEvent(PlayerTickEvent event) { if (Utils.Player.isPlayerInGame() && this.leftClickCounterField != null) { if (!mc.inGameHasFocus || mc.thePlayer.capabilities.isCreativeMode) { diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/HitBox.java b/src/main/java/keystrokesmod/client/module/modules/combat/HitBox.java index 4505aa9f..21cd13c3 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/HitBox.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/HitBox.java @@ -16,7 +16,7 @@ import net.minecraft.util.Vec3; import net.minecraftforge.client.event.MouseEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -39,7 +39,7 @@ public void update() { gmo(1.0F); } - @FMLEvent + @SubscribeEvent public void m(MouseEvent e) { if(!Utils.Player.isPlayerInGame()) return; if (e.button == 0 && e.buttonstate && mv != null) { @@ -47,7 +47,7 @@ public void m(MouseEvent e) { } } - @FMLEvent + @SubscribeEvent public void ef(TickEvent.RenderTickEvent ev) { // autoclick event if(!Utils.Player.isPlayerInGame()) return; @@ -62,7 +62,7 @@ public void ef(TickEvent.RenderTickEvent ev) { } } - @FMLEvent + @SubscribeEvent public void r1(RenderWorldLastEvent e) { if (b.isToggled() && Utils.Player.isPlayerInGame()) { for (Entity en : mc.theWorld.loadedEntityList) { diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/Reach.java b/src/main/java/keystrokesmod/client/module/modules/combat/Reach.java index b24f5fa5..09b1db61 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/Reach.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/Reach.java @@ -14,7 +14,7 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraftforge.client.event.MouseEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Mouse; @@ -36,7 +36,7 @@ public Reach() { this.registerSetting(hit_through_blocks = new TickSetting("Hit through blocks", false)); } - @FMLEvent + @SubscribeEvent public void onMouse(MouseEvent ev) { // legit event if(!Utils.Player.isPlayerInGame()) return; @@ -47,7 +47,7 @@ public void onMouse(MouseEvent ev) { } } - @FMLEvent + @SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent ev) { // autoclick event if(!Utils.Player.isPlayerInGame()) return; diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/RodAimbot.java b/src/main/java/keystrokesmod/client/module/modules/combat/RodAimbot.java index 957be05a..373b6806 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/RodAimbot.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/RodAimbot.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFishingRod; import net.minecraftforge.client.event.MouseEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.util.Iterator; @@ -25,7 +25,7 @@ public RodAimbot() { this.registerSetting(c = new TickSetting("Aim invis", false)); } - @FMLEvent + @SubscribeEvent public void x(MouseEvent ev) { if (ev.button == 1 && ev.buttonstate && Utils.Player.isPlayerInGame() && mc.currentScreen == null) { if (mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemFishingRod && mc.thePlayer.fishEntity == null) { 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 23624870..13fcd122 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/STap.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/STap.java @@ -11,7 +11,7 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -44,7 +44,7 @@ public void guiUpdate(){ } - @FMLEvent + @SubscribeEvent public void onTick(TickEvent.RenderTickEvent e) { if(!Utils.Player.isPlayerInGame()) 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 035c9317..141637d4 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/ShiftTap.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/ShiftTap.java @@ -11,7 +11,7 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -45,7 +45,7 @@ public void guiUpdate() { } - @FMLEvent + @SubscribeEvent public void onTick(TickEvent.RenderTickEvent e) { if(!Utils.Player.isPlayerInGame()) return; diff --git a/src/main/java/keystrokesmod/client/module/modules/combat/Velocity.java b/src/main/java/keystrokesmod/client/module/modules/combat/Velocity.java index 4e035b39..66124e58 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/Velocity.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/Velocity.java @@ -5,7 +5,7 @@ import keystrokesmod.client.module.setting.impl.TickSetting; import keystrokesmod.client.utils.Utils; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.input.Keyboard; public class Velocity extends Module { @@ -24,7 +24,7 @@ public Velocity() { this.registerSetting(e = new TickSetting("Disable while holding S", false)); } - @FMLEvent + @SubscribeEvent public void c(LivingUpdateEvent ev) { if (Utils.Player.isPlayerInGame() && mc.thePlayer.maxHurtTime > 0 && mc.thePlayer.hurtTime == mc.thePlayer.maxHurtTime) { 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 ee8a79d1..dfd388a1 100644 --- a/src/main/java/keystrokesmod/client/module/modules/combat/WTap.java +++ b/src/main/java/keystrokesmod/client/module/modules/combat/WTap.java @@ -11,7 +11,7 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -45,7 +45,7 @@ public void guiUpdate() { } - @FMLEvent + @SubscribeEvent public void onTick(TickEvent.RenderTickEvent e) { if(!Utils.Player.isPlayerInGame()) return; diff --git a/src/main/java/keystrokesmod/client/module/modules/minigames/BedwarsOverlay.java b/src/main/java/keystrokesmod/client/module/modules/minigames/BedwarsOverlay.java index 5a124d89..86cec728 100644 --- a/src/main/java/keystrokesmod/client/module/modules/minigames/BedwarsOverlay.java +++ b/src/main/java/keystrokesmod/client/module/modules/minigames/BedwarsOverlay.java @@ -12,7 +12,7 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import java.util.HashMap; @@ -49,7 +49,7 @@ public BedwarsOverlay() { //marginTextX = 21; } - @FMLEvent + @SubscribeEvent public void onChatMessageRecieved(ClientChatReceivedEvent event) { if (Utils.Player.isPlayerInGame()) { if (Utils.Java.str(event.message.getUnformattedText()).startsWith("Sending you to")) { @@ -58,7 +58,7 @@ public void onChatMessageRecieved(ClientChatReceivedEvent event) { } } - @FMLEvent + @SubscribeEvent public void onRender(TickEvent.RenderTickEvent e) { if (!active) { return; diff --git a/src/main/java/keystrokesmod/client/module/modules/minigames/BridgeInfo.java b/src/main/java/keystrokesmod/client/module/modules/minigames/BridgeInfo.java index 0ffa16fa..5fc6cc1b 100644 --- a/src/main/java/keystrokesmod/client/module/modules/minigames/BridgeInfo.java +++ b/src/main/java/keystrokesmod/client/module/modules/minigames/BridgeInfo.java @@ -18,7 +18,7 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.client.config.GuiButtonExt; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent; @@ -102,7 +102,7 @@ public void update() { } } - @FMLEvent + @SubscribeEvent public void a(RenderTickEvent ev) { if (ev.phase == Phase.END && Utils.Player.isPlayerInGame() && this.ibd()) { if (mc.currentScreen != null || mc.gameSettings.showDebugInfo) { @@ -121,7 +121,7 @@ public void a(RenderTickEvent ev) { } - @FMLEvent + @SubscribeEvent public void o(ClientChatReceivedEvent c) { if (Utils.Player.isPlayerInGame()) { String s = Utils.Java.str(c.message.getUnformattedText()); @@ -143,7 +143,7 @@ public void o(ClientChatReceivedEvent c) { } - @FMLEvent + @SubscribeEvent public void w(EntityJoinWorldEvent j) { if (j.entity == mc.thePlayer) { this.rv(); diff --git a/src/main/java/keystrokesmod/client/module/modules/minigames/DuelsStats.java b/src/main/java/keystrokesmod/client/module/modules/minigames/DuelsStats.java index 5e270f76..94f0687b 100644 --- a/src/main/java/keystrokesmod/client/module/modules/minigames/DuelsStats.java +++ b/src/main/java/keystrokesmod/client/module/modules/minigames/DuelsStats.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.util.ArrayList; import java.util.List; @@ -74,7 +74,7 @@ public void update() { } - @FMLEvent + @SubscribeEvent public void onMessageRecieved(ClientChatReceivedEvent c) { if (Utils.Player.isPlayerInGame() && this.id()) { String s = Utils.Java.str(c.message.getUnformattedText()); @@ -100,7 +100,7 @@ public void onMessageRecieved(ClientChatReceivedEvent c) { } } - @FMLEvent + @SubscribeEvent public void onEntityJoin(EntityJoinWorldEvent j) { if (j.entity == mc.thePlayer) { this.en = ""; 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 596f4606..5db97f56 100644 --- a/src/main/java/keystrokesmod/client/module/modules/minigames/MurderMystery.java +++ b/src/main/java/keystrokesmod/client/module/modules/minigames/MurderMystery.java @@ -34,7 +34,7 @@ public MurderMystery() { } @SubscribeEvent - public void o(RenderWorldLastEvent e) { + public void onRenderWorldLast(RenderWorldLastEvent e) { if (Utils.Player.isPlayerInGame()) { PlayerESP playerESP = (PlayerESP) ModuleManager.getModuleByName("PlayerESP"); assert playerESP != null; diff --git a/src/main/java/keystrokesmod/client/module/modules/minigames/SumoFences.java b/src/main/java/keystrokesmod/client/module/modules/minigames/SumoFences.java index 9aaa47b4..0cde541f 100644 --- a/src/main/java/keystrokesmod/client/module/modules/minigames/SumoFences.java +++ b/src/main/java/keystrokesmod/client/module/modules/minigames/SumoFences.java @@ -10,7 +10,7 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraftforge.client.event.MouseEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.input.Mouse; import java.util.Arrays; @@ -68,7 +68,7 @@ public void onDisable() { } - @FMLEvent + @SubscribeEvent public void m(MouseEvent e) { if (e.buttonstate && (e.button == 0 || e.button == 1) && Utils.Player.isPlayerInGame() && this.is()) { MovingObjectPosition mop = mc.objectMouseOver; diff --git a/src/main/java/keystrokesmod/client/module/modules/movement/AutoHeader.java b/src/main/java/keystrokesmod/client/module/modules/movement/AutoHeader.java index 5160fac0..1134d693 100644 --- a/src/main/java/keystrokesmod/client/module/modules/movement/AutoHeader.java +++ b/src/main/java/keystrokesmod/client/module/modules/movement/AutoHeader.java @@ -6,7 +6,7 @@ import keystrokesmod.client.module.setting.impl.SliderSetting; import keystrokesmod.client.module.setting.impl.TickSetting; import keystrokesmod.client.utils.Utils; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; @@ -32,7 +32,7 @@ public void onEnable(){ super.onEnable(); } - @FMLEvent + @SubscribeEvent public void onTick(TickEvent.RenderTickEvent e) { if (!Utils.Player.isPlayerInGame() || mc.currentScreen != null) return; diff --git a/src/main/java/keystrokesmod/client/module/modules/movement/Fly.java b/src/main/java/keystrokesmod/client/module/modules/movement/Fly.java index de48d103..ee59df62 100644 --- a/src/main/java/keystrokesmod/client/module/modules/movement/Fly.java +++ b/src/main/java/keystrokesmod/client/module/modules/movement/Fly.java @@ -4,6 +4,7 @@ import keystrokesmod.client.module.setting.impl.DescriptionSetting; import keystrokesmod.client.module.setting.impl.SliderSetting; import keystrokesmod.client.utils.Utils; +import net.minecraft.client.Minecraft; public class Fly extends Module { private final Fly.VanFly vanFly = new VanFly(); @@ -103,11 +104,14 @@ static class VanFly { public void onEnable() {} public void onDisable() { - if (Module.mc.thePlayer.capabilities.isFlying) { - Module.mc.thePlayer.capabilities.isFlying = false; + if(Minecraft.getMinecraft().thePlayer== null) + return; + + if (Minecraft.getMinecraft().thePlayer.capabilities.isFlying) { + Minecraft.getMinecraft().thePlayer.capabilities.isFlying = false; } - Module.mc.thePlayer.capabilities.setFlySpeed(0.05F); + Minecraft.getMinecraft().thePlayer.capabilities.setFlySpeed(0.05F); } public void update() { diff --git a/src/main/java/keystrokesmod/client/module/modules/movement/Sprint.java b/src/main/java/keystrokesmod/client/module/modules/movement/Sprint.java index 655daf98..b2427940 100644 --- a/src/main/java/keystrokesmod/client/module/modules/movement/Sprint.java +++ b/src/main/java/keystrokesmod/client/module/modules/movement/Sprint.java @@ -5,7 +5,7 @@ import keystrokesmod.client.utils.Utils; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.settings.KeyBinding; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; public class Sprint extends Module { @@ -17,7 +17,7 @@ public Sprint() { this.registerSetting(a); } - @FMLEvent + @SubscribeEvent public void p(PlayerTickEvent e) { if (Utils.Player.isPlayerInGame() && mc.inGameHasFocus) { EntityPlayerSP p = mc.thePlayer; diff --git a/src/main/java/keystrokesmod/client/module/modules/movement/StopMotion.java b/src/main/java/keystrokesmod/client/module/modules/movement/StopMotion.java index 422cbf86..a5e5d400 100644 --- a/src/main/java/keystrokesmod/client/module/modules/movement/StopMotion.java +++ b/src/main/java/keystrokesmod/client/module/modules/movement/StopMotion.java @@ -2,6 +2,7 @@ import keystrokesmod.client.module.Module; import keystrokesmod.client.module.setting.impl.TickSetting; +import keystrokesmod.client.utils.Utils; public class StopMotion extends Module { public static TickSetting a; @@ -16,7 +17,19 @@ public StopMotion() { } public void onEnable() { - //System.out.println("No fuck you"); + if(!Utils.Player.isPlayerInGame()){ + this.disable(); + return; + } + + if(a.isToggled()) + mc.thePlayer.motionX = 0; + + if(b.isToggled()) + mc.thePlayer.motionY = 0; + + if(c.isToggled()) + mc.thePlayer.motionZ = 0; this.disable(); } diff --git a/src/main/java/keystrokesmod/client/module/modules/other/MiddleClick.java b/src/main/java/keystrokesmod/client/module/modules/other/MiddleClick.java new file mode 100644 index 00000000..d1a562d0 --- /dev/null +++ b/src/main/java/keystrokesmod/client/module/modules/other/MiddleClick.java @@ -0,0 +1,128 @@ +package keystrokesmod.client.module.modules.other; + +import keystrokesmod.client.module.Module; +import keystrokesmod.client.module.modules.combat.AimAssist; +import keystrokesmod.client.module.setting.impl.DescriptionSetting; +import keystrokesmod.client.module.setting.impl.SliderSetting; +import keystrokesmod.client.module.setting.impl.TickSetting; +import keystrokesmod.client.utils.Utils; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemEnderPearl; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import org.lwjgl.input.Mouse; + +import java.awt.*; +import java.awt.event.InputEvent; + +public class MiddleClick extends Module { + public static SliderSetting action; + public static TickSetting showHelp; + public static DescriptionSetting actionDesc; + int prevSlot; + public static boolean a; + private Robot bot; + private boolean hasClicked; + private int pearlEvent; + + public MiddleClick() { + super("Middleclick", ModuleCategory.other, 0); + this.registerSetting(showHelp = new TickSetting("Show friend help in chat", true)); + this.registerSetting(action = new SliderSetting("Value:", 1,1, 3, 1)); + this.registerSetting(actionDesc = new DescriptionSetting("Mode: PEARL_THROW")); + } + + public void guiUpdate() { + actionDesc.setDesc(Utils.md + actions.values()[(int)(action.getInput() -1)]); + } + + public void onEnable() { + try { + this.bot = new Robot(); + } catch (AWTException var2) { + this.disable(); + } + hasClicked = false; + pearlEvent = 4; + } + + @SubscribeEvent + public void onTick(TickEvent.PlayerTickEvent e) { + if(!Utils.Player.isPlayerInGame()) return; + + if(pearlEvent < 4){ + if(pearlEvent==3) mc.thePlayer.inventory.currentItem = prevSlot; + pearlEvent++; + } + + if(Mouse.isButtonDown(2) && !hasClicked) { + switch (actions.values()[(int)(action.getInput() -1)]){ + case PEARL_THROW: + for (int slot = 0; slot <= 8; slot++) { + ItemStack itemInSlot = mc.thePlayer.inventory.getStackInSlot(slot); + if(itemInSlot != null && itemInSlot.getItem() instanceof ItemEnderPearl) { + prevSlot = mc.thePlayer.inventory.currentItem; + mc.thePlayer.inventory.currentItem = slot; + this.bot.mousePress(InputEvent.BUTTON3_MASK); + this.bot.mouseRelease(InputEvent.BUTTON3_MASK); + pearlEvent = 0; + hasClicked = true; + return; + } + } + break; + + case ADD_FRIEND: + addFriend(); + if(showHelp.isToggled()) showHelpMessage(); + break; + + case REMOVE_FRIEND: + removeFriend(); + if(showHelp.isToggled()) showHelpMessage(); + break; + + } + hasClicked = true; + } else if(!Mouse.isButtonDown(2) && hasClicked) { + hasClicked = false; + } + } + + private void showHelpMessage() { + if(showHelp.isToggled()) { + Utils.Player.sendMessageToSelf("Run 'help friends' in CommandLine to find out how to add, remove and view friends."); + } + } + + private void removeFriend() { + Entity player = mc.objectMouseOver.entityHit; + if(player == null) { + Utils.Player.sendMessageToSelf("Please aim at a player/entity when removing them."); + } else { + if (AimAssist.removeFriend(player)) { + Utils.Player.sendMessageToSelf("Successfully removed " + player.getName() + " from friends list!"); + } else { + Utils.Player.sendMessageToSelf(player.getName() + " was not found in the friends list!"); + } + } + } + + private void addFriend() { + Entity player = mc.objectMouseOver.entityHit; + if(player == null) { + Utils.Player.sendMessageToSelf("Please aim at a player/entity when adding them."); + } + else { + AimAssist.addFriend(player); + Utils.Player.sendMessageToSelf("Successfully added " + player.getName() + " to friends list."); + } + } + + public enum actions { + PEARL_THROW, + ADD_FRIEND, + REMOVE_FRIEND + } +} diff --git a/src/main/java/keystrokesmod/client/module/modules/other/WaterBucket.java b/src/main/java/keystrokesmod/client/module/modules/other/WaterBucket.java index 97425495..6d297e95 100644 --- a/src/main/java/keystrokesmod/client/module/modules/other/WaterBucket.java +++ b/src/main/java/keystrokesmod/client/module/modules/other/WaterBucket.java @@ -13,7 +13,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition.MovingObjectType; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; @@ -32,7 +32,7 @@ public boolean canBeEnabled() { return !DimensionHelper.isPlayerInNether(); } - @FMLEvent + @SubscribeEvent public void onTick(ClientTickEvent ev) { if (ev.phase != Phase.END && Utils.Player.isPlayerInGame() && !mc.isGamePaused()) { if (DimensionHelper.isPlayerInNether()) this.disable(); diff --git a/src/main/java/keystrokesmod/client/module/modules/player/AutoJump.java b/src/main/java/keystrokesmod/client/module/modules/player/AutoJump.java index 3390d55a..6197a4fa 100644 --- a/src/main/java/keystrokesmod/client/module/modules/player/AutoJump.java +++ b/src/main/java/keystrokesmod/client/module/modules/player/AutoJump.java @@ -4,7 +4,7 @@ import keystrokesmod.client.module.setting.impl.TickSetting; import keystrokesmod.client.utils.Utils; import net.minecraft.client.settings.KeyBinding; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; public class AutoJump extends Module { @@ -20,7 +20,7 @@ public void onDisable() { this.ju(this.c = false); } - @FMLEvent + @SubscribeEvent public void p(PlayerTickEvent e) { if (Utils.Player.isPlayerInGame()) { if (mc.thePlayer.onGround && (!b.isToggled() || !mc.thePlayer.isSneaking())) { diff --git a/src/main/java/keystrokesmod/client/module/modules/player/AutoPlace.java b/src/main/java/keystrokesmod/client/module/modules/player/AutoPlace.java index 87af615e..e9a70195 100644 --- a/src/main/java/keystrokesmod/client/module/modules/player/AutoPlace.java +++ b/src/main/java/keystrokesmod/client/module/modules/player/AutoPlace.java @@ -15,7 +15,7 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.minecraftforge.client.event.DrawBlockHighlightEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.input.Mouse; public class AutoPlace extends Module { @@ -66,7 +66,7 @@ public void update() { } - @FMLEvent + @SubscribeEvent public void bh(DrawBlockHighlightEvent ev) { if (Utils.Player.isPlayerInGame()) { if (mc.currentScreen == null && !mc.thePlayer.capabilities.isFlying) { 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 ac6f864b..1b9213fb 100644 --- a/src/main/java/keystrokesmod/client/module/modules/player/AutoTool.java +++ b/src/main/java/keystrokesmod/client/module/modules/player/AutoTool.java @@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; import net.minecraft.util.BlockPos; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Mouse; @@ -37,7 +37,7 @@ public AutoTool() { delay = new CoolDown(0); } - @FMLEvent + @SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent e) { if (!Utils.Player.isPlayerInGame() || mc.currentScreen != null) return; diff --git a/src/main/java/keystrokesmod/client/module/modules/player/BridgeAssist.java b/src/main/java/keystrokesmod/client/module/modules/player/BridgeAssist.java index bfb88396..6d05a4dc 100644 --- a/src/main/java/keystrokesmod/client/module/modules/player/BridgeAssist.java +++ b/src/main/java/keystrokesmod/client/module/modules/player/BridgeAssist.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.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; public class BridgeAssist extends Module { @@ -53,7 +53,7 @@ public void onEnable() { super.onEnable(); } - @FMLEvent + @SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent e) { if (!Utils.Player.isPlayerInGame()) { return; diff --git a/src/main/java/keystrokesmod/client/module/modules/player/FastPlace.java b/src/main/java/keystrokesmod/client/module/modules/player/FastPlace.java index 8efd3cce..c7331e1a 100644 --- a/src/main/java/keystrokesmod/client/module/modules/player/FastPlace.java +++ b/src/main/java/keystrokesmod/client/module/modules/player/FastPlace.java @@ -7,7 +7,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; import net.minecraftforge.fml.relauncher.ReflectionHelper; @@ -39,7 +39,7 @@ public boolean canBeEnabled() { return rightClickDelayTimerField != null; } - @FMLEvent + @SubscribeEvent public void onPlayerTick(PlayerTickEvent event) { if (event.phase == Phase.END) { if (Utils.Player.isPlayerInGame() && mc.inGameHasFocus && rightClickDelayTimerField != null) { diff --git a/src/main/java/keystrokesmod/client/module/modules/player/Freecam.java b/src/main/java/keystrokesmod/client/module/modules/player/Freecam.java index b28afdb9..cd9f0f01 100644 --- a/src/main/java/keystrokesmod/client/module/modules/player/Freecam.java +++ b/src/main/java/keystrokesmod/client/module/modules/player/Freecam.java @@ -7,7 +7,7 @@ import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraftforge.client.event.MouseEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.input.Keyboard; import java.awt.*; @@ -147,7 +147,7 @@ public void update() { } } - @FMLEvent + @SubscribeEvent public void re(RenderWorldLastEvent e) { if (Utils.Player.isPlayerInGame()) { mc.thePlayer.renderArmPitch = mc.thePlayer.prevRenderArmPitch = 700.0F; @@ -157,7 +157,7 @@ public void re(RenderWorldLastEvent e) { } - @FMLEvent + @SubscribeEvent public void m(MouseEvent e) { if (Utils.Player.isPlayerInGame() && e.button != -1) { e.setCanceled(true); 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 7ff3c778..87848c47 100644 --- a/src/main/java/keystrokesmod/client/module/modules/player/SafeWalk.java +++ b/src/main/java/keystrokesmod/client/module/modules/player/SafeWalk.java @@ -11,7 +11,7 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; import org.lwjgl.input.Keyboard; @@ -57,7 +57,7 @@ public void guiUpdate() { blockShowModeDesc.setDesc(Utils.md + BlockAmountInfo.values()[(int)blockShowMode.getInput() - 1]); } - @FMLEvent + @SubscribeEvent public void p(PlayerTickEvent e) { if(!Utils.Client.currentScreenMinecraft()) return; @@ -137,7 +137,7 @@ else if (shouldBridge && Utils.Player.playerOverAir() && shiftOnJump.isToggled() } } - @FMLEvent + @SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent e) { if(!showBlockAmount.isToggled() || !Utils.Player.isPlayerInGame()) return; if (e.phase == TickEvent.Phase.END) { diff --git a/src/main/java/keystrokesmod/client/module/modules/render/Chams.java b/src/main/java/keystrokesmod/client/module/modules/render/Chams.java index 5ba7ae3e..a073a6a2 100644 --- a/src/main/java/keystrokesmod/client/module/modules/render/Chams.java +++ b/src/main/java/keystrokesmod/client/module/modules/render/Chams.java @@ -3,7 +3,7 @@ import keystrokesmod.client.module.Module; import net.minecraftforge.client.event.RenderPlayerEvent.Post; import net.minecraftforge.client.event.RenderPlayerEvent.Pre; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.opengl.GL11; public class Chams extends Module { @@ -11,7 +11,7 @@ public Chams() { super("Chams", ModuleCategory.render, 0); } - @FMLEvent + @SubscribeEvent public void r1(Pre e) { if (e.entity != mc.thePlayer) { GL11.glEnable(32823); @@ -19,7 +19,7 @@ public void r1(Pre e) { } } - @FMLEvent + @SubscribeEvent public void r2(Post e) { if (e.entity != mc.thePlayer) { GL11.glDisable(32823); diff --git a/src/main/java/keystrokesmod/client/module/modules/render/ChestESP.java b/src/main/java/keystrokesmod/client/module/modules/render/ChestESP.java index cad8e42e..c1a2e921 100644 --- a/src/main/java/keystrokesmod/client/module/modules/render/ChestESP.java +++ b/src/main/java/keystrokesmod/client/module/modules/render/ChestESP.java @@ -8,7 +8,7 @@ import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityEnderChest; import net.minecraftforge.client.event.RenderWorldLastEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.awt.*; import java.util.Iterator; @@ -31,7 +31,7 @@ public ChestESP() { this.registerSetting(d); } - @FMLEvent + @SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent ev) { if (Utils.Player.isPlayerInGame()) { int rgb = d.isToggled() ? Utils.Client.rainbowDraw(2L, 0L) : (new Color((int)a.getInput(), (int)b.getInput(), (int)c.getInput())).getRGB(); diff --git a/src/main/java/keystrokesmod/client/module/modules/render/ExplicitB9NameTags.java b/src/main/java/keystrokesmod/client/module/modules/render/ExplicitB9NameTags.java index ea2b401d..065dac3f 100644 --- a/src/main/java/keystrokesmod/client/module/modules/render/ExplicitB9NameTags.java +++ b/src/main/java/keystrokesmod/client/module/modules/render/ExplicitB9NameTags.java @@ -20,7 +20,7 @@ import net.minecraft.item.*; import net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre; import net.minecraftforge.client.event.RenderWorldLastEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.opengl.GL11; import java.awt.*; @@ -76,7 +76,7 @@ public void guiUpdate() { mode = modeSetting.getInput() == 1.0D ? "Hearts" : "Percentage"; } - @FMLEvent + @SubscribeEvent public void nameTag(Pre player) { boolean _0 = player.entity.getDisplayName().getFormattedText() != null; boolean _1 = !player.entity.getDisplayName().getFormattedText().equals(""); @@ -87,7 +87,7 @@ public void nameTag(Pre player) { } } - @FMLEvent + @SubscribeEvent public void render3d(RenderWorldLastEvent renderWorldLastEvent) { ArrayList playersArr = new ArrayList<>(); diff --git a/src/main/java/keystrokesmod/client/module/modules/render/Fullbright.java b/src/main/java/keystrokesmod/client/module/modules/render/Fullbright.java index a9a60411..a4ce483d 100644 --- a/src/main/java/keystrokesmod/client/module/modules/render/Fullbright.java +++ b/src/main/java/keystrokesmod/client/module/modules/render/Fullbright.java @@ -3,7 +3,7 @@ import keystrokesmod.client.module.Module; import keystrokesmod.client.module.setting.impl.DescriptionSetting; import keystrokesmod.client.utils.Utils; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; public class Fullbright extends Module { @@ -30,7 +30,7 @@ public void onDisable(){ mc.gameSettings.gammaSetting = this.defaultGamma; } - @FMLEvent + @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent e) { if (!Utils.Player.isPlayerInGame()) { onDisable(); diff --git a/src/main/java/keystrokesmod/client/module/modules/render/Nametags.java b/src/main/java/keystrokesmod/client/module/modules/render/Nametags.java index a4caeaaf..b8a3ab4f 100644 --- a/src/main/java/keystrokesmod/client/module/modules/render/Nametags.java +++ b/src/main/java/keystrokesmod/client/module/modules/render/Nametags.java @@ -11,7 +11,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.opengl.GL11; public class Nametags extends Module { @@ -31,7 +31,7 @@ public Nametags() { this.registerSetting(rm = new TickSetting("Remove tags", false)); } - @FMLEvent + @SubscribeEvent public void r(Pre e) { if (rm.isToggled()) { e.setCanceled(true); diff --git a/src/main/java/keystrokesmod/client/module/modules/render/PlayerESP.java b/src/main/java/keystrokesmod/client/module/modules/render/PlayerESP.java index d079e13d..5ede0f80 100644 --- a/src/main/java/keystrokesmod/client/module/modules/render/PlayerESP.java +++ b/src/main/java/keystrokesmod/client/module/modules/render/PlayerESP.java @@ -11,7 +11,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.client.event.RenderWorldLastEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.awt.*; import java.util.Iterator; @@ -61,7 +61,7 @@ public void guiUpdate() { this.rgb_c = (new Color((int)a.getInput(), (int)b.getInput(), (int)c.getInput())).getRGB(); } - @FMLEvent + @SubscribeEvent public void r1(RenderWorldLastEvent e) { if (Utils.Player.isPlayerInGame()) { int rgb = d.isToggled() ? 0 : this.rgb_c; diff --git a/src/main/java/keystrokesmod/client/module/modules/render/TargetHUD.java b/src/main/java/keystrokesmod/client/module/modules/render/TargetHUD.java index bcd3b640..fa84a19b 100644 --- a/src/main/java/keystrokesmod/client/module/modules/render/TargetHUD.java +++ b/src/main/java/keystrokesmod/client/module/modules/render/TargetHUD.java @@ -8,7 +8,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraftforge.client.event.RenderGameOverlayEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class TargetHUD extends Module { public static TickSetting editPosition; @@ -23,7 +23,7 @@ public TargetHUD() { fr = mc.fontRendererObj; } - @FMLEvent + @SubscribeEvent public void r(RenderGameOverlayEvent ev) { if (ev.type != RenderGameOverlayEvent.ElementType.CROSSHAIRS || !Utils.Player.isPlayerInGame()) return; ////System.out.println("render"); diff --git a/src/main/java/keystrokesmod/client/module/modules/render/Tracers.java b/src/main/java/keystrokesmod/client/module/modules/render/Tracers.java index 784d4afc..47ced3e4 100644 --- a/src/main/java/keystrokesmod/client/module/modules/render/Tracers.java +++ b/src/main/java/keystrokesmod/client/module/modules/render/Tracers.java @@ -10,7 +10,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.client.event.RenderWorldLastEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.awt.*; import java.util.Iterator; @@ -58,7 +58,7 @@ public void guiUpdate() { this.rgb_c = (new Color((int)b.getInput(), (int)c.getInput(), (int)d.getInput())).getRGB(); } - @FMLEvent + @SubscribeEvent public void o(RenderWorldLastEvent ev) { if (Utils.Player.isPlayerInGame()) { int rgb = e.isToggled() ? Utils.Client.rainbowDraw(2L, 0L) : this.rgb_c; diff --git a/src/main/java/keystrokesmod/client/module/modules/render/Xray.java b/src/main/java/keystrokesmod/client/module/modules/render/Xray.java index 9e525c84..8c288ccf 100644 --- a/src/main/java/keystrokesmod/client/module/modules/render/Xray.java +++ b/src/main/java/keystrokesmod/client/module/modules/render/Xray.java @@ -8,7 +8,7 @@ import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraftforge.client.event.RenderWorldLastEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.awt.*; import java.util.ArrayList; @@ -80,7 +80,7 @@ public void run() { }; } - @FMLEvent + @SubscribeEvent public void orl(RenderWorldLastEvent ev) { if (Utils.Player.isPlayerInGame() && !this.ren.isEmpty()) { List tRen = new ArrayList<>(this.ren); diff --git a/src/main/java/keystrokesmod/client/module/modules/world/AntiBot.java b/src/main/java/keystrokesmod/client/module/modules/world/AntiBot.java index 24939e05..81611913 100644 --- a/src/main/java/keystrokesmod/client/module/modules/world/AntiBot.java +++ b/src/main/java/keystrokesmod/client/module/modules/world/AntiBot.java @@ -8,7 +8,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.util.HashMap; @@ -26,7 +26,7 @@ public void onDisable() { newEnt.clear(); } - @FMLEvent + @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { if(!Utils.Player.isPlayerInGame()) return; if (a.isToggled() && event.entity instanceof EntityPlayer && event.entity != mc.thePlayer) { diff --git a/src/main/java/keystrokesmod/client/module/modules/world/ChatLogger.java b/src/main/java/keystrokesmod/client/module/modules/world/ChatLogger.java index 499a07c4..9d8cec08 100644 --- a/src/main/java/keystrokesmod/client/module/modules/world/ChatLogger.java +++ b/src/main/java/keystrokesmod/client/module/modules/world/ChatLogger.java @@ -2,7 +2,7 @@ import keystrokesmod.client.module.Module; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.*; import java.time.LocalDateTime; @@ -42,7 +42,7 @@ public void onEnable() { super.onEnable(); } - @FMLEvent + @SubscribeEvent public void onMessageRecieved(ClientChatReceivedEvent c) { try(FileWriter fw = new FileWriter(this.chatLog.getPath(), true); BufferedWriter bw = new BufferedWriter(fw); diff --git a/src/main/java/keystrokesmod/client/module/setting/Setting.java b/src/main/java/keystrokesmod/client/module/setting/Setting.java index a8553361..97d44dae 100644 --- a/src/main/java/keystrokesmod/client/module/setting/Setting.java +++ b/src/main/java/keystrokesmod/client/module/setting/Setting.java @@ -2,7 +2,7 @@ import com.google.gson.JsonObject; import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; +import keystrokesmod.client.clickgui.raven.components.ModuleComponent; public abstract class Setting { public String settingName; diff --git a/src/main/java/keystrokesmod/client/module/setting/impl/ComboSetting.java b/src/main/java/keystrokesmod/client/module/setting/impl/ComboSetting.java index cc82c7bf..c4dbfd7d 100644 --- a/src/main/java/keystrokesmod/client/module/setting/impl/ComboSetting.java +++ b/src/main/java/keystrokesmod/client/module/setting/impl/ComboSetting.java @@ -2,8 +2,7 @@ import com.google.gson.JsonObject; import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.raven.settings.ComboComponent; +import keystrokesmod.client.clickgui.raven.components.ModuleComponent; import keystrokesmod.client.module.setting.Setting; public class ComboSetting> extends Setting { @@ -55,7 +54,7 @@ public void applyConfigFromJson(JsonObject data) { @Override public Component createComponent(ModuleComponent moduleComponent) { - return new ComboComponent(this, moduleComponent); + return null; } public T getMode(){ diff --git a/src/main/java/keystrokesmod/client/module/setting/impl/DescriptionSetting.java b/src/main/java/keystrokesmod/client/module/setting/impl/DescriptionSetting.java index 18f8ebab..d6c3aec0 100644 --- a/src/main/java/keystrokesmod/client/module/setting/impl/DescriptionSetting.java +++ b/src/main/java/keystrokesmod/client/module/setting/impl/DescriptionSetting.java @@ -2,8 +2,7 @@ import com.google.gson.JsonObject; import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.raven.settings.DescriptionComponent; +import keystrokesmod.client.clickgui.raven.components.ModuleComponent; import keystrokesmod.client.module.setting.Setting; public class DescriptionSetting extends Setting { @@ -52,6 +51,6 @@ public void applyConfigFromJson(JsonObject data) { @Override public Component createComponent(ModuleComponent moduleComponent) { - return new DescriptionComponent(this, moduleComponent); + return null; } } diff --git a/src/main/java/keystrokesmod/client/module/setting/impl/DoubleSliderSetting.java b/src/main/java/keystrokesmod/client/module/setting/impl/DoubleSliderSetting.java index 097ebb73..ac19e039 100644 --- a/src/main/java/keystrokesmod/client/module/setting/impl/DoubleSliderSetting.java +++ b/src/main/java/keystrokesmod/client/module/setting/impl/DoubleSliderSetting.java @@ -2,8 +2,7 @@ import com.google.gson.JsonObject; import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.raven.settings.RangeSliderComponent; +import keystrokesmod.client.clickgui.raven.components.ModuleComponent; import keystrokesmod.client.module.setting.Setting; import java.math.BigDecimal; @@ -65,7 +64,7 @@ public void applyConfigFromJson(JsonObject data) { @Override public Component createComponent(ModuleComponent moduleComponent) { - return new RangeSliderComponent(this, moduleComponent); + return null; } public double getInputMin() { diff --git a/src/main/java/keystrokesmod/client/module/setting/impl/SliderSetting.java b/src/main/java/keystrokesmod/client/module/setting/impl/SliderSetting.java index 3b7fb56b..2fcff480 100644 --- a/src/main/java/keystrokesmod/client/module/setting/impl/SliderSetting.java +++ b/src/main/java/keystrokesmod/client/module/setting/impl/SliderSetting.java @@ -2,8 +2,7 @@ import com.google.gson.JsonObject; import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.raven.settings.SliderComponent; +import keystrokesmod.client.clickgui.raven.components.ModuleComponent; import keystrokesmod.client.module.setting.Setting; import java.math.BigDecimal; @@ -59,7 +58,7 @@ public void applyConfigFromJson(JsonObject data) { @Override public Component createComponent(ModuleComponent moduleComponent) { - return new SliderComponent(this, moduleComponent); + return null; } public double getInput() { diff --git a/src/main/java/keystrokesmod/client/module/setting/impl/TickSetting.java b/src/main/java/keystrokesmod/client/module/setting/impl/TickSetting.java index e6300569..829a07a3 100644 --- a/src/main/java/keystrokesmod/client/module/setting/impl/TickSetting.java +++ b/src/main/java/keystrokesmod/client/module/setting/impl/TickSetting.java @@ -2,8 +2,7 @@ import com.google.gson.JsonObject; import keystrokesmod.client.clickgui.raven.Component; -import keystrokesmod.client.clickgui.raven.ModuleComponent; -import keystrokesmod.client.clickgui.raven.settings.TickComponent; +import keystrokesmod.client.clickgui.raven.components.ModuleComponent; import keystrokesmod.client.module.setting.Setting; public class TickSetting extends Setting { @@ -50,7 +49,7 @@ public void applyConfigFromJson(JsonObject data) { @Override public Component createComponent(ModuleComponent moduleComponent) { - return new TickComponent(this, moduleComponent); + return null; } public boolean isToggled() { diff --git a/src/main/java/keystrokesmod/client/utils/ChatHelper.java b/src/main/java/keystrokesmod/client/utils/ChatHelper.java index 8d7e0a9c..383105f9 100644 --- a/src/main/java/keystrokesmod/client/utils/ChatHelper.java +++ b/src/main/java/keystrokesmod/client/utils/ChatHelper.java @@ -2,13 +2,13 @@ import keystrokesmod.client.clickgui.raven.CommandLine; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ChatHelper { private static boolean e = false; private static long s = 0L; - @FMLEvent + @SubscribeEvent public void onChatMessageReceived(ClientChatReceivedEvent event) { if (e && Utils.Player.isPlayerInGame()) { if (Utils.Java.str(event.message.getUnformattedText()).startsWith("Unknown")) { diff --git a/src/main/java/keystrokesmod/client/utils/DebugInfoRenderer.java b/src/main/java/keystrokesmod/client/utils/DebugInfoRenderer.java index 9918738e..32249281 100644 --- a/src/main/java/keystrokesmod/client/utils/DebugInfoRenderer.java +++ b/src/main/java/keystrokesmod/client/utils/DebugInfoRenderer.java @@ -5,7 +5,7 @@ import keystrokesmod.client.module.modules.player.Freecam; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent; @@ -14,7 +14,7 @@ public class DebugInfoRenderer extends net.minecraft.client.gui.Gui { private static final Minecraft mc = Minecraft.getMinecraft(); - @FMLEvent + @SubscribeEvent public void onRenderTick(RenderTickEvent ev) { if (Raven.debugger && ev.phase == Phase.END && Utils.Player.isPlayerInGame()) { if (mc.currentScreen == null) { diff --git a/src/main/java/keystrokesmod/client/utils/mouseManager.java b/src/main/java/keystrokesmod/client/utils/mouseManager.java index 82299335..7497705d 100644 --- a/src/main/java/keystrokesmod/client/utils/mouseManager.java +++ b/src/main/java/keystrokesmod/client/utils/mouseManager.java @@ -5,7 +5,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraftforge.client.event.MouseEvent; -import keystrokesmod.client.lib.fr.jmraich.rax.event.FMLEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.util.ArrayList; import java.util.List; @@ -16,7 +16,7 @@ public class mouseManager { public static long leftClickTimer = 0L; public static long rightClickTimer = 0L; - @FMLEvent + @SubscribeEvent public void onMouseUpdate(MouseEvent mouse) { if (mouse.buttonstate) { if (mouse.button == 0) { diff --git a/src/main/resources/assets/keystrokes/version b/src/main/resources/assets/keystrokes/version index 93325961..9ffec73d 100644 --- a/src/main/resources/assets/keystrokes/version +++ b/src/main/resources/assets/keystrokes/version @@ -1 +1 @@ -1-0-18 \ No newline at end of file +1-0-19 \ No newline at end of file