ROOT:挂端主文件夹

5x001 HeroGUIv2

下载

很明显的是,手动制作一个ClickGUI不仅很难,也在我的能力范围之外。所以,我们需要使用其他人制作的模版。我搜索到了一个很好的,可以在这里下载:

https://www.mediafire.com/file/nb4jc813eax023b/HeroGUI_v2.zip/file
(有可能需要挂梯子,如果大家下载不了的话在评论区告诉我,我会上传到蓝奏云一份)

打开你的下载文件夹,然后解压这个文件。你应该能看到一个叫de的文件夹。如果你看到的是HeroGUI_v2的话,进入这个文件夹,应该也可以看到de

随后,打开ROOT/src/minecraft文件夹,这里你应该至少可以看到两个已经存在了的文件夹,分别是me,和net。现在,将de这个文件夹拖到ROOT/src/minecraft里。现在,你的minecraft文件夹里应该长这个样子:
如果你没有看到assets文件夹的话,不用担心,当你最终构建模组的时候应该就有了。

配置HeroGUI,修改代码

现在回到IntelliJ,你应该可以看到你刚刚放进去的de文件夹。同时,你也可能发现了很多报错,这是正常的,因为这个HeroGUI是给另一个挂端做的,自然不适用于我们的挂端,所以我们需要进行一些修改。

先删掉de.Hero.example包,我们不需要它。

打开de.Hero.settings.SettingsManager,删掉里面所有的代码,并把这些粘贴到里面:

package de.Hero.settings;import me.hack.hackedclient.HackedClient;
import me.hack.hackedclient.module.Module;import java.util.ArrayList;// I have to delete all the comments for normal encodingpublic class SettingsManager {private ArrayList<Setting> settings;public SettingsManager(){this.settings = new ArrayList<>();}public void rSetting(Setting in){this.settings.add(in);}public ArrayList<Setting> getSettings(){return this.settings;}public ArrayList<Setting> getSettingsByMod(Module mod){ArrayList<Setting> out = new ArrayList<>();for(Setting s : getSettings()){if(s.getParentMod().equals(mod)){out.add(s);}}if(out.isEmpty()){return null;}return out;}public Setting getSettingByName(String name){for(Setting set : getSettings()){if(set.getName().equalsIgnoreCase(name)){return set;}}System.err.println("["+ HackedClient.instance.name + "] Error Setting NOT found: '" + name +"'!");return null;}}

我需要删掉所有的注释来保证正常的编码。同时,如果修改完后还有报错,不需要担心,这些我们以后会修改的。

打开de.Hero.settings.Setting,删掉里面所有的代码,并把这些代码粘贴到里面:

package de.Hero.settings;import me.hack.hackedclient.module.Module;import java.util.ArrayList;// I have to delete all the comments for normal encodingpublic class Setting {private String name;private Module parent;private String mode;private String sval;private ArrayList<String> options;private boolean bval;private double dval;private double min;private double max;private boolean onlyint = false;public Setting(String name, Module parent, String sval, ArrayList<String> options){this.name = name;this.parent = parent;this.sval = sval;this.options = options;this.mode = "Combo";}public Setting(String name, Module parent, boolean bval){this.name = name;this.parent = parent;this.bval = bval;this.mode = "Check";}public Setting(String name, Module parent, double dval, double min, double max, boolean onlyint){this.name = name;this.parent = parent;this.dval = dval;this.min = min;this.max = max;this.onlyint = onlyint;this.mode = "Slider";}public String getName(){return name;}public Module getParentMod(){return parent;}public String getValString(){return this.sval;}public void setValString(String in){this.sval = in;}public ArrayList<String> getOptions(){return this.options;}public boolean getValBoolean(){return this.bval;}public void setValBoolean(boolean in){this.bval = in;}public double getValDouble(){if(this.onlyint){this.dval = (int)dval;}return this.dval;}public void setValDouble(double in){this.dval = in;}public double getMin(){return this.min;}public double getMax(){return this.max;}public boolean isCombo(){return this.mode.equalsIgnoreCase("Combo") ? true : false;}public boolean isCheck(){return this.mode.equalsIgnoreCase("Check") ? true : false;}public boolean isSlider(){return this.mode.equalsIgnoreCase("Slider") ? true : false;}public boolean onlyInt(){return this.onlyint;}
}

