Merge pull request #174 from Abnumality/main

add splash
This commit is contained in:
LAX1DUDE 2022-07-25 17:46:46 -07:00 committed by GitHub
commit 7b5e336606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 18 deletions

View File

@ -1,5 +1,7 @@
package net.lax1dude.eaglercraft;
import net.minecraft.src.NBTTagList;
public class ConfigConstants {
public static boolean profanity = false;
@ -18,5 +20,6 @@ public class ConfigConstants {
public static String mainMenuItemLine1 = null;
public static String mainMenuItemLine2 = null;
public static String mainMenuItemLink = null;
public static NBTTagList splashTexts = null;
}

View File

@ -3,6 +3,8 @@ package net.minecraft.src;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.io.IOException;
import java.util.*;
import net.lax1dude.eaglercraft.ConfigConstants;
import net.lax1dude.eaglercraft.EaglerAdapter;
@ -11,13 +13,16 @@ import net.lax1dude.eaglercraft.GuiScreenEditProfile;
import net.lax1dude.eaglercraft.LocalStorageManager;
import net.lax1dude.eaglercraft.TextureLocation;
import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.minecraft.client.Minecraft;
import net.lax1dude.eaglercraft.Base64;
public class GuiMainMenu extends GuiScreen {
/** The RNG used by the Main Menu Screen. */
private static final EaglercraftRandom rand = new EaglercraftRandom();
/** The splash message. */
private String splashText = "missingno";
public String splashText = "missingno";
private GuiButton buttonResetDemo;
private static boolean showingEndian = true;
@ -89,6 +94,11 @@ public class GuiMainMenu extends GuiScreen {
* RunnableTitleScreen(this), "1.6 Update Check Thread")).start(); }
*/
if (enableSplash) {
EaglercraftRandom rand = new EaglercraftRandom();
NBTTagList splashesList = ConfigConstants.splashTexts;
this.splashText = ((NBTTagString) splashesList.tagAt(rand.nextInt(splashesList.tagCount()))).data;
}
this.field_92025_p = EaglerAdapter._wisWebGL() ? ("eaglercraft javascript runtime") : ("eaglercraft desktop runtime");
this.start = System.currentTimeMillis() + System.currentTimeMillis() % 10000l;
this.ackLines = new ArrayList();
@ -146,8 +156,6 @@ public class GuiMainMenu extends GuiScreen {
Calendar var1 = Calendar.getInstance();
var1.setTime(new Date());
this.splashText = "darviglet!";
StringTranslate var2 = StringTranslate.getInstance();
int var4 = this.height / 4 + 48;
@ -207,6 +215,9 @@ public class GuiMainMenu extends GuiScreen {
}
public static boolean enableSplash = false;
protected void mouseClicked(int par1, int par2, int par3) {
if(!showAck) {
super.mouseClicked(par1, par2, par3);
@ -469,17 +480,6 @@ public class GuiMainMenu extends GuiScreen {
this.drawTexturedModalRect(var6 + 99 + 26, var7 + 0, 126, 0, 3, 44);
this.drawTexturedModalRect(var6 + 99 + 26 + 3, var7 + 0, 99, 0, 26, 44);
this.drawTexturedModalRect(var6 + 154, var7 + 0, 0, 45, 155, 44);
/*
* var4.setColorOpaque_I(16777215); EaglerAdapter.glPushMatrix();
* EaglerAdapter.glTranslatef((float)(this.width / 2 + 90), 70.0F, 0.0F);
* EaglerAdapter.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F); float var8 = 1.8F -
* MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) /
* 1000.0F * (float)Math.PI * 2.0F) * 0.1F); var8 = var8 * 100.0F /
* (float)(this.fontRenderer.getStringWidth(this.splashText) + 32);
* EaglerAdapter.glScalef(var8, var8, var8); this.drawCenteredString(this.fontRenderer,
* this.splashText, 0, -8, 16776960); EaglerAdapter.glPopMatrix();
*/
this.drawString(this.fontRenderer, "minecraft 1.5.2", 2, this.height - 20, 16777215);
this.drawString(this.fontRenderer, ConfigConstants.mainMenuString + EnumChatFormatting.GRAY + " (cracked)", 2, this.height - 10, 16777215);
@ -502,6 +502,17 @@ public class GuiMainMenu extends GuiScreen {
// this.field_92024_r) / 2, ((GuiButton)this.buttonList.get(0)).yPosition - 12,
// 16777215);
}
if (enableSplash) {
var4.setColorOpaque_I(16777215);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef((float) (this.width / 2 + 90), 70.0F, 0.0F);
EaglerAdapter.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
float var8 = 1.8F - MathHelper.abs(MathHelper.sin((float) (Minecraft.getSystemTime() % 1000L) / 1000.0F * (float) Math.PI * 2.0F) * 0.1F);
var8 = var8 * 100.0F / (float) (this.fontRenderer.getStringWidth(this.splashText) + 32);
EaglerAdapter.glScalef(var8, var8, var8);
this.drawCenteredString(this.fontRenderer, this.splashText, 0, -8, 16776960);
EaglerAdapter.glPopMatrix();
}
/*
String lid = "(login is disabled, this copy violates Mojang's terms of service)";
int sl = this.fontRenderer.getStringWidth(lid);

View File

@ -7,10 +7,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import net.lax1dude.eaglercraft.Base64;
import net.lax1dude.eaglercraft.ConfigConstants;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.LocalStorageManager;
import net.lax1dude.eaglercraft.*;
import net.lax1dude.eaglercraft.ServerQuery.QueryResponse;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
import net.minecraft.client.Minecraft;
@ -36,6 +33,10 @@ public class ServerList {
public static void loadDefaultServers(String base64) {
try {
NBTTagCompound nbt = CompressedStreamTools.readUncompressed(Base64.decodeBase64(base64));
GuiMainMenu.enableSplash = nbt.getBoolean("enableSplash");
if (GuiMainMenu.enableSplash) {
ConfigConstants.splashTexts = nbt.getTagList("splashes");
}
ConfigConstants.profanity = nbt.getBoolean("profanity");
hideDownDefaultServers = nbt.getBoolean("hide_down");
ConfigConstants.ayonullTitle = nbt.hasKey("serverListTitle") ? nbt.getString("serverListTitle") : null;