【Java】我的世界Java版外挂制作 [2] - 游戏内GUI
package me.EpicfToxic.HackCraft.gui;
import com.google.common.collect.Sets;
import me.hack.hackedclient.HackedClient;
import me.hack.hackedclient.module.Module;
import me.hack.hackedclient.utils.ColorUtils;
import me.hack.hackedclient.utils.Wrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import java.util.HashSet;
public class GuiIngameHook extends GuiIngame {
public GuiIngameHook(Minecraft mcIn) {
super(mcIn);
}
@Override
public void renderGameOverlay(float p_175180_1_) {
super.renderGameOverlay(p_175180_1_);
if(!mc.gameSettings.showDebugInfo) {
drawRect(2, 2, 100, 14, 0x80000000);
Wrapper.fr.drawString("Hacked Client", 4, 4, 0x00FF2B);
Wrapper.fr.drawString("FPS: " + mc.getDebugFPS(), 57, 4, -1);
renderArrayList();
}
}
private HashSet<String> modBlacklist = Sets.newHashSet();
public boolean isModBlacklisted(Module m) {
return modBlacklist.contains(m.getClass().getName());
}
private void renderArrayList() {
int yCount = 0;
int index = 0;
long x = 0;
for(Module m : HackedClient.instance.moduleManager.getModules()) {
m.onRender();
ScaledResolution sr = new ScaledResolution(mc);
double offset = yCount * (Wrapper.fr.FONT_HEIGHT + 6);
if(m.isToggled()) {
if(!modBlacklist.contains(m.getClass().getName())) {
Gui.drawRect(sr.getScaledWidth() - Wrapper.fr.getStringWidth(m.getName()) - 15, offset, sr.getScaledWidth(), 6 + Wrapper.fr.FONT_HEIGHT + offset, 0x80000000);
Wrapper.fr.drawString("- " + m.getName(), sr.getScaledWidth() - Wrapper.fr.getStringWidth(m.getName()) - 13, 4 + offset, ColorUtils.rainbowEffect(index + x * 2000000000L, 1.0F).getRGB());
yCount++;
index++;
x++;
}
}
}
}
}