From 0d4efc3bbd3846d89320e8c911cababcc1700876 Mon Sep 17 00:00:00 2001 From: LAX1DUDE Date: Mon, 25 Jul 2022 20:11:20 -0700 Subject: [PATCH] organized splash code --- javascript/index.html | 2 +- .../lax1dude/eaglercraft/ConfigConstants.java | 2 + .../java/net/minecraft/src/GuiMainMenu.java | 39 +++++-------------- .../java/net/minecraft/src/ServerList.java | 4 +- 4 files changed, 14 insertions(+), 33 deletions(-) diff --git a/javascript/index.html b/javascript/index.html index 0dc6017..85d40c0 100644 --- a/javascript/index.html +++ b/javascript/index.html @@ -12,7 +12,7 @@ alert("You're not supposed to 'open' this file in your browser. Please upload th window.addEventListener("load", function(){ window.minecraftOpts = [ "game_frame","assets.epk", -"CgAACQAHc2VydmVycwoAAAABCAACaXAAIHdzKHMpOi8vIChhZGRyZXNzIGhlcmUpOihwb3J0KSAvCAAEbmFtZQAIdGVtcGxhdGUBAAtoaWRlQWRkcmVzcwEIAApmb3JjZWRNT1REABl0aGlzIGlzIG5vdCBhIHJlYWwgc2VydmVyAAA=" +"CgAACQAHc2VydmVycwoAAAABCAAEbmFtZQARTG9jYWwgVGVzdCBTZXJ2ZXIIAAJpcAAPMTI3LjAuMC4xOjI1NTY1CAALaGlkZUFkZHJlc3MABWZhbHNlCAAKZm9yY2VkTU9URAAAAAkACHNwbGFzaGVzCAAAAAoACkRhcnZpZ2xldCEADkRhcnZpZ2xvcGhpbGUhAAtZb3UgRWFnbGVyIQALWWVlZWVlZWVlZSEAC1lvdSBZZWVsZXIhAA1FRUVFRUVFRUVFRUUhAAtZb3UgRGFydmlnIQAJWW91IFZpZ2chAAI6PgACfD4BAAxlbmFibGVTcGxhc2gBAA==" ]; (function(){ var q = window.location.search; diff --git a/src/main/java/net/lax1dude/eaglercraft/ConfigConstants.java b/src/main/java/net/lax1dude/eaglercraft/ConfigConstants.java index fa873cd..e4eaef7 100644 --- a/src/main/java/net/lax1dude/eaglercraft/ConfigConstants.java +++ b/src/main/java/net/lax1dude/eaglercraft/ConfigConstants.java @@ -20,6 +20,8 @@ public class ConfigConstants { public static String mainMenuItemLine1 = null; public static String mainMenuItemLine2 = null; public static String mainMenuItemLink = null; + + public static boolean enableSplash = false; public static NBTTagList splashTexts = null; } diff --git a/src/main/java/net/minecraft/src/GuiMainMenu.java b/src/main/java/net/minecraft/src/GuiMainMenu.java index 01dfd2c..eac40f3 100644 --- a/src/main/java/net/minecraft/src/GuiMainMenu.java +++ b/src/main/java/net/minecraft/src/GuiMainMenu.java @@ -3,8 +3,6 @@ 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; @@ -14,7 +12,6 @@ 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 { @@ -22,7 +19,7 @@ public class GuiMainMenu extends GuiScreen { private static final EaglercraftRandom rand = new EaglercraftRandom(); /** The splash message. */ - public String splashText = "missingno"; + public String splashText = null; private GuiButton buttonResetDemo; private static boolean showingEndian = true; @@ -76,28 +73,14 @@ public class GuiMainMenu extends GuiScreen { public boolean showAck = false; public GuiMainMenu() { - /* - * this.field_92025_p = ""; String var14 = - * System.getProperty("os_architecture"); var3 = - * System.getProperty("java_version"); - * - * if ("ppc".equalsIgnoreCase(var14)) { this.field_92025_p = "" + - * EnumChatFormatting.BOLD + "Notice!" + EnumChatFormatting.RESET + - * " PowerPC compatibility will be dropped in Minecraft 1.6"; - * this.field_104024_v = "http://tinyurl.com/javappc"; } else if (var3 != null - * && var3.startsWith("1.5")) { this.field_92025_p = "" + - * EnumChatFormatting.BOLD + "Notice!" + EnumChatFormatting.RESET + - * " Java 1.5 compatibility will be dropped in Minecraft 1.6"; - * this.field_104024_v = "http://tinyurl.com/javappc"; } - * - * if (this.field_92025_p.length() == 0) { (new Thread(new - * RunnableTitleScreen(this), "1.6 Update Check Thread")).start(); } - */ - - if (enableSplash) { - EaglercraftRandom rand = new EaglercraftRandom(); + if (ConfigConstants.enableSplash) { NBTTagList splashesList = ConfigConstants.splashTexts; - this.splashText = ((NBTTagString) splashesList.tagAt(rand.nextInt(splashesList.tagCount()))).data; + if(splashesList.tagCount() > 0) { + EaglercraftRandom rand = new EaglercraftRandom(); + this.splashText = ((NBTTagString) splashesList.tagAt(rand.nextInt(splashesList.tagCount()))).data; + }else { + this.splashText = "missingno"; + } } this.field_92025_p = EaglerAdapter._wisWebGL() ? ("eaglercraft javascript runtime") : ("eaglercraft desktop runtime"); this.start = System.currentTimeMillis() + System.currentTimeMillis() % 10000l; @@ -115,7 +98,6 @@ public class GuiMainMenu extends GuiScreen { public boolean doesGuiPauseGame() { return false; } - public void handleMouseInput() { super.handleMouseInput(); @@ -214,9 +196,6 @@ public class GuiMainMenu extends GuiScreen { } } - - - public static boolean enableSplash = false; protected void mouseClicked(int par1, int par2, int par3) { if(!showAck) { @@ -502,7 +481,7 @@ public class GuiMainMenu extends GuiScreen { // this.field_92024_r) / 2, ((GuiButton)this.buttonList.get(0)).yPosition - 12, // 16777215); } - if (enableSplash) { + if (this.splashText != null) { var4.setColorOpaque_I(16777215); EaglerAdapter.glPushMatrix(); EaglerAdapter.glTranslatef((float) (this.width / 2 + 90), 70.0F, 0.0F); diff --git a/src/main/java/net/minecraft/src/ServerList.java b/src/main/java/net/minecraft/src/ServerList.java index 7540a92..84c8933 100644 --- a/src/main/java/net/minecraft/src/ServerList.java +++ b/src/main/java/net/minecraft/src/ServerList.java @@ -33,8 +33,8 @@ 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.enableSplash = nbt.getBoolean("enableSplash"); + if (ConfigConstants.enableSplash) { ConfigConstants.splashTexts = nbt.getTagList("splashes"); } ConfigConstants.profanity = nbt.getBoolean("profanity");