Finish main menu

This commit is contained in:
PeytonPlayz595 2023-10-30 16:37:31 +00:00
parent 5f27a5cfed
commit 6dd8ccd5f9
13 changed files with 108764 additions and 108480 deletions

View File

@ -0,0 +1,41 @@
§bShadow §bClient §bDevelopers
§b~~~~~~~~~~~~~~~~~~~~~~~~
§bPeytonPlayz585:
§b- §bCreator §bof §bShadow §bClient
§b- §bPorted §bOptifine
§b- §bPorted §bCredits §bGUI §bfrom §bEagler §b1.5.2
§b- §bMade §bShaders §bGUI §b& §bShader §bProfiles
§b- §bMade §bthe §bmain §bmenu
§b- §bAdded §bController §bSupport
§b- §bPorted §bLeft §bHand
§b- §bPorted §bChunk §bBorders
§b- §bMade §bToggle §bSprint
§bkone:
§b- Loading screen
§b- Password Hiding
§bEaglercraftX §bDevelopers
§b~~~~~~~~~~~~~~~~~~~~~~~
§blax1dude:
§b- §bCreator §bof §bEaglercraft
§b- §bPorted §bthe §bMinecraft §b1.8 §bclient §bsrc §bto §bTeaVM
§b- §bWrote §bHW §baccelerated §bOpenGL §b1.3 §bemulator
§b- §bWrote §bthe §bdefault §bshader §bpack
§b- §bMade §bthe §bintegrated §bPBR §bresource §bpack
§b- §bWrote §ball §bdesktop §bemulation §bcode
§b- §bWrote §bEaglercraftXBungee
§b- §bWrote §bthe §bpatch §band §bbuild §bsystem
§bayunami2000:
§b- §bMany §bbug §bfixes
§b- §bAdded §bresource §bpacks
§b- §bAdded §bscreen §brecording
§b- §bAdded §bseamless §bfullscreen
§b- §bCreated §bthe §breplit

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,124 @@
package net.PeytonPlayz585.shadow.gui;
import java.util.ArrayList;
import java.io.IOException;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.util.ResourceLocation;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.gui.GuiScreen;
public class GuiCredits extends GuiScreen {
private ArrayList<String> credits = new ArrayList();
private int mousex = 0;
private int mousey = 0;
private int scrollPosition = 0;
private static final int visibleLines = 21;
private int dragstart = -1;
private int dragstartI = -1;
private static final ResourceLocation beaconx = new ResourceLocation("textures/gui/container/beacon.png");
private static final ResourceLocation creditsBck = new ResourceLocation("textures/gui/demo_bg.png");
public void initGui() {
if(this.credits.isEmpty()) {
int width1 = 315;
String file = EagRuntime.getResourceString("/assets/eagler/CREDITS_SHADOW.txt");
String[] lines = file.split("\n");
for(String s : lines) {
String s2 = s.trim();
if(s2.isEmpty()) {
this.credits.add("");
}else {
String[] words = s2.split(" ");
String currentLine = " ";
for(String s3 : words) {
String cCurrentLine = currentLine + s3 + " ";
if(this.mc.fontRendererObj.getStringWidth(cCurrentLine) < width) {
currentLine = cCurrentLine;
}else {
this.credits.add(currentLine);
currentLine = s3 + " ";
}
}
this.credits.add(currentLine);
}
}
}
}
protected void mouseClicked(int par1, int par2, int par3) {
if(par3 == 0) {
int x = (width - 345) / 2;
int y = (height - 230) / 2;
if(par1 >= (x + 323) && par1 <= (x + 323 + 13) && par2 >= (y + 7) && par2 <= (y + 7 + 13)) {
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
this.mc.displayGuiScreen(new GuiMainMenu());
}
int trackHeight = 193;
int offset = trackHeight * scrollPosition / this.credits.size();
if(par1 >= (x + 326) && par1 <= (x + 334) && par2 >= (y + 27 + offset) && par2 <= (y + 27 + offset + (visibleLines * trackHeight / this.credits.size()) + 1)) {
dragstart = par2;
dragstartI = scrollPosition;
}
}
}
public void drawScreen(int par1, int par2, float par3) {
super.drawScreen(0, 0, par3);
this.drawBackground(0);
this.drawGradientRect(0, 0, width, height, -1072689136, -804253680);
mousex = par1;
mousey = par2;
int x = (width - 345) / 2;
int y = (height - 230) / 2;
this.mc.getTextureManager().bindTexture(creditsBck);
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0.0f);
GlStateManager.scale(1.39f, 1.39f, 1.39f);
this.drawTexturedModalRect(0, 0, 0, 0, 248, 166);
GlStateManager.popMatrix();
this.mc.getTextureManager().bindTexture(beaconx);
this.drawTexturedModalRect(x + 323, y + 7, 114, 223, 13, 13);
int lines = this.credits.size();
if(scrollPosition < 0) scrollPosition = 0;
if(scrollPosition + visibleLines > lines) scrollPosition = lines - visibleLines;
for(int i = 0; i < visibleLines; ++i) {
this.mc.fontRendererObj.drawString(this.credits.get(scrollPosition + i), x + 10, y + 10 + (i * 10), 0x404060);
}
int trackHeight = 193;
int offset = trackHeight * scrollPosition / lines;
drawRect(x + 326, y + 27, x + 334, y + 220, 0x33000020);
drawRect(x + 326, y + 27 + offset, x + 334, y + 27 + (visibleLines * trackHeight / lines) + offset + 1, 0x66000000);
}
public void updateScreen() {
if(Mouse.isButtonDown(0) && dragstart > 0) {
int trackHeight = 193;
scrollPosition = (mousey - dragstart) * this.credits.size() / trackHeight + dragstartI;
if(scrollPosition < 0) scrollPosition = 0;
if(scrollPosition + visibleLines > this.credits.size()) scrollPosition = this.credits.size() - visibleLines;
} else {
dragstart = -1;
}
}
public void handleMouseInput() throws IOException {
super.handleMouseInput();
int var1 = Mouse.getEventDWheel();
if(var1 < 0) {
scrollPosition += 3;
}
if(var1 > 0) {
scrollPosition -= 3;
}
}
}