打开de.Hero.clickgui.ClickGUI,删掉里面所有的代码,并把以下代码复制进去:

package de.Hero.clickgui;import java.awt.Color;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;import me.hack.hackedclient.HackedClient;
import me.hack.hackedclient.module.Category;
import me.hack.hackedclient.module.Module;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;import de.Hero.clickgui.elements.Element;
import de.Hero.clickgui.elements.ModuleButton;
import de.Hero.clickgui.elements.menu.ElementSlider;
import de.Hero.clickgui.util.ColorUtil;
import de.Hero.clickgui.util.FontUtil;
import de.Hero.settings.SettingsManager;// I have to delete all the comments for normal encodingpublic class ClickGUI extends GuiScreen {public static ArrayList<Panel> panels;public static ArrayList<Panel> rpanels;private ModuleButton mb = null;public SettingsManager setmgr;public ClickGUI() {setmgr = HackedClient.instance.settingsManager;FontUtil.setupFontUtils();panels = new ArrayList<>();double pwidth = 80;double pheight = 15;double px = 10;double py = 10;double pyplus = pheight + 10;for (final Category c : Category.values()) {String title = Character.toUpperCase(c.name().toLowerCase().charAt(0)) + c.name().toLowerCase().substring(1);ClickGUI.panels.add(new Panel(title, px, py, pwidth, pheight, false, this) {@Overridepublic void setup() {for (Module m : HackedClient.instance.moduleManager.getModules()) {if (!m.getCategory().equals(c))continue;this.Elements.add(new ModuleButton(m, this));}}});py += pyplus;}rpanels = new ArrayList<Panel>();for (Panel p : panels) {rpanels.add(p);}Collections.reverse(rpanels);}@Overridepublic void drawScreen(int mouseX, int mouseY, float partialTicks) {for (Panel p : panels) {p.drawScreen(mouseX, mouseY, partialTicks);}ScaledResolution s = new ScaledResolution(mc);GL11.glPushMatrix();GL11.glTranslated(s.getScaledWidth(), s.getScaledHeight(), 0);GL11.glScaled(0.5, 0.5, 0.5);FontUtil.drawStringWithShadow("b"+"y"+ "H"+"e"+"r"+"o"+"C"+"o"+"d"+"e", -Minecraft.getMinecraft().fontRendererObj.getStringWidth("b"+"y"+ "H"+"e"+"r"+"o"+"C"+"o"+"d"+"e"), -Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT, 0xff11F86B);GL11.glPopMatrix();mb = null;listen:for (Panel p : panels) {if (p != null && p.visible && p.extended && p.Elements != null&& p.Elements.size() > 0) {for (ModuleButton e : p.Elements) {if (e.listening) {mb = e;break listen;}}}}for (Panel panel : panels) {if (panel.extended && panel.visible && panel.Elements != null) {for (ModuleButton b : panel.Elements) {if (b.extended && b.menuelements != null && !b.menuelements.isEmpty()) {double off = 0;Color temp = ColorUtil.getClickGUIColor().darker();int outlineColor = new Color(temp.getRed(), temp.getGreen(), temp.getBlue(), 170).getRGB();for (Element e : b.menuelements) {e.offset = off;e.update();if(HackedClient.instance.settingsManager.getSettingByName("Design").getValString().equalsIgnoreCase("New")){Gui.drawRect(e.x, e.y, e.x + e.width + 2, e.y + e.height, outlineColor);}e.drawScreen(mouseX, mouseY, partialTicks);off += e.height;}}}}}if(mb != null){drawRect(0, 0, this.width, this.height, 0x88101010);GL11.glPushMatrix();GL11.glTranslatef(s.getScaledWidth() / 2, s.getScaledHeight() / 2, 0.0F);GL11.glScalef(4.0F, 4.0F, 0F);FontUtil.drawTotalCenteredStringWithShadow("Listening...", 0, -10, 0xffffffff);GL11.glScalef(0.5F, 0.5F, 0F);FontUtil.drawTotalCenteredStringWithShadow("Press 'ESCAPE' to unbind " + mb.mod.getName() + (mb.mod.getKey() > -1 ? " (" + Keyboard.getKeyName(mb.mod.getKey())+ ")" : ""), 0, 0, 0xffffffff);GL11.glScalef(0.25F, 0.25F, 0F);FontUtil.drawTotalCenteredStringWithShadow("by HeroCode", 0, 20, 0xffffffff);GL11.glPopMatrix();}super.drawScreen(mouseX, mouseY, partialTicks);}@Overridepublic void mouseClicked(int mouseX, int mouseY, int mouseButton) {if(mb != null)return;for (Panel panel : rpanels) {if (panel.extended && panel.visible && panel.Elements != null) {for (ModuleButton b : panel.Elements) {if (b.extended) {for (Element e : b.menuelements) {if (e.mouseClicked(mouseX, mouseY, mouseButton))return;}}}}}for (Panel p : rpanels) {if (p.mouseClicked(mouseX, mouseY, mouseButton))return;}try {super.mouseClicked(mouseX, mouseY, mouseButton);} catch (IOException e) {e.printStackTrace();}}@Overridepublic void mouseReleased(int mouseX, int mouseY, int state) {if(mb != null)return;for (Panel panel : rpanels) {if (panel.extended && panel.visible && panel.Elements != null) {for (ModuleButton b : panel.Elements) {if (b.extended) {for (Element e : b.menuelements) {e.mouseReleased(mouseX, mouseY, state);}}}}}for (Panel p : rpanels) {p.mouseReleased(mouseX, mouseY, state);}super.mouseReleased(mouseX, mouseY, state);}@Overrideprotected void keyTyped(char typedChar, int keyCode) {for (Panel p : rpanels) {if (p != null && p.visible && p.extended && p.Elements != null && p.Elements.size() > 0) {for (ModuleButton e : p.Elements) {try {if (e.keyTyped(typedChar, keyCode))return;} catch (IOException e1) {e1.printStackTrace();}}}}try {super.keyTyped(typedChar, keyCode);} catch (IOException e2) {e2.printStackTrace();}}@Overridepublic void initGui() {if (OpenGlHelper.shadersSupported && mc.getRenderViewEntity() instanceof EntityPlayer) {if (mc.entityRenderer.theShaderGroup != null) {mc.entityRenderer.theShaderGroup.deleteShaderGroup();}mc.entityRenderer.loadShader(new ResourceLocation("shaders/post/blur.json"));}}@Overridepublic void onGuiClosed() {if (mc.entityRenderer.theShaderGroup != null) {mc.entityRenderer.theShaderGroup.deleteShaderGroup();mc.entityRenderer.theShaderGroup = null;}for (Panel panel : ClickGUI.rpanels) {if (panel.extended && panel.visible && panel.Elements != null) {for (ModuleButton b : panel.Elements) {if (b.extended) {for (Element e : b.menuelements) {if(e instanceof ElementSlider){((ElementSlider)e).dragging = false;}}}}}}}public void closeAllSettings() {for (Panel p : rpanels) {if (p != null && p.visible && p.extended && p.Elements != null&& p.Elements.size() > 0) {for (ModuleButton e : p.Elements) {//e.extended = false;}}}}
}

