diff --git a/src/main/java/com/mojang/minecraft/GameSettings.java b/src/main/java/com/mojang/minecraft/GameSettings.java index 06f11af..cb4d5d7 100644 --- a/src/main/java/com/mojang/minecraft/GameSettings.java +++ b/src/main/java/com/mojang/minecraft/GameSettings.java @@ -1,23 +1,12 @@ package com.mojang.minecraft; -import com.mojang.minecraft.render.TextureManager; -import java.awt.image.BufferedImage; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Iterator; -import javax.imageio.ImageIO; import org.lwjgl.input.Keyboard; import com.mojang.minecraft.gamemode.*; -import com.mojang.minecraft.player.Inventory; public final class GameSettings { - public GameSettings(Minecraft minecraft, File minecraftFolder) + public GameSettings(Minecraft minecraft) { bindings = new KeyBinding[] {forwardKey, leftKey, backKey, rightKey, jumpKey, buildKey, chatKey, toggleFogKey, saveLocationKey, loadLocationKey}; @@ -25,7 +14,7 @@ public final class GameSettings this.minecraft = minecraft; - settingsFile = new File(minecraftFolder, "options.txt"); +// settingsFile = new File(minecraftFolder, "options.txt"); load(); } @@ -56,7 +45,7 @@ public final class GameSettings public KeyBinding loadLocationKey = new KeyBinding("Load location", 19); public KeyBinding[] bindings; private Minecraft minecraft; - private File settingsFile; +// private File settingsFile; public int settingCount; public String getBinding(int key) @@ -167,121 +156,121 @@ public final class GameSettings private void load() { - try - { - if(settingsFile.exists()) - { - FileReader fileReader = new FileReader(settingsFile); - BufferedReader reader = new BufferedReader(fileReader); - - String line = null; - - while((line = reader.readLine()) != null) - { - String[] setting = line.split(":"); - - if(setting[0].equals("music")) - { - music = setting[1].equals("true"); - } - - if(setting[0].equals("sound")) - { - sound = setting[1].equals("true"); - } - - if(setting[0].equals("invertYMouse")) - { - invertMouse = setting[1].equals("true"); - } - - if(setting[0].equals("showFrameRate")) - { - showFrameRate = setting[1].equals("true"); - } - - if(setting[0].equals("viewDistance")) - { - viewDistance = Integer.parseInt(setting[1]); - } - - if(setting[0].equals("bobView")) - { - viewBobbing = setting[1].equals("true"); - } - - if(setting[0].equals("anaglyph3d")) - { - anaglyph = setting[1].equals("true"); - } - - if(setting[0].equals("limitFramerate")) - { - limitFramerate = setting[1].equals("true"); - } - - if(setting[0].equals("ofBetterGrass")) - { - ofBetterGrass = setting[1].equals("true"); - } - - if(setting[0].equals("ofFastMath")) - { - ofFastMath = setting[1].equals("true"); - } - - if(setting[0].equals("ofSmoothFPS")) - { - ofSmoothFPS = setting[1].equals("true"); - } - - for(int index = 0; index < this.bindings.length; index++) - { - if(setting[0].equals("key_" + bindings[index].name)) - { - bindings[index].key = Integer.parseInt(setting[1]); - } - } - } - - reader.close(); - } - } catch (Exception e) { - System.out.println("Failed to load options"); - - e.printStackTrace(); - } +// try +// { +// if(settingsFile.exists()) +// { +// FileReader fileReader = new FileReader(settingsFile); +// BufferedReader reader = new BufferedReader(fileReader); +// +// String line = null; +// +// while((line = reader.readLine()) != null) +// { +// String[] setting = line.split(":"); +// +// if(setting[0].equals("music")) +// { +// music = setting[1].equals("true"); +// } +// +// if(setting[0].equals("sound")) +// { +// sound = setting[1].equals("true"); +// } +// +// if(setting[0].equals("invertYMouse")) +// { +// invertMouse = setting[1].equals("true"); +// } +// +// if(setting[0].equals("showFrameRate")) +// { +// showFrameRate = setting[1].equals("true"); +// } +// +// if(setting[0].equals("viewDistance")) +// { +// viewDistance = Integer.parseInt(setting[1]); +// } +// +// if(setting[0].equals("bobView")) +// { +// viewBobbing = setting[1].equals("true"); +// } +// +// if(setting[0].equals("anaglyph3d")) +// { +// anaglyph = setting[1].equals("true"); +// } +// +// if(setting[0].equals("limitFramerate")) +// { +// limitFramerate = setting[1].equals("true"); +// } +// +// if(setting[0].equals("ofBetterGrass")) +// { +// ofBetterGrass = setting[1].equals("true"); +// } +// +// if(setting[0].equals("ofFastMath")) +// { +// ofFastMath = setting[1].equals("true"); +// } +// +// if(setting[0].equals("ofSmoothFPS")) +// { +// ofSmoothFPS = setting[1].equals("true"); +// } +// +// for(int index = 0; index < this.bindings.length; index++) +// { +// if(setting[0].equals("key_" + bindings[index].name)) +// { +// bindings[index].key = Integer.parseInt(setting[1]); +// } +// } +// } +// +// reader.close(); +// } +// } catch (Exception e) { +// System.out.println("Failed to load options"); +// +// e.printStackTrace(); +// } } private void save() { - try { - FileWriter fileWriter = new FileWriter(this.settingsFile); - PrintWriter writer = new PrintWriter(fileWriter); - - writer.println("music:" + music); - writer.println("sound:" + sound); - writer.println("invertYMouse:" + invertMouse); - writer.println("showFrameRate:" + showFrameRate); - writer.println("viewDistance:" + viewDistance); - writer.println("bobView:" + viewBobbing); - writer.println("anaglyph3d:" + anaglyph); - writer.println("limitFramerate:" + limitFramerate); - writer.println("ofBetterGrass:" + ofBetterGrass); - writer.println("ofFastMath:" + ofFastMath); - writer.println("ofSmoothFPS:" + ofSmoothFPS); - - for(int binding = 0; binding < bindings.length; binding++) - { - writer.println("key_" + bindings[binding].name + ":" + bindings[binding].key); - } - - writer.close(); - } catch (Exception e) { - System.out.println("Failed to save options"); - - e.printStackTrace(); - } +// try { +// FileWriter fileWriter = new FileWriter(this.settingsFile); +// PrintWriter writer = new PrintWriter(fileWriter); +// +// writer.println("music:" + music); +// writer.println("sound:" + sound); +// writer.println("invertYMouse:" + invertMouse); +// writer.println("showFrameRate:" + showFrameRate); +// writer.println("viewDistance:" + viewDistance); +// writer.println("bobView:" + viewBobbing); +// writer.println("anaglyph3d:" + anaglyph); +// writer.println("limitFramerate:" + limitFramerate); +// writer.println("ofBetterGrass:" + ofBetterGrass); +// writer.println("ofFastMath:" + ofFastMath); +// writer.println("ofSmoothFPS:" + ofSmoothFPS); +// +// for(int binding = 0; binding < bindings.length; binding++) +// { +// writer.println("key_" + bindings[binding].name + ":" + bindings[binding].key); +// } +// +// writer.close(); +// } catch (Exception e) { +// System.out.println("Failed to save options"); +// +// e.printStackTrace(); +// } } } diff --git a/src/main/java/com/mojang/minecraft/Minecraft$OS.java b/src/main/java/com/mojang/minecraft/Minecraft$OS.java deleted file mode 100644 index 53e2455..0000000 --- a/src/main/java/com/mojang/minecraft/Minecraft$OS.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.mojang.minecraft; - -public enum Minecraft$OS -{ - linux("linux", 0), - solaris("solaris", 1), - windows("windows", 2), - macos("macos", 3), - unknown("unknown", 4); - - private static final Minecraft$OS[] values = new Minecraft$OS[] {linux, solaris, windows, macos, unknown}; - - private Minecraft$OS(String name, int id) - { - } -} diff --git a/src/main/java/com/mojang/minecraft/Minecraft.java b/src/main/java/com/mojang/minecraft/Minecraft.java index 6c8dc75..5cd733e 100644 --- a/src/main/java/com/mojang/minecraft/Minecraft.java +++ b/src/main/java/com/mojang/minecraft/Minecraft.java @@ -34,22 +34,15 @@ import com.mojang.minecraft.sound.SoundManager; import com.mojang.minecraft.sound.SoundPlayer; import com.mojang.net.NetworkHandler; import com.mojang.util.MathHelper; + +import net.PeytonPlayz585.main.MinecraftMain; + import org.lwjgl.BufferUtils; -import org.lwjgl.LWJGLException; -import org.lwjgl.input.Controllers; -import org.lwjgl.input.Cursor; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GL11; -import org.lwjgl.util.glu.GLU; -import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioSystem; -import javax.swing.*; -import java.awt.*; -import java.io.*; import java.nio.IntBuffer; import java.util.Collections; import java.util.List; @@ -67,10 +60,8 @@ public final class Minecraft implements Runnable { public ParticleManager particleManager; public SessionData session = null; public String host; - public Canvas canvas; public boolean levelLoaded = false; public volatile boolean waiting = false; - private Cursor cursor; public TextureManager textureManager; public FontRenderer fontRenderer; public GuiScreen currentScreen = null; @@ -83,14 +74,12 @@ public final class Minecraft implements Runnable { private int blockHitTime; public String levelName; public int levelId; - public Robot robot; public HUDScreen hud; public boolean online; public NetworkManager networkManager; public SoundPlayer soundPlayer; public MovingObjectPosition selected; public static GameSettings settings; - private MinecraftApplet applet; String server; int port; volatile boolean running; @@ -100,7 +89,7 @@ public final class Minecraft implements Runnable { public boolean raining; - public Minecraft(Canvas var1, MinecraftApplet var2, int var3, int var4, boolean var5) { + public Minecraft(int var3, int var4, boolean var5) { this.levelIo = new LevelIO(this.progressBar); this.sound = new SoundManager(); this.ticks = 0; @@ -117,28 +106,10 @@ public final class Minecraft implements Runnable { this.hasMouse = false; this.lastClick = 0; this.raining = false; - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (Exception var7) { - var7.printStackTrace(); - } - - this.applet = var2; new SleepForeverThread(this); - this.canvas = var1; this.width = var3; this.height = var4; this.fullscreen = var5; - if(var1 != null) { - try { - this.robot = new Robot(); - return; - } catch (AWTException var8) { - var8.printStackTrace(); - } - } - } public final void setCurrentScreen(GuiScreen var1) { @@ -157,11 +128,7 @@ public final class Minecraft implements Runnable { this.player.releaseAllKeys(); this.hasMouse = false; if(this.levelLoaded) { - try { - Mouse.setNativeCursor((Cursor)null); - } catch (LWJGLException var4) { - var4.printStackTrace(); - } + Mouse.setGrabbed(false); } else { Mouse.setGrabbed(false); } @@ -180,7 +147,7 @@ public final class Minecraft implements Runnable { private static void checkGLError(String var0) { int var1; if((var1 = GL11.glGetError()) != 0) { - String var2 = GLU.gluErrorString(var1); + String var2 = GL11.gluErrorString(var1); System.out.println("########## GL ERROR ##########"); System.out.println("@ " + var0); System.out.println(var1 + ": " + var2); @@ -204,18 +171,14 @@ public final class Minecraft implements Runnable { ; } - Minecraft var5 = this; - if(!this.levelLoaded) { - try { - LevelIO.save(var5.level, (OutputStream)(new FileOutputStream(new File("level.dat")))); - } catch (Exception var2) { - var2.printStackTrace(); - } - } - - Mouse.destroy(); - Keyboard.destroy(); - Display.destroy(); +// Minecraft var5 = this; +// if(!this.levelLoaded) { +// try { +// LevelIO.save(var5.level, (OutputStream)(new FileOutputStream(new File("level.dat")))); +// } catch (Exception var2) { +// var2.printStackTrace(); +// } +// } } public final void run() { @@ -223,45 +186,13 @@ public final class Minecraft implements Runnable { try { Minecraft var1 = this; - if(this.canvas != null) { - Display.setParent(this.canvas); - } else if(this.fullscreen) { - Display.setFullscreen(true); - this.width = Display.getDisplayMode().getWidth(); - this.height = Display.getDisplayMode().getHeight(); - } else { - Display.setDisplayMode(new DisplayMode(this.width, this.height)); - } - - Display.setTitle("Minecraft 0.30"); - - try { - Display.create(); - } catch (LWJGLException var57) { - var57.printStackTrace(); - - try { - Thread.sleep(1000L); - } catch (InterruptedException var56) { - ; - } - - Display.create(); - } - - Keyboard.create(); - Mouse.create(); - - try { - Controllers.create(); - } catch (Exception var55) { - var55.printStackTrace(); - } + this.width = MinecraftMain.canvas.getWidth(); + this.height = MinecraftMain.canvas.getHeight(); checkGLError("Pre startup"); GL11.glEnable(3553); GL11.glShadeModel(7425); - GL11.glClearDepth(1.0D); + GL11.glClearDepth((float)1.0D); GL11.glEnable(2929); GL11.glDepthFunc(515); GL11.glEnable(3008); @@ -271,36 +202,7 @@ public final class Minecraft implements Runnable { GL11.glLoadIdentity(); GL11.glMatrixMode(5888); checkGLError("Startup"); - String var3 = "minecraftclassicforever"; - String var5 = System.getProperty("user.home", "."); - String var6; - File var7; - switch(OperatingSystemLookup.lookup[((var6 = System.getProperty("os.name").toLowerCase()).contains("win")?Minecraft$OS.windows:(var6.contains("mac")?Minecraft$OS.macos:(var6.contains("solaris")?Minecraft$OS.solaris:(var6.contains("sunos")?Minecraft$OS.solaris:(var6.contains("linux")?Minecraft$OS.linux:(var6.contains("unix")?Minecraft$OS.linux:Minecraft$OS.unknown)))))).ordinal()]) { - case 1: - case 2: - var7 = new File(var5, '.' + var3 + '/'); - break; - case 3: - String var8; - if((var8 = System.getenv("APPDATA")) != null) { - var7 = new File(var8, "." + var3 + '/'); - } else { - var7 = new File(var5, '.' + var3 + '/'); - } - break; - case 4: - var7 = new File(var5, "Library/Application Support/" + var3); - break; - default: - var7 = new File(var5, var3 + '/'); - } - - if(!var7.exists() && !var7.mkdirs()) { - throw new RuntimeException("The working directory could not be created: " + var7); - } - - File var2 = var7; - this.settings = new GameSettings(this, var7); + this.settings = new GameSettings(this); this.textureManager = new TextureManager(this.settings); this.textureManager.registerAnimation(new TextureLavaFX()); this.textureManager.registerAnimation(new TextureWaterFX()); @@ -318,57 +220,50 @@ public final class Minecraft implements Runnable { } else { boolean var10 = false; - try { - if(var1.levelName != null) { - var1.loadOnlineLevel(var1.levelName, var1.levelId); - } else if(!var1.levelLoaded) { - Level var11 = null; - if((var11 = var1.levelIo.load((InputStream)(new FileInputStream(new File("level.dat"))))) != null) { - var1.setLevel(var11); - } - } - } catch (Exception var54) { - var54.printStackTrace(); - } +// try { +// if(var1.levelName != null) { +// var1.loadOnlineLevel(var1.levelName, var1.levelId); +// } else if(!var1.levelLoaded) { +// Level var11 = null; +// if((var11 = var1.levelIo.load((InputStream)(new FileInputStream(new File("level.dat"))))) != null) { +// var1.setLevel(var11); +// } +// } +// } catch (Exception var54) { +// var54.printStackTrace(); +// } - if(this.level == null) { + //if(this.level == null) { this.generateLevel(1); - } + //} } this.particleManager = new ParticleManager(this.level, this.textureManager); - if(this.levelLoaded) { - try { - var1.cursor = new Cursor(16, 16, 0, 0, 1, var9, (IntBuffer)null); - } catch (LWJGLException var53) { - var53.printStackTrace(); - } - } - try { - var1.soundPlayer = new SoundPlayer(var1.settings); - SoundPlayer var4 = var1.soundPlayer; - - try { - AudioFormat var67 = new AudioFormat(44100.0F, 16, 2, true, true); - var4.dataLine = AudioSystem.getSourceDataLine(var67); - var4.dataLine.open(var67, 4410); - var4.dataLine.start(); - var4.running = true; - Thread var72; - (var72 = new Thread(var4)).setDaemon(true); - var72.setPriority(10); - var72.start(); - } catch (Exception var51) { - var51.printStackTrace(); - var4.running = false; - } - - var1.resourceThread = new ResourceDownloadThread(var2, var1); - var1.resourceThread.start(); - } catch (Exception var52) { - ; - } +// try { +// var1.soundPlayer = new SoundPlayer(var1.settings); +// SoundPlayer var4 = var1.soundPlayer; +// +// try { +// AudioFormat var67 = new AudioFormat(44100.0F, 16, 2, true, true); +// var4.dataLine = AudioSystem.getSourceDataLine(var67); +// var4.dataLine.open(var67, 4410); +// var4.dataLine.start(); +// var4.running = true; +// Thread var72; +// (var72 = new Thread(var4)).setDaemon(true); +// var72.setPriority(10); +// var72.start(); +// } catch (Exception var51) { +// var51.printStackTrace(); +// var4.running = false; +// } +// +// var1.resourceThread = new ResourceDownloadThread(var2, var1); +// var1.resourceThread.start(); +// } catch (Exception var52) { +// ; +// } checkGLError("Post startup"); this.hud = new HUDScreen(this, this.width, this.height); @@ -378,8 +273,7 @@ public final class Minecraft implements Runnable { } } catch (Exception var62) { var62.printStackTrace(); - JOptionPane.showMessageDialog((Component)null, var62.toString(), "Failed to start Minecraft", 0); - return; + throw new RuntimeException("Failed to start Minecraft! :("); } long var13 = System.currentTimeMillis(); @@ -390,7 +284,7 @@ public final class Minecraft implements Runnable { if(this.waiting) { Thread.sleep(100L); } else { - if(this.canvas == null && Display.isCloseRequested()) { + if(Display.isCloseRequested()) { this.running = false; } @@ -457,17 +351,17 @@ public final class Minecraft implements Runnable { var81 = 0; var86 = 0; if(var66.minecraft.levelLoaded) { - if(var66.minecraft.canvas != null) { - Point var90; - var70 = (var90 = var66.minecraft.canvas.getLocationOnScreen()).x + var66.minecraft.width / 2; - var68 = var90.y + var66.minecraft.height / 2; - Point var75; - var81 = (var75 = MouseInfo.getPointerInfo().getLocation()).x - var70; - var86 = -(var75.y - var68); - var66.minecraft.robot.mouseMove(var70, var68); - } else { +// if(var66.minecraft.canvas != null) { +// Point var90; +// var70 = (var90 = MinecraftMain.canvas.mouse).x + var66.minecraft.width / 2; +// var68 = var90.y + var66.minecraft.height / 2; +// Point var75; +// var81 = (var75 = MouseInfo.getPointerInfo().getLocation()).x - var70; +// var86 = -(var75.y - var68); +// Mouse.setCursorPosition(var70, var68); +// } else { Mouse.setCursorPosition(var66.minecraft.width / 2, var66.minecraft.height / 2); - } +// } } else { var81 = Mouse.getDX(); var86 = Mouse.getDY(); @@ -615,7 +509,7 @@ public final class Minecraft implements Runnable { var69 /= (1.0F - 500.0F / (var74 + 500.0F)) * 2.0F + 1.0F; } - GLU.gluPerspective(var69, (float)var82.minecraft.width / (float)var82.minecraft.height, 0.05F, var82.fogEnd); + GL11.gluPerspective(var69, (float)var82.minecraft.width / (float)var82.minecraft.height, 0.05F, var82.fogEnd); GL11.glMatrixMode(5888); GL11.glLoadIdentity(); if(var82.minecraft.settings.anaglyph) { @@ -870,33 +764,33 @@ public final class Minecraft implements Runnable { GL11.glDisable(3553); GL11.glDepthMask(false); var29 = 0.002F; - if((var104 = var89.level.getTile(var102.x, var102.y, var102.z)) > 0) { - AABB var111 = Block.blocks[var104].getSelectionBox(var102.x, var102.y, var102.z).grow(var29, var29, var29); - GL11.glBegin(3); - GL11.glVertex3f(var111.x0, var111.y0, var111.z0); - GL11.glVertex3f(var111.x1, var111.y0, var111.z0); - GL11.glVertex3f(var111.x1, var111.y0, var111.z1); - GL11.glVertex3f(var111.x0, var111.y0, var111.z1); - GL11.glVertex3f(var111.x0, var111.y0, var111.z0); - GL11.glEnd(); - GL11.glBegin(3); - GL11.glVertex3f(var111.x0, var111.y1, var111.z0); - GL11.glVertex3f(var111.x1, var111.y1, var111.z0); - GL11.glVertex3f(var111.x1, var111.y1, var111.z1); - GL11.glVertex3f(var111.x0, var111.y1, var111.z1); - GL11.glVertex3f(var111.x0, var111.y1, var111.z0); - GL11.glEnd(); - GL11.glBegin(1); - GL11.glVertex3f(var111.x0, var111.y0, var111.z0); - GL11.glVertex3f(var111.x0, var111.y1, var111.z0); - GL11.glVertex3f(var111.x1, var111.y0, var111.z0); - GL11.glVertex3f(var111.x1, var111.y1, var111.z0); - GL11.glVertex3f(var111.x1, var111.y0, var111.z1); - GL11.glVertex3f(var111.x1, var111.y1, var111.z1); - GL11.glVertex3f(var111.x0, var111.y0, var111.z1); - GL11.glVertex3f(var111.x0, var111.y1, var111.z1); - GL11.glEnd(); - } +// if((var104 = var89.level.getTile(var102.x, var102.y, var102.z)) > 0) { +// AABB var111 = Block.blocks[var104].getSelectionBox(var102.x, var102.y, var102.z).grow(var29, var29, var29); +// GL11.glBegin(3); +// GL11.glVertex3f(var111.x0, var111.y0, var111.z0); +// GL11.glVertex3f(var111.x1, var111.y0, var111.z0); +// GL11.glVertex3f(var111.x1, var111.y0, var111.z1); +// GL11.glVertex3f(var111.x0, var111.y0, var111.z1); +// GL11.glVertex3f(var111.x0, var111.y0, var111.z0); +// GL11.glEnd(); +// GL11.glBegin(3); +// GL11.glVertex3f(var111.x0, var111.y1, var111.z0); +// GL11.glVertex3f(var111.x1, var111.y1, var111.z0); +// GL11.glVertex3f(var111.x1, var111.y1, var111.z1); +// GL11.glVertex3f(var111.x0, var111.y1, var111.z1); +// GL11.glVertex3f(var111.x0, var111.y1, var111.z0); +// GL11.glEnd(); +// GL11.glBegin(1); +// GL11.glVertex3f(var111.x0, var111.y0, var111.z0); +// GL11.glVertex3f(var111.x0, var111.y1, var111.z0); +// GL11.glVertex3f(var111.x1, var111.y0, var111.z0); +// GL11.glVertex3f(var111.x1, var111.y1, var111.z0); +// GL11.glVertex3f(var111.x1, var111.y0, var111.z1); +// GL11.glVertex3f(var111.x1, var111.y1, var111.z1); +// GL11.glVertex3f(var111.x0, var111.y0, var111.z1); +// GL11.glVertex3f(var111.x0, var111.y1, var111.z1); +// GL11.glEnd(); +// } GL11.glDepthMask(true); GL11.glEnable(3553); @@ -1114,24 +1008,15 @@ public final class Minecraft implements Runnable { public final void grabMouse() { if(!this.hasMouse) { - this.hasMouse = true; - if(this.levelLoaded) { - try { - Mouse.setNativeCursor(this.cursor); - Mouse.setCursorPosition(this.width / 2, this.height / 2); - } catch (LWJGLException var2) { - var2.printStackTrace(); - } - - if(this.canvas == null) { - this.canvas.requestFocus(); - } - } else { - Mouse.setGrabbed(true); - } - - this.setCurrentScreen((GuiScreen)null); - this.lastClick = this.ticks + 10000; + if(!Mouse.isFocused()) { + return; + } else if(Mouse.isActuallyGrabbed()) { + return; + } else { + Mouse.setGrabbed(true); + this.setCurrentScreen((GuiScreen)null); + this.lastClick = this.ticks + 10000; + } } } @@ -1285,7 +1170,7 @@ public final class Minecraft implements Runnable { byte var5 = var22.in.get(0); PacketType var6; if((var6 = PacketType.packets[var5]) == null) { - throw new IOException("Bad command: " + var5); + throw new Exception("Bad command: " + var5); } if(var22.in.remaining() < var6.length + 1) { @@ -1308,28 +1193,28 @@ public final class Minecraft implements Runnable { var42.minecraft.player.userType = ((Byte)var7[3]).byteValue(); } else if(var6 == PacketType.LEVEL_INIT) { var42.minecraft.setLevel((Level)null); - var42.levelData = new ByteArrayOutputStream(); + //var42.levelData = new ByteArrayOutputStream(); } else if(var6 == PacketType.LEVEL_DATA) { short var11 = ((Short)var7[0]).shortValue(); byte[] var12 = (byte[])((byte[])var7[1]); byte var13 = ((Byte)var7[2]).byteValue(); var42.minecraft.progressBar.setProgress(var13); - var42.levelData.write(var12, 0, var11); + //var42.levelData.write(var12, 0, var11); } else if(var6 == PacketType.LEVEL_FINALIZE) { - try { - var42.levelData.close(); - } catch (IOException var14) { - var14.printStackTrace(); - } + //try { + //var42.levelData.close(); + //} catch (IOException var14) { + //var14.printStackTrace(); + //} - byte[] var51 = LevelIO.decompress(new ByteArrayInputStream(var42.levelData.toByteArray())); - var42.levelData = null; + //byte[] var51 = LevelIO.decompress(new ByteArrayInputStream(var42.levelData.toByteArray())); + //var42.levelData = null; short var55 = ((Short)var7[0]).shortValue(); short var63 = ((Short)var7[1]).shortValue(); short var21 = ((Short)var7[2]).shortValue(); Level var30; (var30 = new Level()).setNetworkMode(true); - var30.setData(var55, var63, var21, var51); + //var30.setData(var55, var63, var21, var51); var42.minecraft.setLevel(var30); var42.minecraft.online = false; var42.levelLoaded = true; @@ -1739,10 +1624,6 @@ public final class Minecraft implements Runnable { } public final void setLevel(Level var1) { - if(this.applet == null || !this.applet.getDocumentBase().getHost().equalsIgnoreCase("minecraft.net") && !this.applet.getDocumentBase().getHost().equalsIgnoreCase("www.minecraft.net") || !this.applet.getCodeBase().getHost().equalsIgnoreCase("minecraft.net") && !this.applet.getCodeBase().getHost().equalsIgnoreCase("www.minecraft.net")) { - var1 = null; - } - this.level = var1; if(var1 != null) { var1.initTransient(); diff --git a/src/main/java/com/mojang/minecraft/MinecraftApplet$1.java b/src/main/java/com/mojang/minecraft/MinecraftApplet$1.java deleted file mode 100644 index d2ed969..0000000 --- a/src/main/java/com/mojang/minecraft/MinecraftApplet$1.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.mojang.minecraft; - -import java.awt.Canvas; - -// MinecraftCanvas -public class MinecraftApplet$1 extends Canvas -{ - public MinecraftApplet$1(MinecraftApplet minecraftApplet) - { - this.applet = minecraftApplet; - } - - @Override - public synchronized void addNotify() - { - super.addNotify(); - - applet.startGameThread(); - } - - @Override - public synchronized void removeNotify() - { - applet.stopGameThread(); - - super.removeNotify(); - } - - private static final long serialVersionUID = 1L; - - private MinecraftApplet applet; -} diff --git a/src/main/java/com/mojang/minecraft/MinecraftApplet.java b/src/main/java/com/mojang/minecraft/MinecraftApplet.java deleted file mode 100644 index a835106..0000000 --- a/src/main/java/com/mojang/minecraft/MinecraftApplet.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.mojang.minecraft; - -import java.applet.Applet; -import java.awt.BorderLayout; -import java.awt.Canvas; - -public class MinecraftApplet extends Applet -{ - private static final long serialVersionUID = 1L; - - private Canvas canvas; - private Minecraft minecraft; - - private Thread thread = null; - - public void init() - { - canvas = new MinecraftApplet$1(this); - - boolean fullscreen = false; - - if(getParameter("fullscreen") != null) - { - fullscreen = getParameter("fullscreen").equalsIgnoreCase("true"); - } - - minecraft = new Minecraft(canvas, this, getWidth(), getHeight(), fullscreen); - - minecraft.host = getDocumentBase().getHost(); - - if(getDocumentBase().getPort() > 0) - { - minecraft.host = minecraft.host + ":" + getDocumentBase().getPort(); - } - - if(getParameter("username") != null && getParameter("sessionid") != null) - { - minecraft.session = new SessionData(getParameter("username"), getParameter("sessionid")); - - if(getParameter("mppass") != null) - { - minecraft.session.mppass = getParameter("mppass"); - } - - // TODO: Not tested. - minecraft.session.haspaid = getParameter("haspaid").equalsIgnoreCase("true"); - } - - if(getParameter("loadmap_user") != null && getParameter("loadmap_id") != null) - { - minecraft.levelName = getParameter("loadmap_user"); - minecraft.levelId = Integer.parseInt(getParameter("loadmap_id")); - } else if(getParameter("server") != null && getParameter("port") != null) { - String server = getParameter("server"); - int port = Integer.parseInt(getParameter("port")); - - minecraft.server = server; - minecraft.port = port; - } - - minecraft.levelLoaded = true; - - setLayout(new BorderLayout()); - - add(canvas, "Center"); - - canvas.setFocusable(true); - - validate(); - } - - public void startGameThread() - { - if(thread == null) - { - thread = new Thread(minecraft); - - thread.start(); - } - } - - @Override - public void start() - { - minecraft.waiting = false; - } - - @Override - public void stop() - { - minecraft.waiting = true; - } - - @Override - public void destroy() - { - stopGameThread(); - } - - public void stopGameThread() - { - if(thread != null) - { - minecraft.running = false; - - try { - thread.join(1000L); - } catch (InterruptedException var3) { - minecraft.shutdown(); - } - - thread = null; - } - } -} diff --git a/src/main/java/com/mojang/minecraft/gui/GameOverScreen.java b/src/main/java/com/mojang/minecraft/gui/GameOverScreen.java index 09a7546..0a82253 100644 --- a/src/main/java/com/mojang/minecraft/gui/GameOverScreen.java +++ b/src/main/java/com/mojang/minecraft/gui/GameOverScreen.java @@ -1,10 +1,5 @@ package com.mojang.minecraft.gui; -import com.mojang.minecraft.gui.Button; -import com.mojang.minecraft.gui.GenerateLevelScreen; -import com.mojang.minecraft.gui.GuiScreen; -import com.mojang.minecraft.gui.LoadLevelScreen; -import com.mojang.minecraft.gui.OptionsScreen; import org.lwjgl.opengl.GL11; public final class GameOverScreen extends GuiScreen { @@ -28,9 +23,9 @@ public final class GameOverScreen extends GuiScreen { this.minecraft.setCurrentScreen(new GenerateLevelScreen(this)); } - if(this.minecraft.session != null && var1.id == 2) { - this.minecraft.setCurrentScreen(new LoadLevelScreen(this)); - } + //if(this.minecraft.session != null && var1.id == 2) { + //this.minecraft.setCurrentScreen(new LoadLevelScreen(this)); + //} } diff --git a/src/main/java/com/mojang/minecraft/gui/HUDScreen.java b/src/main/java/com/mojang/minecraft/gui/HUDScreen.java index 4558ba2..4ec3a83 100644 --- a/src/main/java/com/mojang/minecraft/gui/HUDScreen.java +++ b/src/main/java/com/mojang/minecraft/gui/HUDScreen.java @@ -177,14 +177,14 @@ public final class HUDScreen extends Screen { GL11.glEnable(3042); GL11.glDisable(3553); GL11.glBlendFunc(770, 771); - GL11.glBegin(7); + //GL11.glBegin(7); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.7F); - GL11.glVertex2f((float)(var14 + 128), (float)(var15 - 68 - 12)); - GL11.glVertex2f((float)(var14 - 128), (float)(var15 - 68 - 12)); + //GL11.glVertex2f((float)(var14 + 128), (float)(var15 - 68 - 12)); + //GL11.glVertex2f((float)(var14 - 128), (float)(var15 - 68 - 12)); GL11.glColor4f(0.2F, 0.2F, 0.2F, 0.8F); - GL11.glVertex2f((float)(var14 - 128), (float)(var15 + 68)); - GL11.glVertex2f((float)(var14 + 128), (float)(var15 + 68)); - GL11.glEnd(); + //GL11.glVertex2f((float)(var14 - 128), (float)(var15 + 68)); + //GL11.glVertex2f((float)(var14 + 128), (float)(var15 + 68)); + //GL11.glEnd(); GL11.glDisable(3042); GL11.glEnable(3553); var23 = "Connected players:"; diff --git a/src/main/java/com/mojang/minecraft/gui/LevelDialog.java b/src/main/java/com/mojang/minecraft/gui/LevelDialog.java deleted file mode 100644 index 30d1250..0000000 --- a/src/main/java/com/mojang/minecraft/gui/LevelDialog.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.mojang.minecraft.gui; - -import com.mojang.minecraft.gui.LoadLevelScreen; -import javax.swing.JFileChooser; -import javax.swing.filechooser.FileNameExtensionFilter; - -final class LevelDialog extends Thread { - - // $FF: synthetic field - private LoadLevelScreen screen; - - - LevelDialog(LoadLevelScreen var1) { - super(); - this.screen = var1; - } - - public final void run() { - JFileChooser var1; - LoadLevelScreen var2; - try { - LoadLevelScreen var10000 = this.screen; - var1 = new JFileChooser(); - var10000.chooser = var1; - FileNameExtensionFilter var3 = new FileNameExtensionFilter("Minecraft levels", new String[]{"mine"}); - var2 = this.screen; - this.screen.chooser.setFileFilter(var3); - var2 = this.screen; - this.screen.chooser.setMultiSelectionEnabled(false); - int var7; - if(this.screen.saving) { - var2 = this.screen; - var7 = this.screen.chooser.showSaveDialog(this.screen.minecraft.canvas); - } else { - var2 = this.screen; - var7 = this.screen.chooser.showOpenDialog(this.screen.minecraft.canvas); - } - - if(var7 == 0) { - (var2 = this.screen).selectedFile = this.screen.chooser.getSelectedFile(); - } - } finally { - boolean var6 = false; - var2 = this.screen; - this.screen.frozen = false; - var1 = null; - var2 = this.screen; - this.screen.chooser = var1; - } - - } -} diff --git a/src/main/java/com/mojang/minecraft/gui/LoadLevelScreen.java b/src/main/java/com/mojang/minecraft/gui/LoadLevelScreen.java deleted file mode 100644 index 468f2e0..0000000 --- a/src/main/java/com/mojang/minecraft/gui/LoadLevelScreen.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.mojang.minecraft.gui; - -import com.mojang.minecraft.Minecraft; -import com.mojang.minecraft.gui.Button; -import com.mojang.minecraft.gui.GuiScreen; -import com.mojang.minecraft.gui.LevelDialog; -import com.mojang.minecraft.level.Level; -import java.io.BufferedReader; -import java.io.File; -import java.io.InputStreamReader; -import java.net.URL; -import javax.swing.JFileChooser; -import javax.swing.SwingUtilities; - -public class LoadLevelScreen extends GuiScreen implements Runnable { - - protected GuiScreen parent; - private boolean finished = false; - private boolean loaded = false; - private String[] levels = null; - private String status = ""; - protected String title = "Load level"; - boolean frozen = false; - JFileChooser chooser; - protected boolean saving = false; - protected File selectedFile; - - - public LoadLevelScreen(GuiScreen var1) { - this.parent = var1; - } - - public void run() { - try { - if(this.frozen) { - try { - Thread.sleep(100L); - } catch (InterruptedException var2) { - var2.printStackTrace(); - } - } - - this.status = "Getting level list.."; - URL var1 = new URL("http://" + this.minecraft.host + "/listmaps.jsp?user=" + this.minecraft.session.username); - BufferedReader var4 = new BufferedReader(new InputStreamReader(var1.openConnection().getInputStream())); - this.levels = var4.readLine().split(";"); - if(this.levels.length >= 5) { - this.setLevels(this.levels); - this.loaded = true; - return; - } - - this.status = this.levels[0]; - this.finished = true; - } catch (Exception var3) { - var3.printStackTrace(); - this.status = "Failed to load levels"; - this.finished = true; - } - - } - - protected void setLevels(String[] var1) { - for(int var2 = 0; var2 < 5; ++var2) { - ((Button)this.buttons.get(var2)).active = !var1[var2].equals("-"); - ((Button)this.buttons.get(var2)).text = var1[var2]; - ((Button)this.buttons.get(var2)).visible = true; - } - - } - - public void onOpen() { - (new Thread(this)).start(); - - for(int var1 = 0; var1 < 5; ++var1) { - this.buttons.add(new Button(var1, this.width / 2 - 100, this.height / 6 + var1 * 24, "---")); - ((Button)this.buttons.get(var1)).visible = false; - ((Button)this.buttons.get(var1)).active = false; - } - - this.buttons.add(new Button(5, this.width / 2 - 100, this.height / 6 + 120 + 12, "Load file...")); - this.buttons.add(new Button(6, this.width / 2 - 100, this.height / 6 + 168, "Cancel")); - } - - protected final void onButtonClick(Button var1) { - if(!this.frozen) { - if(var1.active) { - if(this.loaded && var1.id < 5) { - this.openLevel(var1.id); - } - - if(this.finished || this.loaded && var1.id == 5) { - this.frozen = true; - LevelDialog var2; - (var2 = new LevelDialog(this)).setDaemon(true); - SwingUtilities.invokeLater(var2); - } - - if(this.finished || this.loaded && var1.id == 6) { - this.minecraft.setCurrentScreen(this.parent); - } - - } - } - } - - protected void openLevel(File var1) { - File var2 = var1; - Minecraft var4 = this.minecraft; - Level var5; - boolean var10000; - if((var5 = this.minecraft.levelIo.load(var2)) == null) { - var10000 = false; - } else { - var4.setLevel(var5); - var10000 = true; - } - - this.minecraft.setCurrentScreen(this.parent); - } - - protected void openLevel(int var1) { - this.minecraft.loadOnlineLevel(this.minecraft.session.username, var1); - this.minecraft.setCurrentScreen((GuiScreen)null); - this.minecraft.grabMouse(); - } - - public void render(int var1, int var2) { - drawFadingBox(0, 0, this.width, this.height, 1610941696, -1607454624); - drawCenteredString(this.fontRenderer, this.title, this.width / 2, 20, 16777215); - if(this.frozen) { - drawCenteredString(this.fontRenderer, "Selecting file..", this.width / 2, this.height / 2 - 4, 16777215); - - try { - Thread.sleep(20L); - } catch (InterruptedException var3) { - var3.printStackTrace(); - } - } else { - if(!this.loaded) { - drawCenteredString(this.fontRenderer, this.status, this.width / 2, this.height / 2 - 4, 16777215); - } - - super.render(var1, var2); - } - } - - public final void onClose() { - super.onClose(); - if(this.chooser != null) { - this.chooser.cancelSelection(); - } - - } - - public final void tick() { - super.tick(); - if(this.selectedFile != null) { - this.openLevel(this.selectedFile); - this.selectedFile = null; - } - - } -} diff --git a/src/main/java/com/mojang/minecraft/gui/PauseScreen.java b/src/main/java/com/mojang/minecraft/gui/PauseScreen.java index 63894d2..790f6f1 100644 --- a/src/main/java/com/mojang/minecraft/gui/PauseScreen.java +++ b/src/main/java/com/mojang/minecraft/gui/PauseScreen.java @@ -1,12 +1,5 @@ package com.mojang.minecraft.gui; -import com.mojang.minecraft.gui.Button; -import com.mojang.minecraft.gui.GenerateLevelScreen; -import com.mojang.minecraft.gui.GuiScreen; -import com.mojang.minecraft.gui.LoadLevelScreen; -import com.mojang.minecraft.gui.OptionsScreen; -import com.mojang.minecraft.gui.SaveLevelScreen; - public final class PauseScreen extends GuiScreen { public final void onOpen() { @@ -38,15 +31,15 @@ public final class PauseScreen extends GuiScreen { this.minecraft.setCurrentScreen(new GenerateLevelScreen(this)); } - if(this.minecraft.session != null) { - if(var1.id == 2) { - this.minecraft.setCurrentScreen(new SaveLevelScreen(this)); - } + //if(this.minecraft.session != null) { + //if(var1.id == 2) { + //this.minecraft.setCurrentScreen(new SaveLevelScreen(this)); + //} - if(var1.id == 3) { - this.minecraft.setCurrentScreen(new LoadLevelScreen(this)); - } - } + //if(var1.id == 3) { + //this.minecraft.setCurrentScreen(new LoadLevelScreen(this)); + //} + //} if(var1.id == 4) { this.minecraft.setCurrentScreen((GuiScreen)null); diff --git a/src/main/java/com/mojang/minecraft/gui/SaveLevelScreen.java b/src/main/java/com/mojang/minecraft/gui/SaveLevelScreen.java deleted file mode 100644 index 6ad7917..0000000 --- a/src/main/java/com/mojang/minecraft/gui/SaveLevelScreen.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.mojang.minecraft.gui; - -import com.mojang.minecraft.Minecraft; -import com.mojang.minecraft.gui.Button; -import com.mojang.minecraft.gui.GuiScreen; -import com.mojang.minecraft.gui.LevelNameScreen; -import com.mojang.minecraft.gui.LoadLevelScreen; -import java.io.File; - -public final class SaveLevelScreen extends LoadLevelScreen { - - public SaveLevelScreen(GuiScreen var1) { - super(var1); - this.title = "Save level"; - this.saving = true; - } - - public final void onOpen() { - super.onOpen(); - ((Button)this.buttons.get(5)).text = "Save file..."; - } - - protected final void setLevels(String[] var1) { - for(int var2 = 0; var2 < 5; ++var2) { - ((Button)this.buttons.get(var2)).text = var1[var2]; - ((Button)this.buttons.get(var2)).visible = true; - ((Button)this.buttons.get(var2)).active = this.minecraft.session.haspaid; - } - - } - - public final void render(int var1, int var2) { - super.render(var1, var2); - if(!this.minecraft.session.haspaid) { - drawFadingBox(this.width / 2 - 80, 72, this.width / 2 + 80, 120, -536870912, -536870912); - drawCenteredString(this.fontRenderer, "Premium only!", this.width / 2, 80, 16748688); - drawCenteredString(this.fontRenderer, "Purchase the game to be able", this.width / 2, 96, 14712960); - drawCenteredString(this.fontRenderer, "to save your levels online.", this.width / 2, 104, 14712960); - } - } - - protected final void openLevel(File var1) { - if(!var1.getName().endsWith(".mine")) { - var1 = new File(var1.getParentFile(), var1.getName() + ".mine"); - } - - File var2 = var1; - Minecraft var3 = this.minecraft; - this.minecraft.levelIo.save(var3.level, var2); - this.minecraft.setCurrentScreen(this.parent); - } - - protected final void openLevel(int var1) { - this.minecraft.setCurrentScreen(new LevelNameScreen(this, ((Button)this.buttons.get(var1)).text, var1)); - } -} diff --git a/src/main/java/com/mojang/minecraft/gui/Screen.java b/src/main/java/com/mojang/minecraft/gui/Screen.java index c44cdae..a17a86b 100644 --- a/src/main/java/com/mojang/minecraft/gui/Screen.java +++ b/src/main/java/com/mojang/minecraft/gui/Screen.java @@ -41,14 +41,14 @@ public class Screen { GL11.glDisable(3553); GL11.glEnable(3042); GL11.glBlendFunc(770, 771); - GL11.glBegin(7); + //GL11.glBegin(7); GL11.glColor4f(var7, var8, var12, var6); - GL11.glVertex2f((float)var2, (float)var1); - GL11.glVertex2f((float)var0, (float)var1); + //GL11.glVertex2f((float)var2, (float)var1); + //GL11.glVertex2f((float)var0, (float)var1); GL11.glColor4f(var10, var11, var13, var9); - GL11.glVertex2f((float)var0, (float)var3); - GL11.glVertex2f((float)var2, (float)var3); - GL11.glEnd(); + //GL11.glVertex2f((float)var0, (float)var3); + //GL11.glVertex2f((float)var2, (float)var3); + //GL11.glEnd(); GL11.glDisable(3042); GL11.glEnable(3553); } diff --git a/src/main/java/com/mojang/minecraft/net/NetworkManager.java b/src/main/java/com/mojang/minecraft/net/NetworkManager.java index 866878b..f218ed8 100644 --- a/src/main/java/com/mojang/minecraft/net/NetworkManager.java +++ b/src/main/java/com/mojang/minecraft/net/NetworkManager.java @@ -22,7 +22,7 @@ public class NetworkManager new ServerConnectThread(this, server, port, username, key, minecraft).start(); } - public ByteArrayOutputStream levelData; +// public ByteArrayOutputStream levelData; public NetworkHandler netHandler; diff --git a/src/main/java/net/PeytonPlayz585/main/MinecraftMain.java b/src/main/java/net/PeytonPlayz585/main/MinecraftMain.java index 81c97db..7c65480 100644 --- a/src/main/java/net/PeytonPlayz585/main/MinecraftMain.java +++ b/src/main/java/net/PeytonPlayz585/main/MinecraftMain.java @@ -19,6 +19,9 @@ import org.teavm.jso.typedarrays.Uint8Array; import org.teavm.jso.webgl.WebGLFramebuffer; import org.teavm.jso.webgl.WebGLRenderingContext; +import com.mojang.minecraft.Minecraft; +import com.mojang.minecraft.SessionData; + import net.PeytonPlayz585.lwjgl.PlatformInput; import net.PeytonPlayz585.minecraft.MinecraftClient; import net.PeytonPlayz585.teavm.WebGL2RenderingContext; @@ -107,7 +110,17 @@ public class MinecraftMain { e.printStackTrace(); } - //Start Game Function + //Start Game + Minecraft minecraft = new Minecraft(canvas.getWidth(), canvas.getHeight(), true); + //minecraft.host = "127.0.0.1:25565"; + minecraft.session = new SessionData("PeytonPlayz585", "TeaVM-WebGL"); + minecraft.levelLoaded = true; + canvas.focus(); + + Thread thread = null; + thread = new Thread(minecraft); + thread.start(); + minecraft.waiting = false; } diff --git a/src/main/java/org/lwjgl/input/Mouse.java b/src/main/java/org/lwjgl/input/Mouse.java index 264bab5..12ef918 100644 --- a/src/main/java/org/lwjgl/input/Mouse.java +++ b/src/main/java/org/lwjgl/input/Mouse.java @@ -1,5 +1,7 @@ package org.lwjgl.input; +import org.lwjgl.opengl.Display; + import net.PeytonPlayz585.lwjgl.PlatformInput; /** @@ -89,4 +91,8 @@ public class Mouse { return PlatformInput.isMouseGrabbed(); } + public static boolean isFocused() { + return Display.isActive() && isActuallyGrabbed(); + } + } \ No newline at end of file diff --git a/src/main/java/org/oyasunadev/minecraft/MCApplet.java b/src/main/java/org/oyasunadev/minecraft/MCApplet.java deleted file mode 100644 index c8902ef..0000000 --- a/src/main/java/org/oyasunadev/minecraft/MCApplet.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.oyasunadev.minecraft; - -import com.mojang.minecraft.MinecraftApplet; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -/** - * Created with IntelliJ IDEA. - * User: Oliver Yasuna - * Date: 9/23/12 - * Time: 4:17 PM - */ -public class MCApplet extends MinecraftApplet -{ - public MCApplet() - { - MP = false; - - parameters = new HashMap(); - } - - public MCApplet(String username, String sessionid, boolean haspaid, String server, int port, String mppass) - { - MP = true; - - parameters = new HashMap(); - - parameters.put("username", username); - parameters.put("sessionid", sessionid); - parameters.put("haspaid", String.valueOf(haspaid)); - parameters.put("server", server); - parameters.put("port", String.valueOf(port)); - parameters.put("mppass", mppass); - } - - @Override - public URL getDocumentBase() - { - try { - return new URL("http://minecraft.net:80/play.jsp"); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - - return null; - } - - @Override - public URL getCodeBase() - { - try { - return new URL("http://minecraft.net:80/"); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - - return null; - } - - @Override - public String getParameter(String name) - { - if(MP) - { - return (String)parameters.get(name); - } else { - return super.getParameter(name); - } - } - - private final boolean MP; - public final Map parameters; -} diff --git a/src/main/java/org/oyasunadev/minecraft/SPFrame.java b/src/main/java/org/oyasunadev/minecraft/SPFrame.java deleted file mode 100644 index f44a851..0000000 --- a/src/main/java/org/oyasunadev/minecraft/SPFrame.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.oyasunadev.minecraft; - -import com.mojang.minecraft.Minecraft; -import com.mojang.minecraft.MinecraftApplet$1; - -import javax.swing.*; -import java.awt.*; - -public final class SPFrame extends JFrame -{ - public SPFrame() - { - setTitle("Shadow Client Classic"); - setSize(854, 480); - setResizable(false); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setLayout(new BorderLayout()); - - int width = Toolkit.getDefaultToolkit().getScreenSize().width; - int height = Toolkit.getDefaultToolkit().getScreenSize().height; - - if(getWidth() == width && getHeight() == height) - { - setUndecorated(true); - } - } - - public void startMinecraft() - { - MCApplet applet = new MCApplet(); - MinecraftApplet$1 canvas = new MinecraftApplet$1(applet); - - Minecraft minecraft = new Minecraft(canvas, applet, getWidth(), getHeight(), false); - - canvas.setSize(getWidth(), getHeight()); - - add(canvas, "Center"); - - pack(); - - new Thread(minecraft).start(); - } - - public void finish() - { - setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - getWidth()) / 2, - (Toolkit.getDefaultToolkit().getScreenSize().height - getHeight()) / 2); - } -} diff --git a/src/main/java/org/oyasunadev/minecraft/Start.java b/src/main/java/org/oyasunadev/minecraft/Start.java deleted file mode 100644 index f60e012..0000000 --- a/src/main/java/org/oyasunadev/minecraft/Start.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.oyasunadev.minecraft; - -import java.io.File; - -import javax.swing.*; - -/** - * Created with IntelliJ IDEA. - * User: Oliver Yasuna - * Date: 9/23/12 - * Time: 4:04 PM - */ -public class Start -{ - public static void main(String[] args) - { - new Start(); - } - - public Start() - { - System.setProperty("org.lwjgl.librarypath", new File("./run/native/linux").getAbsolutePath()); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (UnsupportedLookAndFeelException e) { - e.printStackTrace(); - } - - SPFrame spFrame = new SPFrame(); - - spFrame.setVisible(true); - - spFrame.startMinecraft(); - spFrame.finish(); - } -}