View File

@ -0,0 +1,68 @@
package net.PeytonPlayz585.shadow.gui.button;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.FontRenderer;
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;
import net.minecraft.util.ResourceLocation;
public class ImageButton extends MainButton {
protected ResourceLocation image;
public ImageButton(int id, int x, int y, String buttonText, ResourceLocation image) {
this(id, x, y, 12, 12, buttonText);
this.image = image;
}
public ImageButton(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;
drawHoverEffect();
} else {
if (hoverFade > 0) hoverFade -= 10;
}
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));
drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 2, 3, new Color(255, 255, 255, 30).getRGB());
int color = new Color(232, 232, 232, 183).getRGB();
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;
GlStateManager.color(f2, f3, f4, f1);
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
Minecraft.getMinecraft().getTextureManager().bindTexture(image);
Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0, 0, 6, 6, 6, 6);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
protected void drawHoverEffect() {
FontRenderer font = Minecraft.getMinecraft().fontRendererObj;
int w = (int) (font.getStringWidth(this.displayString) * 0.9F);
drawRoundedRect(this.xPosition + (this.width - w) / 2, this.yPosition - 12, w, 7, 2, new Color(0, 0, 0, 126));
this.drawCenteredString(font, this.displayString, this.xPosition + this.width / 2, this.yPosition - 11, new Color(255, 255, 255, 135).getRGB());
}
}

View File