打开me.hack.hackedclient.HackedClient,进行以下修改:
将:

...
public static ModuleManager moduleManager;
...

修改为:

...
public static SettingsManager settingsManager;
public static ModuleManager moduleManager;
...

将:

...
public static void startClient() {moduleManager = new ModuleManager();...
}
...

修改为:

...
public static void startClient() {settingsManager = new SettingsManager();moduleManager = new ModuleManager();...
}
...

并在import部分添加:

import de.Hero.settings.SettingsManager;

打开me.hack.hackedclient.module.Module,在setToggled方法下面添加:

public Category getCategory() {return category;
}public void setCategory(Category category) {this.category = category;
}

onRender方法后面添加:

public void setup() {}

Module构造器的最后一行添加:

setup();

打开de.Hero.clickgui.Panel,删除里面所有的代码,并把以下代码复制到里面:

package de.Hero.clickgui;import java.awt.Color;
import java.util.ArrayList;import me.hack.hackedclient.HackedClient;
import net.minecraft.client.gui.Gui;
import de.Hero.clickgui.elements.ModuleButton;
import de.Hero.clickgui.util.ColorUtil;
import de.Hero.clickgui.util.FontUtil;// I have to delete all the comments for normal encodingpublic class Panel {public String title;public double x;public double y;private double x2;private double y2;public double width;public double height;public boolean dragging;public boolean extended;public boolean visible;public ArrayList<ModuleButton> Elements = new ArrayList<>();public ClickGUI clickgui;public Panel(String ititle, double ix, double iy, double iwidth, double iheight, boolean iextended, ClickGUI parent) {this.title = ititle;this.x = ix;this.y = iy;this.width = iwidth;this.height = iheight;this.extended = iextended;this.dragging = false;this.visible = true;this.clickgui = parent;setup();}public void setup() {}public void drawScreen(int mouseX, int mouseY, float partialTicks) {if (!this.visible)return;if (this.dragging) {x = x2 + mouseX;y = y2 + mouseY;}Color temp = ColorUtil.getClickGUIColor().darker();int outlineColor = new Color(temp.getRed(), temp.getGreen(), temp.getBlue(), 170).getRGB();Gui.drawRect(x, y, x + width, y + height, 0xff121212);if(HackedClient.instance.settingsManager.getSettingByName("Design").getValString().equalsIgnoreCase("New")){Gui.drawRect(x - 2, y, x, y + height, outlineColor);FontUtil.drawStringWithShadow(title, x + 2, y + height / 2 - FontUtil.getFontHeight()/2, 0xffefefef);}else if(HackedClient.instance.settingsManager.getSettingByName("Design").getValString().equalsIgnoreCase("JellyLike")){Gui.drawRect(x + 4,           y + 2, x + 4.3,       y + height - 2, 0xffaaaaaa);Gui.drawRect(x - 4 + width, y + 2, x - 4.3 + width, y + height - 2, 0xffaaaaaa);FontUtil.drawTotalCenteredStringWithShadow(title, x + width / 2, y + height / 2, 0xffefefef);}if (this.extended && !Elements.isEmpty()) {double startY = y + height;int epanelcolor = HackedClient.instance.settingsManager.getSettingByName("Design").getValString().equalsIgnoreCase("New") ? 0xff232323 : HackedClient.instance.settingsManager.getSettingByName("Design").getValString().equalsIgnoreCase("JellyLike") ? 0xbb151515 : 0;;for (ModuleButton et : Elements) {if(HackedClient.instance.settingsManager.getSettingByName("Design").getValString().equalsIgnoreCase("New")){Gui.drawRect(x - 2, startY, x + width, startY + et.height + 1, outlineColor);}Gui.drawRect(x,   startY, x + width, startY + et.height + 1, epanelcolor);et.x = x + 2;et.y = startY;et.width = width - 4;et.drawScreen(mouseX, mouseY, partialTicks);startY += et.height + 1;}Gui.drawRect(x, startY + 1, x + width, startY + 1, epanelcolor);}}public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {if (!this.visible) {return false;}if (mouseButton == 0 && isHovered(mouseX, mouseY)) {x2 = this.x - mouseX;y2 = this.y - mouseY;dragging = true;return true;} else if (mouseButton == 1 && isHovered(mouseX, mouseY)) {extended = !extended;return true;} else if (extended) {for (ModuleButton et : Elements) {if (et.mouseClicked(mouseX, mouseY, mouseButton)) {return true;}}}return false;}public void mouseReleased(int mouseX, int mouseY, int state) {if (!this.visible) {return;}if (state == 0) {this.dragging = false;}}public boolean isHovered(int mouseX, int mouseY) {return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height;}
}

