├── ClickGui ├── ClickGui.java ├── comp │ ├── CategoryManager.java │ ├── ClickGuiCategoryButton.java │ └── ModButton.java └── modSetting │ ├── ModSettingGui.java │ └── ModSettingManager.java ├── LICENSE ├── README.md └── Roundedutil.java /ClickGui/ClickGui.java: -------------------------------------------------------------------------------- 1 | package mc.red.Gui.ClickGui; 2 | 3 | import java.awt.Color; 4 | import java.io.IOException; 5 | import java.util.ArrayList; 6 | 7 | import org.lwjgl.input.Mouse; 8 | import org.lwjgl.opengl.GL11; 9 | 10 | import mc.red.Gui.ClickGui.comp.CategoryManager; 11 | import mc.red.Gui.ClickGui.comp.ClickGuiCategoryButton; 12 | import mc.red.Gui.ClickGui.comp.ModButton; 13 | import mc.red.Gui.ClickGui.modSetting.ModSettingGui; 14 | import mc.red.Gui.ClickGui.modSetting.ModSettingManager; 15 | import mc.red.mods.ModInstances; 16 | import net.minecraft.client.Minecraft; 17 | import net.minecraft.client.gui.Gui; 18 | import net.minecraft.client.gui.GuiScreen; 19 | import net.minecraft.client.gui.ScaledResolution; 20 | import net.minecraft.client.renderer.GlStateManager; 21 | import net.minecraft.util.ResourceLocation; 22 | 23 | public class ClickGui extends GuiScreen{ 24 | 25 | public static ArrayList clickGuiCategoryButton = new ArrayList<>(); 26 | 27 | public static ArrayList modButtonToRender = new ArrayList<>(); 28 | 29 | ScaledResolution sr; 30 | private ModSettingManager msManager; 31 | 32 | int backgroundW = 200; 33 | int centerW; 34 | int centerH; 35 | 36 | 37 | @Override 38 | public void initGui() { 39 | //Enable Minecrafts blur shader 40 | mc.entityRenderer.loadShader(new ResourceLocation("shaders/post/menu_blur.json")); 41 | 42 | sr = new ScaledResolution(mc); 43 | centerW = sr.getScaledWidth()/2; 44 | centerH = sr.getScaledHeight()/2; 45 | reset(); 46 | this.clickGuiCategoryButton.add(new ClickGuiCategoryButton(centerW - 200, centerH - 65,100,20, "Player",0)); 47 | this.clickGuiCategoryButton.add(new ClickGuiCategoryButton(centerW - 200, centerH - 45,100,20, "World",1)); 48 | this.clickGuiCategoryButton.add(new ClickGuiCategoryButton(centerW - 200, centerH - 25,100,20, "Render",2)); 49 | this.clickGuiCategoryButton.add(new ClickGuiCategoryButton(centerW - 200, centerH - 5,100,20, "Util",3)); 50 | this.clickGuiCategoryButton.add(new ClickGuiCategoryButton(centerW - 200, centerH + 15,100,20, "HudManager",4)); 51 | 52 | int modButtonW = 260; 53 | int modButtonH = 25; 54 | int spaceBetween = 26; 55 | 56 | //player 57 | this.modButtonToRender.add(new ModButton(centerW,centerH, modButtonW, modButtonH, ModInstances.getModToggleSprintSneak(),0)); 58 | this.modButtonToRender.add(new ModButton(centerW,centerH + 1*spaceBetween, modButtonW, modButtonH, ModInstances.getModKeyStrokes(),0)); 59 | this.modButtonToRender.add(new ModButton(centerW,centerH + 2*spaceBetween, modButtonW, modButtonH, ModInstances.getModArmorStatus(),0)); 60 | this.modButtonToRender.add(new ModButton(centerW,centerH + 3*spaceBetween, modButtonW, modButtonH, ModInstances.getModFPS(),0)); 61 | this.modButtonToRender.add(new ModButton(centerW,centerH + 4*spaceBetween, modButtonW, modButtonH, ModInstances.getModAVGFPS(),0)); 62 | this.modButtonToRender.add(new ModButton(centerW,centerH + 5*spaceBetween, modButtonW, modButtonH, ModInstances.getModCPS(),0)); 63 | this.modButtonToRender.add(new ModButton(centerW,centerH + 6*spaceBetween, modButtonW, modButtonH, ModInstances.getModPlayerModel(),0)); 64 | this.modButtonToRender.add(new ModButton(centerW,centerH + 7*spaceBetween, modButtonW, modButtonH, ModInstances.getModBPS(),0)); 65 | //world 66 | this.modButtonToRender.add(new ModButton(centerW,centerH, modButtonW, modButtonH, ModInstances.getModXYZ(),1)); 67 | 68 | //render 69 | this.modButtonToRender.add(new ModButton(centerW,centerH, modButtonW, modButtonH, ModInstances.getModHelloWorld(),2)); 70 | this.modButtonToRender.add(new ModButton(centerW,centerH + 1*spaceBetween, modButtonW, modButtonH, ModInstances.getModAnimations(),2)); 71 | this.modButtonToRender.add(new ModButton(centerW,centerH + 2*spaceBetween, modButtonW, modButtonH, ModInstances.getModMotionBlur(),2)); 72 | 73 | //util 74 | this.modButtonToRender.add(new ModButton(centerW,centerH, modButtonW, modButtonH, ModInstances.getModTargetHUD(),3)); 75 | 76 | msManager = new ModSettingManager(centerW,centerH); 77 | } 78 | @Override 79 | public void onGuiClosed() { 80 | //Disable Minecrafts blur shader 81 | mc.entityRenderer.loadEntityShader(null); 82 | super.onGuiClosed(); 83 | 84 | } 85 | 86 | @Override 87 | public void drawScreen(int mouseX, int mouseY, float partialTicks) { 88 | 89 | 90 | super.drawScreen(mouseX, mouseY, partialTicks); 91 | //update center w 92 | centerW = sr.getScaledWidth()/2; 93 | centerH = sr.getScaledHeight()/2; 94 | 95 | GlStateManager.pushAttrib(); //idk why i do this i sohuld learn gl 96 | GlStateManager.pushMatrix(); 97 | Gui.drawRoundedRect(centerW - backgroundW, centerH - 100, centerW + backgroundW, centerH + 100, 8, new Color(245, 242, 233,255).getRGB()); 98 | Gui.drawRoundedRect(centerW - backgroundW + 390, centerH - 100, centerW + backgroundW, centerH + 100, 8, new Color(138, 66, 88,255).getRGB()); 99 | GlStateManager.popMatrix(); 100 | msManager.render(); 101 | 102 | for(ClickGuiCategoryButton clickGuiCategoryButton :clickGuiCategoryButton) { 103 | clickGuiCategoryButton.renderButton(); 104 | } 105 | 106 | int wheel = Mouse.getDWheel(); 107 | for (ModButton modButton : modButtonToRender) { 108 | if(modButton.id == CategoryManager.currentPage) { 109 | GL11.glEnable(GL11.GL_SCISSOR_TEST); 110 | this.glScissor(centerW - backgroundW, centerH - 90, centerW + backgroundW, 180); 111 | modButton.render(); 112 | if (wheel < 0) { 113 | modButton.y -= 8; 114 | } else if (wheel > 0) { 115 | modButton.y += 8; 116 | } 117 | GL11.glDisable(GL11.GL_SCISSOR_TEST); 118 | } 119 | } 120 | 121 | //idk why i did this i shuold learn gl 122 | GlStateManager.popAttrib(); 123 | //System.out.println("2"); 124 | 125 | } 126 | 127 | @Override 128 | protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { 129 | super.mouseClicked(mouseX, mouseY, mouseButton); 130 | if(mouseX >= (centerW - backgroundW) && mouseX <= (centerW + backgroundW) && mouseY >= (centerH - 90) && mouseY <= (centerH + 90)) { 131 | for(ModButton modButton : modButtonToRender) { 132 | if(modButton.id == CategoryManager.currentPage) { 133 | modButton.onClick(mouseX, mouseY, mouseButton); 134 | } 135 | } 136 | } 137 | 138 | for(ClickGuiCategoryButton clickGuiCategoryButton :clickGuiCategoryButton) { 139 | clickGuiCategoryButton.onClick(mouseX, mouseY, mouseButton); 140 | } 141 | 142 | } 143 | public static ArrayList getClickGuiCategoryButton() { 144 | return clickGuiCategoryButton; 145 | } 146 | 147 | @Override 148 | protected void keyTyped(char typedChar, int keyCode) throws IOException { 149 | // TODO Auto-generated method stub 150 | super.keyTyped(typedChar, keyCode); 151 | } 152 | 153 | private static void reset() { 154 | modButtonToRender.removeAll(modButtonToRender); 155 | clickGuiCategoryButton.removeAll(clickGuiCategoryButton); 156 | 157 | } 158 | 159 | private void glScissor(double x, double y, double width, double height) { 160 | 161 | y += height; 162 | 163 | ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); 164 | 165 | Minecraft mc = Minecraft.getMinecraft(); 166 | 167 | GL11.glScissor((int) ((x * mc.displayWidth) / scaledResolution.getScaledWidth()), 168 | (int) (((scaledResolution.getScaledHeight() - y) * mc.displayHeight) / scaledResolution.getScaledHeight()), 169 | (int) (width * mc.displayWidth / scaledResolution.getScaledWidth()), 170 | (int) (height * mc.displayHeight / scaledResolution.getScaledHeight())); 171 | } 172 | 173 | 174 | 175 | } 176 | 177 | -------------------------------------------------------------------------------- /ClickGui/comp/CategoryManager.java: -------------------------------------------------------------------------------- 1 | package mc.red.Gui.ClickGui.comp; 2 | 3 | import java.util.ArrayList; 4 | 5 | import mc.red.RedClient; 6 | import mc.red.Gui.ClickGui.ClickGui; 7 | import mc.red.Gui.hud.HUDManager; 8 | 9 | public class CategoryManager { 10 | 11 | public static int currentPage = 0; 12 | public static boolean openDragScreen = false; 13 | 14 | public static void thisPage(int number) { 15 | currentPage=number; 16 | ArrayList category = ClickGui.getClickGuiCategoryButton(); 17 | 18 | for(int i = 0; i< category.size();i++) { 19 | if(i != currentPage) { 20 | category.get(i).setIsOnThisPage(false); 21 | } 22 | } 23 | 24 | if(currentPage == 4) { 25 | currentPage = 0; 26 | openDragScreen = true; 27 | } 28 | } 29 | 30 | 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ClickGui/comp/ClickGuiCategoryButton.java: -------------------------------------------------------------------------------- 1 | package mc.red.Gui.ClickGui.comp; 2 | 3 | import java.awt.Color; 4 | 5 | import mc.red.util.animation.AnimationEngine; 6 | import net.minecraft.client.Minecraft; 7 | import net.minecraft.client.gui.Gui; 8 | 9 | public class ClickGuiCategoryButton extends CategoryManager{ 10 | public int x,y,w,h,r; 11 | private String name; 12 | private boolean isOnThisPage = false; 13 | //this is use for the categorymanager toknow which page this is on 14 | private int number = 0; 15 | CategoryManager categoryManager; 16 | 17 | private AnimationEngine animation = new AnimationEngine(x, x+w, 500,false); 18 | 19 | public ClickGuiCategoryButton(int x, int y, int w, int h, String name, int number) { 20 | this.x = x; 21 | this.y = y; 22 | this.w = w; 23 | this.h = h; 24 | this.name = name; 25 | this.number = number; 26 | animation.AnimationUpdateValue(x, x+w, 500,false); 27 | 28 | } 29 | 30 | 31 | 32 | 33 | public void renderButton(){ 34 | 35 | //System.out.println(name + ": " + animation.getAnimationValue()); 36 | if(animation.getAnimationValue() >=x+1) { 37 | Gui.drawRoundedRect(x, y, animation.getAnimationValue(), y+h, 5, new Color(191,226,246,255).getRGB()); 38 | Minecraft.getMinecraft().fontRendererObj.drawString(name, x + w/2 - Minecraft.getMinecraft().fontRendererObj.getStringWidth(name)/2, 39 | y + h/2 - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT/2, new Color( 40 | 20, 23, 34,255).getRGB()); 41 | } 42 | else { 43 | Minecraft.getMinecraft().fontRendererObj.drawString(name, x + w/2 - Minecraft.getMinecraft().fontRendererObj.getStringWidth(name)/2, 44 | y + h/2 - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT/2, new Color( 45 | 20, 23, 34,255).getRGB()); 46 | } 47 | //Gui.drawRoundedRect(x, y, x+w, y+h, 5, new Color(226,240,240,255).getRGB()); 48 | 49 | if(CategoryManager.currentPage == number) { 50 | isOnThisPage = true; 51 | animation.setIsDrawAnimation(true); 52 | //animation.setIsDrawBackWardsAnimation(false); 53 | } 54 | 55 | else if(!isOnThisPage) { 56 | animation.resetUsingBackWardsAnimation(); 57 | } 58 | 59 | 60 | } 61 | 62 | public void onClick(int mouseX, int mouseY, int button) { 63 | if(mouseX >= x && mouseX <= x + w && mouseY >= y && mouseY <= y + h) { 64 | animation.setIsDrawAnimation(true); 65 | this.isOnThisPage = true; 66 | CategoryManager.thisPage(number); 67 | } 68 | } 69 | 70 | public String getName() { 71 | return name; 72 | } 73 | public boolean isOnThisPage() { 74 | return isOnThisPage; 75 | 76 | } 77 | 78 | public void setIsOnThisPage(boolean value) { 79 | this.isOnThisPage = value; 80 | 81 | } 82 | 83 | 84 | 85 | } 86 | -------------------------------------------------------------------------------- /ClickGui/comp/ModButton.java: -------------------------------------------------------------------------------- 1 | package mc.red.Gui.ClickGui.comp; 2 | 3 | import java.awt.Color; 4 | 5 | import org.lwjgl.opengl.GL11; 6 | 7 | import mc.red.Gui.ClickGui.ClickGui; 8 | import mc.red.Gui.ClickGui.modSetting.ModSettingManager; 9 | import mc.red.mods.Mod; 10 | import net.minecraft.client.Minecraft; 11 | import net.minecraft.client.gui.Gui; 12 | import net.minecraft.client.gui.ScaledResolution; 13 | 14 | public class ModButton { 15 | 16 | public int x,y,w,h; 17 | public Mod mod; 18 | public int id; 19 | 20 | public ModButton(int x, int y, int w, int h, Mod mod, int id) { 21 | this.x = x-85; 22 | this.y = y-80; 23 | this.w = w; 24 | this.h = h; 25 | this.mod = mod; 26 | this.id = id; 27 | } 28 | 29 | public void render() { 30 | 31 | Gui.drawRoundedRect(x , y , x+w , y+h , 8, new Color(224,214,214,255).getRGB()); 32 | Gui.drawRoundedRect((x+w)-28, (y+h)-18, (x+w)-5 , (y+h)-7, 8, getColor()); 33 | Minecraft.getMinecraft().fontRendererObj.drawString(mod.name, x +8, y +8, new Color(0,0,0,255).getRGB()); 34 | 35 | } 36 | 37 | private int getColor() { 38 | if(mod.isEnabled()) { 39 | return new Color(131,255,92,255).getRGB(); 40 | } else { 41 | return new Color(255,64,59,255).getRGB(); 42 | } 43 | 44 | } 45 | 46 | public void onClick(int mouseX, int mouseY, int button) { 47 | if(button == 0) { 48 | if(mouseX >= x && mouseX <= x + w && mouseY >= y && mouseY <= y + h) { 49 | if(mod.isEnabled()) { 50 | mod.setEnabled(false); 51 | } 52 | else { 53 | mod.setEnabled(true); 54 | } 55 | 56 | } 57 | } 58 | else if(button == 1) { 59 | if(mouseX >= x && mouseX <= x + w && mouseY >= y && mouseY <= y + h) { 60 | if(ModSettingManager.mod != mod) { 61 | ModSettingManager.mod = mod; 62 | } 63 | else { 64 | ModSettingManager.mod = null; 65 | } 66 | } 67 | } 68 | 69 | } 70 | 71 | 72 | 73 | 74 | 75 | } 76 | -------------------------------------------------------------------------------- /ClickGui/modSetting/ModSettingGui.java: -------------------------------------------------------------------------------- 1 | package mc.red.Gui.ClickGui.modSetting; 2 | 3 | import java.awt.Color; 4 | 5 | import mc.red.mods.Mod; 6 | import net.minecraft.client.Minecraft; 7 | import net.minecraft.client.gui.FontRenderer; 8 | import net.minecraft.client.gui.Gui; 9 | 10 | public class ModSettingGui { 11 | public Mod mod; 12 | public int x,y,w,h; 13 | 14 | public ModSettingGui(int x, int y, int w, int h,Mod mod) { 15 | this.x = x; 16 | this.y = y; 17 | this.w = w; 18 | this.h = h; 19 | this.mod = mod; 20 | } 21 | 22 | 23 | public void render() { 24 | Gui.drawRoundedRect(x , y , x+w , y+h, 8, new Color(245, 242, 233,255).getRGB()); 25 | Gui.drawRoundedRect(x , y , x+w , y+10, 8, new Color(138, 66, 88,255).getRGB()); 26 | Minecraft.getMinecraft().fontRendererObj.drawString(mod.name + " : " + mod.isEnabled(), x + 3, y + 13, new Color(0,0,0,255).getRGB()); 27 | Minecraft.getMinecraft().fontRendererObj.drawString(mod.description, x + 3, y + 23, new Color(0,0,0,255).getRGB()); 28 | } 29 | 30 | 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ClickGui/modSetting/ModSettingManager.java: -------------------------------------------------------------------------------- 1 | package mc.red.Gui.ClickGui.modSetting; 2 | 3 | import java.util.ArrayList; 4 | 5 | import mc.red.Gui.ClickGui.ClickGui; 6 | import mc.red.Gui.ClickGui.comp.ModButton; 7 | import mc.red.mods.Mod; 8 | 9 | 10 | public class ModSettingManager { 11 | public ArrayList modSettingRender = new ArrayList<>(); 12 | 13 | public static Mod mod = null; 14 | 15 | 16 | public ModSettingManager(int centerW, int centerH) { 17 | //reset 18 | modSettingRender.removeAll(modSettingRender); 19 | 20 | //add 21 | System.out.println(centerW); 22 | for(ModButton modButton : ClickGui.modButtonToRender) { 23 | this.modSettingRender.add(new ModSettingGui(centerW+205, centerH-100, 200, 200, modButton.mod)); 24 | } 25 | } 26 | 27 | public void render() { 28 | if(mod != null) { 29 | for(ModSettingGui modSettingGui : modSettingRender) { 30 | if(modSettingGui.mod == mod) { 31 | modSettingGui.render(); 32 | continue; 33 | } 34 | } 35 | } 36 | 37 | } 38 | 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 lee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Temporarily deprecated project. 2 | Please see the newest issue 3 | 4 | 5 | # EasyClickGui 6 | Easy Minecraft Click Gui for mcp/mixin 7 | I code this a long time ago and it might not be perfect 8 | you will also need rounded utils for this to work 9 | 10 | Please note that you will need animationengine for the animation to work 11 | https://github.com/nullpointerexceptionkek/AnimationEngine 12 | 13 | 14 | 15 | I am currently working on a new project that renders ClickGui on the user's web browser, which will be open-source after reaching a stable status. 16 | 17 | a demo is shown below 18 | 19 | ![image](https://github.com/user-attachments/assets/5092f79e-7ded-4b0b-9826-5abdb6a0cd48) 20 | 21 | -------------------------------------------------------------------------------- /Roundedutil.java: -------------------------------------------------------------------------------- 1 | final static Minecraft mc = Minecraft.getMinecraft(); 2 | final static FontRenderer fr = mc.fontRendererObj; 3 | 4 | public static void enableGL2D() { 5 | glDisable(GL_DEPTH_TEST); 6 | glEnable(GL_BLEND); 7 | glDisable(GL_TEXTURE_2D); 8 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 9 | glDepthMask(true); 10 | glEnable(GL_LINE_SMOOTH); 11 | glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); 12 | glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); 13 | } 14 | 15 | public static void disableGL2D() { 16 | glEnable(GL_TEXTURE_2D); 17 | glDisable(GL_BLEND); 18 | glEnable(GL_DEPTH_TEST); 19 | glDisable(GL_LINE_SMOOTH); 20 | glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE); 21 | glHint(GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE); 22 | } 23 | /* 24 | * 25 | * NORMAL 26 | * 27 | */ 28 | 29 | /** 30 | * @param x : X pos 31 | * @param y : Y pos 32 | * @param x1 : X2 pos 33 | * @param y1 : Y2 pos 34 | * @param radius : round of edges; 35 | * @param color : color; 36 | */ 37 | 38 | public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) { 39 | glPushAttrib(0); 40 | glScaled(0.5D, 0.5D, 0.5D); 41 | x *= 2.0D; 42 | y *= 2.0D; 43 | x1 *= 2.0D; 44 | y1 *= 2.0D; 45 | glEnable(GL_BLEND); 46 | glDisable(GL_TEXTURE_2D); 47 | glEnable(GL_LINE_SMOOTH); 48 | setColor(color); 49 | glEnable(GL_LINE_SMOOTH); 50 | glBegin(GL_POLYGON); 51 | int i; 52 | for (i = 0; i <= 90; i += 3) 53 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 54 | for (i = 90; i <= 180; i += 3) 55 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 56 | for (i = 0; i <= 90; i += 3) 57 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); 58 | for (i = 90; i <= 180; i += 3) 59 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); 60 | glEnd(); 61 | glBegin(GL_LINE_LOOP); 62 | for (i = 0; i <= 90; i += 3) 63 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 64 | for (i = 90; i <= 180; i += 3) 65 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 66 | for (i = 0; i <= 90; i += 3) 67 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); 68 | for (i = 90; i <= 180; i += 3) 69 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); 70 | glEnd(); 71 | glEnable(GL_TEXTURE_2D); 72 | glDisable(GL_BLEND); 73 | glDisable(GL_LINE_SMOOTH); 74 | glDisable(GL_LINE_SMOOTH); 75 | glEnable(GL_TEXTURE_2D); 76 | glScaled(2.0D, 2.0D, 2.0D); 77 | glPopAttrib(); 78 | glLineWidth(1); 79 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); 80 | } 81 | public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) { 82 | glPushAttrib(0); 83 | glScaled(0.5D, 0.5D, 0.5D); 84 | x *= 2.0D; 85 | y *= 2.0D; 86 | x1 *= 2.0D; 87 | y1 *= 2.0D; 88 | glEnable(GL_BLEND); 89 | glDisable(GL_TEXTURE_2D); 90 | glEnable(GL_LINE_SMOOTH); 91 | setColor(color); 92 | glEnable(GL_LINE_SMOOTH); 93 | glBegin(GL_POLYGON); 94 | int i; 95 | for (i = 0; i <= 90; i += 3) 96 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 97 | for (i = 90; i <= 180; i += 3) 98 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 99 | for (i = 0; i <= 90; i += 3) 100 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); 101 | for (i = 90; i <= 180; i += 3) 102 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); 103 | glEnd(); 104 | glEnable(GL_TEXTURE_2D); 105 | glDisable(GL_BLEND); 106 | glDisable(GL_LINE_SMOOTH); 107 | glDisable(GL_BLEND); 108 | glDisable(GL_LINE_SMOOTH); 109 | glScaled(2.0D, 2.0D, 2.0D); 110 | glEnable(GL_BLEND); 111 | glPopAttrib(); 112 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); 113 | } 114 | /** 115 | * @param x : X pos 116 | * @param y : Y pos 117 | * @param x1 : X2 pos 118 | * @param y1 : Y2 pos 119 | * @param radius : round of edges; 120 | * @param lineWidth : width of outline line; 121 | * @param color : color; 122 | */ 123 | 124 | public static void drawRoundedOutline(float x, float y, float x1, float y1, float radius,float lineWidth, int color) { 125 | glPushAttrib(0); 126 | glScaled(0.5D, 0.5D, 0.5D); 127 | x *= 2.0D; 128 | y *= 2.0D; 129 | x1 *= 2.0D; 130 | y1 *= 2.0D; 131 | glEnable(GL_BLEND); 132 | glDisable(GL_TEXTURE_2D); 133 | setColor(color); 134 | glEnable(GL_LINE_SMOOTH); 135 | glLineWidth(lineWidth); 136 | glBegin(GL_LINE_LOOP); 137 | int i; 138 | for (i = 0; i <= 90; i += 3) 139 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 140 | for (i = 90; i <= 180; i += 3) 141 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 142 | for (i = 0; i <= 90; i += 3) 143 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); 144 | for (i = 90; i <= 180; i += 3) 145 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); 146 | glEnd(); 147 | glEnable(GL_TEXTURE_2D); 148 | glDisable(GL_BLEND); 149 | glDisable(GL_LINE_SMOOTH); 150 | glDisable(GL_BLEND); 151 | glEnable(GL_TEXTURE_2D); 152 | glScaled(2.0D, 2.0D, 2.0D); 153 | glPopAttrib(); 154 | glLineWidth(1); 155 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); 156 | } 157 | 158 | /* 159 | * 160 | * SELECTED EDGES 161 | * 162 | */ 163 | 164 | /** 165 | * @param x : X pos 166 | * @param y : Y pos 167 | * @param x1 : X2 pos 168 | * @param y1 : Y2 pos 169 | * @param radius1 : round of left top edges; 170 | * @param radius2 : round of right top edges; 171 | * @param radius3 : round of left bottom edges; 172 | * @param radius4 : round of right bottom edges; 173 | * @param color : color; 174 | */ 175 | 176 | public static void drawSelectRoundedRect(float x, float y, float x1, float y1, float radius1,float radius2,float radius3,float radius4, int color) { 177 | glPushAttrib(0); 178 | glScaled(0.5D, 0.5D, 0.5D); 179 | x *= 2.0D; 180 | y *= 2.0D; 181 | x1 *= 2.0D; 182 | y1 *= 2.0D; 183 | glEnable(GL_BLEND); 184 | glDisable(GL_TEXTURE_2D); 185 | setColor(color); 186 | glEnable(GL_LINE_SMOOTH); 187 | glBegin(9); 188 | int i; 189 | for (i = 0; i <= 90; i += 3) 190 | glVertex2d(x + radius1 + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, y + radius1 + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D); 191 | for (i = 90; i <= 180; i += 3) 192 | glVertex2d(x + radius2 + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, y1 - radius2 + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D); 193 | for (i = 0; i <= 90; i += 3) 194 | glVertex2d(x1 - radius3 + Math.sin(i * Math.PI / 180.0D) * radius3, y1 - radius3 + Math.cos(i * Math.PI / 180.0D) * radius3); 195 | for (i = 90; i <= 180; i += 3) 196 | glVertex2d(x1 - radius4 + Math.sin(i * Math.PI / 180.0D) * radius4, y + radius4 + Math.cos(i * Math.PI / 180.0D) * radius4); 197 | glEnd(); 198 | glEnable(GL_TEXTURE_2D); 199 | glDisable(GL_BLEND); 200 | glDisable(GL_LINE_SMOOTH); 201 | glDisable(GL_BLEND); 202 | glEnable(GL_TEXTURE_2D); 203 | glScaled(2.0D, 2.0D, 2.0D); 204 | glPopAttrib(); 205 | glLineWidth(1); 206 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); 207 | } 208 | 209 | /** 210 | * @param x : X pos 211 | * @param y : Y pos 212 | * @param x1 : X2 pos 213 | * @param y1 : Y2 pos 214 | * @param radius1 : round of left top edges; 215 | * @param radius2 : round of right top edges; 216 | * @param radius3 : round of left bottom edges; 217 | * @param radius4 : round of right bottom edges; 218 | * @param lineWidth : width of outline line; 219 | * @param color : color; 220 | */ 221 | 222 | public static void drawSelectRoundedOutline(float x, float y, float x1, float y1, float radius1,float radius2,float radius3,float radius4,float lineWidth, int color) { 223 | glPushAttrib(0); 224 | glScaled(0.5D, 0.5D, 0.5D); 225 | x *= 2.0D; 226 | y *= 2.0D; 227 | x1 *= 2.0D; 228 | y1 *= 2.0D; 229 | glEnable(GL_BLEND); 230 | glDisable(GL_TEXTURE_2D); 231 | setColor(color); 232 | glEnable(GL_LINE_SMOOTH); 233 | glLineWidth(lineWidth); 234 | glBegin(GL_LINE_LOOP); 235 | int i; 236 | for (i = 0; i <= 90; i += 3) 237 | glVertex2d(x + radius1 + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, y + radius1 + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D); 238 | for (i = 90; i <= 180; i += 3) 239 | glVertex2d(x + radius2 + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, y1 - radius2 + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D); 240 | for (i = 0; i <= 90; i += 3) 241 | glVertex2d(x1 - radius3 + Math.sin(i * Math.PI / 180.0D) * radius3, y1 - radius3 + Math.cos(i * Math.PI / 180.0D) * radius3); 242 | for (i = 90; i <= 180; i += 3) 243 | glVertex2d(x1 - radius4 + Math.sin(i * Math.PI / 180.0D) * radius4, y + radius4 + Math.cos(i * Math.PI / 180.0D) * radius4); 244 | glEnd(); 245 | glEnable(GL_TEXTURE_2D); 246 | glDisable(GL_BLEND); 247 | glDisable(GL_LINE_SMOOTH); 248 | glDisable(GL_BLEND); 249 | glEnable(GL_TEXTURE_2D); 250 | glScaled(2.0D, 2.0D, 2.0D); 251 | glPopAttrib(); 252 | glLineWidth(1); 253 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); 254 | } 255 | public static void setColor(int color) { 256 | float a = (color >> 24 & 0xFF) / 255.0F; 257 | float r = (color >> 16 & 0xFF) / 255.0F; 258 | float g = (color >> 8 & 0xFF) / 255.0F; 259 | float b = (color & 0xFF) / 255.0F; 260 | glColor4f(r, g, b, a); 261 | } 262 | 263 | /* 264 | * 265 | * GRADIENT 266 | * 267 | */ 268 | 269 | /** 270 | * @param x : X pos 271 | * @param y : Y pos 272 | * @param x1 : X2 pos 273 | * @param y1 : Y2 pos 274 | * @param radius : round of edges; 275 | * @param color : color; 276 | * @param color2 : color2; 277 | * @param color3 : color3; 278 | * @param color4 : color4; 279 | */ 280 | public static void drawRoundedGradientRectCorner(float x, float y, float x1, float y1, float radius, int color, int color2, int color3, int color4) { 281 | setColor(-1); 282 | glEnable(GL_BLEND); 283 | glDisable(GL_TEXTURE_2D); 284 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 285 | glEnable(GL_LINE_SMOOTH); 286 | glShadeModel(GL_SMOOTH); 287 | 288 | glPushAttrib(0); 289 | glScaled(0.5D, 0.5D, 0.5D); 290 | x *= 2.0D; 291 | y *= 2.0D; 292 | x1 *= 2.0D; 293 | y1 *= 2.0D; 294 | glEnable(GL_BLEND); 295 | glDisable(GL_TEXTURE_2D); 296 | setColor(color); 297 | glEnable(GL_LINE_SMOOTH); 298 | glShadeModel(GL_SMOOTH); 299 | glBegin(9); 300 | int i; 301 | for (i = 0; i <= 90; i += 3) 302 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 303 | setColor(color2); 304 | for (i = 90; i <= 180; i += 3) 305 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 306 | setColor(color3); 307 | for (i = 0; i <= 90; i += 3) 308 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); 309 | setColor(color4); 310 | for (i = 90; i <= 180; i += 3) 311 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); 312 | glEnd(); 313 | glEnable(GL_TEXTURE_2D); 314 | glDisable(GL_BLEND); 315 | glDisable(GL_LINE_SMOOTH); 316 | glDisable(GL_BLEND); 317 | glEnable(GL_TEXTURE_2D); 318 | glScaled(2.0D, 2.0D, 2.0D); 319 | glPopAttrib(); 320 | 321 | 322 | glEnable(GL_TEXTURE_2D); 323 | glDisable(GL_BLEND); 324 | glDisable(GL_LINE_SMOOTH); 325 | glShadeModel(GL_FLAT); 326 | setColor(-1); 327 | } 328 | 329 | 330 | /** 331 | * @param x : X pos 332 | * @param y : Y pos 333 | * @param x1 : X2 pos 334 | * @param y1 : Y2 pos 335 | * @param width : width of line; 336 | * @param radius : round of edges; 337 | * @param color : color; 338 | * @param color2 : color2; 339 | * @param color3 : color3; 340 | * @param color4 : color4; 341 | */ 342 | public static void drawRoundedGradientOutlineCorner(float x, float y, float x1, float y1, float width, float radius, int color, int color2, int color3, int color4) { 343 | setColor(-1); 344 | glEnable(GL_BLEND); 345 | glDisable(GL_TEXTURE_2D); 346 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 347 | glEnable(GL_LINE_SMOOTH); 348 | glShadeModel(GL_SMOOTH); 349 | 350 | glPushAttrib(0); 351 | glScaled(0.5D, 0.5D, 0.5D); 352 | x *= 2.0D; 353 | y *= 2.0D; 354 | x1 *= 2.0D; 355 | y1 *= 2.0D; 356 | glEnable(GL_BLEND); 357 | glDisable(GL_TEXTURE_2D); 358 | setColor(color); 359 | glEnable(GL_LINE_SMOOTH); 360 | glShadeModel(GL_SMOOTH); 361 | glLineWidth(width); 362 | glBegin(GL_LINE_LOOP); 363 | int i; 364 | for (i = 0; i <= 90; i += 3) 365 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 366 | setColor(color2); 367 | for (i = 90; i <= 180; i += 3) 368 | glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); 369 | setColor(color3); 370 | for (i = 0; i <= 90; i += 3) 371 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); 372 | setColor(color4); 373 | for (i = 90; i <= 180; i += 3) 374 | glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); 375 | glEnd(); 376 | glLineWidth(1); 377 | glEnable(GL_TEXTURE_2D); 378 | glDisable(GL_BLEND); 379 | glDisable(GL_LINE_SMOOTH); 380 | glDisable(GL_BLEND); 381 | glEnable(GL_TEXTURE_2D); 382 | glScaled(2.0D, 2.0D, 2.0D); 383 | glPopAttrib(); 384 | 385 | 386 | glEnable(GL_TEXTURE_2D); 387 | glDisable(GL_BLEND); 388 | glDisable(GL_LINE_SMOOTH); 389 | glShadeModel(GL_FLAT); 390 | setColor(-1); 391 | } 392 | 393 | public static void drawImage(ResourceLocation image, float x, float y, float width, float height, float alpha) { 394 | GL11.glPushMatrix(); 395 | GL11.glDisable(2929); 396 | GL11.glEnable(3042); 397 | GL11.glDepthMask(false); 398 | OpenGlHelper.glBlendFunc(770, 771, 1, 0); 399 | GL11.glColor4f(1f, 1f, 1f, alpha); 400 | mc.getTextureManager().bindTexture(image); 401 | Gui.drawModalRectWithCustomSizedTexture((int) x, (int) y, 0.0f, 0.0f, (int) width, (int) height, width, height); 402 | GL11.glDepthMask(true); 403 | GL11.glDisable(3042); 404 | GL11.glEnable(2929); 405 | GL11.glPopMatrix(); 406 | 407 | GL11.glColor4f(1f, 1f, 1f, 1f); 408 | } 409 | 410 | public static void drawImage(ResourceLocation image, int x, int y, float width, float height, float alpha) { 411 | GL11.glPushMatrix(); 412 | GL11.glDisable((int) 2929); 413 | GL11.glEnable((int) 3042); 414 | GL11.glDepthMask((boolean) false); 415 | OpenGlHelper.glBlendFunc((int) 770, (int) 771, (int) 1, (int) 0); 416 | GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, alpha); 417 | mc.getTextureManager().bindTexture(image); 418 | Gui.drawModalRectWithCustomSizedTexture((int) x, (int) y, (float) 0.0f, (float) 0.0f, (int) width, (int) height, 419 | (float) width, (float) height); 420 | GL11.glDepthMask((boolean) true); 421 | GL11.glDisable((int) 3042); 422 | GL11.glEnable((int) 2929); 423 | GL11.glPopMatrix(); 424 | 425 | GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, 1f); 426 | } 427 | 428 | public static void drawImage(ResourceLocation image, float x, float y, float width, float height) { 429 | GL11.glDisable((int) 2929); 430 | GL11.glEnable((int) 3042); 431 | GL11.glDepthMask((boolean) false); 432 | OpenGlHelper.glBlendFunc((int) 770, (int) 771, (int) 1, (int) 0); 433 | GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, 1f); 434 | mc.getTextureManager().bindTexture(image); 435 | Gui.drawModalRectWithCustomSizedTexture((int) x, (int) y, (float) 0.0f, (float) 0.0f, (int) width, (int) height, (float) width, (float) height); 436 | GL11.glDepthMask((boolean) true); 437 | GL11.glDisable((int) 3042); 438 | GL11.glEnable((int) 2929); 439 | } 440 | --------------------------------------------------------------------------------