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 encoding public 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 encoding public 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 encoding public 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) {
@Override public 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
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/63816.html