打开de.Hero.clickgui.util.ColorUtil,删除里面所有的代码,并把一下代码复制进去:

package de.Hero.clickgui.util;import me.hack.hackedclient.HackedClient;import java.awt.Color;// I have to delete all the comments for normal encodingpublic class ColorUtil {public static Color getClickGUIColor(){return new Color((int) HackedClient.instance.settingsManager.getSettingByName("GuiRed").getValDouble(), (int)HackedClient.instance.settingsManager.getSettingByName("GuiGreen").getValDouble(), (int)HackedClient.instance.settingsManager.getSettingByName("GuiBlue").getValDouble());}
}

打开de.Hero.clickgui.util.FontUtil,删除里面所有的代码,并把以下代码复制进去:

package de.Hero.clickgui.util;import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.util.StringUtils;// I have to delete all the comments for normal encodingpublic class FontUtil {private static FontRenderer fontRenderer;public static void setupFontUtils() {fontRenderer = Minecraft.getMinecraft().fontRendererObj;}public static int getStringWidth(String text) {return fontRenderer.getStringWidth(StringUtils.stripControlCodes(text));}public static int getFontHeight() {return fontRenderer.FONT_HEIGHT;}public static void drawString(String text, double x, double y, int color) {fontRenderer.drawString(text, x, y, color);}public static void drawStringWithShadow(String text, double x, double y, int color) {fontRenderer.drawStringWithShadow(text, (float) x, (float) y, color);}public static void drawCenteredString(String text, double x, double y, int color) {drawString(text, x - fontRenderer.getStringWidth(text) / 2, y, color);}public static void drawCenteredStringWithShadow(String text, double x, double y, int color) {drawStringWithShadow(text, x - fontRenderer.getStringWidth(text) / 2, y, color);}public static void drawTotalCenteredString(String text, double x, double y, int color) {drawString(text, x - fontRenderer.getStringWidth(text) / 2, y - fontRenderer.FONT_HEIGHT / 2, color);}public static void drawTotalCenteredStringWithShadow(String text, double x, double y, int color) {drawStringWithShadow(text, x - fontRenderer.getStringWidth(text) / 2, y - fontRenderer.FONT_HEIGHT / 2F, color);}
}

