Added tabgui
This commit is contained in:
parent
8e5e472dac
commit
ad4ab5299e
60520
javascript/classes.js
60520
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -69,11 +69,10 @@ public abstract class Mod {
|
||||||
|
|
||||||
public enum Category {
|
public enum Category {
|
||||||
HUD("Hud"),
|
HUD("Hud"),
|
||||||
MOVEMENT("Movement"),
|
|
||||||
MISC("Misc");
|
MISC("Misc");
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
|
public int i;
|
||||||
Category(final String name) {
|
Category(final String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package dev.resent.module.base;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import dev.resent.module.base.Mod.Category;
|
||||||
import dev.resent.module.impl.hud.ArmorHud;
|
import dev.resent.module.impl.hud.ArmorHud;
|
||||||
import dev.resent.module.impl.hud.CPS;
|
import dev.resent.module.impl.hud.CPS;
|
||||||
import dev.resent.module.impl.hud.ComboCounter;
|
import dev.resent.module.impl.hud.ComboCounter;
|
||||||
|
@ -35,6 +36,7 @@ import dev.resent.module.impl.misc.NoSwingDelay;
|
||||||
import dev.resent.module.impl.misc.Scoreboard;
|
import dev.resent.module.impl.misc.Scoreboard;
|
||||||
import dev.resent.module.impl.misc.SelfNametag;
|
import dev.resent.module.impl.misc.SelfNametag;
|
||||||
import dev.resent.module.impl.misc.Sprint;
|
import dev.resent.module.impl.misc.Sprint;
|
||||||
|
import dev.resent.module.impl.misc.TabGui;
|
||||||
import dev.resent.module.impl.misc.Tooltips;
|
import dev.resent.module.impl.misc.Tooltips;
|
||||||
|
|
||||||
public class ModManager {
|
public class ModManager {
|
||||||
|
@ -75,10 +77,12 @@ public class ModManager {
|
||||||
public static Crosshair crosshair = new Crosshair();
|
public static Crosshair crosshair = new Crosshair();
|
||||||
public static HUD hud = new HUD();
|
public static HUD hud = new HUD();
|
||||||
public static CrystalOptimizer crystalOptimizer = new CrystalOptimizer();
|
public static CrystalOptimizer crystalOptimizer = new CrystalOptimizer();
|
||||||
|
public static TabGui tabGui = new TabGui();
|
||||||
|
|
||||||
public ModManager() {
|
public ModManager() {
|
||||||
//HudZ
|
//Hud
|
||||||
register(cosmetics);
|
register(cosmetics);
|
||||||
|
register(tabGui);
|
||||||
register(hotbar);
|
register(hotbar);
|
||||||
register(crystalOptimizer);
|
register(crystalOptimizer);
|
||||||
register(hud = new HUD());
|
register(hud = new HUD());
|
||||||
|
@ -117,6 +121,15 @@ public class ModManager {
|
||||||
register(animations);
|
register(animations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<Mod> modsInCategory(Category c){
|
||||||
|
ArrayList<Mod> inCategory = new ArrayList<>();
|
||||||
|
for(Mod m : this.modules){
|
||||||
|
if(m.category == c)
|
||||||
|
inCategory.add(m);
|
||||||
|
}
|
||||||
|
return inCategory;
|
||||||
|
}
|
||||||
|
|
||||||
public void register(final Mod m) {
|
public void register(final Mod m) {
|
||||||
this.modules.add(m);
|
this.modules.add(m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,6 @@ public class ComboCounter extends RenderMod {
|
||||||
if(Minecraft.getMinecraft().thePlayer.hurtTime > 3 && this.enabled){
|
if(Minecraft.getMinecraft().thePlayer.hurtTime > 3 && this.enabled){
|
||||||
combo = 0;
|
combo = 0;
|
||||||
}
|
}
|
||||||
Minecraft.getMinecraft().fontRendererObj.drawString("["+combo+" Combo]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
|
drawString("["+combo+" Combo]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
102
src/main/java/dev/resent/module/impl/misc/TabGui.java
Normal file
102
src/main/java/dev/resent/module/impl/misc/TabGui.java
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
package dev.resent.module.impl.misc;
|
||||||
|
|
||||||
|
import dev.resent.Resent;
|
||||||
|
import dev.resent.annotation.RenderModule;
|
||||||
|
import dev.resent.module.base.Mod;
|
||||||
|
import dev.resent.module.base.Mod.Category;
|
||||||
|
import dev.resent.util.misc.GlUtils;
|
||||||
|
import dev.resent.util.render.RenderUtils;
|
||||||
|
import dev.resent.module.base.RenderMod;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.internal.KeyboardConstants;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
|
||||||
|
@RenderModule(name = "TabGUI", category = Category.HUD, x = 30, y = 150)
|
||||||
|
public class TabGui extends RenderMod{
|
||||||
|
|
||||||
|
public int current = 0;
|
||||||
|
public boolean expanded;
|
||||||
|
|
||||||
|
public int getWidth(){
|
||||||
|
return expanded ? 90 : 70;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight(){
|
||||||
|
return Category.values().length*16;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {
|
||||||
|
|
||||||
|
GlUtils.startTranslate(this.x, this.y-50);
|
||||||
|
Gui.drawRect(x+5, y+30.5, x+70, y+31.5+Category.values().length*16, 0x90000000);
|
||||||
|
RenderUtils.drawChromaRectangle(x+7, y+33+current*16, x+68, y+45+current*16, 0xff900000);
|
||||||
|
|
||||||
|
int offset = 0;
|
||||||
|
for(Category c : Category.values()){
|
||||||
|
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(c.name, x+10, y+35+offset, -1);
|
||||||
|
offset += 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(expanded){
|
||||||
|
|
||||||
|
Category category = Category.values()[current];
|
||||||
|
if(Resent.INSTANCE.modManager.modsInCategory(category).size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Gui.drawRect(x+70, y+30.5, x+138, y+31.5+Resent.INSTANCE.modManager.modsInCategory(category).size()*16, 0x90000000);
|
||||||
|
RenderUtils.drawChromaRectangle(x+70, y+33+category.i*16, x+136, y+45+category.i*16, 0xff900000);
|
||||||
|
|
||||||
|
offset = 0;
|
||||||
|
for(Mod m : Resent.INSTANCE.modManager.modsInCategory(category)){
|
||||||
|
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(m.name, x+73, y+35+offset, -1);
|
||||||
|
offset += 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GlUtils.stopTranslate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onKey(int k){
|
||||||
|
Category category = Category.values()[current];
|
||||||
|
if (k ==KeyboardConstants.KEY_UP) {
|
||||||
|
if(expanded){
|
||||||
|
if(category.i <= 0){
|
||||||
|
category.i = Resent.INSTANCE.modManager.modsInCategory(category).size()-1;
|
||||||
|
}else{
|
||||||
|
--category.i;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if(current <= 0){
|
||||||
|
current = Category.values().length-1;
|
||||||
|
}else {
|
||||||
|
--current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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).name != "TabGUI"){
|
||||||
|
Resent.INSTANCE.modManager.modsInCategory(category).get(category.i).toggle();
|
||||||
|
}else {
|
||||||
|
expanded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (k ==KeyboardConstants.KEY_LEFT){
|
||||||
|
expanded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -25,7 +25,7 @@ public class RenderUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawChromaRectangle(int x, int y, int width, int height) {
|
public static void drawChromaRectangle(int x, int y, int width, int height, int colorbecauseidontwanttoremovecolor) {
|
||||||
int i = x;
|
int i = x;
|
||||||
while(true) {
|
while(true) {
|
||||||
if(i+10 <= width) {
|
if(i+10 <= width) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.commons.lang3.Validate;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import dev.resent.Resent;
|
import dev.resent.Resent;
|
||||||
|
import dev.resent.module.base.ModManager;
|
||||||
import dev.resent.ui.PreGUI;
|
import dev.resent.ui.PreGUI;
|
||||||
import dev.resent.util.misc.W;
|
import dev.resent.util.misc.W;
|
||||||
import net.lax1dude.eaglercraft.v1_8.Display;
|
import net.lax1dude.eaglercraft.v1_8.Display;
|
||||||
|
@ -1305,6 +1306,8 @@ public class Minecraft implements IThreadListener {
|
||||||
this.displayInGameMenu();
|
this.displayInGameMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ModManager.tabGui.onKey(k);
|
||||||
|
|
||||||
if (k == 32 && Keyboard.isKeyDown(61) && this.ingameGUI != null) {
|
if (k == 32 && Keyboard.isKeyDown(61) && this.ingameGUI != null) {
|
||||||
this.ingameGUI.getChatGUI().clearChatMessages();
|
this.ingameGUI.getChatGUI().clearChatMessages();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,15 +68,15 @@ public class Gui {
|
||||||
* Draws a solid color rectangle with the specified coordinates
|
* Draws a solid color rectangle with the specified coordinates
|
||||||
* and color (ARGB format). Args: x1, y1, x2, y2, color
|
* and color (ARGB format). Args: x1, y1, x2, y2, color
|
||||||
*/
|
*/
|
||||||
public static void drawRect(int left, int top, int right, int bottom, int color) {
|
public static void drawRect(double left, double top, double right, double bottom, int color) {
|
||||||
if (left < right) {
|
if (left < right) {
|
||||||
int i = left;
|
double i = left;
|
||||||
left = right;
|
left = right;
|
||||||
right = i;
|
right = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (top < bottom) {
|
if (top < bottom) {
|
||||||
int j = top;
|
double j = top;
|
||||||
top = bottom;
|
top = bottom;
|
||||||
bottom = j;
|
bottom = j;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user