Added warning message on startup

This commit is contained in:
PeytonPlayz595 2024-02-03 20:28:41 -05:00 committed by GitHub
parent 458e47b0d5
commit 7d78af5b4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 71 additions and 12 deletions

View File

@ -1,6 +1,9 @@
package net.minecraft.src;
import java.nio.IntBuffer;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.lwjgl.opengl.GL11;
@ -169,4 +172,13 @@ public class FontRenderer {
private IntBuffer buffer;
public static final char formatChar = '\247';
public List<String> listFormattedStringToWidth(String title2) {
java.util.ArrayList arraylist = new java.util.ArrayList();
String[] string = title2.split("\n");
for (String list : string) {
arraylist.add(list);
}
return arraylist;
}
}

View File

@ -0,0 +1,45 @@
package net.minecraft.src;
import java.util.ArrayList;
import java.util.List;
public class GuiMessage extends GuiScreen {
private String title1;
private String title2;
private final List listLines2 = new ArrayList();
private GuiScreen parent;
public GuiMessage(GuiScreen var1, String var2, String var3) {
parent = var1;
title1 = var2;
title2 = var3;
}
public void initGui() {
this.controlList.clear();
this.controlList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 72, "I Understand!"));
this.listLines2.clear();
this.listLines2.addAll(this.fontRenderer.listFormattedStringToWidth(this.title2));
}
protected void actionPerformed(GuiButton var1) {
if(var1.id == 0) {
this.mc.displayGuiScreen(parent);
}
}
public void drawScreen(int var1, int var2, float var3) {
this.drawDefaultBackground();
this.drawCenteredString(fontRenderer, title1, this.width / 2 - 5, 70, 16777215);
int i = 90;
for (Object s : this.listLines2) {
this.drawCenteredString(this.fontRenderer, (String) s, this.width / 2 - 5, i, 16777215);
i += 9;
}
super.drawScreen(var1, var2, var3);
}
}

View File

@ -10,7 +10,7 @@ public class GuiScreen extends Gui {
protected Minecraft mc;
public int width;
public int height;
protected List controlList = new ArrayList();
protected List controlList<GuiButton> = new ArrayList<GuiButton>();
public boolean allowUserInput = false;
protected FontRenderer fontRenderer;

View File

@ -45,6 +45,7 @@ public class Minecraft implements Runnable {
private int mouseTicksRan = 0;
public boolean isRaining = false;
long systemTime = System.currentTimeMillis();
private static Minecraft mc;
public Minecraft(int var4, int var5, boolean var6) {
new ThreadSleepForever(this, "Timer hack thread");
@ -55,7 +56,7 @@ public class Minecraft implements Runnable {
public void setServer(String var1, int var2) {
}
public void startGame() throws LWJGLException {
public void startGame() {
this.gameSettings = new GameSettings(this);
this.renderEngine = new RenderEngine(this.gameSettings);
this.fontRenderer = new FontRenderer(this.gameSettings, "/default.png", this.renderEngine);
@ -75,7 +76,6 @@ public class Minecraft implements Runnable {
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
this.checkGLError("Startup");
//this.sndManager.loadSoundSettings(this.gameSettings);
this.renderEngine.registerTextureFX(this.textureLavaFX);
this.renderEngine.registerTextureFX(this.textureWaterFX);
this.renderEngine.registerTextureFX(new TextureWaterFlowFX());
@ -84,7 +84,7 @@ public class Minecraft implements Runnable {
this.renderEngine.registerTextureFX(new TextureFlamesFX(1));
this.renderGlobal = new RenderGlobal(this, this.renderEngine);
GL11.glViewport(0, 0, this.displayWidth, this.displayHeight);
this.displayGuiScreen(new GuiMainMenu());
Minecraft.getMinecraft().displayGuiMessage(new GuiMainMenu(), "EARLY BETA TESTING!", "THIS PROJECT IS STILL IN TESTING!\nTHERE WILL BE BUGS!");
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
this.checkGLError("Post startup");
this.ingameGUI = new GuiIngame(this);
@ -150,6 +150,11 @@ public class Minecraft implements Runnable {
}
}
public void displayGuiMessage(GuiScreen var1, String var2, String var3) {
GuiMessage guimessage = new GuiMessage(var1, var2, var3);
this.displayGuiScreen(guimessage);
}
private void checkGLError(String var1) {
int var2 = GL11.glGetError();
if(var2 != 0) {
@ -172,14 +177,7 @@ public class Minecraft implements Runnable {
public void run() {
this.running = true;
try {
this.startGame();
} catch (Exception var10) {
var10.printStackTrace();
new UnexpectedThrowable("Failed to start game", var10);
return;
}
this.startGame();
long var1 = System.currentTimeMillis();
int var3 = 0;
@ -777,4 +775,8 @@ public class Minecraft implements Runnable {
this.playerController.onRespawn(this.thePlayer);
this.preloadWorld("Respawning");
}
public static Minecraft getMinecraft() {
return mc;
}
}