@ -2,7 +2,7 @@ package net.PeytonPlayz585.shadow.gui.button;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
@ -38,55 +38,24 @@ public class MainButton extends GuiButton {
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());
drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 2, 3, new Color(255, 255, 255, 30).getRGB());
FontRenderer fontrenderer = mc.fontRendererObj;
this.drawCenteredString(fontrenderer, 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());
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 4) / 2, 10526880);
this.drawCenteredString(fontrenderer, this.displayString, (int)(this.xPosition + this.width / 2 + 0.5F), (int)(this.yPosition + (this.height - 4) / 2 + 0.5F) - 1, new Color(30, 30, 30, 50).getRGB());
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, (this.yPosition + (this.height - 4) / 2) - 1, 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);
GlStateManager.color(f2, f3, f4, f1);
drawRoundedOutline(x, y, x2, y2, radius, width);
}
@ -94,69 +63,81 @@ public class MainButton extends GuiButton {
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);
//}
GlStateManager.blendFunc(RealOpenGLEnums.GL_SRC_ALPHA, RealOpenGLEnums.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.tryBlendFuncSeparate(RealOpenGLEnums.GL_SRC_ALPHA, RealOpenGLEnums.GL_ONE_MINUS_SRC_ALPHA, RealOpenGLEnums.GL_ONE, RealOpenGLEnums.GL_ZERO);
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();
worldRenderer.pos(x + radius, y, 0).endVertex();
worldRenderer.pos(x2 - radius, y, 0).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();
worldRenderer.pos(x2, y + radius, 0).endVertex();
worldRenderer.pos(x2, y2 - radius, 0).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();
worldRenderer.pos(x2 - radius, y2 - 0.1F, 0).endVertex();
worldRenderer.pos(x + radius, y2 - 0.1F, 0).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();
worldRenderer.pos(x + 0.1F, y2 - radius, 0).endVertex();
worldRenderer.pos(x + 0.1F, y + radius, 0).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++) {
for (int 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();
worldRenderer.pos((float) (f1 + radius * ClientMathUtils.getRightAngle(m)), (float) (f2 - radius * ClientMathUtils.getAngle(m)), 0).endVertex();
}
tessellator.draw();
f1 = x2 - radius;
f2 = y2 - radius;
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
for (k = 0; k <= i; k++) {
for (int 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();
worldRenderer.pos((float) (f1 + radius * ClientMathUtils.getRightAngle(m)), (float) (f2 - radius * ClientMathUtils.getAngle(m)), 0).endVertex();
}
tessellator.draw();
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
f1 = x + radius;
f2 = y2 - radius;
for (k = 0; k <= i; k++) {
for (int 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();
worldRenderer.pos((float) (f1 + radius * ClientMathUtils.getRightAngle(m)), (float) (f2 + radius * ClientMathUtils.getAngle(m)), 0).endVertex();
}
tessellator.draw();
worldRenderer.begin(Tessellator.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
f1 = x + radius;
f2 = y + radius;
for (k = 0; k <= i; k++) {
for (int 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();
worldRenderer.pos((float) (f1 + radius * ClientMathUtils.getRightAngle(m)), (float) (f2 + radius * ClientMathUtils.getAngle(m)), 0).endVertex();
}
tessellator.draw();
//if (width != 1.0F) {
//EaglercraftGPU.glLineWidth(1.0F);
//}
if (width != 1.0F) {
EaglercraftGPU.glLineWidth(1.0F);
}
GlStateManager.enableCull();
GlStateManager.disableBlend();
GlStateManager.disableColorMaterial();

View File

@ -10,7 +10,9 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import net.PeytonPlayz585.shadow.gui.GuiCredits;
import net.PeytonPlayz585.shadow.gui.button.MainButton;
import net.PeytonPlayz585.shadow.gui.button.ImageButton;
import net.PeytonPlayz585.shadow.gui.GuiSecretMainMenu;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
@ -221,12 +223,11 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
this.addSingleplayerMultiplayerButtons(i, 24);
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, i + 72 + 12, 98, 20,
I18n.format("menu.options", new Object[0])));
this.buttonList.add(new GuiButton(4, this.width / 2 + 2, i + 72 + 12, 98, 20,
I18n.format("menu.editProfile", new Object[0])));
int yPos = height - 20;
this.buttonList.add(new ImageButton(0, width / 2 - 15, yPos, "MINECRAFT SETTINGS", new ResourceLocation("textures/shadow/icons/settings.png")));
this.buttonList.add(new ImageButton(4, width / 2, yPos, "EDIT PROFILE", new ResourceLocation("textures/shadow/icons/edit_profile.png")));
this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, i + 72 + 12));
//this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, i + 72 + 12));
if (isFork) {
this.openGLWarning1 = EaglercraftVersion.mainMenuStringE;
@ -253,6 +254,7 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
// .add(new GuiButton(1, this.width / 2 - 100, parInt1,
// I18n.format("menu.singleplayer", new Object[0])));
this.buttonList.add(new MainButton(2, width / 2 - 66, height / 2, "MULTIPLAYER"));
this.buttonList.add(new MainButton(3, width / 2 - 66, height / 2 + 30, "CREDITS"));
this.buttonList.add(new MainButton(14, width / 2 - 66, height / 2 + 15, "DISCORD"));
}
@ -277,6 +279,10 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
this.mc.displayGuiScreen(new GuiMultiplayer(this));
}
if (parGuiButton.id == 3) {
this.mc.displayGuiScreen(new GuiCredits());
}
if (parGuiButton.id == 4) {
this.mc.displayGuiScreen(new GuiScreenEditProfile(this));
}
@ -500,8 +506,7 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2,
this.height - 20, -1);
s1 = EaglercraftVersion.mainMenuStringD;
this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2,
this.height - 10, -1);
this.drawString(this.fontRendererObj, s1, width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1);
GlStateManager.pushMatrix();
GlStateManager.scale(0.75f, 0.75f, 0.75f);
@ -563,8 +568,7 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
if (resStr != null) {
EagRuntime.openCreditsPopup(resStr);
}
mc.getSoundHandler()
.playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
return;
}
}