Archive eaglercraft-archive-resent-3-3-source (source, 1.8.8, clean)
This commit is contained in:
@@ -0,0 +1,278 @@
|
||||
package dev.resent.ui.mods;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import dev.resent.Resent;
|
||||
import dev.resent.module.base.Mod;
|
||||
import dev.resent.setting.BooleanSetting;
|
||||
import dev.resent.setting.ModeSetting;
|
||||
import dev.resent.setting.Setting;
|
||||
import dev.resent.util.render.Color;
|
||||
import dev.resent.util.render.RenderUtils;
|
||||
import net.lax1dude.eaglercraft.v1_8.Keyboard;
|
||||
import net.lax1dude.eaglercraft.v1_8.Mouse;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class ClickGUI extends GuiScreen {
|
||||
|
||||
public Mod modWatching = null;
|
||||
public ScaledResolution sr;
|
||||
public int x, y, width, height;
|
||||
public int offset = 0;
|
||||
public FontRenderer fr;
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
offset = MathHelper.clamp_int(MathHelper.clamp_int(offset, 0, getListMaxScroll()), 0, getListMaxScroll());
|
||||
int xo = 0;
|
||||
int xy = -30;
|
||||
|
||||
sr = new ScaledResolution(mc);
|
||||
fr = Minecraft.getMinecraft().fontRendererObj;
|
||||
width = GuiScreen.width - x;
|
||||
height = GuiScreen.height - y;
|
||||
x = sr.getScaledWidth() / 8 + xo;
|
||||
y = sr.getScaledHeight() - 10 + xy;
|
||||
int off = 0;
|
||||
|
||||
for (Mod m: Resent.INSTANCE.modManager.modules) {
|
||||
int fh = fr.FONT_HEIGHT;
|
||||
|
||||
if (isMouseInside(mouseX, mouseY, this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 - 1 - offset, this.x + 90 + xo - 1 + 21, height + 30 - fh * (-off) + 30 - 1 + 2 - 1 - offset) && m.hasSetting) {
|
||||
// Open settings
|
||||
this.modWatching = m;
|
||||
} else if (isMouseInside(mouseX, mouseY, x - fr.FONT_HEIGHT + 2, height + 27 + fr.FONT_HEIGHT + 2, x - fr.FONT_HEIGHT + 6 + fr.getStringWidth("<"), height + 33 + fr.FONT_HEIGHT + 2 + fr.getStringWidth("<")) && mouseButton == 0) {
|
||||
// Close settings
|
||||
this.modWatching = null;
|
||||
} else if (isMouseInside(mouseX, mouseY, width + 15, height - 10, width + 25, height + 7)) {
|
||||
// Close ui
|
||||
mc.displayGuiScreen(null);
|
||||
this.modWatching = null;
|
||||
} else if (isMouseInside(mouseX, mouseY, this.x + 10 + xo - 2 + 10, height - 2 - fh * -(off) + 50 - 2 - offset, this.x + 90 + xo + 22, height + 30 - fh * (-off) + 30 + 2 - offset) && mouseButton == 0 && modWatching == null) {
|
||||
// Toggle mod
|
||||
m.toggle();
|
||||
} else if (isMouseInside(mouseX, mouseY, GuiScreen.width/2-fr.getStringWidth("Edit Layout")/2-5, GuiScreen.height-y-fr.FONT_HEIGHT, GuiScreen.width/2-fr.getStringWidth("Edit Layout")/2+5+fr.getStringWidth("Edit Layout"), GuiScreen.height-y+5) && mouseButton == 0){
|
||||
mc.displayGuiScreen(new HUDConfigScreen());
|
||||
this.modWatching = null;
|
||||
}
|
||||
if (xo > width / 2) {
|
||||
xo = 0;
|
||||
off += 3;
|
||||
} else {
|
||||
xo += 100;
|
||||
}
|
||||
}
|
||||
|
||||
if (modWatching != null) {
|
||||
int var = 0;
|
||||
fr.drawString("<", x - fr.FONT_HEIGHT + 4, height + 29 + fr.FONT_HEIGHT + 2, -1);
|
||||
for (int asdf = 0; asdf < this.modWatching.settings.size(); asdf++) {
|
||||
|
||||
BooleanSetting b;
|
||||
ModeSetting m;
|
||||
Setting s = this.modWatching.settings.get(asdf);
|
||||
|
||||
if (s instanceof BooleanSetting) {
|
||||
b = (BooleanSetting) s;
|
||||
if (isMouseInside(mouseX, mouseY, this.x + 6 + 1 + 6, height - fr.FONT_HEIGHT + 50 - offset + var + 1, this.x + 15 - 1 + 6, height - fr.FONT_HEIGHT + 50 + fr.FONT_HEIGHT - offset + var - 1) && mouseButton == 0){
|
||||
b.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
if (s instanceof ModeSetting) {
|
||||
m = (ModeSetting) s;
|
||||
if(isMouseInside(mouseX, mouseY, this.x+24, height-fr.FONT_HEIGHT+50+var, this.x+24+fr.getStringWidth(s.name+": "+m.getValue()), height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT) && mouseButton == 0)
|
||||
m.next();
|
||||
}
|
||||
|
||||
|
||||
var += fr.FONT_HEIGHT + 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float par3) {
|
||||
sr = new ScaledResolution(mc);
|
||||
offset = MathHelper.clamp_int(MathHelper.clamp_int(offset, 0, getListMaxScroll()), 0, getListMaxScroll());
|
||||
int xo = 0;
|
||||
int xy = -30;
|
||||
|
||||
fr = Minecraft.getMinecraft().fontRendererObj;
|
||||
width = GuiScreen.width - x;
|
||||
height = GuiScreen.height - y;
|
||||
x = sr.getScaledWidth() / 8 + xo;
|
||||
y = sr.getScaledHeight() - 10 + xy;
|
||||
int off = 0;
|
||||
|
||||
// background
|
||||
Gui.drawRect(x - 10, y + 20, width + 35, height - 10, new Color(35, 39, 42, 200).getRGB());
|
||||
fr.drawString(Resent.NAME + " Client " + Resent.VERSION, x + 8, height - 2, -1);
|
||||
RenderUtils.drawRectOutline(GuiScreen.width/2-fr.getStringWidth("Edit Layout")/2-5, GuiScreen.height - y - fr.FONT_HEIGHT, GuiScreen.width / 2 - fr.getStringWidth("Edit Layout") / 2 + 5 + fr.getStringWidth("Edit Layout"), GuiScreen.height - y + 5, -1);
|
||||
Gui.drawRect(GuiScreen.width/2-fr.getStringWidth("Edit Layout")/2-4,
|
||||
GuiScreen.height - y - fr.FONT_HEIGHT+1,
|
||||
GuiScreen.width / 2 - fr.getStringWidth("Edit Layout") / 2 + 5 + fr.getStringWidth("Edit Layout")-1,
|
||||
GuiScreen.height - y + 4, isMouseInside(mouseX, mouseY, GuiScreen.width/2-fr.getStringWidth("Edit Layout")/2-4,
|
||||
GuiScreen.height - y - fr.FONT_HEIGHT+1,
|
||||
GuiScreen.width / 2 - fr.getStringWidth("Edit Layout") / 2 + 5 + fr.getStringWidth("Edit Layout")-1,
|
||||
GuiScreen.height - y + 4) ? new Color(105, 105, 105, 65).getRGB()
|
||||
: new Color(211, 211, 211, 65).getRGB());
|
||||
|
||||
fr.drawStringWithShadow("Edit Layout", GuiScreen.width / 2 - fr.getStringWidth("Edit Layout") / 2 + 1,
|
||||
GuiScreen.height - y - fr.FONT_HEIGHT + fr.FONT_HEIGHT / 2 - 1, -1);
|
||||
|
||||
// close
|
||||
// RenderUtils.drawRectOutline(width+15, height-5, width+26, height+8, new Color(200, 200, 200, 90).getRGB());
|
||||
fr.drawString("X", width + 18, height - 2, -1);
|
||||
|
||||
// white line
|
||||
Gui.drawRect(x - 8, height + 29, width + 33, height + 30, -1);
|
||||
|
||||
for (Mod m : Resent.INSTANCE.modManager.modules) {
|
||||
if (this.modWatching == null) {
|
||||
int fh = fr.FONT_HEIGHT;
|
||||
if (height - 2 - fh * -(off) + 50 - 2 - offset > height + 29
|
||||
&& height + 30 - fh * (-off) + 30 + 2 - offset < y + 20){
|
||||
|
||||
// Enabled outline
|
||||
RenderUtils.drawRectOutline(this.x + 10 + xo - 2 + 10, height - 2 - fh * -(off) + 50 - 2 - offset,
|
||||
this.x + 90 + xo + 22, height + 30 - fh * (-off) + 30 + 2 - offset,
|
||||
m.isEnabled() ? Color.GREEN.getRGB()
|
||||
: Color.RED.getRGB());
|
||||
Gui.drawRect(this.x + 10 + xo - 1 + 10, height - 2 - fh * -(off) + 50 - 1 - offset,
|
||||
this.x + 90 + xo - 1 + 22, height + 30 - fh * (-off) + 30 - 1 + 2 - offset,
|
||||
isMouseInside(mouseX, mouseY, this.x + 10 + xo - 1 + 10,
|
||||
height - 2 - fh * -(off) + 50 - 1 - offset, this.x + 90 + xo - 1 + 22,
|
||||
height + 30 - fh * (-off) + 30 - 1 + 2 - offset)
|
||||
? new Color(105, 105, 105, 65).getRGB()
|
||||
: new Color(211, 211, 211, 65).getRGB());
|
||||
|
||||
if (m.hasSetting) {
|
||||
fr.drawString("o", this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, isMouseInside(mouseX, mouseY, this.x+90+xo-1+10, height-2-fh*-(off)+51+1-offset, this.x+90+xo-1+10+fr.getStringWidth("o"), height-2-fh*-(off)+51+1-offset+fr.FONT_HEIGHT) ? new Color(105, 105, 105, 65).getRGB() : -1);
|
||||
//RenderUtils.drawRectOutline(this.x+90+xo-1+10, height-2-fh*-(off)+51+1-offset, this.x+90+xo-1+10+fr.getStringWidth("o"), height-2-fh*-(off)+51+1-offset+fr.FONT_HEIGHT, -1);
|
||||
//fr.drawString("+", this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, -1);
|
||||
//fr.drawString(" x", this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, -1);
|
||||
// Gui.drawRect(this.x+90+xo-1+10, height-2-fh*-(off)+51-1-offset,
|
||||
// this.x+90+xo-1+21, height+30-fh*(-off)+30-1+2-1-offset, -1);
|
||||
}
|
||||
|
||||
fr.drawStringWithShadow(m.name,
|
||||
this.x + 15 + 7 + xo, height - fh * -(off) + 50 - offset, -1);
|
||||
}
|
||||
} else if (this.modWatching != null) {
|
||||
|
||||
int var = 0;
|
||||
fr.drawString("<", x - fr.FONT_HEIGHT + 4, height + 29 + fr.FONT_HEIGHT + 2, -1);
|
||||
fr.drawStringWithShadow("Resent - " + modWatching.name,
|
||||
GuiScreen.width / 2 - (fr.getStringWidth("Resent - " + modWatching.name) / 2),
|
||||
height + 29 - fr.FONT_HEIGHT - 2, -1);
|
||||
|
||||
for (int amogus = 0; amogus < this.modWatching.settings.size(); amogus++) {
|
||||
BooleanSetting b;
|
||||
ModeSetting mo = null;
|
||||
Setting s = this.modWatching.settings.get(amogus);
|
||||
if (s instanceof BooleanSetting) {
|
||||
b = (BooleanSetting) s;
|
||||
RenderUtils.drawRectOutline(this.x + 6 + 6, height - fr.FONT_HEIGHT + 50 + var, this.x + 15 + 6, height - fr.FONT_HEIGHT + 50 + fr.FONT_HEIGHT + var, b.getValue() ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
||||
Gui.drawRect(this.x + 6 + 1 + 6, height - fr.FONT_HEIGHT + 50 + var + 1, this.x + 15 - 1 + 6, height - fr.FONT_HEIGHT + 50 + fr.FONT_HEIGHT + var - 1,
|
||||
isMouseInside(mouseX, mouseY, this.x + 6 + 1 + 6, height - fr.FONT_HEIGHT + 50 + var + 1, this.x + 15 - 1 + 6, height - fr.FONT_HEIGHT + 50 + fr.FONT_HEIGHT + var - 1) ? new Color(211, 211, 211, 65).getRGB() : new Color(105, 105, 105, 65).getRGB());
|
||||
}
|
||||
|
||||
if (s instanceof ModeSetting) {
|
||||
mo = (ModeSetting) s;
|
||||
//RenderUtils.drawRectOutline(this.x+18+6-2, height-fr.FONT_HEIGHT+50+var, this.x+18+6+fr.getStringWidth(this.modWatching.settings.get(amogus).name + ": " + m.getValue() + 2), height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT, -1);
|
||||
}
|
||||
|
||||
if (s instanceof ModeSetting) {
|
||||
/*RenderUtils.drawRectOutline(this.x+24-fr.FONT_HEIGHT-2,
|
||||
this.height-fr.FONT_HEIGHT+50+var, this.x+24,
|
||||
this.height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT, -1);
|
||||
RenderUtils.drawRectOutline(
|
||||
this.x + 24,
|
||||
this.height - fr.FONT_HEIGHT + 50 + var,
|
||||
this.x + 24
|
||||
+ fr.getStringWidth(
|
||||
s.name + ": " + m.getValue())
|
||||
+ 2,
|
||||
this.height - fr.FONT_HEIGHT + 50 + var + fr.FONT_HEIGHT, -1);*/
|
||||
//RenderUtils.drawRectOutline(this.x+24, height-fr.FONT_HEIGHT+50+var, this.x+24+fr.getStringWidth(s.name+": "+m.getValue()), height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT, -1);
|
||||
fr.drawStringWithShadow(s.name + ": " + mo.getValue(),
|
||||
this.x + 18 + 6, height - fr.FONT_HEIGHT + 50 + var, -1);
|
||||
} else {
|
||||
fr.drawStringWithShadow(s.name, this.x + 18 + 6,
|
||||
height - fr.FONT_HEIGHT + 50 + var, -1);
|
||||
}
|
||||
|
||||
var += fr.FONT_HEIGHT + 2;
|
||||
}
|
||||
// RenderUtils.drawRectOutline(x-fr.FONT_HEIGHT+2,
|
||||
// height+27+fr.FONT_HEIGHT+2,x-fr.FONT_HEIGHT+6+fr.getStringWidth("<"),
|
||||
// height+33+fr.FONT_HEIGHT+2+fr.getStringWidth("<"), new Color(200, 200,
|
||||
// 200,90).getRGB());
|
||||
}
|
||||
|
||||
if (xo > width / 2) {
|
||||
xo = 0;
|
||||
off += 3;
|
||||
} else {
|
||||
xo += 100;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean doesGuiPauseGame() { return false; }
|
||||
public boolean isMouseInside(int mouseX, int mouseY, int x, int y, int width, int height) { return (mouseX >= x && mouseX <= width) && (mouseY >= y && mouseY <= height); }
|
||||
public void onGuiClosed() { Keyboard.enableRepeatEvents(true); mc.gameSettings.saveOptions(); }
|
||||
@Override
|
||||
public void initGui(){ mc.gameSettings.loadOptions(); }
|
||||
protected void keyTyped(char par1, int par2) { if (par2 == 0x01 || par2 == Minecraft.getMinecraft().gameSettings.keyBindClickGui.keyCode) { mc.displayGuiScreen(null); } }
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
if (getListMaxScroll() + this.height >= this.height) {
|
||||
int wheel = Mouse.getEventDWheel();
|
||||
if (wheel < 0) {
|
||||
new Thread(() -> {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
offset = MathHelper.clamp_int(offset + 1, 0, getListMaxScroll());
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
} else if (wheel > 0) {
|
||||
new Thread(() -> {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
offset = MathHelper.clamp_int(offset - 1, 0, getListMaxScroll());
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
try {
|
||||
super.handleMouseInput();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
offset = MathHelper.clamp_int(MathHelper.clamp_int(offset, 0, getListMaxScroll()), 0, getListMaxScroll());
|
||||
}
|
||||
|
||||
private int getListMaxScroll() {
|
||||
return 60 + 70 - this.height;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
/*package dev.resent.ui.mods;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import dev.resent.Resent;
|
||||
import dev.resent.module.base.Mod;
|
||||
import dev.resent.setting.BooleanSetting;
|
||||
import dev.resent.setting.Setting;
|
||||
import dev.resent.util.misc.Keyboard;
|
||||
GlStateManager.popMatrix();
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.src.GuiButton;
|
||||
import net.minecraft.src.GuiScreen;
|
||||
import net.minecraft.src.GuiTextField;
|
||||
import net.minecraft.src.MathHelper;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class GuiScreenModule extends GuiScreen {
|
||||
|
||||
protected String screenTitle = "Resent";
|
||||
public int mcount = 0;
|
||||
public ArrayList<Mod> modules = new ArrayList<>();
|
||||
public boolean watchingMod = false;
|
||||
public Mod modWatching = null;
|
||||
public String searchString = "";
|
||||
public GuiTextField search;
|
||||
public int offset = 0;
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int par3) {
|
||||
if (watchingMod == false && modWatching == null) {
|
||||
this.search.mouseClicked(mouseX, mouseY, par3);
|
||||
int i = 0;
|
||||
for (int z = 0; z < Resent.INSTANCE.modManager.modules.size(); z++) {
|
||||
Mod m = Resent.INSTANCE.modManager.modules.get(z);
|
||||
if (m.name.toLowerCase().contains(this.searchString.toLowerCase())) {
|
||||
int x = 10;
|
||||
int y = (10 + fontRenderer.FONT_HEIGHT * 2 + 15 + 10 + 10) + 60 * i + 10 - offset;
|
||||
int width = MathHelper.clamp_int(this.width / 4, 200, this.width / 4) - 10 - x;
|
||||
int height = (10 + fontRenderer.FONT_HEIGHT * 2 + 15 + 10 + 10) + 60 * i + 60 - offset - y;
|
||||
if ((mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height && par3 == 0)
|
||||
&& !(mouseX >= x + 5 && mouseX <= x + width - 5 && mouseY >= y + height - 5 - 15
|
||||
&& mouseY <= y + height - 5))
|
||||
m.toggle();
|
||||
if (par3 == 0 && mouseX >= x + 5 && mouseX <= x + width - 5 && mouseY >= y + height - 5 - 15
|
||||
&& mouseY <= y + height - 5) {
|
||||
this.modWatching = m;
|
||||
this.watchingMod = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Mod m1 = this.modWatching;
|
||||
if (par3 == 0 && mouseX >= (10 + fontRenderer.FONT_HEIGHT + 6) / 2 / 2
|
||||
&& mouseX <= (10 + fontRenderer.FONT_HEIGHT + 6) / 2 / 2 + (10 + fontRenderer.FONT_HEIGHT + 6) / 2
|
||||
&& mouseY >= (10 + fontRenderer.FONT_HEIGHT + 6) / 2 / 2
|
||||
&& mouseY <= (10 + fontRenderer.FONT_HEIGHT + 6) / 2 / 2
|
||||
+ (10 + fontRenderer.FONT_HEIGHT + 6) / 2) {
|
||||
watchingMod = false;
|
||||
modWatching = null;
|
||||
}else {
|
||||
int i = 0;
|
||||
Mod m = this.modWatching;
|
||||
for (int amongus = 0; amongus < m.settings.size(); amongus++) {
|
||||
Setting s = m.settings.get(amongus);
|
||||
BooleanSetting bS = null;
|
||||
if (s instanceof BooleanSetting) {
|
||||
bS = (BooleanSetting) s;
|
||||
}
|
||||
|
||||
int x = 10;
|
||||
int y = (fontRenderer.FONT_HEIGHT * 2 + 45) + 60 * i + 10 - offset;
|
||||
int width = MathHelper.clamp_int(this.width / 4, 200, this.width / 4) - 10 - x;
|
||||
int height = (fontRenderer.FONT_HEIGHT * 2 + 45) + 60 * i + 60 - offset - y;
|
||||
if (isMouseInside(mouseX, mouseY, 10, (fontRenderer.FONT_HEIGHT*2+45)+60*i+10-offset,
|
||||
MathHelper.clamp_int(this.width / 4, 200, this.width / 4) - 10,
|
||||
(10 + fontRenderer.FONT_HEIGHT * 2 + 15 + 10 + 10) + 60 * i + 60 - offset) && par3 == 0) {
|
||||
if (bS != null) {
|
||||
bS.setValue(!bS.getValue());
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.mouseClicked(mouseX, mouseY, par3);
|
||||
}
|
||||
|
||||
public void drawScreen(int mx, int my, float par3) {
|
||||
offset = MathHelper.clamp_int(MathHelper.clamp_int(offset, 0, getListMaxScroll()), 0, getListMaxScroll());
|
||||
|
||||
Gui.drawRect(0, 0, MathHelper.clamp_int(this.width / 4, 200, this.width / 4), this.height, 0xFF090909);
|
||||
if (!this.watchingMod && this.modWatching == null) {
|
||||
int i = 0;
|
||||
for (int z = 0; z < Resent.INSTANCE.modManager.modules.size(); z++) {
|
||||
Mod m = Resent.INSTANCE.modManager.modules.get(z);
|
||||
if (m.name.toLowerCase().contains(this.searchString.toLowerCase())) {
|
||||
int frho = (10 + fontRenderer.FONT_HEIGHT * 2 + 15 + 10 + 10 + 60 * i + 60 - offset);
|
||||
int x = 10;
|
||||
int y = (fontRenderer.FONT_HEIGHT*2+45) + 60 * i + 10 - offset;
|
||||
int width = MathHelper.clamp_int(this.width / 4, 200, this.width / 4) - 10 - x;
|
||||
int height = frho - y;
|
||||
Gui.drawRect(10, (10 + fontRenderer.FONT_HEIGHT * 2 + 15 + 10 + 10) + 60 * i + 10 - offset,
|
||||
MathHelper.clamp_int(this.width / 4, 200, this.width / 4) - 10,
|
||||
frho, 0xff1c1c1c);
|
||||
fontRenderer.drawString(m.name, 20,
|
||||
(10 + fontRenderer.FONT_HEIGHT * 2 + 15 + 10 + 10) + 60 * i + 10 - offset + 10, -1);
|
||||
|
||||
Gui.drawRect(x, y, x + width, y + 1, m.isEnabled() ? 0xff009e00 : 0xff9e0000);
|
||||
Gui.drawRect(x, y, x + 1, y + height, m.isEnabled() ? 0xff009e00 : 0xff9e0000);
|
||||
Gui.drawRect(x + width - 1, y, x + width, y + height, m.isEnabled() ? 0xff009e00 : 0xff9e0000);
|
||||
Gui.drawRect(x, y + height - 1, x + width, y + height, m.isEnabled() ? 0xff009e00 : 0xff9e0000);
|
||||
|
||||
Gui.drawRect(x + 5, y + height - 5 - 15, x + width - 5, y + height - 5, 0xff333333);
|
||||
fontRenderer.drawString("Settings",
|
||||
(x + width / 2) - fontRenderer.getStringWidth("Settings") / 2,
|
||||
y + height - 5 - 15 + fontRenderer.FONT_HEIGHT / 2, -1);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
Gui.drawRect(0, 0, MathHelper.clamp_int(this.width / 4, 200, this.width / 4),
|
||||
10 + fontRenderer.FONT_HEIGHT * 2 + 15 + 10, 0xFF090909);
|
||||
this.search.drawTextBox();
|
||||
fontRenderer.drawString(screenTitle + " - ClickGui", this.width / 4 / 2 - fontRenderer.getStringWidth(screenTitle + "") / 2,
|
||||
10,
|
||||
-1);
|
||||
} else {
|
||||
int frho3 = (10+fontRenderer.FONT_HEIGHT+6)/2/2;
|
||||
Gui.drawRect(frho3, frho3, frho3+(10+fontRenderer.FONT_HEIGHT+6)/2, frho3+(10+fontRenderer.FONT_HEIGHT+6)/2,0xff1c1c1c);
|
||||
fontRenderer.drawString("<", frho3+frho3-fontRenderer.getStringWidth("<")/2, frho3+frho3-fontRenderer.FONT_HEIGHT/2, -1);
|
||||
fontRenderer.drawString(screenTitle + " - "+modWatching.name, MathHelper.clamp_int(this.width/4, 200, this.width/4)/2-fontRenderer.getStringWidth(screenTitle + " - "+modWatching.name)/2, 10, -1);
|
||||
Gui.drawRect(0, 10+fontRenderer.FONT_HEIGHT+6, MathHelper.clamp_int(this.width/4, 200, this.width/4), 10+fontRenderer.FONT_HEIGHT+7, -1);
|
||||
int i = 0;
|
||||
Mod m = this.modWatching;
|
||||
for (int amongus = 0; amongus < m.settings.size(); amongus++) {
|
||||
Setting s = m.settings.get(amongus);
|
||||
BooleanSetting bS = null;
|
||||
if (s instanceof BooleanSetting) {
|
||||
bS = (BooleanSetting)s;
|
||||
}
|
||||
|
||||
int x = 10;
|
||||
int y = (fontRenderer.FONT_HEIGHT*2+45)+60*i+10-offset;
|
||||
int frho1 = (10 + fontRenderer.FONT_HEIGHT * 2 + 15 + 10 + 10);
|
||||
int width = MathHelper.clamp_int(this.width / 4, 200, this.width / 4) - 10 - x;
|
||||
int height = (fontRenderer.FONT_HEIGHT*2+45)+60*i+60-offset-y;
|
||||
Gui.drawRect(10, y,
|
||||
MathHelper.clamp_int(this.width / 4, 200, this.width / 4) - 10,
|
||||
frho1 + 60 * i + 60 - offset, 0xff1c1c1c);
|
||||
fontRenderer.drawString(s.name, 20,frho1 + 60 * i + 10 - offset + 10, -1);
|
||||
|
||||
if (bS != null) {
|
||||
Gui.drawRect(x, y, x + width, y + 1, bS.getValue() ? 0xff009e00 : 0xff9e0000);
|
||||
Gui.drawRect(x, y, x + 1, y + height, bS.getValue() ? 0xff009e00 : 0xff9e0000);
|
||||
Gui.drawRect(x + width - 1, y, x + width, y + height, bS.getValue() ? 0xff009e00 : 0xff9e0000);
|
||||
Gui.drawRect(x, y + height - 1, x + width, y + height, bS.getValue() ? 0xff009e00 : 0xff9e0000);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
super.drawScreen(mx, my, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton.id == 200) {
|
||||
this.mc.displayGuiScreen(null);
|
||||
}else if (par1GuiButton.id == 5) {
|
||||
mc.displayGuiScreen(new HUDConfigScreen());
|
||||
}else if (par1GuiButton.id == 2) {
|
||||
mc.displayGuiScreen(new ClickGUI());
|
||||
}
|
||||
|
||||
if (par1GuiButton.id != 200 && par1GuiButton.id != 5 && par1GuiButton.id != 2) {
|
||||
this.mc.displayGuiScreen(new GuiScreenModule());
|
||||
}
|
||||
super.actionPerformed(par1GuiButton);
|
||||
}
|
||||
|
||||
public boolean doesGuiPauseGame() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
this.search.updateCursorCounter();
|
||||
super.updateScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
this.search.textboxKeyTyped(par1, par2);
|
||||
searchString = this.search.getText();
|
||||
if (par2 == Keyboard.KEY_ESCAPE || par2 == Minecraft.getMinecraft().gameSettings.keyBindClickGui.keyCode)
|
||||
mc.displayGuiScreen(null);
|
||||
super.keyTyped(par1, par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
if (getListMaxScroll() + this.height >= this.height) {
|
||||
int wheel = EaglerAdapter.mouseGetEventDWheel();
|
||||
if (wheel < 0) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
offset = MathHelper.clamp_int(offset + 1, 0, getListMaxScroll());
|
||||
}
|
||||
} else if (wheel > 0) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
offset = MathHelper.clamp_int(offset - 1, 0, getListMaxScroll());
|
||||
}
|
||||
}
|
||||
super.handleMouseInput();
|
||||
}
|
||||
offset = MathHelper.clamp_int(MathHelper.clamp_int(offset, 0, getListMaxScroll()), 0, getListMaxScroll());
|
||||
}
|
||||
|
||||
private int getListMaxScroll() {
|
||||
int mods = 0;
|
||||
int i = 0;
|
||||
for (int z = 0; z < Resent.INSTANCE.modManager.modules.size(); z++) {
|
||||
Mod m = Resent.INSTANCE.modManager.modules.get(z);
|
||||
if (m.name.toLowerCase().contains(this.searchString.toLowerCase())) {
|
||||
mods++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return 60 * mods + 70 - this.height;
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
this.buttonList.add(new GuiButton(200, this.width - 200, this.height - 20, 100, 20, "Back"));
|
||||
this.buttonList.add(new GuiButton(5, this.width - 100, this.height - 20, 100, 20, "Modify HUD"));
|
||||
this.buttonList.add(new GuiButton(2, this.width - 300, this.height - 20, 100, 20, "Test"));
|
||||
search = new GuiTextField(fontRenderer, 10, 10 + fontRenderer.FONT_HEIGHT * 2,
|
||||
MathHelper.clamp_int(this.width / 4, 200, this.width / 4) - 20, 15);
|
||||
this.search.custom = true;
|
||||
this.search.setText(searchString);
|
||||
}
|
||||
|
||||
public void onGuiClosed() {
|
||||
EaglerAdapter.enableRepeatEvents(false);
|
||||
mc.gameSettings.saveOptions();
|
||||
}
|
||||
|
||||
public boolean isMouseInside(int mouseX, int mouseY, int x, int y, int width, int height) {
|
||||
return (mouseX >= x && mouseX <= width) && (mouseY >= y && mouseY <= height);
|
||||
}
|
||||
|
||||
}*/
|
||||
@@ -0,0 +1,38 @@
|
||||
package dev.resent.ui.mods;
|
||||
|
||||
import dev.resent.Resent;
|
||||
import dev.resent.module.base.RenderModule;
|
||||
import net.lax1dude.eaglercraft.v1_8.Keyboard;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class HUDConfigScreen extends GuiScreen {
|
||||
|
||||
public void initGui() {
|
||||
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 148, "Back"));
|
||||
}
|
||||
|
||||
public void onGuiClosed() {
|
||||
Keyboard.enableRepeatEvents(false); mc.gameSettings.saveOptions();
|
||||
}
|
||||
|
||||
public void drawScreen(int mx, int my, float par3) {
|
||||
this.drawDefaultBackground();
|
||||
for (int i = 0; i < Resent.INSTANCE.modManager.modules.size(); i++) {
|
||||
if (Resent.INSTANCE.modManager.modules.get(i).isEnabled() && (Resent.INSTANCE.modManager.modules.get(i) instanceof RenderModule)) {
|
||||
((RenderModule)Resent.INSTANCE.modManager.modules.get(i)).renderLayout(mx, my);
|
||||
}
|
||||
}
|
||||
super.drawScreen(mx, my, par3);
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton.id == 200) {
|
||||
this.mc.displayGuiScreen(new ClickGUI());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean doesGuiPauseGame() { return false; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
/*package dev.resent.ui.mods;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import dev.resent.setting.BooleanSetting;
|
||||
import dev.resent.setting.Setting;
|
||||
import dev.resent.util.misc.Keyboard;
|
||||
import dev.resent.util.render.Color;
|
||||
import dev.resent.util.render.RenderUtils;
|
||||
GlStateManager.popMatrix();
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.src.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.src.GuiScreen;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.ScaledResolution;
|
||||
|
||||
public class Settings extends GuiScreen {
|
||||
|
||||
public ScaledResolution sr;
|
||||
|
||||
public List<Setting> settings = new ArrayList<>(); //TODO: bind module class arrays with setting arrays
|
||||
public int x, y, width, height;
|
||||
public int offset = 0;
|
||||
public float offsety = 20;
|
||||
public FontRenderer fr;
|
||||
|
||||
//Temporary test settings
|
||||
public static BooleanSetting rain = new BooleanSetting("Rain", "", false);
|
||||
public static BooleanSetting scoreboard = new BooleanSetting("Scoreboard", "", true);
|
||||
public static BooleanSetting nametag = new BooleanSetting("Self Nametags", "", true);
|
||||
|
||||
public Settings() {
|
||||
addSetting(rain, scoreboard, nametag);
|
||||
}
|
||||
|
||||
public void addSetting(Setting... setting) {
|
||||
for (Setting s : setting)
|
||||
this.settings.add(s);
|
||||
}
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
int ox = 10;
|
||||
int oy = -30;
|
||||
sr = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
fr = Minecraft.getMinecraft().fontRenderer;
|
||||
width = GuiScreen.width-x;
|
||||
height = GuiScreen.height-y;
|
||||
x = sr.getScaledWidth()/8 + ox;
|
||||
y = sr.getScaledHeight()/(int)1.1-10+oy;
|
||||
int off = 0;
|
||||
|
||||
|
||||
for (int i = 0; i < settings.size(); i++) {
|
||||
|
||||
//bolean setting
|
||||
if (mouseButton == 0 && isMouseInside(mouseX, mouseY, this.x+3+5, height-2-fr.FONT_HEIGHT*-(off), this.x+12+5, height-2-fr.FONT_HEIGHT*(-off)+fr.FONT_HEIGHT) && settings.get(i) instanceof BooleanSetting) {
|
||||
Setting s = settings.get(i);
|
||||
BooleanSetting b = (BooleanSetting) s;
|
||||
b.setValue(!b.getValue());
|
||||
}
|
||||
|
||||
off += 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float par3) {
|
||||
offset = MathHelper.clamp_int(MathHelper.clamp_int(offset, 0, getListMaxScroll()), 0, getListMaxScroll());
|
||||
int xo = 10;
|
||||
int xy = -30;
|
||||
|
||||
sr = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
fr = Minecraft.getMinecraft().fontRenderer;
|
||||
width = GuiScreen.width-x;
|
||||
height = GuiScreen.height-y;
|
||||
x = sr.getScaledWidth()/8+xo;
|
||||
y = sr.getScaledHeight()/(int)1.1-10+xy;
|
||||
int off = 0;
|
||||
|
||||
//background
|
||||
RenderUtils.drawRoundedRect(x, y, width, height, 4, Color.DARK_GRAY.getRGB());
|
||||
|
||||
//for each settings it will do this, i dont use i as offset because it made it weird idk
|
||||
for (int i = 0; i < settings.size(); i++) {
|
||||
|
||||
Setting s = settings.get(i);
|
||||
int fh = fr.FONT_HEIGHT;
|
||||
|
||||
//booleansetting
|
||||
|
||||
//if its current module is a boolean setting
|
||||
if (settings.get(i) instanceof BooleanSetting) {
|
||||
BooleanSetting b = (BooleanSetting) s;
|
||||
//Draw enabled outline
|
||||
RenderUtils.drawRectOutline(this.x+3+5, height-2-fh*-(off)-offset, this.x+12+5,
|
||||
height-2-fh*(-off)+fh-offset,
|
||||
b.getValue() ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
||||
|
||||
//Draw outline fill
|
||||
Gui.drawRect(this.x+4+5, height-1-fh*-(off)-offset, this.x+11+5,
|
||||
height-3-fh*(-off)+fh-offset, isMouseInside(mouseX, mouseY, this.x+4+5,
|
||||
height-1-fh*-(off)-offset, this.x+11+5,
|
||||
height-3-fh*(-off)+fh-offset) ? Color.LIGHT_GRAY.getRGB() : Color.GRAY.getRGB());
|
||||
}
|
||||
|
||||
|
||||
//Sort settings based on length
|
||||
settings.sort(Comparator.comparingInt(set -> fr.getStringWidth(((Setting) set).name)).reversed());
|
||||
|
||||
|
||||
//Draw setting name
|
||||
fr.drawStringWithShadow(settings.get(i).name, this.x+15+5, height-2-fh*-(off)-offset,-1);
|
||||
|
||||
off += 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean doesGuiPauseGame() { return false; }
|
||||
public boolean isMouseInside(int mouseX, int mouseY, int x, int y, int width, int height) { return (mouseX >= x && mouseX <= width) && (mouseY >= y && mouseY <= height); }
|
||||
public void onGuiClosed() { EaglerAdapter.enableRepeatEvents(false); mc.gameSettings.saveOptions(); }
|
||||
protected void keyTyped(char par1, int par2) { if (par2 == Keyboard.KEY_ESCAPE || par2 == Minecraft.getMinecraft().gameSettings.keyBindClickGui.keyCode) { mc.displayGuiScreen(null); } }
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
if (getListMaxScroll() + this.height >= this.height) {
|
||||
int wheel = EaglerAdapter.mouseGetEventDWheel();
|
||||
if (wheel < 0) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
offset = MathHelper.clamp_int(offset + 1, 0, getListMaxScroll());
|
||||
}
|
||||
} else if (wheel > 0) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
offset = MathHelper.clamp_int(offset - 1, 0, getListMaxScroll());
|
||||
}
|
||||
}
|
||||
super.handleMouseInput();
|
||||
}
|
||||
offset = MathHelper.clamp_int(MathHelper.clamp_int(offset, 0, getListMaxScroll()), 0, getListMaxScroll());
|
||||
}
|
||||
|
||||
private int getListMaxScroll() {
|
||||
return 70 - this.height;
|
||||
}
|
||||
}*/
|
||||
Reference in New Issue
Block a user