Theme fixes.

This commit is contained in:
UnknownUser1789 2023-01-20 14:14:42 +00:00
parent b88b41dfda
commit 847e996299
12 changed files with 29839 additions and 29869 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,6 @@
package dev.resent.module;
import dev.resent.module.impl.misc.HUD;
import dev.resent.util.render.Color;
import dev.resent.util.render.RainbowUtil;
public class Theme {
@ -14,10 +13,6 @@ public class Theme {
switch(id){
case 1:
return -1;
case 2:
return Color.black.getRGB();
case 3:
return Color.white.getRGB();
case 50:
return RainbowUtil.getRainbow(4f, 0.8f, 0.85f);
}
@ -28,10 +23,6 @@ public class Theme {
switch(HUD.theme.getValue()){
case "Classic":
return 1;
case "Light":
return 2;
case "Dark":
return 3;
case "Rainbow":
return 50;

View File

@ -8,8 +8,6 @@ import dev.resent.Resent;
import dev.resent.event.impl.Event;
import dev.resent.module.Theme;
import dev.resent.setting.Setting;
import dev.resent.util.render.Color;
import dev.resent.util.render.RainbowUtil;
import dev.resent.util.render.RenderUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
@ -57,12 +55,8 @@ public class Mod {
switch(Theme.getId()){
case 1:
RenderUtils.drawRect(left, top, right, bottom, color);
case 2:
RenderUtils.drawRect(left, top, right, bottom, new Color(255, 255, 255, 200).getRGB());
case 3:
RenderUtils.drawRect(left, top, right, bottom, new Color(0, 0, 0, 140).getRGB());
case 50:
Gui.drawRect(left, top, right, bottom, RainbowUtil.getRainbow(4, 0.8f, 0.85f));
Gui.drawRect(left, top, right, bottom, color);
}
}

View File

@ -1,77 +1,45 @@
package dev.resent.module.impl.hud;
import java.util.ArrayList;
import java.util.List;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.setting.BooleanSetting;
import dev.resent.util.misc.FuncUtils;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import java.util.ArrayList;
import java.util.List;
public class CPS extends RenderModule {
private List<Long> clicksLMB = new ArrayList<Long>();
private List<Long> clicksRMB = new ArrayList<Long>();
private boolean wasPressedLMB;
private long lastPressedLMB;
private boolean wasPressedRMB;
private long lastPressedRMB;
public CPS() {
super("CPS", Category.HUD, 4, 84, true);
super("CPS", Category.HUD, 50, 4, true);
addSetting(tshadow);
}
private final List<Long> clicks = new ArrayList<>();
private boolean wasPressed;
private long lastPressed;
public BooleanSetting tshadow = new BooleanSetting("Text shadow", "", true);
public int getWidth() {
return mc.fontRendererObj.getStringWidth("[00 | 00]") + 4;
}
public int getHeight() {
return mc.fontRendererObj.FONT_HEIGHT + 4;
}
public int getWidth() { return mc.fontRendererObj.getStringWidth("[CPS: 00]") + 4; }
public int getHeight() { return mc.fontRendererObj.FONT_HEIGHT+4; }
@Override
public void draw() {
final boolean pressed = Mouse.isButtonDown(0) || Mouse.isButtonDown(1);
boolean pressedLMB = Keyboard.isKeyDown(mc.gameSettings.keyBindAttack.getKeyCode());
if(pressedLMB != this.wasPressedLMB) {
this.lastPressedLMB = System.currentTimeMillis();
this.wasPressedLMB = pressedLMB;
if(pressedLMB) {
this.clicksLMB.add(this.lastPressedLMB);
}
}
boolean pressedRMB = Keyboard.isKeyDown(mc.gameSettings.keyBindUseItem.getKeyCode());
if(pressedRMB != this.wasPressedRMB) {
this.lastPressedRMB = System.currentTimeMillis();
this.wasPressedRMB = pressedRMB;
if(pressedRMB){
this.clicksRMB.add(this.lastPressedRMB);
if(pressed != wasPressed){
lastPressed = System.currentTimeMillis();
wasPressed = pressed;
if(pressed){
this.clicks.add(lastPressed);
}
}
final long time = System.currentTimeMillis();
FuncUtils.removeIf(clicksRMB, aLong -> aLong + 1000 < time);
FuncUtils.removeIf(clicksLMB, aLong -> aLong + 1000 < time);
mc.fontRendererObj.drawString(getText(), this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId()), tshadow.getValue());
}
FuncUtils.removeIf(clicks, aLong -> aLong + 1000 < time);
public String getText(){
return "[ " + getLMB() + " | " + getRMB() + " ]";
}
public int getLMB() {
return this.clicksLMB.size();
}
public int getRMB() {
return this.clicksRMB.size();
mc.fontRendererObj.drawString("[CPS: " + clicks.size() + "]", this.x+2, this.y+2, -1, tshadow.getValue());
}
}

View File

@ -6,6 +6,7 @@ import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.setting.BooleanSetting;
import net.minecraft.client.Minecraft;
import net.minecraft.network.play.server.S19PacketEntityStatus;
public class ComboCounter extends RenderModule {
@ -33,11 +34,11 @@ public class ComboCounter extends RenderModule {
}
public int getWidth() {
return mc.fontRendererObj.getStringWidth(getText()) + 4;
return Minecraft.getMinecraft().fontRendererObj.getStringWidth(getText()) + 4;
}
public int getHeight() {
return mc.fontRendererObj.FONT_HEIGHT + 4;
return Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT + 4;
}
private String getText(){
@ -46,6 +47,6 @@ public class ComboCounter extends RenderModule {
@Override
public void draw() {
mc.fontRendererObj.drawString(getText(), this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId()), tshadow.getValue());
Minecraft.getMinecraft().fontRendererObj.drawString("["+combo+" Combo]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId()), tshadow.getValue());
}
}

View File

@ -37,7 +37,7 @@ public class Info extends RenderModule {
mc.fontRendererObj.drawStringWithShadow(" Y: " + py, this.x + 5, this.y + 24, Theme.getFontColor(Theme.getId()));
mc.fontRendererObj.drawStringWithShadow(" Z: " + pz, this.x + 5, this.y + 34, Theme.getFontColor(Theme.getId()));
if (!direction.getValue()) yes = 6;
//if (direction.getValue()) {
//if (direction.getVtalue()) {
// mc.fontRendererObj.drawStringWithShadow(" Dir: " + Direction.directionsF[rot], this.x+5+mc.fontRendererObj.getStringWidth(" X: " + px), this.y + 14, Theme.getFontColor(Theme.getId()));
mc.fontRendererObj.drawStringWithShadow(" Biome: " + mc.theWorld.getBiomeGenForCoords(new BlockPos(px, py, pz)).biomeName, this.x + 5, this.y + 44, Theme.getFontColor(Theme.getId()));
//mc.fontRendererObj.drawStringWithShadow(" A: " + MathHelper.floor_double((double)mc.thePlayer.rotationYaw>360 || mc.thePlayer.rotationYaw<-360 ? mc.thePlayer.rotationYaw-360 : mc.thePlayer.rotationYaw) + "°", this.x + mc.fontRendererObj.getStringWidth(" D: N "), this.y + 44, Theme.getFontColor(Theme.getId()));

View File

@ -10,6 +10,7 @@ import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
public class KeyStrokes extends RenderModule {
public static KeyStrokes INSTANCE = new KeyStrokes();
@ -58,23 +59,23 @@ public class KeyStrokes extends RenderModule {
if (!transparent.getValue()) {
//W
drawRect(this.x + 30, this.y + 3, this.x + 55, this.y + 25 + 3, wKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 30, this.y + 3, this.x + 55, this.y + 25 + 3, wKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// S
drawRect(this.x + 30, this.y + 30, this.x + 55, this.y + 55, sKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 30, this.y + 30, this.x + 55, this.y + 55, sKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// A
drawRect(this.x + 3, this.y + 30, this.x + 25 + 3, this.y + 55, aKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 3, this.y + 30, this.x + 25 + 3, this.y + 55, aKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// D
drawRect(this.x + 60 - 3, this.y + 30, this.x + 85 - 3, this.y + 25 + 5 + 25, dKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 60 - 3, this.y + 30, this.x + 85 - 3, this.y + 25 + 5 + 25, dKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// LMB
drawRect(this.x + 3, this.y + 57, this.x + 41, this.y + 82, pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 3, this.y + 57, this.x + 41, this.y + 82, pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// RMB
drawRect(this.x + 45 - 1, this.y + 60 - 3, this.x + 85 - 3, this.y + 85 - 3, rpressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 45 - 1, this.y + 60 - 3, this.x + 85 - 3, this.y + 85 - 3, rpressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// Jump
if (jump.getValue()) drawRect(this.x + 3, this.y + 84, this.x + 85 - 3, this.y + 105 - 6, spaceKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
if (jump.getValue()) Gui.drawRect(this.x + 3, this.y + 84, this.x + 85 - 3, this.y + 105 - 6, spaceKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// Sneak
if (sneak.getValue()) drawRect(this.x + 3, jump.getValue() ? this.y + 102 : this.y + 84, this.x + 85 - 3, jump.getValue() ? this.y + 120 - 3 : this.y + 105 - 6, mc.gameSettings.keyBindSneak.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
if (sneak.getValue()) Gui.drawRect(this.x + 3, jump.getValue() ? this.y + 102 : this.y + 84, this.x + 85 - 3, jump.getValue() ? this.y + 120 - 3 : this.y + 105 - 6, mc.gameSettings.keyBindSneak.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
}
mc.fontRendererObj.drawString("W", this.x + 25 + 5 + (25 / 2 - mc.fontRendererObj.getStringWidth("W") + 4), this.y + 8 + 3, chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : wKey ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());

View File

@ -7,12 +7,13 @@ import dev.resent.event.impl.EventAttack;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
public class ReachDisplay extends RenderModule {
public static final DecimalFormat df2 = new DecimalFormat("0.00");
public static double range;
public double range;
public ReachDisplay() {
super("ReachDisplay", Category.HUD, 4, 34);
@ -33,11 +34,10 @@ public class ReachDisplay extends RenderModule {
@Override
public void onEvent(Event e) {
if (e instanceof EventAttack && e.isPre() && isEnabled()) {
Vec3 vec3 = this.mc.getRenderViewEntity().getPositionEyes(1.0f);
range = this.mc.objectMouseOver.hitVec.distanceTo(vec3);
if (range > 3.0f && !mc.playerController.isInCreativeMode()) {
range = 3.0f;
if(e instanceof EventAttack){
if (this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && this.isEnabled() && this.mc.objectMouseOver.entityHit.getEntityId() == ((EventAttack)e).target.getEntityId()) {
final Vec3 vec3 = this.mc.getRenderViewEntity().getPositionEyes(1.0f);
this.range = this.mc.objectMouseOver.hitVec.distanceTo(vec3);
}
}
}

View File

@ -2,16 +2,15 @@ package dev.resent.module.impl.misc;
import dev.resent.module.base.Category;
import dev.resent.module.base.Mod;
import dev.resent.setting.BooleanSetting;
import dev.resent.setting.ModeSetting;
public class HUD extends Mod{
public HUD(){
super("Hud", Category.MISC, true);
addSetting(theme, animated);
super("Theme", Category.MISC, true);
addSetting(theme);
}
public static final ModeSetting theme = new ModeSetting("Theme", "", "Classic", "Light", "Dark", "Rainbow");
public static final BooleanSetting animated = new BooleanSetting("Animated", "", true);
public static final ModeSetting theme = new ModeSetting("Theme", "", "Classic", "Rainbow");
//public static final BooleanSetting animated = new BooleanSetting("Animated", "", true);
}

View File

@ -1,6 +1,7 @@
package dev.resent.util.render;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import dev.resent.setting.ModeSetting;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
@ -33,6 +34,32 @@ public class RenderUtils {
return -1;
}
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);
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_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 void drawChromaString(String string, int x, int y, boolean shadow) {
Minecraft mc = Minecraft.getMinecraft();

View File

@ -1,7 +1,11 @@
package net.minecraft.client.gui;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_FLAT;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_ONE_MINUS_SRC_ALPHA;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_SMOOTH;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_SRC_ALPHA;
import dev.resent.util.render.Color;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;