打开de.Hero.clickgui.elements.ModuleButton,删掉里面所有的代码,并将以下代码粘贴进去:

package de.Hero.clickgui.elements;import java.awt.Color;
import java.io.IOException;
import java.util.ArrayList;import me.hack.hackedclient.HackedClient;
import me.hack.hackedclient.module.Module;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;import org.lwjgl.input.Keyboard;import de.Hero.clickgui.Panel;
import de.Hero.clickgui.elements.menu.ElementCheckBox;
import de.Hero.clickgui.elements.menu.ElementComboBox;
import de.Hero.clickgui.elements.menu.ElementSlider;
import de.Hero.clickgui.util.ColorUtil;
import de.Hero.clickgui.util.FontUtil;
import de.Hero.settings.Setting;// I have to delete all the comments for normal encodingpublic class ModuleButton {public Module mod;public ArrayList<Element> menuelements;public Panel parent;public double x;public double y;public double width;public double height;public boolean extended = false;public boolean listening = false;public ModuleButton(Module imod, Panel pl) {mod = imod;height = Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT + 2;parent = pl;menuelements = new ArrayList<>();if (HackedClient.instance.settingsManager.getSettingsByMod(imod) != null)for (Setting s : HackedClient.instance.settingsManager.getSettingsByMod(imod)) {if (s.isCheck()) {menuelements.add(new ElementCheckBox(this, s));} else if (s.isSlider()) {menuelements.add(new ElementSlider(this, s));} else if (s.isCombo()) {menuelements.add(new ElementComboBox(this, s));}}}public void drawScreen(int mouseX, int mouseY, float partialTicks) {Color temp = ColorUtil.getClickGUIColor();int color = new Color(temp.getRed(), temp.getGreen(), temp.getBlue(), 150).getRGB();int textcolor = 0xffafafaf;if (mod.isToggled()) {Gui.drawRect(x - 2, y, x + width + 2, y + height + 1, color);textcolor = 0xffefefef;}if (isHovered(mouseX, mouseY)) {Gui.drawRect(x - 2, y, x + width + 2, y + height + 1, 0x55111111);}FontUtil.drawTotalCenteredStringWithShadow(mod.getName(), x + width / 2, y + 1 + height / 2, textcolor);}public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {if (!isHovered(mouseX, mouseY))return false;if (mouseButton == 0) {mod.toggle();if(HackedClient.instance.settingsManager.getSettingByName("Sound").getValBoolean())Minecraft.getMinecraft().thePlayer.playSound("random.click", 0.5f, 0.5f);} else if (mouseButton == 1) {if (menuelements != null && menuelements.size() > 0) {boolean b = !this.extended;HackedClient.clickGUI.closeAllSettings();this.extended = b;if(HackedClient.instance.settingsManager.getSettingByName("Sound").getValBoolean())if(extended)Minecraft.getMinecraft().thePlayer.playSound("tile.piston.out", 1f, 1f);else Minecraft.getMinecraft().thePlayer.playSound("tile.piston.in", 1f, 1f);}} else if (mouseButton == 2) {listening = true;}return true;}public boolean keyTyped(char typedChar, int keyCode) throws IOException {if (listening) {if (keyCode != Keyboard.KEY_ESCAPE) {// Client.sendChatMessage("Bound '" + mod.getName() + "'" + " to '" + Keyboard.getKeyName(keyCode) + "'");mod.setKey(keyCode);} else {// Client.sendChatMessage("Unbound '" + mod.getName() + "'");mod.setKey(Keyboard.KEY_NONE);}listening = false;return true;}return false;}public boolean isHovered(int mouseX, int mouseY) {return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height;}}

