#
4. Making the ArrayList
So we need to display enabled modules, otherwise we dont know which modules are enabled. So create a package called gui
in your package and create a class called GuiIngameHook
You must be asking "what is this?" it is a class that we can draw anything to your screen like FPS and CPS.. We will be adding these soon! So after creating the class. It must extend GuiIngame
That is english so i think you understand it. Add the following code:
package com.demez.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
public class GuiIngameHook extends GuiIngame{
protected Minecraft mc = Minecraft.getMinecraft();
public GuiIngameHook(Minecraft mcIn) {
super(mcIn);
}
public void renderGameOverlay(float p_175180_1_){
super.renderGameOverlay(p_175180_1_);
if(!mc.gameSettings.showDebugInfo) {
///Render arraylist if not clicked to F3.
renderArrayList();
}
}
private void renderArrayList() {
int yCount = 0;
int index = 0;
long x = 0;
for(Module m : Paradox.instance.moduleManager.getModules()) {
m.onRender();
ScaledResolution sr = new ScaledResolution(mc);
double offset = yCount*(mc.fontRendererObj.FONT_HEIGHT + 6);
if(m.isToggled()) {
//Draw a rectangle.
Gui.drawRect(sr.getScaledWidth() - mc.fontRendererObj.getStringWidth(m.getName()) - 15, offset, sr.getScaledWidth(), 6 + mc.fontRendererObj.FONT_HEIGHT + offset, 0x80000000);
//Draw module names on right top.
mc.fontRendererObj.drawString("- " + m.getName(), sr.getScaledWidth() - mc.fontRendererObj.getStringWidth(m.getName()) - 13 , 4 + offset , -1) //White color
}
}
}
}
After that go to Minecraft.java
and find this.ingameGui = new GuiIngame();
change the GuiIngame
to GuiIngameHook
And launch the game.