Refactor a few stuff

This commit is contained in:
ThisIsALegitUsername 2023-02-02 23:03:08 +00:00
parent fe330f7f43
commit 33c95ec29b
19 changed files with 38 additions and 40 deletions

View File

@ -5,8 +5,8 @@ import java.util.Arrays;
import java.util.List;
import dev.resent.annotation.Module;
import dev.resent.module.Theme;
import dev.resent.module.setting.Setting;
import dev.resent.ui.Theme;
import dev.resent.util.render.RenderUtils;
import net.minecraft.client.Minecraft;

View File

@ -4,9 +4,9 @@ import java.util.ArrayList;
import java.util.List;
import dev.resent.annotation.RenderModule;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.ui.Theme;
import dev.resent.util.misc.FuncUtils;
@RenderModule(name = "CPS", category = Category.HUD, x = 4, y = 26)

View File

@ -1,9 +1,9 @@
package dev.resent.module.impl.hud;
import dev.resent.annotation.RenderModule;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.ui.Theme;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.network.play.server.S19PacketEntityStatus;

View File

@ -1,9 +1,9 @@
package dev.resent.module.impl.hud;
import dev.resent.annotation.RenderModule;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.ui.Theme;
import net.minecraft.client.Minecraft;
@RenderModule(name = "FPS", category = Category.HUD, x = 4, y = 38)

View File

@ -1,10 +1,10 @@
package dev.resent.module.impl.hud;
import dev.resent.annotation.RenderModule;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.module.setting.BooleanSetting;
import dev.resent.ui.Theme;
import dev.resent.util.render.Color;
import net.minecraft.util.BlockPos;

View File

@ -4,11 +4,11 @@ import java.util.ArrayList;
import java.util.List;
import dev.resent.annotation.RenderModule;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.module.setting.BooleanSetting;
import dev.resent.module.setting.ModeSetting;
import dev.resent.ui.Theme;
import dev.resent.util.misc.FuncUtils;
import dev.resent.util.render.Color;
import dev.resent.util.render.RenderUtils;

View File