再次打开me.hack.hackedclient.HackedClient,并将:

...
public static ModuleManager moduleManager;
...

修改为:

...
public static ModuleManager moduleManager;
public static ClickGUI clickGUI;
...

将:

...
public static void startClient() {...moduleManager = new ModuleManager();...
}

修改为:

...
public static void startClient() {...moduleManager = new ModuleManager();clickGUI = new ClickGUI();...
}

打开de.Hero.clickgui.menu.ElementCheckBox,删掉里面所有的代码,并将以下代码复制到里面:

package de.Hero.clickgui.elements.menu;import java.awt.Color;import net.minecraft.client.gui.Gui;
import de.Hero.clickgui.elements.Element;
import de.Hero.clickgui.elements.ModuleButton;
import de.Hero.clickgui.util.ColorUtil;
import de.Hero.clickgui.util.FontUtil;
import de.Hero.settings.Setting;// I have to delete all the comments for normal encodingpublic class ElementCheckBox extends Element {public ElementCheckBox(ModuleButton iparent, Setting iset) {parent = iparent;set = iset;super.setup();}public void drawScreen(int mouseX, int mouseY, float partialTicks) {Color temp = ColorUtil.getClickGUIColor();int color = new Color(temp.getRed(), temp.getGreen(), temp.getBlue(), 200).getRGB();Gui.drawRect(x, y, x + width, y + height, 0xff1a1a1a);FontUtil.drawString(setstrg, x + width - FontUtil.getStringWidth(setstrg), y + FontUtil.getFontHeight() / 2 - 0.5, 0xffffffff);Gui.drawRect(x + 1, y + 2, x + 12, y + 13, set.getValBoolean() ? color : 0xff000000);if (isCheckHovered(mouseX, mouseY))Gui.drawRect(x + 1, y + 2, x + 12, y + 13, 0x55111111);}public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {if (mouseButton == 0 && isCheckHovered(mouseX, mouseY)) {set.setValBoolean(!set.getValBoolean());return true;}return super.mouseClicked(mouseX, mouseY, mouseButton);}public boolean isCheckHovered(int mouseX, int mouseY) {return mouseX >= x + 1 && mouseX <= x + 12 && mouseY >= y + 2 && mouseY <= y + 13;}
}

最后,打开de.Hero.clickgui.menu.ElementComboBox,删掉里面所有的代码,并将以下代码复制到里面:

package de.Hero.clickgui.elements.menu;import java.awt.Color;import me.hack.hackedclient.HackedClient;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import de.Hero.clickgui.elements.Element;
import de.Hero.clickgui.elements.ModuleButton;
import de.Hero.clickgui.util.ColorUtil;
import de.Hero.clickgui.util.FontUtil;
import de.Hero.settings.Setting;// I have to delete all the comments for normal encodingpublic class ElementComboBox extends Element {public ElementComboBox(ModuleButton iparent, Setting iset) {parent = iparent;set = iset;super.setup();}public void drawScreen(int mouseX, int mouseY, float partialTicks) {Color temp = ColorUtil.getClickGUIColor();int color = new Color(temp.getRed(), temp.getGreen(), temp.getBlue(), 150).getRGB();Gui.drawRect(x, y, x + width, y + height, 0xff1a1a1a);FontUtil.drawTotalCenteredString(setstrg, x + width / 2, y + 15/2, 0xffffffff);int clr1 = color;int clr2 = temp.getRGB();Gui.drawRect(x, y + 14, x + width, y + 15, 0x77000000);if (comboextended) {Gui.drawRect(x, y + 15, x + width, y + height, 0xaa121212);double ay = y + 15;for (String sld : set.getOptions()) {String elementtitle = sld.substring(0, 1).toUpperCase() + sld.substring(1, sld.length());FontUtil.drawCenteredString(elementtitle, x + width / 2, ay + 2, 0xffffffff);if (sld.equalsIgnoreCase(set.getValString())) {Gui.drawRect(x, ay, x + 1.5, ay + FontUtil.getFontHeight() + 2, clr1);}if (mouseX >= x && mouseX <= x + width && mouseY >= ay && mouseY < ay + FontUtil.getFontHeight() + 2) {Gui.drawRect(x + width - 1.2, ay, x + width, ay + FontUtil.getFontHeight() + 2, clr2);}ay += FontUtil.getFontHeight() + 2;}}}public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {if (mouseButton == 0) {if (isButtonHovered(mouseX, mouseY)) {comboextended = !comboextended;return true;}if (!comboextended)return false;double ay = y + 15;for (String slcd : set.getOptions()) {if (mouseX >= x && mouseX <= x + width && mouseY >= ay && mouseY <= ay + FontUtil.getFontHeight() + 2) {if(HackedClient.instance.settingsManager.getSettingByName("Sound").getValBoolean())Minecraft.getMinecraft().thePlayer.playSound("tile.piston.in", 20.0F, 20.0F);if(clickgui != null && clickgui.setmgr != null)clickgui.setmgr.getSettingByName(set.getName()).setValString(slcd.toLowerCase());return true;}ay += FontUtil.getFontHeight() + 2;}}return super.mouseClicked(mouseX, mouseY, mouseButton);}public boolean isButtonHovered(int mouseX, int mouseY) {return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 15;}
}

