Lunar Client main menu
After Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 148 KiB |
After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 52 KiB |
71846
javascript/classes.js
|
@ -0,0 +1,49 @@
|
|||
package net.PeytonPlayz585.shadow.gui.button;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class ClientMathUtils {
|
||||
|
||||
private static final double[] a = new double[65536];
|
||||
|
||||
private static final double[] b = new double[360];
|
||||
|
||||
static {
|
||||
int i;
|
||||
for (i = 0; i < 65536; i++)
|
||||
a[i] = Math.sin(i * Math.PI * 2.0D / 65536.0D);
|
||||
for (i = 0; i < 360; i++)
|
||||
b[i] = Math.sin(Math.toRadians(i));
|
||||
}
|
||||
|
||||
public static double getAngle(int paramInt) {
|
||||
paramInt %= 360;
|
||||
return b[paramInt];
|
||||
}
|
||||
|
||||
public static double getRightAngle(int paramInt) {
|
||||
paramInt += 90;
|
||||
paramInt %= 360;
|
||||
return b[paramInt];
|
||||
}
|
||||
|
||||
private static float snapToStep(float value, float valueStep) {
|
||||
if (valueStep > 0.0F)
|
||||
value = valueStep * Math.round(value / valueStep);
|
||||
return value;
|
||||
}
|
||||
|
||||
public static float normalizeValue(float p_148266_1_, float valueMin, float valueMax, float valueStep) {
|
||||
return MathHelper.clamp_float((snapToStepClamp(p_148266_1_, valueMin, valueMax, valueStep) - valueMin) / (valueMax - valueMin), 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
private static float snapToStepClamp(float value, float valueMin, float valueMax, float valueStep) {
|
||||
value = snapToStep(value, valueStep);
|
||||
return MathHelper.clamp_float(value, valueMin, valueMax);
|
||||
}
|
||||
|
||||
public static float denormalizeValue(float value, float valueMin, float valueMax, float valueStep) {
|
||||
return snapToStepClamp(valueMin + (valueMax - valueMin) * MathHelper.clamp_float(value, 0.0F, 1.0F), valueMin, valueMax, valueStep);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package net.PeytonPlayz585.shadow.gui.button;
|
||||
|
||||
public class Color {
|
||||
private int rgb;
|
||||
|
||||
public static final Color BLACK = new Color(0, 0, 0);
|
||||
public static final Color WHITE = new Color(255, 255, 255);
|
||||
|
||||
public Color(int r, int g, int b) {
|
||||
this.rgb = ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
|
||||
}
|
||||
|
||||
public Color(int r, int g, int b, int a) {
|
||||
this.rgb = ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
|
||||
}
|
||||
|
||||
public int getRed() {
|
||||
return (rgb >> 16) & 0xFF;
|
||||
}
|
||||
|
||||
public int getGreen() {
|
||||
return (rgb >> 8) & 0xFF;
|
||||
}
|
||||
|
||||
public int getBlue() {
|
||||
return rgb & 0xFF;
|
||||
}
|
||||
|
||||
public int getRGB() {
|
||||
return rgb;
|
||||
}
|
||||
|
||||
public int getAlpha() {
|
||||
return (rgb >> 24) & 0xFF;
|
||||
}
|
||||
|
||||
public static Color decode(String nm) throws NumberFormatException {
|
||||
nm = nm.trim();
|
||||
if (nm.charAt(0) == '#') {
|
||||
nm = nm.substring(1);
|
||||
}
|
||||
|
||||
int colorValue = Integer.parseInt(nm, 16);
|
||||
return new Color((colorValue >> 16) & 0xFF, (colorValue >> 8) & 0xFF, colorValue & 0xFF);
|
||||
}
|
||||
|
||||
public Color brighter() {
|
||||
int r = getRed();
|
||||
int g = getGreen();
|
||||
int b = getBlue();
|
||||
|
||||
int i = (int) (1.0 / (1.0 - 0.7));
|
||||
if (r == 0 && g == 0 && b == 0) {
|
||||
return new Color(i, i, i);
|
||||
}
|
||||
|
||||
if (r > 0 && r < i) {
|
||||
r = i;
|
||||
}
|
||||
|
||||
if (g > 0 && g < i) {
|
||||
g = i;
|
||||
}
|
||||
|
||||
if (b > 0 && b < i) {
|
||||
b = i;
|
||||
}
|
||||
|
||||
return new Color(Math.min((int) (r / 0.7), 255), Math.min((int) (g / 0.7), 255),
|
||||
Math.min((int) (b / 0.7), 255));
|
||||
}
|
||||
|
||||
public Color darker() {
|
||||
return new Color(Math.max((int) (getRed() * 0.7), 0), Math.max((int) (getGreen() * 0.7), 0),
|
||||
Math.max((int) (getBlue() * 0.7), 0));
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Color) {
|
||||
return ((Color) obj).getRGB() == rgb;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Color[r=" + getRed() + ",g=" + getGreen() + ",b=" + getBlue() + "]";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,162 @@
|
|||
package net.PeytonPlayz585.shadow.gui.button;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
|
||||
public class MainButton extends GuiButton {
|
||||
|
||||
public int hoverFade = 0;
|
||||
|
||||
public MainButton(int id, int x, int y, String buttonText) {
|
||||
this(id, x, y, 132, 11, buttonText);
|
||||
}
|
||||
|
||||
public MainButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) {
|
||||
super(buttonId, x, y, widthIn, heightIn, buttonText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
boolean hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
if (hovered) {
|
||||
if (hoverFade < 40) hoverFade += 10;
|
||||
} else {
|
||||
if (hoverFade > 0) hoverFade -= 10;
|
||||
}
|
||||
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F);
|
||||
drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 2, new Color(30, 30, 30, 60));
|
||||
drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 2, new Color(255, 255, 255, 38 + hoverFade));
|
||||
|
||||
Color color = new Color(255, 255, 255, 30);
|
||||
drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 2, 3, color.getRGB());
|
||||
|
||||
Minecraft.getMinecraft().currentScreen.drawCenteredString(Minecraft.getMinecraft().fontRendererObj, this.displayString, (int)(this.xPosition + this.width / 2 + 0.5F), (int)(this.yPosition + (this.height - 4) / 2 + 0.5F), new Color(30, 30, 30, 50).getRGB());
|
||||
Minecraft.getMinecraft().currentScreen.drawCenteredString(Minecraft.getMinecraft().fontRendererObj, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 4) / 2, 10526880);
|
||||
}
|
||||
|
||||
public static void drawRoundedRect(int x, int y, int width, int height, int cornerRadius, Color color) {
|
||||
Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB());
|
||||
Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB());
|
||||
Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB());
|
||||
|
||||
drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color);
|
||||
drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color);
|
||||
drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color);
|
||||
drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color);
|
||||
}
|
||||
|
||||
public static void drawArc(int x, int y, int radius, int startAngle, int endAngle, Color color) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
GlStateManager.color((float) color.getRed() / 255, (float) color.getGreen() / 255, (float) color.getBlue() / 255, (float) color.getAlpha() / 255);
|
||||
|
||||
WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer();
|
||||
|
||||
worldRenderer.begin(6, DefaultVertexFormats.POSITION);
|
||||
worldRenderer.pos(x, y, 0).endVertex();
|
||||
|
||||
for (int i = (int) (startAngle / 360.0 * 100); i <= (int) (endAngle / 360.0 * 100); i++) {
|
||||
double angle = (Math.PI * 2 * i / 100) + Math.toRadians(180);
|
||||
worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0).endVertex();
|
||||
}
|
||||
|
||||
Tessellator.getInstance().draw();
|
||||
|
||||
GlStateManager.disableAlpha();;
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public static void drawRoundedOutline(int x, int y, int x2, int y2, float radius, float width, int color) {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer renderer = tessellator.getWorldRenderer();
|
||||
float f1 = (color >> 24 & 0xFF) / 255.0F;
|
||||
float f2 = (color >> 16 & 0xFF) / 255.0F;
|
||||
float f3 = (color >> 8 & 0xFF) / 255.0F;
|
||||
float f4 = (color & 0xFF) / 255.0F;
|
||||
renderer.color(f2, f3, f4, f1);
|
||||
drawRoundedOutline(x, y, x2, y2, radius, width);
|
||||
}
|
||||
|
||||
public static void drawRoundedOutline(float x, float y, float x2, float y2, float radius, float width) {
|
||||
int i = 18;
|
||||
int j = 90 / i;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.enableColorMaterial();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
if (width != 1.0F) {
|
||||
EaglercraftGPU.glLineWidth(width);
|
||||
}
|
||||
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||
worldRenderer.pos(x + radius, y, 0.0F).endVertex();
|
||||
worldRenderer.pos(x2 - radius, y, 0.0F).endVertex();
|
||||
tessellator.draw();
|
||||
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||
worldRenderer.pos(x2, y + radius, 0.0F).endVertex();
|
||||
worldRenderer.pos(x2, y2 - radius, 0.0F).endVertex();
|
||||
tessellator.draw();
|
||||
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||
worldRenderer.pos(x2 - radius, y2 - 0.1F, 0.0F).endVertex();
|
||||
worldRenderer.pos(x + radius, y2 - 0.1F, 0.0F).endVertex();
|
||||
tessellator.draw();
|
||||
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||
worldRenderer.pos(x + 0.1F, y2 - radius, 0.0F).endVertex();
|
||||
worldRenderer.pos(x + 0.1F, y + radius, 0.0F).endVertex();
|
||||
tessellator.draw();
|
||||
float f1 = x2 - radius;
|
||||
float f2 = y + radius;
|
||||
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||
int k;
|
||||
for (k = 0; k <= i; k++) {
|
||||
int m = 90 - k * j;
|
||||
worldRenderer.pos((float) (f1 + radius * ClientMathUtils.getRightAngle(m)), (float) (f2 - radius * ClientMathUtils.getAngle(m)), 0.0F).endVertex();
|
||||
}
|
||||
tessellator.draw();
|
||||
f1 = x2 - radius;
|
||||
f2 = y2 - radius;
|
||||
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||
for (k = 0; k <= i; k++) {
|
||||
int m = k * j + 270;
|
||||
worldRenderer.pos((float) (f1 + radius * ClientMathUtils.getRightAngle(m)), (float) (f2 - radius * ClientMathUtils.getAngle(m)), 0.0F).endVertex();
|
||||
}
|
||||
tessellator.draw();
|
||||
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||
f1 = x + radius;
|
||||
f2 = y2 - radius;
|
||||
for (k = 0; k <= i; k++) {
|
||||
int m = k * j + 90;
|
||||
worldRenderer.pos((float) (f1 + radius * ClientMathUtils.getRightAngle(m)), (float) (f2 + radius * ClientMathUtils.getAngle(m)), 0.0F).endVertex();
|
||||
}
|
||||
tessellator.draw();
|
||||
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||
f1 = x + radius;
|
||||
f2 = y + radius;
|
||||
for (k = 0; k <= i; k++) {
|
||||
int m = 270 - k * j;
|
||||
worldRenderer.pos((float) (f1 + radius * ClientMathUtils.getRightAngle(m)), (float) (f2 + radius * ClientMathUtils.getAngle(m)), 0.0F).endVertex();
|
||||
}
|
||||
tessellator.draw();
|
||||
if (width != 1.0F) {
|
||||
EaglercraftGPU.glLineWidth(1.0F);
|
||||
}
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableColorMaterial();
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import java.util.Arrays;
|
|||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import net.PeytonPlayz585.shadow.gui.button.MainButton;
|
||||
import net.PeytonPlayz585.shadow.gui.GuiSecretMainMenu;
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
||||
|
@ -82,12 +83,12 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
|||
* An array of all the paths to the panorama pictures.
|
||||
*/
|
||||
private static final ResourceLocation[] titlePanoramaPaths = new ResourceLocation[] {
|
||||
new ResourceLocation("textures/gui/title/background/panorama_0.png"),
|
||||
new ResourceLocation("textures/gui/title/background/panorama_1.png"),
|
||||
new ResourceLocation("textures/gui/title/background/panorama_2.png"),
|
||||
new ResourceLocation("textures/gui/title/background/panorama_3.png"),
|
||||
new ResourceLocation("textures/gui/title/background/panorama_4.png"),
|
||||
new ResourceLocation("textures/gui/title/background/panorama_5.png") };
|
||||
new ResourceLocation("textures/gui/title/background/lunar_0.png"),
|
||||
new ResourceLocation("textures/gui/title/background/lunar_1.png"),
|
||||
new ResourceLocation("textures/gui/title/background/lunar_2.png"),
|
||||
new ResourceLocation("textures/gui/title/background/lunar_3.png"),
|
||||
new ResourceLocation("textures/gui/title/background/lunar_4.png"),
|
||||
new ResourceLocation("textures/gui/title/background/lunar_5.png") };
|
||||
private int field_92024_r;
|
||||
private int field_92023_s;
|
||||
private int field_92022_t;
|
||||
|
@ -206,6 +207,8 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
|||
this.splashText = "Happy new year!";
|
||||
} else if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31) {
|
||||
this.splashText = "OOoooOOOoooo! Spooky!";
|
||||
} else if (calendar.get(2) + 1 == 11 && calendar.get(5) == 12) {
|
||||
this.splashText = "Happy Birthday, PeytonPlayz585!";
|
||||
}
|
||||
|
||||
int i = this.height / 4 + 48;
|
||||
|
@ -249,12 +252,8 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
|||
// this.buttonList
|
||||
// .add(new GuiButton(1, this.width / 2 - 100, parInt1,
|
||||
// I18n.format("menu.singleplayer", new Object[0])));
|
||||
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, parInt1 + parInt2 * 0,
|
||||
I18n.format("menu.multiplayer", new Object[0])));
|
||||
GuiButton btn;
|
||||
this.buttonList.add(btn = new GuiButton(14, this.width / 2 - 100, parInt1 + parInt2 * 1,
|
||||
I18n.format("menu.forkOnGitlab", new Object[0])));
|
||||
btn.enabled = EaglercraftVersion.mainMenuEnableGithubButton;
|
||||
this.buttonList.add(new MainButton(2, width / 2 - 100, parInt1 + parInt2 * 0, "M U L T I P L A Y E R"));
|
||||
this.buttonList.add(new MainButton(14, width / 2 - 100, parInt1 + parInt2 * 1, "D I S C O R D"));
|
||||
}
|
||||
|
||||
/**+
|
||||
|
@ -283,7 +282,7 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
|
|||
}
|
||||
|
||||
if (parGuiButton.id == 14) {
|
||||
EagRuntime.openLink(EaglercraftVersion.projectForkURL);
|
||||
EagRuntime.openLink("https://discord.com/invite/wQ8ynJ6A93");
|
||||
}
|
||||
|
||||
}
|
||||
|
|