Unbad some more code

This commit is contained in:
PeytonPlayz595 2023-07-19 13:50:09 -04:00
parent bd979db96d
commit 7d92e54b1a
7 changed files with 62 additions and 162 deletions

View File

@ -11,6 +11,8 @@ import org.teavm.jso.core.JSError;
import org.teavm.jso.dom.html.HTMLDocument;
import org.teavm.jso.dom.html.HTMLElement;
import net.minecraft.client.Minecraft;
import net.minecraft.client.Session;
import net.PeytonPlayz585.storage.LocalStorageManager;
public class MinecraftMain {
@ -45,6 +47,9 @@ public class MinecraftMain {
}
private static void run1() {
Minecraft minecraft = new Minecraft(GL11.getCanvasWidth(), GL11.getCanvasHeight());
minecraft.minecraftUri = "127.0.0.1:25565";
minecraft.session = new Session("PeytonPlayz595", "WebGL-Emulator");
}
@JSBody(params = { }, script = "return window.classicConfig;")

View File

@ -1,21 +0,0 @@
package net.minecraft.client;
import java.awt.Canvas;
final class CanvasMinecraftApplet extends Canvas {
private MinecraftApplet mcApplet;
CanvasMinecraftApplet(MinecraftApplet var1) {
this.mcApplet = var1;
}
public final synchronized void addNotify() {
super.addNotify();
this.mcApplet.startMainThread();
}
public final synchronized void removeNotify() {
this.mcApplet.shutdown();
super.removeNotify();
}
}

View File

@ -53,7 +53,6 @@ public final class Minecraft implements Runnable {
public EffectRenderer effectRenderer;
public Session session = null;
public String minecraftUri;
public boolean appletMode = true;
public volatile boolean isGamePaused = false;
public RenderEngine renderEngine;
public FontRenderer fontRenderer;

View File

@ -1,83 +0,0 @@
package net.minecraft.client;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Canvas;
public class MinecraftApplet extends Applet {
private Canvas mcCanvas;
private Minecraft mc;
private Thread mcThread = null;
public void init() {
this.mcCanvas = new CanvasMinecraftApplet(this);
boolean var1 = false;
if(this.getParameter("fullscreen") != null) {
var1 = this.getParameter("fullscreen").equalsIgnoreCase("true");
}
this.mc = new Minecraft(this.mcCanvas, this, this.getWidth(), this.getHeight(), var1);
this.mc.minecraftUri = this.getDocumentBase().getHost();
if(this.getDocumentBase().getPort() > 0) {
this.mc.minecraftUri = this.mc.minecraftUri + ":" + this.getDocumentBase().getPort();
}
if(this.getParameter("username") != null && this.getParameter("sessionid") != null) {
this.mc.session = new Session(this.getParameter("username"), this.getParameter("sessionid"));
if(this.getParameter("mppass") != null) {
this.getParameter("mppass");
}
}
if(this.getParameter("loadmap_user") != null && this.getParameter("loadmap_id") != null) {
this.mc.loadMapUser = this.getParameter("loadmap_user");
this.mc.loadMapID = Integer.parseInt(this.getParameter("loadmap_id"));
} else if(this.getParameter("server") != null && this.getParameter("port") != null) {
this.mc.setServer(this.getParameter("server"), Integer.parseInt(this.getParameter("port")));
}
this.mc.appletMode = true;
this.setLayout(new BorderLayout());
this.add(this.mcCanvas, "Center");
this.mcCanvas.setFocusable(true);
this.validate();
}
public final void startMainThread() {
if(this.mcThread == null) {
this.mcThread = new Thread(this.mc, "Minecraft main thread");
this.mcThread.start();
}
}
public void start() {
this.mc.isGamePaused = false;
}
public void stop() {
this.mc.isGamePaused = true;
}
public void destroy() {
this.shutdown();
}
public final void shutdown() {
if(this.mcThread != null) {
Minecraft var1 = this.mc;
var1.running = false;
try {
this.mcThread.join(1000L);
} catch (InterruptedException var3) {
try {
this.mc.shutdownMinecraftApplet();
} catch (Exception var2) {
var2.printStackTrace();
}
}
this.mcThread = null;
}
}
}

View File

@ -1,13 +1,13 @@
package net.minecraft.client.gui;
import java.io.File;
import java.io.FilenameFilter;
final class FilenameFilterLevel implements FilenameFilter {
FilenameFilterLevel(GuiLevelDialog var1) {
}
public final boolean accept(File var1, String var2) {
return var2.toLowerCase().endsWith(".mclevel");
}
}
//package net.minecraft.client.gui;
//
//import java.io.File;
//import java.io.FilenameFilter;
//
//final class FilenameFilterLevel implements FilenameFilter {
// FilenameFilterLevel(GuiLevelDialog var1) {
// }
//
// public final boolean accept(File var1, String var2) {
// return var2.toLowerCase().endsWith(".mclevel");
// }
//}

View File

@ -1,41 +1,41 @@
package net.minecraft.client.gui;
import java.awt.FileDialog;
import java.io.File;
final class GuiLevelDialog extends Thread {
private GuiLoadLevel screen;
GuiLevelDialog(GuiLoadLevel var1) {
this.screen = var1;
}
public final void run() {
try {
FileDialog var1 = this.screen.saveFileDialog();
File var2 = new File(this.screen.mc.mcDataDir, "saves");
var2.mkdir();
String var5 = var2.toString();
if(!var5.endsWith(File.separator)) {
var5 = var5 + File.separator;
}
var1.setDirectory(var5);
FilenameFilterLevel var6 = new FilenameFilterLevel(this);
var1.setFilenameFilter(var6);
var1.setLocationRelativeTo(this.screen.mc.mcCanvas);
var1.setVisible(true);
if(var1.getFile() != null) {
var5 = var1.getDirectory();
if(!var5.endsWith(File.separator)) {
var5 = var5 + File.separator;
}
GuiLoadLevel.a(this.screen, new File(var5 + var1.getFile()));
}
} finally {
GuiLoadLevel.unknown(this.screen, false);
}
}
}
//package net.minecraft.client.gui;
//
//import java.awt.FileDialog;
//import java.io.File;
//
//final class GuiLevelDialog extends Thread {
// private GuiLoadLevel screen;
//
// GuiLevelDialog(GuiLoadLevel var1) {
// this.screen = var1;
// }
//
// public final void run() {
// try {
// FileDialog var1 = this.screen.saveFileDialog();
// File var2 = new File(this.screen.mc.mcDataDir, "saves");
// var2.mkdir();
// String var5 = var2.toString();
// if(!var5.endsWith(File.separator)) {
// var5 = var5 + File.separator;
// }
//
// var1.setDirectory(var5);
// FilenameFilterLevel var6 = new FilenameFilterLevel(this);
// var1.setFilenameFilter(var6);
// var1.setLocationRelativeTo(this.screen.mc.mcCanvas);
// var1.setVisible(true);
// if(var1.getFile() != null) {
// var5 = var1.getDirectory();
// if(!var5.endsWith(File.separator)) {
// var5 = var5 + File.separator;
// }
//
// GuiLoadLevel.a(this.screen, new File(var5 + var1.getFile()));
// }
// } finally {
// GuiLoadLevel.unknown(this.screen, false);
// }
//
// }
//}

View File

@ -92,9 +92,9 @@ public class GuiLoadLevel extends GuiScreen implements Runnable {
if(this.finished || this.loaded && var1.id == 5) {
this.frozen = true;
GuiLevelDialog var2 = new GuiLevelDialog(this);
var2.setDaemon(true);
var2.start();
// GuiLevelDialog var2 = new GuiLevelDialog(this);
// var2.setDaemon(true);
// var2.start();
}
if(this.finished || this.loaded && var1.id == 6) {