Modesetting

This commit is contained in:
ThisIsALegitUsername 2023-04-09 08:44:55 -06:00
parent bcef081195
commit 1b4810da8e
3 changed files with 29 additions and 5 deletions

View File

@ -9,7 +9,7 @@ import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.item.ItemStack;
@RenderModule(name = "ArmorHud", category = Category.HUD, x = 20, y = 4, hasSetting = true, description = "See armor durability without opening your inventory")
@RenderModule(name = "ArmorHud", category = Category.HUD, x = 20, y = 4, hasSetting = true, description = "See armor durability")
public class ArmorHud extends RenderMod {
public ScaledResolution sr;

View File

@ -289,19 +289,24 @@ public class ClickGuiRewrite extends GuiScreen {
public void drawSetting() {
int settingYOffset = 0;
int settingXOffset = 0;
int modeSettingYOffset = 0;
for (Setting s : selectedMod.settings) {
if (s instanceof BooleanSetting) {
comps.add(new CompCheck(x+110+settingXOffset, y+125+settingYOffset, selectedMod, s));
}
if(s instanceof ModeSetting) {
comps.add(new CompMode(x+110+settingXOffset, y+125+settingYOffset, selectedMod, s));
settingXOffset -= fr.getStringWidth(s.name)+50;
comps.add(new CompMode(x+135, y+175+settingYOffset+modeSettingYOffset, selectedMod, s));
modeSettingYOffset += 50;
}
if(x+160+settingXOffset+fr.getStringWidth(s.name)*2 > x+width-20) {
settingXOffset = 0;
settingYOffset += 25;
}else
settingXOffset += fr.getStringWidth(s.name)+50;
}else {
settingXOffset += fr.getStringWidth(s.name)+50;
}
}
}
}

View File

@ -1,8 +1,13 @@
package dev.resent.visual.ui.clickgui.rewrite.comp.impl;
import dev.resent.module.base.Mod;
import dev.resent.module.base.setting.ModeSetting;
import dev.resent.module.base.setting.Setting;
import dev.resent.util.misc.GlUtils;
import dev.resent.util.render.RenderUtils;
import dev.resent.visual.ui.clickgui.rewrite.comp.Comp;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
public class CompMode extends Comp{
@ -15,12 +20,26 @@ public class CompMode extends Comp{
@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
if(isMouseInside(mouseX, mouseY, x-2, y-3, x+6, y+9)) {
((ModeSetting)setting).cycle(false);
}
if(isMouseInside(mouseX, mouseY, x*3-12, y-3, x*3-4, y+9)) {
((ModeSetting)setting).cycle(true);
}
}
@Override
public void drawScreen(int mouseX, int mouseY) {
RenderUtils.drawRoundedRect(x-20, y-10, x*3+10, y+20, 8, 0xFF000000);
GlUtils.startScale((x-20+x*3+10)/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(setting.name)/2, y-20, 1.4f);
Minecraft.getMinecraft().fontRendererObj.drawString(setting.name, (x-20+x*3+10)/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(setting.name)/2-4, y-24, -1, false);
GlStateManager.popMatrix();
Minecraft.getMinecraft().fontRendererObj.drawString(((ModeSetting)setting).getValue(), (x-20+x*3+10)/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(((ModeSetting)setting).getValue())/2, y, -1, false);
Minecraft.getMinecraft().fontRendererObj.drawString("<", x, y, -1, false);
//RenderUtils.drawRectOutline(x-2, y-3, x+6, y+9, -1);
Minecraft.getMinecraft().fontRendererObj.drawString(">", x*3-10, y, -1, false);
//RenderUtils.drawRectOutline(x*3-12, y-3, x*3-4, y+9, -1);
}
}