astolfo theme & fix draw

This commit is contained in:
ThisIsALegitUsername 2023-02-04 23:19:56 +00:00
parent 86917a0def
commit c98b68cea3
9 changed files with 28521 additions and 28455 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -49,6 +49,9 @@ public abstract class Mod {
} }
protected void drawRect(final int left, final int top, final int right, final int bottom, final int color){ protected void drawRect(final int left, final int top, final int right, final int bottom, final int color){
if(color == 6942069){
RenderUtils.drawChromaRectangle(left, top, right, bottom, Theme.getRounded());
}else
RenderUtils.drawRoundedRect(left, top, right, bottom, 4, color, Theme.getRounded()); RenderUtils.drawRoundedRect(left, top, right, bottom, 4, color, Theme.getRounded());
} }

View File

@ -5,7 +5,6 @@ import dev.resent.module.base.Mod.Category;
import dev.resent.module.base.RenderMod; import dev.resent.module.base.RenderMod;
import dev.resent.module.setting.BooleanSetting; import dev.resent.module.setting.BooleanSetting;
import dev.resent.ui.Theme; import dev.resent.ui.Theme;
import dev.resent.util.render.Color;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
@RenderModule(name = "Info", category = Category.HUD, x = 140, y = 50) @RenderModule(name = "Info", category = Category.HUD, x = 140, y = 50)
@ -29,7 +28,7 @@ public class Info extends RenderMod {
int pz = (int) mc.thePlayer.posZ; int pz = (int) mc.thePlayer.posZ;
//int rot = MathHelper.floor_double(this.mc.thePlayer.rotationYaw*4/360+0.5) & 3; //int rot = MathHelper.floor_double(this.mc.thePlayer.rotationYaw*4/360+0.5) & 3;
if (mc.thePlayer != null) { if (mc.thePlayer != null) {
drawRect(this.x, this.y, this.x + this.getWidth(), this.y + this.getHeight(), new Color(0, 0, 0, 200).getRGB()); drawRect(this.x, this.y, this.x + this.getWidth(), this.y + this.getHeight(), Theme.getRectColor(Theme.getRectId()));
drawString(" X: " + px, this.x + 5, this.y + 14, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow()); drawString(" X: " + px, this.x + 5, this.y + 14, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
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());

View File

@ -8,9 +8,10 @@ import dev.resent.module.setting.ModeSetting;
@Module(name = "Theme", category = Category.MISC, hasSetting = true) @Module(name = "Theme", category = Category.MISC, hasSetting = true)
public class HUD extends Mod{ public class HUD extends Mod{
public HUD(){ addSetting(fontTheme, animationTheme, tshadow, round); } public HUD(){ addSetting(fontTheme, rectTheme, animationTheme, tshadow, round); }
public static final ModeSetting fontTheme = new ModeSetting("Font", "", "Classic", "Rainbow", "Chroma"); public static final ModeSetting fontTheme = new ModeSetting("Font", "", "Classic", "Rainbow", "Chroma");
public static final ModeSetting rectTheme = new ModeSetting("Rectangle", "", "Classic", "Astolfo");
public static final BooleanSetting round = new BooleanSetting("Rounded", "", true); public static final BooleanSetting round = new BooleanSetting("Rounded", "", true);
public static final BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", true); public static final BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", true);
public static final ModeSetting animationTheme = new ModeSetting("Animation", "", "Ease back in", "Ease in out quad", "Elastic", "Smooth step", "Decelerate"); public static final ModeSetting animationTheme = new ModeSetting("Animation", "", "Ease back in", "Ease in out quad", "Elastic", "Smooth step", "Decelerate");

View File

@ -7,6 +7,7 @@ import dev.resent.animation.impl.EaseInOutQuad;
import dev.resent.animation.impl.ElasticAnimation; import dev.resent.animation.impl.ElasticAnimation;
import dev.resent.animation.impl.SmoothStepAnimation; import dev.resent.animation.impl.SmoothStepAnimation;
import dev.resent.module.impl.misc.HUD; import dev.resent.module.impl.misc.HUD;
import dev.resent.util.render.Color;
import dev.resent.util.render.RenderUtils; import dev.resent.util.render.RenderUtils;
public class Theme { public class Theme {
@ -44,6 +45,26 @@ public class Theme {
return null; return null;
} }
public static int getRectColor(int id){
switch(getRectId()){
case 1:
return new Color(0, 0, 0, 200).getRGB();
case 6942069:
return 6942069;
}
return -1;
}
public static int getRectId(){
switch(HUD.rectTheme.getValue()){
case "Classic":
return 1;
case "Astolfo":
return 6942069;
}
return 1;
}
public static int getFontId(){ public static int getFontId(){
switch(HUD.fontTheme.getValue()){ switch(HUD.fontTheme.getValue()){
case "Classic": case "Classic":

View File

@ -5,6 +5,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer; import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@ -24,6 +25,41 @@ public class RenderUtils {
} }
} }
public static void drawChromaRectangle(int x, int y, int width, int height, boolean rounded) {
int i = x;
while(true) {
if(i+10 <= width) {
drawRoundedRect(i, y, i+10, height, 4, RenderUtils.astolfoColorsDraw(i, GuiScreen.width,10000f), rounded);
} else {
break;
}
i+=10;
}
if(width-i != 0) {
for(int h = i; h < width; h++) {
drawRoundedRect(h, y, h+1, height, 4, RenderUtils.astolfoColorsDraw(h, GuiScreen.width,10000f), rounded
);
}
}
}
public static int astolfoColorsDraw(int yOffset, int yTotal, float speed) {
float hue = (float) (System.currentTimeMillis() % (int)speed) + ((yTotal - yOffset) * 9);
while (hue > speed) {
hue -= speed;
}
hue /= speed;
if (hue > 0.5) {
hue = 0.5F - (hue - 0.5f);
}
hue += 0.5F;
return Color.HSBtoRGB(hue, 0.5f, 1F);
}
public static int astolfoColorsDraw(int yOffset, int yTotal) {
return astolfoColorsDraw(yOffset, yTotal, 50000f);
}
public static void drawRoundedRect(final float paramInt1, final float paramInt2, final float paramInt3, final float paramInt4, final float radius, final int color, boolean... rounded) { public static void drawRoundedRect(final float paramInt1, final float paramInt2, final float paramInt3, final float paramInt4, final float radius, final int color, boolean... rounded) {
final float f1 = (color >> 24 & 0xFF) / 255.0f; final float f1 = (color >> 24 & 0xFF) / 255.0f;
final float f2 = (color >> 16 & 0xFF) / 255.0f; final float f2 = (color >> 16 & 0xFF) / 255.0f;

View File

@ -13,9 +13,13 @@ import com.google.common.base.Predicate;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import dev.resent.Resent;
import dev.resent.animation.SimpleAnimation; import dev.resent.animation.SimpleAnimation;
import dev.resent.module.base.Mod;
import dev.resent.module.base.ModManager; import dev.resent.module.base.ModManager;
import dev.resent.module.base.RenderMod;
import dev.resent.module.impl.misc.Crosshair; import dev.resent.module.impl.misc.Crosshair;
import dev.resent.ui.HUDConfigScreen;
import dev.resent.util.misc.W; import dev.resent.util.misc.W;
import dev.resent.util.render.Color; import dev.resent.util.render.Color;
import dev.resent.util.render.RenderUtils; import dev.resent.util.render.RenderUtils;
@ -312,6 +316,12 @@ public class GuiIngame extends Gui {
this.overlayPlayerList.renderPlayerlist(i, scoreboard, scoreobjective1); this.overlayPlayerList.renderPlayerlist(i, scoreboard, scoreobjective1);
} }
for (Mod m : Resent.INSTANCE.modManager.modules) {
if (m.isEnabled() && m instanceof RenderMod && !(mc.currentScreen instanceof HUDConfigScreen)) {
((RenderMod) m).draw();
}
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();

View File

@ -28,11 +28,7 @@ import java.util.concurrent.Callable;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import dev.resent.Resent;
import dev.resent.module.base.Mod;
import dev.resent.module.base.ModManager; import dev.resent.module.base.ModManager;
import dev.resent.module.base.RenderMod;
import dev.resent.ui.HUDConfigScreen;
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;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
@ -889,11 +885,6 @@ public class EntityRenderer implements IResourceManagerReloadListener {
this.overlayFramebuffer.endRender(); 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(); this.setupOverlayRendering();
GlStateManager.enableBlend(); GlStateManager.enableBlend();
if (Minecraft.isFancyGraphicsEnabled()) { if (Minecraft.isFancyGraphicsEnabled()) {