Add boolean settings
also made eclipse stfu about imports
This commit is contained in:
parent
6552390c0a
commit
60a08c3dad
|
@ -2,7 +2,6 @@ package dev.resent.module.impl.hud;
|
|||
|
||||
import dev.resent.annotation.RenderModule;
|
||||
import dev.resent.module.base.Mod.Category;
|
||||
import dev.resent.visual.ui.Theme;
|
||||
import dev.resent.module.base.RenderMod;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
|
|
@ -2,7 +2,6 @@ package dev.resent.module.impl.hud;
|
|||
|
||||
import dev.resent.annotation.RenderModule;
|
||||
import dev.resent.module.base.Mod.Category;
|
||||
import dev.resent.visual.ui.Theme;
|
||||
import dev.resent.module.base.RenderMod;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package dev.resent.module.impl.hud;
|
|||
|
||||
import dev.resent.annotation.RenderModule;
|
||||
import dev.resent.module.base.Mod.Category;
|
||||
import dev.resent.visual.ui.Theme;
|
||||
import dev.resent.module.base.RenderMod;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
|
|
@ -2,7 +2,6 @@ package dev.resent.module.impl.hud;
|
|||
|
||||
import dev.resent.annotation.RenderModule;
|
||||
import dev.resent.module.base.Mod.Category;
|
||||
import dev.resent.visual.ui.Theme;
|
||||
import dev.resent.module.base.RenderMod;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
|
|
@ -45,38 +45,6 @@ public class RenderUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void drawChromaRect(int zLevel, int x, int y, int width, int height) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)x, (float)(y + height), (float)0.0f);
|
||||
GlStateManager.rotate((float)-90.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
boolean p_drawGradientRect_1_ = false;
|
||||
boolean p_drawGradientRect_2_ = false;
|
||||
int p_drawGradientRect_5_ = Color.HSBtoRGB((float)((System.currentTimeMillis() - (long)x * 10L - (long)y * 10L) % 2000L) / 2000.0f, 0.8f, 0.8f);
|
||||
int p_drawGradientRect_6_ = Color.HSBtoRGB((float)((System.currentTimeMillis() - (long)(x + width / 2) * 10L - (long)y * 10L) % 2000L) / 2000.0f, 0.8f, 0.8f);
|
||||
float lvt_7_1_ = (float)(p_drawGradientRect_5_ >> 24 & 0xFF) / 255.0f;
|
||||
float lvt_8_1_ = (float)(p_drawGradientRect_5_ >> 16 & 0xFF) / 255.0f;
|
||||
float lvt_9_1_ = (float)(p_drawGradientRect_5_ >> 8 & 0xFF) / 255.0f;
|
||||
float lvt_10_1_ = (float)(p_drawGradientRect_5_ & 0xFF) / 255.0f;
|
||||
float lvt_11_1_ = (float)(p_drawGradientRect_6_ >> 24 & 0xFF) / 255.0f;
|
||||
float lvt_12_1_ = (float)(p_drawGradientRect_6_ >> 16 & 0xFF) / 255.0f;
|
||||
float lvt_13_1_ = (float)(p_drawGradientRect_6_ >> 8 & 0xFF) / 255.0f;
|
||||
float lvt_14_1_ = (float)(p_drawGradientRect_6_ & 0xFF) / 255.0f;
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.tryBlendFuncSeparate((int)770, (int)771, (int)1, (int)0);
|
||||
GlStateManager.shadeModel((int)7425);
|
||||
Tessellator lvt_15_1_ = Tessellator.getInstance();
|
||||
WorldRenderer lvt_16_1_ = lvt_15_1_.getWorldRenderer();
|
||||
lvt_16_1_.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
lvt_16_1_.pos((double)height, (double)width, (double)zLevel).color(lvt_12_1_, lvt_13_1_, lvt_14_1_, lvt_11_1_).endVertex();
|
||||
lvt_15_1_.draw();
|
||||
GlStateManager.shadeModel((int)7424);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public static int astolfoColorsDraw(float yOffset, int yTotal, float speed) {
|
||||
float hue = (float) (System.currentTimeMillis() % (int) speed) + ((yTotal - yOffset) * 9);
|
||||
while (hue > speed) {
|
||||
|
@ -167,6 +135,7 @@ public class RenderUtils {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static void drawRoundedRect(final float paramFloat1, final float paramFloat2, final float paramFloat3, final float paramFloat4, final float paramFloat5) {
|
||||
final int i = 18;
|
||||
final float f1 = 90.0f / i;
|
||||
|
|
|
@ -191,31 +191,39 @@ public class ClickGuiRewrite extends GuiScreen {
|
|||
if (!m.isAdmin() && m.getName().toLowerCase().startsWith(searchString.toLowerCase()) && selectedMod == null) {
|
||||
if (y + 115 + offset + scrollOffset > y + 95 && y + 185 + offset + scrollOffset < y + height && part == "Home") {
|
||||
|
||||
if (isMouseInside(mouseX, mouseY, x + width - 60, y + 140 + offset, x + width - 40, y + 160 + offset) && mouseButton == 0 && m.doesHaveSetting()) {
|
||||
selectedMod = m;
|
||||
|
||||
int settingOffset = 0;
|
||||
for (Setting s: selectedMod.settings) {
|
||||
if (s instanceof BooleanSetting) {
|
||||
comps.add(new CompCheck(x+110, y+125+settingOffset, selectedMod, s));
|
||||
}
|
||||
|
||||
settingOffset += 25;
|
||||
}
|
||||
}
|
||||
|
||||
if(isMouseInside(mouseX, mouseY, x + 80, y + 115 + offset + scrollOffset, x + width - 20, y + 185 + offset + scrollOffset)) {
|
||||
if(mouseButton == 0) {
|
||||
m.toggle();
|
||||
}
|
||||
|
||||
if(mouseButton == 1) {
|
||||
if(mouseButton == 1 && m.doesHaveSetting()) {
|
||||
selectedMod = m;
|
||||
|
||||
int settingOffset = 0;
|
||||
for (Setting s: selectedMod.settings) {
|
||||
|
||||
if (s instanceof BooleanSetting) {
|
||||
comps.add(new CompCheck(4, 4, selectedMod, s));
|
||||
}
|
||||
}
|
||||
}
|
||||
comps.add(new CompCheck(x+110, y+125+settingOffset, selectedMod, s));
|
||||
}
|
||||
|
||||
if (isMouseInside(mouseX, mouseY, x + width - 60, y + 140 + offset, x + width - 40, y + 160 + offset) && mouseButton == 0 && m.doesHaveSetting()) {
|
||||
selectedMod = m;
|
||||
for (Setting s: selectedMod.settings) {
|
||||
if (s instanceof BooleanSetting) {
|
||||
comps.add(new CompCheck(4, 4, selectedMod, s));
|
||||
settingOffset += 25;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
offset += 80;
|
||||
}
|
||||
|
|
|
@ -7,11 +7,15 @@ public abstract class Comp {
|
|||
|
||||
public Mod mod;
|
||||
public Setting setting;
|
||||
public int x, y, width, height;
|
||||
public float x, y, width, height;
|
||||
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {}
|
||||
public void mouseReleased(int mouseX, int mouseY, int state) {}
|
||||
public void drawScreen(int mouseX, int mouseY) {}
|
||||
public void keyTyped(char typedChar, int keyCode) {}
|
||||
|
||||
public boolean isMouseInside(double mouseX, double mouseY, double x, double y, double width, double height) {
|
||||
return (mouseX >= x && mouseX <= width) && (mouseY >= y && mouseY <= height);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,12 +4,14 @@ import dev.resent.module.base.Mod;
|
|||
import dev.resent.module.base.setting.BooleanSetting;
|
||||
import dev.resent.module.base.setting.Setting;
|
||||
import dev.resent.util.misc.FuncUtils;
|
||||
import dev.resent.util.render.Color;
|
||||
import dev.resent.util.render.RenderUtils;
|
||||
import dev.resent.visual.ui.clickgui.rewrite.comp.Comp;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class CompCheck extends Comp{
|
||||
|
||||
public CompCheck(int x, int y, Mod m, Setting s){
|
||||
public CompCheck(float x, float y, Mod m, Setting s){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.mod = m;
|
||||
|
@ -18,13 +20,13 @@ public class CompCheck extends Comp{
|
|||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY) {
|
||||
|
||||
RenderUtils.drawRoundedRect(this.x, this.y, this.x+20, this.y+20, 8, ((BooleanSetting)setting).getValue() ? new Color(3, 218, 197).getRGB() : new Color(66, 66, 66).getRGB());
|
||||
Minecraft.getMinecraft().fontRendererObj.drawString(setting.name, this.x+25, this.y+6.5f, -1, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
//replace with checkbox location
|
||||
if(FuncUtils.isInside(mouseX, mouseY, x, y, width, height)){
|
||||
if(isMouseInside(mouseX, mouseY, this.x, this.y, this.x+20, this.y+20)){
|
||||
((BooleanSetting)setting).toggle();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user