Code optimizations

This commit is contained in:
ThisIsALegitUsername 2023-02-04 22:59:09 +00:00
parent 1c1bea85b8
commit 86917a0def
16 changed files with 14579 additions and 14613 deletions

View File

@ -1,4 +1,6 @@
{
"java.dependency.packagePresentation": "hierarchical",
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms100m -Xlog:disable"
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms100m -Xlog:disable",
"editor.tabCompletion": "on",
"diffEditor.codeLens": true
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -4,18 +4,15 @@ import dev.resent.module.base.ModManager;
public class Resent {
public static boolean hasInit = false;
static {
INSTANCE = new Resent();
}
public static String NAME = "Resent", VERSION = "3.4";
public static Resent INSTANCE;
public static final String NAME = "Resent", VERSION = "3.4";
public static final Resent INSTANCE;
public ModManager modManager;
public void init() {
Resent.INSTANCE.modManager = new ModManager();
hasInit = true;
}
}

View File

@ -42,7 +42,6 @@ public class Halo extends CosmeticBase {
private class ModelHalo extends CosmeticModelBase
{
private ModelRenderer halo;
private boolean hat;
public ModelHalo(final RenderPlayer player) {
super(player);
@ -70,7 +69,6 @@ public class Halo extends CosmeticBase {
}
public ModelRenderer bindTextureAndColor(final Color color, final ResourceLocation resourceLocation, final ModelRenderer colorModel, final ModelRenderer playerSkinModel) {
final boolean flag = false;
Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation);
return colorModel;
}

View File

@ -32,7 +32,7 @@ public abstract class Mod {
}
}
public void addSetting(Setting... settings) {
public void addSetting(final Setting... settings) {
this.settings.addAll(Arrays.asList(settings));
}
@ -48,11 +48,11 @@ public abstract class Mod {
}
}
protected void drawRect(int left, int top, int right, int bottom, int color){
protected void drawRect(final int left, final int top, final int right, final int bottom, final int color){
RenderUtils.drawRoundedRect(left, top, right, bottom, 4, color, Theme.getRounded());
}
protected int drawString(String text, int x, int y, int color, boolean idk){
protected int drawString(final String text, final int x, final int y, final int color, final boolean idk){
if(color == 6942069){
RenderUtils.drawChromaString(text, x, y, idk);
}else {
@ -62,7 +62,7 @@ public abstract class Mod {
return x;
}
public void setEnabled(boolean state) {
public void setEnabled(final boolean state) {
this.enabled = state;
if (this.enabled) onEnable(); else onDisable();
}
@ -74,7 +74,7 @@ public abstract class Mod {
public final String name;
Category(String name) {
Category(final String name) {
this.name = name;
}
}

View File

@ -34,8 +34,8 @@ import dev.resent.module.impl.misc.NoRain;
import dev.resent.module.impl.misc.NoSwingDelay;
import dev.resent.module.impl.misc.Scoreboard;
import dev.resent.module.impl.misc.SelfNametag;
import dev.resent.module.impl.misc.Sprint;
import dev.resent.module.impl.misc.Tooltips;
import dev.resent.module.impl.movement.Sprint;
public class ModManager {
public List<Mod> modules = new ArrayList<>();
@ -117,7 +117,7 @@ public class ModManager {
register(animations);
}
public void register(Mod m) {
public void register(final Mod m) {
this.modules.add(m);
}
}

View File

@ -44,7 +44,7 @@ public abstract class RenderMod extends Mod {
}
}
public void renderLayout(int mouseX, int mouseY) {
public void renderLayout(final int mouseX, final int mouseY) {
resize();
draw();
@ -55,13 +55,13 @@ public abstract class RenderMod extends Mod {
if (!Mouse.isButtonDown(0)) this.dragging = false;
}
boolean hovered = mouseX >= getX() && mouseY >= getY() && mouseX < getX() + getWidth() && mouseY < getY() + this.getHeight();
final boolean hovered = mouseX >= getX() && mouseY >= getY() && mouseX < getX() + getWidth() && mouseY < getY() + this.getHeight();
Gui.drawRect(this.x, this.y, this.x + this.getWidth(), this.y + this.getHeight(), hovered ? 0x50FFFFFF : 0x40FFFFFF);
RenderUtils.drawRectOutline(this.x, this.y, this.x+this.getWidth(), this.y+this.getHeight(), -1);
boolean mouseOverX = (mouseX >= this.getX() && mouseX <= this.getX() + this.getWidth());
boolean mouseOverY = (mouseY >= this.getY() && mouseY <= this.getY() + this.getHeight());
final boolean mouseOverX = (mouseX >= this.getX() && mouseX <= this.getX() + this.getWidth());
final boolean mouseOverY = (mouseY >= this.getY() && mouseY <= this.getY() + this.getHeight());
if (mouseOverX && mouseOverY && Mouse.isButtonDown(0) && !this.dragging) {
this.lastX = x - mouseX;
@ -75,7 +75,7 @@ public abstract class RenderMod extends Mod {
return x;
}
public void setX(int x) {
public void setX(final int x) {
this.x = x;
}
@ -83,7 +83,7 @@ public abstract class RenderMod extends Mod {
return y;
}
public void setY(int y) {
public void setY(final int y) {
this.y = y;
}
@ -91,7 +91,7 @@ public abstract class RenderMod extends Mod {
return width;
}
public void setWidth(int width) {
public void setWidth(final int width) {
this.width = width;
}
@ -99,7 +99,7 @@ public abstract class RenderMod extends Mod {
return height;
}
public void setHeight(int height) {
public void setHeight(final int height) {
this.height = height;
}
}

View File

@ -27,6 +27,7 @@ public class KeyStrokes extends RenderMod{
public BooleanSetting sneak = new BooleanSetting("Sneak", "", false);
public BooleanSetting jump = new BooleanSetting("Jump", "", true);
public BooleanSetting tshadow = new BooleanSetting("Text shadow", "", false);
public ModeSetting color = new ModeSetting("Unpressed text color", "", "White", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "Black");
public ModeSetting colorp = new ModeSetting("Pressed text color", "", "Black", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "White");
public ModeSetting gcolor = new ModeSetting("Pressed button color", "", "White", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "Black");
@ -121,16 +122,16 @@ public class KeyStrokes extends RenderMod{
jump.getValue() ? this.y+120-3 : this.y+105-6, 4, mc.gameSettings.keyBindSneak.pressed ? getColor(gcolor) : getColor(gcolorp), Theme.getRounded());
mc.fontRendererObj.drawString("W", this.x+25+5+(25/2-mc.fontRendererObj.getStringWidth("W") + 4), this.y+8+3, wKey ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("S", this.x+25+5+(25/2-mc.fontRendererObj.getStringWidth("S") + 4), this.y+38, sKey ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("A", this.x+3+(25/2-mc.fontRendererObj.getStringWidth("A") + 4), this.y+38, aKey ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("D", this.x+-3+25+25+10+(25/2-mc.fontRendererObj.getStringWidth("D") + 4), this.y+38, dKey ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("W", this.x+25+5+(25/2-mc.fontRendererObj.getStringWidth("W") + 4), this.y+8+3, wKey ? getColor(colorp) : getColor(color), tshadow.getValue());
mc.fontRendererObj.drawString("S", this.x+25+5+(25/2-mc.fontRendererObj.getStringWidth("S") + 4), this.y+38, sKey ? getColor(colorp) : getColor(color), tshadow.getValue());
mc.fontRendererObj.drawString("A", this.x+3+(25/2-mc.fontRendererObj.getStringWidth("A") + 4), this.y+38, aKey ? getColor(colorp) : getColor(color), tshadow.getValue());
mc.fontRendererObj.drawString("D", this.x+-3+25+25+10+(25/2-mc.fontRendererObj.getStringWidth("D") + 4), this.y+38, dKey ? getColor(colorp) : getColor(color), tshadow.getValue());
if(jump.getValue())
mc.fontRendererObj.drawString("\u00A7m-------", this.x+85+(25/2-mc.fontRendererObj.getStringWidth("u00A7m-------") + 4), this.y+92-3, jumpKey ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("\u00A7m-------", this.x+85+(25/2-mc.fontRendererObj.getStringWidth("u00A7m-------") + 4), this.y+92-3, jumpKey ? getColor(colorp) : getColor(color), tshadow.getValue());
if(sneak.getValue())
mc.fontRendererObj.drawString("Sneak", this.x+38+3+(25/2-mc.fontRendererObj.getStringWidth("Sneak") + 4), jump.getValue() ? this.y+92+15+1-3 : this.y+92-4, mc.gameSettings.keyBindSneak.pressed ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("LMB", this.x+3+40/2-mc.fontRendererObj.getStringWidth("LMB")/2, (this.y+60+25/2)-mc.fontRendererObj.FONT_HEIGHT/2-3, Mouse.isButtonDown(0) ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("RMB", this.x+40+3+40/2-mc.fontRendererObj.getStringWidth("RMB")/2, (this.y+60+25/2)-mc.fontRendererObj.FONT_HEIGHT/2-3, Mouse.isButtonDown(1) ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("Sneak", this.x+38+3+(25/2-mc.fontRendererObj.getStringWidth("Sneak") + 4), jump.getValue() ? this.y+92+15+1-3 : this.y+92-4, mc.gameSettings.keyBindSneak.pressed ? getColor(colorp) : getColor(color), tshadow.getValue());
mc.fontRendererObj.drawString("LMB", this.x+3+40/2-mc.fontRendererObj.getStringWidth("LMB")/2, (this.y+60+25/2)-mc.fontRendererObj.FONT_HEIGHT/2-3, Mouse.isButtonDown(0) ? getColor(colorp) : getColor(color), tshadow.getValue());
mc.fontRendererObj.drawString("RMB", this.x+40+3+40/2-mc.fontRendererObj.getStringWidth("RMB")/2, (this.y+60+25/2)-mc.fontRendererObj.FONT_HEIGHT/2-3, Mouse.isButtonDown(1) ? getColor(colorp) : getColor(color), tshadow.getValue());
this.setHeight((25 + 5 + 25 + 5 + 25 + 25));
this.setWidth((25 + 5 + 25 + 5 + 30));
}

View File

@ -11,11 +11,11 @@ public class Cosmetics extends Mod{
public Cosmetics(){ addSetting(who, show, halo, crystalwings, glasses, hat); }
public static BooleanSetting show = new BooleanSetting("Show cosmetics", "", true);
public static BooleanSetting crystalwings = new BooleanSetting("Crystal wings", "", false);
public static BooleanSetting halo = new BooleanSetting("Halo", "", false);
public static BooleanSetting crystalwings = new BooleanSetting("Crystal wings", "", true);
public static BooleanSetting halo = new BooleanSetting("Halo", "", true);
//public static BooleanSetting dragonwings = new BooleanSetting("Dragon wings", "", true);
public static BooleanSetting hat = new BooleanSetting("Top hat", "", true);
public static BooleanSetting glasses = new BooleanSetting("Glasses", "", true);
public static BooleanSetting hat = new BooleanSetting("Top hat", "", false);
public static BooleanSetting glasses = new BooleanSetting("Glasses", "", false);
public static ModeSetting who = new ModeSetting("Who to render on", "", "Only you", "Everyone", "Everyone else");
}

View File

@ -1,4 +1,4 @@
package dev.resent.module.impl.movement;
package dev.resent.module.impl.misc;
import dev.resent.annotation.RenderModule;
import dev.resent.module.base.Mod.Category;
@ -6,7 +6,7 @@ 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)
@RenderModule(name = "ToggleSprint", category = Category.MISC, x = 4, y = 122, hasSetting = true)
public class Sprint extends RenderMod {
public BooleanSetting drawn = new BooleanSetting("Text Drawn", "", true);

View File

@ -162,17 +162,11 @@ public class ClickGUI extends GuiScreen {
//fr.drawString("o", this.x+99+xo, height - 2 - fh * -(off) + 51 + 1 - offset, isMouseInside(mouseX, mouseY, this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, this.x + 90 + xo - 1 + 10 + fr.getStringWidth("o"), height - 2 - fh * -(off) + 51 + 1 - offset + fr.FONT_HEIGHT) ? new Color(105, 105, 105, 65).getRGB() : -1);
GlStateManager.enableBlend();
GlStateManager.color(1.0f, 1.0f, 1.0f, 255f);
//GlStateManager.tryBlendFuncSeparate(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR, 1, 0);
if(isMouseInside(mouseX, mouseY, this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, this.x + 90 + xo - 1 + 10 + fr.getStringWidth("o"), height - 2 - fh * -(off) + 51 + 1 - offset + fr.FONT_HEIGHT))
GlStateManager.color(1,1,1,0.5f);
this.mc.getTextureManager().bindTexture(new ResourceLocation("eagler:gui/gear.png"));
Gui.drawModalRectWithCustomSizedTexture(this.x+99+xo, height - 2 - fh * -(off) + 51 + 1 - offset, 0, 0, 8, 8, 8, 8);
GlStateManager.disableBlend();
//RenderUtils.drawRectOutline(this.x+90+xo-1+10, height-2-fh*-(off)+51+1-offset, this.x+90+xo-1+10+fr.getStringWidth("o"), height-2-fh*-(off)+51+1-offset+fr.FONT_HEIGHT, -1);
//fr.drawString("+", this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, -1);
//fr.drawString(" x", this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, -1);
// drawRect(this.x+90+xo-1+10, height-2-fh*-(off)+51-1-offset,
// this.x+90+xo-1+21, height+30-fh*(-off)+30-1+2-1-offset, -1);
}
fr.drawStringWithShadow(m.name, this.x + 15 + 7 + xo, height - fh * -(off) + 50 - offset, -1);
@ -190,9 +184,9 @@ public class ClickGUI extends GuiScreen {
b = (BooleanSetting) s;
RenderUtils.drawRectOutline(this.x + 6 + 6, height - fr.FONT_HEIGHT + 50 + var, this.x + 15 + 6, height - fr.FONT_HEIGHT + 50 + fr.FONT_HEIGHT + var, b.getValue() ? Color.GREEN.getRGB() : Color.RED.getRGB());
drawRect(
this.x + 6 + 1 + 6,
this.x + 13,
height - fr.FONT_HEIGHT + 50 + var + 1,
this.x + 15 - 1 + 6,
this.x + 20,
height - fr.FONT_HEIGHT + 50 + fr.FONT_HEIGHT + var - 1,
isMouseInside(mouseX, mouseY, this.x + 6 + 1 + 6, height - fr.FONT_HEIGHT + 50 + var + 1, this.x + 15 - 1 + 6, height - fr.FONT_HEIGHT + 50 + fr.FONT_HEIGHT + var - 1) ? new Color(211, 211, 211, 65).getRGB() : new Color(105, 105, 105, 65).getRGB()
);
@ -200,22 +194,9 @@ public class ClickGUI extends GuiScreen {
if (s instanceof ModeSetting) {
mo = (ModeSetting) s;
//RenderUtils.drawRectOutline(this.x+18+6-2, height-fr.FONT_HEIGHT+50+var, this.x+18+6+fr.getStringWidth(this.modWatching.settings.get(amogus).name + ": " + m.getValue() + 2), height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT, -1);
}
if (s instanceof ModeSetting) {
/*RenderUtils.drawRectOutline(this.x+24-fr.FONT_HEIGHT-2,
this.height-fr.FONT_HEIGHT+50+var, this.x+24,
this.height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT, -1);
RenderUtils.drawRectOutline(
this.x + 24,
this.height - fr.FONT_HEIGHT + 50 + var,
this.x + 24
+ fr.getStringWidth(
s.name + ": " + m.getValue())
+ 2,
this.height - fr.FONT_HEIGHT + 50 + var + fr.FONT_HEIGHT, -1);*/
//RenderUtils.drawRectOutline(this.x+24, height-fr.FONT_HEIGHT+50+var, this.x+24+fr.getStringWidth(s.name+": "+m.getValue()), height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT, -1);
fr.drawStringWithShadow(s.name + ": " + mo.getValue(), this.x + 18 + 6, height - fr.FONT_HEIGHT + 50 + var, -1);
} else {
fr.drawStringWithShadow(s.name, this.x + 18 + 6, height - fr.FONT_HEIGHT + 50 + var, -1);
@ -223,10 +204,6 @@ public class ClickGUI extends GuiScreen {
var += fr.FONT_HEIGHT + 2;
}
// RenderUtils.drawRectOutline(x-fr.FONT_HEIGHT+2,
// height+27+fr.FONT_HEIGHT+2,x-fr.FONT_HEIGHT+6+fr.getStringWidth("<"),
// height+33+fr.FONT_HEIGHT+2+fr.getStringWidth("<"), new Color(200, 200,
// 200,90).getRGB());
}
if (xo > width / 2) {

View File

@ -17,12 +17,8 @@ public class PreGUI extends GuiScreen{
Gui.drawModalRectWithCustomSizedTexture(GuiScreen.width/2-20, GuiScreen.height/2-50, 0, 0, 60, 60, 60, 60);
Gui.drawRect(GuiScreen.width/2-20, GuiScreen.height/2+20, GuiScreen.width/2+40, GuiScreen.height/2+50, isMouseInside(i, j, GuiScreen.width/2-20, GuiScreen.height/2+20, GuiScreen.width/2+40, GuiScreen.height/2+50) ? 0x40FFFFFF : 0x50FFFFFF);
RenderUtils.drawRectOutline(GuiScreen.width/2-20, GuiScreen.height/2+20, GuiScreen.width/2+50, GuiScreen.height/2+50, 0x080FFFFFF);
RenderUtils.drawRectOutline(GuiScreen.width/2-20, GuiScreen.height/2+20, GuiScreen.width/2+40, GuiScreen.height/2+50, 0x080FFFFFF);
GlUtils.drawCenteredScaledString("Mods", GuiScreen.width/2+10, GuiScreen.height/2+35-mc.fontRendererObj.FONT_HEIGHT/2, -1, 1f);
/*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);
RenderUtils.drawCenteredScaledString("Cosmetics", GuiScreen.width/2+10, GuiScreen.height/2+70-mc.fontRendererObj.FONT_HEIGHT/2, -1, 1.25f);*/
super.drawScreen(i, j, var3);
}

View File

@ -22,7 +22,7 @@ public class Settings extends GuiScreen {
public ScaledResolution sr;
public List<Setting> settings = new ArrayList<>(); //TODO: bind module class arrays with setting arrays
public List<Setting> settings = new ArrayList<>();
public int x, y, width, height;
public int offset = 0;
public float offsety = 20;

View File

@ -325,12 +325,9 @@ public class GuiIngame extends Gui {
GlStateManager.tryBlendFuncSeparate(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR, 1, 0);
GlStateManager.enableAlpha();
if (ModManager.crosshair.isEnabled()){
if(Minecraft.getMinecraft().pointedEntity != null){
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
GlStateManager.color(RenderUtils.getColorWithoutRGB(Crosshair.color).getRed(), RenderUtils.getColorWithoutRGB(Crosshair.color).getGreen(), RenderUtils.getColorWithoutRGB(Crosshair.color).getBlue());
}
if (ModManager.crosshair.isEnabled() && Minecraft.getMinecraft().pointedEntity != null){
GlStateManager.color(RenderUtils.getColorWithoutRGB(Crosshair.color).getRed(), RenderUtils.getColorWithoutRGB(Crosshair.color).getGreen(), RenderUtils.getColorWithoutRGB(Crosshair.color).getBlue(), 255);
GlStateManager.disableAlpha();
}
this.drawTexturedModalRect(scaledResWidth / 2 - 7, scaledResHeight / 2 - 7, 0, 0, 16, 16);

View File

@ -885,14 +885,15 @@ public class EntityRenderer implements IResourceManagerReloadListener {
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GlStateManager.enableOverlayFramebufferBlending();
this.mc.ingameGUI.renderGameOverlay(parFloat1);
for (Mod m : Resent.INSTANCE.modManager.modules) {
if (m.isEnabled() && m instanceof RenderMod && !(mc.currentScreen instanceof HUDConfigScreen)) {
((RenderMod) m).draw();
}
}
GlStateManager.disableOverlayFramebufferBlending();
this.overlayFramebuffer.endRender();
}
for (Mod m : Resent.INSTANCE.modManager.modules) {
if (m.isEnabled() && m instanceof RenderMod && !(mc.currentScreen instanceof HUDConfigScreen)) {
((RenderMod) m).draw();
}
}
this.setupOverlayRendering();
GlStateManager.enableBlend();
if (Minecraft.isFancyGraphicsEnabled()) {