5x002 ClickGui

me.hack.hackedclient.module下创建一个新包,叫做render。在render包里添加一个新的类,叫ClickGui,并将以下代码粘贴进去:

package me.hack.hackedclient.module.render;import de.Hero.settings.Setting;
import me.hack.hackedclient.HackedClient;
import me.hack.hackedclient.module.Category;
import me.hack.hackedclient.module.Module;
import org.lwjgl.input.Keyboard;import java.util.ArrayList;public class ClickGui extends Module {public ClickGui() {super("ClickGui", Keyboard.KEY_RSHIFT, Category.RENDER);}@Overridepublic void setup() {ArrayList<String> options = new ArrayList<>();options.add("New");options.add("JellyLike");HackedClient.instance.settingsManager.rSetting(new Setting("Design", this, "New", options));HackedClient.instance.settingsManager.rSetting(new Setting("Sound", this, false));HackedClient.instance.settingsManager.rSetting(new Setting("GuiRed", this, 255, 0, 255, true));HackedClient.instance.settingsManager.rSetting(new Setting("GuiGreen", this, 26, 0, 255, true));HackedClient.instance.settingsManager.rSetting(new Setting("GuiBlue", this, 42, 0, 255, true));super.setup();}@Overridepublic void onEnable() {mc.displayGuiScreen(HackedClient.instance.clickGUI);toggle();super.onEnable();}}

5x003 测试

现在,这个ClickGUI已经制作完成了!运行recompile.batstartclient.bat来启动游戏,并在游戏内按下RShift,你应该可以看到一个页面被打开,里面有我们的5个大类。右键这些类,你应该可以看到每一个大类里面的模块。点击这些模块,可以把他们打开或关上,右键就可以对他们进行配置(虽然我们还没有注册任何设置)。只需要注意一点,千万不要关掉ClickGui模块,要不然游戏可能会崩!

— 完 —

如果大家遇到任何问题可以发在评论区,我会尽快回复!
说实话,我也没想到这次这一个模块代码量会这么大,但是我已经尽量简化了…
Credit:
ClickGUI原作者:HeroGUIv2

