Tabgui & fixes

This commit is contained in:
ThisIsALegitUsername 2023-02-25 05:11:49 +00:00
parent 41f6dcb977
commit 18e0c78d41
8 changed files with 28759 additions and 28526 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -17,6 +17,8 @@ public abstract class Mod {
private Category category; private Category category;
private boolean enabled = false; private boolean enabled = false;
private boolean hasSetting; private boolean hasSetting;
public boolean expanded;
public int index;
public List<Setting> settings = new ArrayList<>(); public List<Setting> settings = new ArrayList<>();

View File

@ -5,6 +5,7 @@ public class Setting {
public String name; public String name;
public boolean gameSetting; public boolean gameSetting;
public String description; public String description;
public boolean focused;
public Setting(String name, String description) { public Setting(String name, String description) {
this.name = name; this.name = name;

View File

@ -20,7 +20,7 @@ public class Info extends RenderMod {
public static final String[] directionsF = new String[] { "\u00A79S\u00A7r", "\u00A72W\u00A7r", "\u00A74N\u00A7r", "\u00A76E\u00A7r" }; public static final String[] directionsF = new String[] { "\u00A79S\u00A7r", "\u00A72W\u00A7r", "\u00A74N\u00A7r", "\u00A76E\u00A7r" };
public int getWidth() { public int getWidth() {
return mc.fontRendererObj.getStringWidth("X: -99999999 + "); return mc.fontRendererObj.getStringWidth("X: " + mc.thePlayer.posX + " Dir: " + directionsF[MathHelper.floor_double(this.mc.thePlayer.rotationYaw * 4 / 360 + 0.5) & 3]);
} }
public int getHeight() { public int getHeight() {
@ -39,7 +39,10 @@ public class Info extends RenderMod {
drawString(" Y: " + py, this.x + 5, this.y + 24, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow()); drawString(" Y: " + py, this.x + 5, this.y + 24, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
drawString(" Z: " + pz, this.x + 5, this.y + 34, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow()); drawString(" Z: " + pz, this.x + 5, this.y + 34, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
if (direction.getValue()) drawString(" Dir: " + directionsF[rot], this.x + 5 + mc.fontRendererObj.getStringWidth(" X: " + px), this.y + 14, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow()); if (direction.getValue()){
drawString(" Dir: ", this.x + 5 + mc.fontRendererObj.getStringWidth(" X: " + px), this.y + 14, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
mc.fontRendererObj.drawString(directionsF[rot], this.x+5+mc.fontRendererObj.getStringWidth("X: " + px), this.y + 14, -1, Theme.getTextShadow());
}
drawString(" Biome: " + mc.theWorld.getBiomeGenForCoords(new BlockPos(px, py, pz)).biomeName, this.x + 5, this.y + 44, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow()); drawString(" Biome: " + mc.theWorld.getBiomeGenForCoords(new BlockPos(px, py, pz)).biomeName, this.x + 5, this.y + 44, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
} }
} }

View File

@ -16,10 +16,8 @@ public class Cape extends Mod{
mc.displayGuiScreen(new CapeUi()); mc.displayGuiScreen(new CapeUi());
} }
}; };
public BooleanSetting ratio = new BooleanSetting("qwiehgioqwhe", "", true);
public ModeSetting amogus = new ModeSetting("amogus", "", "asdfasdf", "asdfasdf 1");
public Cape(){ public Cape(){
addSetting(amogus, open, ratio); addSetting(open);
} }
} }

View File

@ -1,13 +1,18 @@
package dev.resent.module.impl.misc; package dev.resent.module.impl.misc;
import java.util.List;
import dev.resent.annotation.RenderModule; import dev.resent.annotation.RenderModule;
import dev.resent.client.Resent; import dev.resent.client.Resent;
import dev.resent.module.base.Mod; import dev.resent.module.base.Mod;
import dev.resent.module.base.Mod.Category; import dev.resent.module.base.Mod.Category;
import dev.resent.module.base.RenderMod; import dev.resent.module.base.RenderMod;
import dev.resent.util.render.RenderUtils; import dev.resent.module.base.setting.BooleanSetting;
import dev.resent.module.base.setting.ModeSetting;
import dev.resent.module.base.setting.NumberSetting;
import dev.resent.module.base.setting.Setting;
import net.lax1dude.eaglercraft.v1_8.internal.KeyboardConstants; import net.lax1dude.eaglercraft.v1_8.internal.KeyboardConstants;
import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
@RenderModule(name = "TabGUI", category = Category.HUD, x = 30, y = 150) @RenderModule(name = "TabGUI", category = Category.HUD, x = 30, y = 150)
@ -24,73 +29,283 @@ public class TabGui extends RenderMod {
return Category.values().length * 16 + 4; return Category.values().length * 16 + 4;
} }
public void draw() { public void draw(){
Gui.drawRect(x, y, x + 70, y + 3 + Category.values().length * 16, 0x90000000); FontRenderer fr = mc.fontRendererObj;
RenderUtils.drawChromaRectangle(x, y + current * 16, x + 70, y + 18f + current * 16, 0.6f, 0xff900000);
int offset = 0; int primaryColor = 0xffff69b4, secondaryColor = 0xffff46b4;
for (Category c : Category.values()) {
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(c.name, x + 10, y + 6.5f + offset, -1);
offset += 16;
}
if (expanded) { //original tab gui
Category category = Category.values()[current]; Gui.drawRect(5.5, 5.5f, 70, 5 + Mod.Category.values().length * 16 + 1.5, 0x90000000);
if (Resent.INSTANCE.modManager.modsInCategory(category).size() == 0) return; Gui.drawRect(5.5, 5.5f + current * 16, 70, 13 + current * 16 + 7 + 2.5f, primaryColor);
Gui.drawRect(x + 70, y, x + 138, y + 3 + Resent.INSTANCE.modManager.modsInCategory(category).size() * 16, 0x90000000);
RenderUtils.drawChromaRectangle(x + 70, y + category.i * 16, x + 138, y + 18f + category.i * 16, 0.6f, 0xff900000);
offset = 0; int count = 0;
for (Mod m : Resent.INSTANCE.modManager.modsInCategory(category)) { for (Category c : Mod.Category.values())
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(m.getName(), x + 73, y + 6.5f + offset, -1); {
offset += 16; fr.drawStringWithShadow(c.name, 11, 10 + count*16, -1);
}
}
}
public void onKey(int k) { count++;
Category category = Category.values()[current]; }
if (k == KeyboardConstants.KEY_UP) {
if (expanded) { //expansion
if (category.i <= 0) { if (expanded)
category.i = Resent.INSTANCE.modManager.modsInCategory(category).size() - 1; {
} else { Category category = Mod.Category.values()[current];
--category.i; List<Mod> modules = Resent.INSTANCE.modManager.modsInCategory(category);
}
} else { if(modules.size() == 0)
if (current <= 0) { {
current = Category.values().length - 1; return;
} else { }
--current;
}
} Gui.drawRect(70, 5.5, 138, 5 + modules.size() * 16 + 1.5, 0x90000000);
Gui.drawRect(70, 5.5 + category.i * 16, 138, 8 + category.i * 16 + 12 + 2.5F, primaryColor);
count = 0;
for (Mod m : modules)
{
fr.drawStringWithShadow(m.getName(), 73, 10 + count*16, -1);
if(count == category.i && m.expanded)
{
int index = 0, maxLength = 0;
for (Setting setting : m.settings)
{
if(setting instanceof BooleanSetting)
{
BooleanSetting bool = (BooleanSetting) setting;
if(maxLength < fr.getStringWidth(setting.name + ": " + (bool.getValue() ? "Enabled" : "Disabled")))
{
maxLength = fr.getStringWidth(setting.name + ": " + (bool.getValue() ? "Enabled" : "Disabled"));
}
}
if(setting instanceof NumberSetting)
{
NumberSetting number = (NumberSetting) setting;
if(maxLength < fr.getStringWidth(setting.name + ": " + number.getValue()))
{
maxLength = fr.getStringWidth(setting.name + ": " + number.getValue());
}
//fr.drawStringWithShadow(setting.name + ": " + number.getValue(), 73 + 68, 35 + index*16, -1);
}
if(setting instanceof ModeSetting)
{
ModeSetting mode = (ModeSetting) setting;
if(maxLength < fr.getStringWidth(setting.name + ": " + mode.getValue()))
{
maxLength = fr.getStringWidth(setting.name + ": " + mode.getValue());
}
//fr.drawStringWithShadow(setting.name + ": " + mode.getValue(), 73 + 68, 35 + index*16, -1);
}
index++;
}
if(!m.settings.isEmpty())
{
Gui.drawRect(70 + 68, 5.5, 70 + 68 + maxLength + 9, 5 + m.settings.size() * 16 + 1.5, 0x90000000);
Gui.drawRect(70 + 68, 5.5f + m.index * 16, 7 + 61 + maxLength + 70 + 9, 8 + m.index * 16 + 12 + 2.5f,m.settings.get(m.index).focused ? secondaryColor : primaryColor); //0xffff69b4);
index = 0;
for (Setting setting : m.settings)
{
if(setting instanceof BooleanSetting)
{
BooleanSetting bool = (BooleanSetting) setting;
fr.drawStringWithShadow(setting.name + ": " + (bool.getValue() ? "Enabled" : "Disabled"), 73 + 68, 10 + index*16, -1);
}
if(setting instanceof ModeSetting)
{
ModeSetting mode = (ModeSetting) setting;
fr.drawStringWithShadow(setting.name + ": " + mode.getValue(), 73 + 68, 10 + index*16, -1);
}
index++;
}
}
}
count++;
}
}
}
public void onKey(int code){
Category category = Mod.Category.values()[current];
List<Mod> modules = Resent.INSTANCE.modManager.modsInCategory(category);
if(expanded && !modules.isEmpty() && modules.get(category.i).expanded)
{
Mod module = modules.get(category.i);
}
if(code == KeyboardConstants.KEY_UP)
{
if(expanded)
{
if(expanded && !modules.isEmpty() && modules.get(category.i).expanded)
{
Mod module = modules.get(category.i);
if(!module.settings.isEmpty())
{
if (module.settings.get(module.index).focused)
{
Setting setting = module.settings.get(module.index);
}
else
{
if(module.index <= 0)
{
module.index = module.settings.size() - 1;
}
else
{
module.index--;
}
}
}
}
else
{
if(category.i <= 0)
{
category.i = modules.size() - 1;
}else
category.i--;
}
}else
if(current <= 0)
{
current = Mod.Category.values().length - 1;
}else
current--;
}
if(code == KeyboardConstants.KEY_DOWN)
{
if(expanded)
{
if(expanded && !modules.isEmpty() && modules.get(category.i).expanded)
{
Mod module = modules.get(category.i);
if(!module.settings.isEmpty())
{
if (module.settings.get(module.index).focused)
{
}
else
{
if (module.index >= module.settings.size() - 1)
{
module.index = 0;
}
else
{
module.index++;
}
}
}
}
else
{
if (category.i >= modules.size() - 1)
{
category.i = 0;
}
else
{
category.i++;
}
}
}else
if (current >= Mod.Category.values().length - 1)
{
current = 0;
}
else
{
current++;
}
}
if(code == KeyboardConstants.KEY_RETURN)
{
if(expanded && modules.size() != 0)
{
Mod module = modules.get(category.i);
if(!module.expanded && !module.settings.isEmpty())
module.expanded = true;
else if(module.expanded && !module.settings.isEmpty())
{
module.settings.get(module.index).focused = !module.settings.get(module.index).focused;
}
}
}
if(code == KeyboardConstants.KEY_RIGHT)
{
if(expanded && modules.size() != 0)
{
Mod module = modules.get(category.i);
if(expanded && !modules.isEmpty() && module.expanded)
{
if(!module.settings.isEmpty())
{
Setting setting = module.settings.get(module.index);
if (setting instanceof BooleanSetting)
{
((BooleanSetting)setting).toggle();
}
if (setting instanceof ModeSetting)
{
((ModeSetting)setting).next();
}
}
}
else
{
if(!module.getName().equals("TabGUI"))
module.toggle();
}
}else
expanded = true;
}
if(code == KeyboardConstants.KEY_LEFT)
{
if(expanded && !modules.isEmpty() && modules.get(category.i).expanded)
{
Mod module = modules.get(category.i);
if(!module.settings.isEmpty())
{
if (module.settings.get(module.index).focused)
{
}
else
modules.get(category.i).expanded = false;
}
}else
expanded = false;
}
} }
if (k == KeyboardConstants.KEY_DOWN) {
if (expanded) {
if (category.i >= Resent.INSTANCE.modManager.modsInCategory(category).size() - 1) {
category.i = 0;
} else {
++category.i;
}
} else {
if (current >= Category.values().length - 1) {
current = 0;
} else {
++current;
}
}
}
if (k == KeyboardConstants.KEY_RIGHT) {
if (expanded && Resent.INSTANCE.modManager.modsInCategory(category).size() != 0 && Resent.INSTANCE.modManager.modsInCategory(category).get(category.i).getName() != "TabGUI") {
Resent.INSTANCE.modManager.modsInCategory(category).get(category.i).toggle();
mc.gameSettings.saveOptions();
} else {
expanded = true;
}
}
if (k == KeyboardConstants.KEY_LEFT) {
expanded = false;
}
}
} }

View File

@ -403,7 +403,7 @@ public abstract class RendererLivingEntity<T extends EntityLivingBase> extends R
} }
} }
if(Minecraft.isGuiEnabled() && ModManager.selfNametag.isEnabled() && !entitylivingbase.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer)) if(Minecraft.isGuiEnabled() && !entitylivingbase.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer) || ModManager.selfNametag.isEnabled())
return true; return true;
return Minecraft.isGuiEnabled() && entitylivingbase != this.renderManager.livingPlayer && !entitylivingbase.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer) && entitylivingbase.riddenByEntity == null; return Minecraft.isGuiEnabled() && entitylivingbase != this.renderManager.livingPlayer && !entitylivingbase.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer) && entitylivingbase.riddenByEntity == null;