@ -1,9 +1,9 @@
package dev.resent.module.impl.hud;
import dev.resent.annotation.RenderModule;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.ui.Theme;
@RenderModule(name = "Ping display", category = Category.HUD, x = 4, y = 50)
public class Ping extends RenderMod {

View File

@ -1,9 +1,9 @@
package dev.resent.module.impl.hud;
import dev.resent.annotation.RenderModule;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.ui.Theme;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;

View File

@ -3,9 +3,9 @@ package dev.resent.module.impl.hud;
import java.text.DecimalFormat;
import dev.resent.annotation.RenderModule;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.ui.Theme;
import net.minecraft.entity.Entity;
import net.minecraft.util.Vec3;

View File

@ -1,9 +1,9 @@
package dev.resent.module.impl.hud;
import dev.resent.annotation.RenderModule;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.ui.Theme;
@RenderModule(name = "Server info", category = Category.HUD, x = 4, y = 110)
public class ServerInfo extends RenderMod {

View File

@ -1,10 +1,10 @@
package dev.resent.module.impl.movement;
import dev.resent.annotation.RenderModule;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.module.setting.BooleanSetting;
import dev.resent.ui.Theme;
@RenderModule(name = "ToggleSprint", category = Category.MOVEMENT, x = 4, y = 122, hasSetting = true)
public class Sprint extends RenderMod {

View File

@ -5,7 +5,6 @@ import java.io.IOException;
import dev.resent.Resent;
import dev.resent.animation.Animation;
import dev.resent.animation.Direction;
import dev.resent.module.Theme;
import dev.resent.module.base.Mod;
import dev.resent.module.setting.BooleanSetting;
import dev.resent.module.setting.ModeSetting;

View File

@ -1,5 +1,6 @@
package dev.resent.ui;
import dev.resent.util.misc.GlUtils;
import dev.resent.util.render.RenderUtils;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
@ -20,7 +21,7 @@ public class PreGUI extends GuiScreen{
Gui.drawRect(GuiScreen.width/2-30, GuiScreen.height/2+20, GuiScreen.width/2+50, GuiScreen.height/2+50, isMouseInside(i, j, GuiScreen.width/2-30, GuiScreen.height/2+20, GuiScreen.width/2+50, GuiScreen.height/2+50) ? 0x40FFFFFF : 0x50FFFFFF);
RenderUtils.drawRectOutline(GuiScreen.width/2-30, GuiScreen.height/2+20, GuiScreen.width/2+50, GuiScreen.height/2+50, 0x080FFFFFF);
RenderUtils.drawCenteredScaledString("Mods", GuiScreen.width/2+10, GuiScreen.height/2+35-mc.fontRendererObj.FONT_HEIGHT/2, -1, 1.25f);
GlUtils.drawCenteredScaledString("Mods", GuiScreen.width/2+10, GuiScreen.height/2+35-mc.fontRendererObj.FONT_HEIGHT/2, -1, 1.25f);
/*drawRect(GuiScreen.width/2-30, GuiScreen.height/2+55, GuiScreen.width/2+50, GuiScreen.height/2+85, isMouseInside(i, j, GuiScreen.width/2-30, GuiScreen.height/2+55, GuiScreen.width/2+50, GuiScreen.height/2+85) ? 0x40FFFFFF : 0x50FFFFFF);
RenderUtils.drawRectOutline(GuiScreen.width/2-30, GuiScreen.height/2+55, GuiScreen.width/2+50, GuiScreen.height/2+85, 0x080FFFFFF);

View File

@ -1,4 +1,4 @@
package dev.resent.module;
package dev.resent.ui;
import dev.resent.animation.Animation;
import dev.resent.animation.impl.DecelerateAnimation;
@ -7,7 +7,7 @@ import dev.resent.animation.impl.EaseInOutQuad;
import dev.resent.animation.impl.ElasticAnimation;
import dev.resent.animation.impl.SmoothStepAnimation;
import dev.resent.module.impl.misc.HUD;
import dev.resent.util.render.RainbowUtil;
import dev.resent.util.render.RenderUtils;
public class Theme {
@ -20,7 +20,7 @@ public class Theme {
case 1:
return -1;
case 50:
return RainbowUtil.getRainbow(4f, 0.8f, 0.85f);
return RenderUtils.getRainbow(4f, 0.8f, 0.85f);
case 6942069:
return 6942069;
}

View File

@ -1,6 +1,8 @@
package dev.resent.util.misc;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
public class GlUtils {
@ -22,5 +24,12 @@ public class GlUtils {
public static void stopTranslate() {
GlStateManager.popMatrix();
}
public static void drawCenteredScaledString(String text, int param1,int param2, int color, float scale){
GlStateManager.pushMatrix();
GlStateManager.scale(scale,scale,scale);
Gui.drawCenteredString(Minecraft.getMinecraft().fontRendererObj, text, (int) (param1 / scale), (int) (param2 / scale), color, false);
GlStateManager.popMatrix();
}
}

View File

@ -1,16 +0,0 @@
package dev.resent.util.render;
public class RainbowUtil {
public static int getRainbow(float seconds, float saturation, float brightness) {
float hue = (System.currentTimeMillis()) % (int) (seconds * 1000) / (seconds * 1000);
int color = Color.HSBtoRGB(hue, saturation, brightness);
return color;
}
public static int getRainbow1(int delay) {
double rainbowState = Math.ceil((System.currentTimeMillis() + delay) / 20.0);
rainbowState %= 360;
return Color.HSBtoRGB((float) (rainbowState / 360.0f), 0.8f, 0.7f);
}
}

View File

@ -142,11 +142,16 @@ public class RenderUtils {
Gui.drawRect(param1, height1 - 1, width1, height1, color);
}
public static void drawCenteredScaledString(String text, int param1,int param2, int color, float scale){
GlStateManager.pushMatrix();
GlStateManager.scale(scale,scale,scale);
Gui.drawCenteredString(Minecraft.getMinecraft().fontRendererObj, text, (int) (param1 / scale), (int) (param2 / scale), color, false);
GlStateManager.popMatrix();
public static int getRainbow(float seconds, float saturation, float brightness) {
float hue = (System.currentTimeMillis()) % (int) (seconds * 1000) / (seconds * 1000);
int color = Color.HSBtoRGB(hue, saturation, brightness);
return color;
}
public static int getRainbow1(int delay) {
double rainbowState = Math.ceil((System.currentTimeMillis() + delay) / 20.0);
rainbowState %= 360;
return Color.HSBtoRGB((float) (rainbowState / 360.0f), 0.8f, 0.7f);
}
}

View File

@ -1,7 +1,7 @@
package net.minecraft.client.gui;
import dev.resent.ui.ClientButton;
import dev.resent.util.render.RenderUtils;
import dev.resent.util.misc.GlUtils;
import net.lax1dude.eaglercraft.v1_8.profile.GuiScreenEditProfile;
import net.minecraft.client.Minecraft;
import net.minecraft.util.EnumChatFormatting;
@ -24,7 +24,7 @@ public class GuiMainMenu extends GuiScreen {
Gui.drawModalRectWithCustomSizedTexture(0, 0, 0.0f, 0.0f, this.width, this.height, this.width + 21, this.height + 50);
final String s1 = "Copyright " + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "M" + EnumChatFormatting.RESET + "ojang AB";
this.drawString(Minecraft.getMinecraft().fontRendererObj, s1, this.width - Minecraft.getMinecraft().fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1);
RenderUtils.drawCenteredScaledString("" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "Resent", this.width / 2, this.height / 2 - 50, -1, 3f);
GlUtils.drawCenteredScaledString("" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "Resent", this.width / 2, this.height / 2 - 50, -1, 3f);
super.drawScreen(mouseX, mouseY, partialTicks);
}

View File

@ -1,7 +1,7 @@
package net.minecraft.client.gui.inventory;
import dev.resent.animation.Animation;
import dev.resent.module.Theme;
import dev.resent.ui.Theme;
import dev.resent.util.misc.GlUtils;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.OpenGlHelper;