【Java】我的世界Java版外挂制作 [5] - ClickGUI相关推荐

  1. 我的世界电脑版加模组JAVA,我的世界java版mod

    详情 我的世界java版mod是一款经典热门沙盒创造游戏,我的世界java版mod游戏是一种特殊的版本,玩家可以自由的体验,而且游戏采用自由开放的风格,玩家可以随意的冒险和建造,还有丰富的未知之地等你 ...

  2. MC指令java,我的世界Java版指令有哪些-我的世界Java版常用指令分享-沧浪手游

    在我的世界中有着很多的指令操作,这些指令可以让玩家在游戏中拥有金手指,就比如下面这些就是Java版的我的世界的指令,具体的代码就让我们一起来看看吧. 我的世界Java版常用指令分享 1./setblo ...

  3. 【Java】我的世界Java版外挂制作 [1] - 模块管理器与第一个模块

    ROOT: 挂端主文件夹 1x001 创建主包和主类 在ROOT/src/minecraft下创建新包,名字叫me.hack.hackedclient.如果没有创建包的选项,就右键ROOT/src/m ...

  4. 【Java】我的世界Java版外挂制作 [4] - 移动类模块合集

    ROOT:挂端主文件夹 4x001 AutoWalk AutoWalk顾名思义,就是自动走路,可以防止服务器因为AFK把你踢了.在movement包下创建一个新类,叫做AutoWalk,并在里面输入以 ...

  5. 修复花雨庭服务器,我的世界手机版怎么进花雨庭服务器 | 手游网游页游攻略大全...

    发布时间:2016-06-08 我的世界手机版进服务器方法带给玩家,我的世界是一款自由度很高的沙盒类游戏,游戏玩法丰富多样,还能加入服务器和别人一起玩,看看我的世界手机版进服务器方法. 我的世界手机版 ...

  6. 我的世界java甘蔗机_我的世界全自动甘蔗收割机怎么做 手机版收割机制作教程...

    我的世界全自动甘蔗收割机怎么做,手机版收割机制作教程.今天4399小甲就为大家带来我的世界pe版全自动甘蔗收割机的详细制作方法,告诉大家这个收割机要怎么做,一起来看下吧. [本教程作者为我的世界手机版 ...

  7. 我的世界java版怎么制作行为包,我的世界addons行为包制作器 | 手游网游页游攻略大全...

    发布时间:2017-09-05 我的世界自定义合成表制作器下载 让你的脑洞飞舞起来吧.那下面给大家分享的这个则是我的世界玩家做的一个自定义合成物品的合成表哦~只要你想就可以合成各种各样的合成表哦~希望 ...

  8. 我的世界java版移除猪灵了吗_我的世界:激怒僵尸猪灵有奖励,用菌光体堆肥,修复126个漏洞!...

    我的世界Java版1.16pre3(第三个预发布版)已经更新,玩家们从中可以看到一些内容被Mojang调整.首先,下界传送门方块加入战利品表,新增部分常规标签,影响不是很大.按照这样的速度,玩家们等到 ...

  9. mcjava盗版联机_我的世界java版联机版

    软件介绍 我的世界java版联机版为玩家带来更加有趣的沙盒探险,在这里玩家可以与好友相约一起探索,在多模式中选择自己西湖爱你的地图进行探索,多人合作,轻松搜集物资与道具,在任务中解锁更加新颖的皮肤,还 ...

最新文章

  1. Redis基础、应用、第三方支持组件总结
  2. 弹性分组环(RPR)技术特点及其在城域网中的应用
  3. node.js koa 实现长轮询
  4. 浅析简易网页制作的准备工作
  5. 虎符杯——虚拟机逆向
  6. Oracle 10g 数据库的备份和还原
  7. Oracle GoldenGate复制过程
  8. Unity 3D第三人称视角、用途广泛限定角度(视角不能360度翻转)
  9. SQLSERVER从一个Server访问另外一个Server中的数据的方法
  10. 电子数字 网易游戏在线笔试 第一题 hihocoder
  11. 最短路径算法详细介绍
  12. html九宫格拼图怎么做,九宫格拼图制作方法分享,只用PPT就能搞定
  13. 我所能做的,就是真实地记录 | 小别手记
  14. 安防流媒体无插件直播管理设计
  15. PX4开源工程结构简明介绍
  16. jvm原理与性能调优
  17. 国内各类 WebShell 密码大全 爆破、社工用 webshell-password
  18. 【微信小程序】不支持使用本地图片设置背景图片解决方法
  19. 正大国际:做期货交易的方法
  20. Hank的无线802.11学习笔记--2

热门文章

  1. python音乐可视化效果_python 音频可视化
  2. 解决微信登录Emoji表情昵称乱码问题
  3. 关于Verilog 写法
  4. 一些java语言的精巧写法
  5. git hub寻找资源
  6. JavaScript基础第06天笔记
  7. ElasticSearch入门教程(1)
  8. 比较两组数据的差异用什么图更直观_用Excel制作旋风图
  9. 数值计算与matlab笔试样卷,数值分析试卷及其答案.doc
  10. 通信总线传输速率计算