commit d868b083b488cae5d5c581fbcf5070466009304e
Author: PF94 <45898787+flickPF94@users.noreply.github.com>
Date: Sun Nov 22 00:10:19 2020 -0500
Initial commit
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..53e6204
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..dfe0770
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+# Auto detect text files and perform LF normalization
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a1c2a23
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,23 @@
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
diff --git a/.project b/.project
new file mode 100644
index 0000000..b0f3d44
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ mc94
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..7341ab1
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..ea43c8d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# mc94
+ MC94
diff --git a/bin/char.png b/bin/char.png
new file mode 100644
index 0000000..d02b718
Binary files /dev/null and b/bin/char.png differ
diff --git a/bin/com.mojang.minecraft.MinecraftApplet1606018080812.html b/bin/com.mojang.minecraft.MinecraftApplet1606018080812.html
new file mode 100644
index 0000000..441aa57
--- /dev/null
+++ b/bin/com.mojang.minecraft.MinecraftApplet1606018080812.html
@@ -0,0 +1,7 @@
+
+
+
+
+
+
diff --git a/bin/com/mojang/minecraft/Minecraft.java_old b/bin/com/mojang/minecraft/Minecraft.java_old
new file mode 100644
index 0000000..82cfb18
--- /dev/null
+++ b/bin/com/mojang/minecraft/Minecraft.java_old
@@ -0,0 +1,406 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft;
+
+import com.mojang.minecraft.level.Tesselator;
+import com.mojang.minecraft.level.tile.Tile;
+import com.mojang.minecraft.level.Frustum;
+import org.lwjgl.util.glu.GLU;
+import com.mojang.minecraft.level.Chunk;
+import java.awt.Component;
+import javax.swing.JOptionPane;
+import java.io.IOException;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.Display;
+import org.lwjgl.opengl.DisplayMode;
+import org.lwjgl.BufferUtils;
+import java.nio.IntBuffer;
+import com.mojang.minecraft.character.Zombie;
+import java.util.ArrayList;
+import com.mojang.minecraft.particle.ParticleEngine;
+import com.mojang.minecraft.level.LevelRenderer;
+import com.mojang.minecraft.level.Level;
+import java.nio.FloatBuffer;
+
+public class RubyDung implements Runnable
+{
+ private static final boolean FULLSCREEN_MODE = false;
+ private int width;
+ private int height;
+ private FloatBuffer fogColor0;
+ private FloatBuffer fogColor1;
+ private Timer timer;
+ private Level level;
+ private LevelRenderer levelRenderer;
+ private Player player;
+ private int paintTexture;
+ private ParticleEngine particleEngine;
+ private ArrayList zombies;
+ private IntBuffer viewportBuffer;
+ private IntBuffer selectBuffer;
+ private HitResult hitResult;
+ FloatBuffer lb;
+
+ public RubyDung() {
+ this.fogColor0 = BufferUtils.createFloatBuffer(4);
+ this.fogColor1 = BufferUtils.createFloatBuffer(4);
+ this.timer = new Timer(20.0f);
+ this.paintTexture = 1;
+ this.zombies = new ArrayList();
+ this.viewportBuffer = BufferUtils.createIntBuffer(16);
+ this.selectBuffer = BufferUtils.createIntBuffer(2000);
+ this.hitResult = null;
+ this.lb = BufferUtils.createFloatBuffer(16);
+ }
+
+ public void init() throws LWJGLException, IOException {
+ final int col0 = 16710650;
+ final int col2 = 920330;
+ final float fr = 0.5f;
+ final float fg = 0.8f;
+ final float fb = 1.0f;
+ this.fogColor0.put(new float[] { (col0 >> 16 & 0xFF) / 255.0f, (col0 >> 8 & 0xFF) / 255.0f, (col0 & 0xFF) / 255.0f, 1.0f });
+ this.fogColor0.flip();
+ this.fogColor1.put(new float[] { (col2 >> 16 & 0xFF) / 255.0f, (col2 >> 8 & 0xFF) / 255.0f, (col2 & 0xFF) / 255.0f, 1.0f });
+ this.fogColor1.flip();
+ Display.setDisplayMode(new DisplayMode(1024, 768));
+ Display.create();
+ Keyboard.create();
+ Mouse.create();
+ this.width = Display.getDisplayMode().getWidth();
+ this.height = Display.getDisplayMode().getHeight();
+ GL11.glEnable(3553);
+ GL11.glShadeModel(7425);
+ GL11.glClearColor(fr, fg, fb, 0.0f);
+ GL11.glClearDepth(1.0);
+ GL11.glEnable(2929);
+ GL11.glDepthFunc(515);
+ GL11.glEnable(3008);
+ GL11.glAlphaFunc(516, 0.5f);
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ GL11.glMatrixMode(5888);
+ this.level = new Level(256, 256, 64);
+ this.levelRenderer = new LevelRenderer(this.level);
+ this.player = new Player(this.level);
+ this.particleEngine = new ParticleEngine(this.level);
+ Mouse.setGrabbed(true);
+ for (int i = 0; i < 10; ++i) {
+ final Zombie zombie = new Zombie(this.level, 128.0f, 0.0f, 128.0f);
+ zombie.resetPos();
+ this.zombies.add(zombie);
+ }
+ }
+
+ public void destroy() {
+ this.level.save();
+ Mouse.destroy();
+ Keyboard.destroy();
+ Display.destroy();
+ }
+
+ @Override
+ public void run() {
+ try {
+ this.init();
+ }
+ catch (Exception e) {
+ JOptionPane.showMessageDialog(null, e.toString(), "Failed to start RubyDung", 0);
+ System.exit(0);
+ }
+ long lastTime = System.currentTimeMillis();
+ int frames = 0;
+ try {
+ while (!Keyboard.isKeyDown(1)) {
+ if (Display.isCloseRequested()) {
+ break;
+ }
+ this.timer.advanceTime();
+ for (int i = 0; i < this.timer.ticks; ++i) {
+ this.tick();
+ }
+ this.render(this.timer.a);
+ ++frames;
+ while (System.currentTimeMillis() >= lastTime + 1000L) {
+ System.out.println(String.valueOf(frames) + " fps, " + Chunk.updates);
+ Chunk.updates = 0;
+ lastTime += 1000L;
+ frames = 0;
+ }
+ }
+ }
+ catch (Exception e2) {
+ e2.printStackTrace();
+ return;
+ }
+ finally {
+ this.destroy();
+ }
+ this.destroy();
+ }
+
+ public void tick() {
+ while (Keyboard.next()) {
+ if (Keyboard.getEventKeyState()) {
+ if (Keyboard.getEventKey() == 28) {
+ this.level.save();
+ }
+ if (Keyboard.getEventKey() == 2) {
+ this.paintTexture = 1;
+ }
+ if (Keyboard.getEventKey() == 3) {
+ this.paintTexture = 3;
+ }
+ if (Keyboard.getEventKey() == 4) {
+ this.paintTexture = 4;
+ }
+ if (Keyboard.getEventKey() == 5) {
+ this.paintTexture = 5;
+ }
+ if (Keyboard.getEventKey() == 7) {
+ this.paintTexture = 6;
+ }
+ if (Keyboard.getEventKey() != 34) {
+ continue;
+ }
+ this.zombies.add(new Zombie(this.level, this.player.x, this.player.y, this.player.z));
+ }
+ }
+ this.level.tick();
+ this.particleEngine.tick();
+ for (int i = 0; i < this.zombies.size(); ++i) {
+ this.zombies.get(i).tick();
+ if (this.zombies.get(i).removed) {
+ this.zombies.remove(i--);
+ }
+ }
+ this.player.tick();
+ }
+
+ private void moveCameraToPlayer(final float a) {
+ GL11.glTranslatef(0.0f, 0.0f, -0.3f);
+ GL11.glRotatef(this.player.xRot, 1.0f, 0.0f, 0.0f);
+ GL11.glRotatef(this.player.yRot, 0.0f, 1.0f, 0.0f);
+ final float x = this.player.xo + (this.player.x - this.player.xo) * a;
+ final float y = this.player.yo + (this.player.y - this.player.yo) * a;
+ final float z = this.player.zo + (this.player.z - this.player.zo) * a;
+ GL11.glTranslatef(-x, -y, -z);
+ }
+
+ private void setupCamera(final float a) {
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ GLU.gluPerspective(70.0f, this.width / (float)this.height, 0.05f, 1000.0f);
+ GL11.glMatrixMode(5888);
+ GL11.glLoadIdentity();
+ this.moveCameraToPlayer(a);
+ }
+
+ private void setupPickCamera(final float a, final int x, final int y) {
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ this.viewportBuffer.clear();
+ GL11.glGetInteger(2978, this.viewportBuffer);
+ this.viewportBuffer.flip();
+ this.viewportBuffer.limit(16);
+ GLU.gluPickMatrix((float)x, (float)y, 5.0f, 5.0f, this.viewportBuffer);
+ GLU.gluPerspective(70.0f, this.width / (float)this.height, 0.05f, 1000.0f);
+ GL11.glMatrixMode(5888);
+ GL11.glLoadIdentity();
+ this.moveCameraToPlayer(a);
+ }
+
+ private void pick(final float a) {
+ this.selectBuffer.clear();
+ GL11.glSelectBuffer(this.selectBuffer);
+ GL11.glRenderMode(7170);
+ this.setupPickCamera(a, this.width / 2, this.height / 2);
+ this.levelRenderer.pick(this.player, Frustum.getFrustum());
+ final int hits = GL11.glRenderMode(7168);
+ this.selectBuffer.flip();
+ this.selectBuffer.limit(this.selectBuffer.capacity());
+ long closest = 0L;
+ final int[] names = new int[10];
+ int hitNameCount = 0;
+ for (int i = 0; i < hits; ++i) {
+ final int nameCount = this.selectBuffer.get();
+ final long minZ = this.selectBuffer.get();
+ this.selectBuffer.get();
+ final long dist = minZ;
+ if (dist < closest || i == 0) {
+ closest = dist;
+ hitNameCount = nameCount;
+ for (int j = 0; j < nameCount; ++j) {
+ names[j] = this.selectBuffer.get();
+ }
+ }
+ else {
+ for (int j = 0; j < nameCount; ++j) {
+ this.selectBuffer.get();
+ }
+ }
+ }
+ if (hitNameCount > 0) {
+ this.hitResult = new HitResult(names[0], names[1], names[2], names[3], names[4]);
+ }
+ else {
+ this.hitResult = null;
+ }
+ }
+
+ public void render(final float a) {
+ final float xo = (float)Mouse.getDX();
+ final float yo = (float)Mouse.getDY();
+ this.player.turn(xo, yo);
+ this.pick(a);
+ while (Mouse.next()) {
+ if (Mouse.getEventButton() == 1 && Mouse.getEventButtonState() && this.hitResult != null) {
+ final Tile oldTile = Tile.tiles[this.level.getTile(this.hitResult.x, this.hitResult.y, this.hitResult.z)];
+ final boolean changed = this.level.setTile(this.hitResult.x, this.hitResult.y, this.hitResult.z, 0);
+ if (oldTile != null && changed) {
+ oldTile.destroy(this.level, this.hitResult.x, this.hitResult.y, this.hitResult.z, this.particleEngine);
+ }
+ }
+ if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState() && this.hitResult != null) {
+ int x = this.hitResult.x;
+ int y = this.hitResult.y;
+ int z = this.hitResult.z;
+ if (this.hitResult.f == 0) {
+ --y;
+ }
+ if (this.hitResult.f == 1) {
+ ++y;
+ }
+ if (this.hitResult.f == 2) {
+ --z;
+ }
+ if (this.hitResult.f == 3) {
+ ++z;
+ }
+ if (this.hitResult.f == 4) {
+ --x;
+ }
+ if (this.hitResult.f == 5) {
+ ++x;
+ }
+ this.level.setTile(x, y, z, this.paintTexture);
+ }
+ }
+ GL11.glClear(16640);
+ this.setupCamera(a);
+ GL11.glEnable(2884);
+ final Frustum frustum = Frustum.getFrustum();
+ this.levelRenderer.updateDirtyChunks(this.player);
+ this.setupFog(0);
+ GL11.glEnable(2912);
+ this.levelRenderer.render(this.player, 0);
+ for (int i = 0; i < this.zombies.size(); ++i) {
+ final Zombie zombie = this.zombies.get(i);
+ if (zombie.isLit() && frustum.isVisible(zombie.bb)) {
+ this.zombies.get(i).render(a);
+ }
+ }
+ this.particleEngine.render(this.player, a, 0);
+ this.setupFog(1);
+ this.levelRenderer.render(this.player, 1);
+ for (int i = 0; i < this.zombies.size(); ++i) {
+ final Zombie zombie = this.zombies.get(i);
+ if (!zombie.isLit() && frustum.isVisible(zombie.bb)) {
+ this.zombies.get(i).render(a);
+ }
+ }
+ this.particleEngine.render(this.player, a, 1);
+ GL11.glDisable(2896);
+ GL11.glDisable(3553);
+ GL11.glDisable(2912);
+ if (this.hitResult != null) {
+ GL11.glDisable(3008);
+ this.levelRenderer.renderHit(this.hitResult);
+ GL11.glEnable(3008);
+ }
+ this.drawGui(a);
+ Display.update();
+ }
+
+ private void drawGui(final float a) {
+ final int screenWidth = this.width * 240 / this.height;
+ final int screenHeight = this.height * 240 / this.height;
+ GL11.glClear(256);
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ GL11.glOrtho(0.0, (double)screenWidth, (double)screenHeight, 0.0, 100.0, 300.0);
+ GL11.glMatrixMode(5888);
+ GL11.glLoadIdentity();
+ GL11.glTranslatef(0.0f, 0.0f, -200.0f);
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)(screenWidth - 16), 16.0f, 0.0f);
+ final Tesselator t = Tesselator.instance;
+ GL11.glScalef(16.0f, 16.0f, 16.0f);
+ GL11.glRotatef(30.0f, 1.0f, 0.0f, 0.0f);
+ GL11.glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
+ GL11.glTranslatef(-1.5f, 0.5f, -0.5f);
+ GL11.glScalef(-1.0f, -1.0f, 1.0f);
+ final int id = Textures.loadTexture("/terrain.png", 9728);
+ GL11.glBindTexture(3553, id);
+ GL11.glEnable(3553);
+ t.init();
+ Tile.tiles[this.paintTexture].render(t, this.level, 0, -2, 0, 0);
+ t.flush();
+ GL11.glDisable(3553);
+ GL11.glPopMatrix();
+ final int wc = screenWidth / 2;
+ final int hc = screenHeight / 2;
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ t.init();
+ t.vertex((float)(wc + 1), (float)(hc - 4), 0.0f);
+ t.vertex((float)(wc - 0), (float)(hc - 4), 0.0f);
+ t.vertex((float)(wc - 0), (float)(hc + 5), 0.0f);
+ t.vertex((float)(wc + 1), (float)(hc + 5), 0.0f);
+ t.vertex((float)(wc + 5), (float)(hc - 0), 0.0f);
+ t.vertex((float)(wc - 4), (float)(hc - 0), 0.0f);
+ t.vertex((float)(wc - 4), (float)(hc + 1), 0.0f);
+ t.vertex((float)(wc + 5), (float)(hc + 1), 0.0f);
+ t.flush();
+ }
+
+ private void setupFog(final int i) {
+ if (i == 0) {
+ GL11.glFogi(2917, 2048);
+ GL11.glFogf(2914, 0.001f);
+ GL11.glFog(2918, this.fogColor0);
+ GL11.glDisable(2896);
+ }
+ else if (i == 1) {
+ GL11.glFogi(2917, 2048);
+ GL11.glFogf(2914, 0.06f);
+ GL11.glFog(2918, this.fogColor1);
+ GL11.glEnable(2896);
+ GL11.glEnable(2903);
+ final float br = 0.6f;
+ GL11.glLightModel(2899, this.getBuffer(br, br, br, 1.0f));
+ }
+ }
+
+ private FloatBuffer getBuffer(final float a, final float b, final float c, final float d) {
+ this.lb.clear();
+ this.lb.put(a).put(b).put(c).put(d);
+ this.lb.flip();
+ return this.lb;
+ }
+
+ public static void checkError() {
+ final int e = GL11.glGetError();
+ if (e != 0) {
+ throw new IllegalStateException(GLU.gluErrorString(e));
+ }
+ }
+
+ public static void main(final String[] args) throws LWJGLException {
+ new Thread(new RubyDung()).start();
+ }
+}
diff --git a/bin/default.gif b/bin/default.gif
new file mode 100644
index 0000000..15e0fc2
Binary files /dev/null and b/bin/default.gif differ
diff --git a/bin/default.png b/bin/default.png
new file mode 100644
index 0000000..89a0c78
Binary files /dev/null and b/bin/default.png differ
diff --git a/bin/dirt.png b/bin/dirt.png
new file mode 100644
index 0000000..b29e009
Binary files /dev/null and b/bin/dirt.png differ
diff --git a/bin/grass.png b/bin/grass.png
new file mode 100644
index 0000000..fd7a724
Binary files /dev/null and b/bin/grass.png differ
diff --git a/bin/java.policy.applet b/bin/java.policy.applet
new file mode 100644
index 0000000..ba9f51d
--- /dev/null
+++ b/bin/java.policy.applet
@@ -0,0 +1,7 @@
+/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/
+/* DO NOT EDIT */
+
+grant {
+ permission java.security.AllPermission;
+};
+
diff --git a/bin/rock.png b/bin/rock.png
new file mode 100644
index 0000000..cb2b511
Binary files /dev/null and b/bin/rock.png differ
diff --git a/bin/terrain.png b/bin/terrain.png
new file mode 100644
index 0000000..b691b74
Binary files /dev/null and b/bin/terrain.png differ
diff --git a/bin/water.png b/bin/water.png
new file mode 100644
index 0000000..8b92f9b
Binary files /dev/null and b/bin/water.png differ
diff --git a/level.dat b/level.dat
new file mode 100644
index 0000000..a58e240
Binary files /dev/null and b/level.dat differ
diff --git a/lib/native-win/OpenAL32.dll b/lib/native-win/OpenAL32.dll
new file mode 100644
index 0000000..1f69e94
Binary files /dev/null and b/lib/native-win/OpenAL32.dll differ
diff --git a/lib/native-win/OpenAL64.dll b/lib/native-win/OpenAL64.dll
new file mode 100644
index 0000000..6f2a2fe
Binary files /dev/null and b/lib/native-win/OpenAL64.dll differ
diff --git a/lib/native-win/jinput-dx8.dll b/lib/native-win/jinput-dx8.dll
new file mode 100644
index 0000000..6d27ad5
Binary files /dev/null and b/lib/native-win/jinput-dx8.dll differ
diff --git a/lib/native-win/jinput-dx8_64.dll b/lib/native-win/jinput-dx8_64.dll
new file mode 100644
index 0000000..6730589
Binary files /dev/null and b/lib/native-win/jinput-dx8_64.dll differ
diff --git a/lib/native-win/jinput-raw.dll b/lib/native-win/jinput-raw.dll
new file mode 100644
index 0000000..ce1d162
Binary files /dev/null and b/lib/native-win/jinput-raw.dll differ
diff --git a/lib/native-win/jinput-raw_64.dll b/lib/native-win/jinput-raw_64.dll
new file mode 100644
index 0000000..3d2b3ad
Binary files /dev/null and b/lib/native-win/jinput-raw_64.dll differ
diff --git a/lib/native-win/lwjgl.dll b/lib/native-win/lwjgl.dll
new file mode 100644
index 0000000..e6c97d9
Binary files /dev/null and b/lib/native-win/lwjgl.dll differ
diff --git a/lib/native-win/lwjgl64.dll b/lib/native-win/lwjgl64.dll
new file mode 100644
index 0000000..2c8b93e
Binary files /dev/null and b/lib/native-win/lwjgl64.dll differ
diff --git a/src/char.png b/src/char.png
new file mode 100644
index 0000000..d02b718
Binary files /dev/null and b/src/char.png differ
diff --git a/src/com/mojang/minecraft/Entity.java b/src/com/mojang/minecraft/Entity.java
new file mode 100644
index 0000000..ef1a322
--- /dev/null
+++ b/src/com/mojang/minecraft/Entity.java
@@ -0,0 +1,156 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft;
+
+import java.util.List;
+import com.mojang.minecraft.phys.AABB;
+import com.mojang.minecraft.level.Level;
+
+public class Entity
+{
+ protected Level level;
+ public float xo;
+ public float yo;
+ public float zo;
+ public float x;
+ public float y;
+ public float z;
+ public float xd;
+ public float yd;
+ public float zd;
+ public float yRot;
+ public float xRot;
+ public AABB bb;
+ public boolean onGround;
+ public boolean horizontalCollision;
+ public boolean removed;
+ protected float heightOffset;
+ protected float bbWidth;
+ protected float bbHeight;
+
+ public Entity(final Level level) {
+ this.onGround = false;
+ this.horizontalCollision = false;
+ this.removed = false;
+ this.heightOffset = 0.0f;
+ this.bbWidth = 0.6f;
+ this.bbHeight = 1.8f;
+ this.level = level;
+ this.resetPos();
+ }
+
+ protected void resetPos() {
+ final float x = (float)Math.random() * (this.level.width - 2) + 1.0f;
+ final float y = (float)(this.level.depth + 10);
+ final float z = (float)Math.random() * (this.level.height - 2) + 1.0f;
+ this.setPos(x, y, z);
+ }
+
+ public void remove() {
+ this.removed = true;
+ }
+
+ protected void setSize(final float w, final float h) {
+ this.bbWidth = w;
+ this.bbHeight = h;
+ }
+
+ protected void setPos(final float x, final float y, final float z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ final float w = this.bbWidth / 2.0f;
+ final float h = this.bbHeight / 2.0f;
+ this.bb = new AABB(x - w, y - h, z - w, x + w, y + h, z + w);
+ }
+
+ public void turn(final float xo, final float yo) {
+ this.yRot += (float)(xo * 0.15);
+ this.xRot -= (float)(yo * 0.15);
+ if (this.xRot < -90.0f) {
+ this.xRot = -90.0f;
+ }
+ if (this.xRot > 90.0f) {
+ this.xRot = 90.0f;
+ }
+ }
+
+ public void tick() {
+ this.xo = this.x;
+ this.yo = this.y;
+ this.zo = this.z;
+ }
+
+ public boolean isFree(final float xa, final float ya, final float za) {
+ final AABB box = this.bb.cloneMove(xa, ya, za);
+ final List aABBs = this.level.getCubes(box);
+ return aABBs.size() <= 0 && !this.level.containsAnyLiquid(box);
+ }
+
+ public void move(float xa, float ya, float za) {
+ final float xaOrg = xa;
+ final float yaOrg = ya;
+ final float zaOrg = za;
+ final List aABBs = this.level.getCubes(this.bb.expand(xa, ya, za));
+ for (int i = 0; i < aABBs.size(); ++i) {
+ ya = aABBs.get(i).clipYCollide(this.bb, ya);
+ }
+ this.bb.move(0.0f, ya, 0.0f);
+ for (int i = 0; i < aABBs.size(); ++i) {
+ xa = aABBs.get(i).clipXCollide(this.bb, xa);
+ }
+ this.bb.move(xa, 0.0f, 0.0f);
+ for (int i = 0; i < aABBs.size(); ++i) {
+ za = aABBs.get(i).clipZCollide(this.bb, za);
+ }
+ this.bb.move(0.0f, 0.0f, za);
+ this.horizontalCollision = (xaOrg != xa || zaOrg != za);
+ this.onGround = (yaOrg != ya && yaOrg < 0.0f);
+ if (xaOrg != xa) {
+ this.xd = 0.0f;
+ }
+ if (yaOrg != ya) {
+ this.yd = 0.0f;
+ }
+ if (zaOrg != za) {
+ this.zd = 0.0f;
+ }
+ this.x = (this.bb.x0 + this.bb.x1) / 2.0f;
+ this.y = this.bb.y0 + this.heightOffset;
+ this.z = (this.bb.z0 + this.bb.z1) / 2.0f;
+ }
+
+ public boolean isInWater() {
+ return this.level.containsLiquid(this.bb.grow(0.0f, -0.4f, 0.0f), 1);
+ }
+
+ public boolean isInLava() {
+ return this.level.containsLiquid(this.bb, 2);
+ }
+
+ public void moveRelative(float xa, float za, final float speed) {
+ float dist = xa * xa + za * za;
+ if (dist < 0.01f) {
+ return;
+ }
+ dist = speed / (float)Math.sqrt(dist);
+ xa *= dist;
+ za *= dist;
+ final float sin = (float)Math.sin(this.yRot * 3.141592653589793 / 180.0);
+ final float cos = (float)Math.cos(this.yRot * 3.141592653589793 / 180.0);
+ this.xd += xa * cos - za * sin;
+ this.zd += za * cos + xa * sin;
+ }
+
+ public boolean isLit() {
+ final int xTile = (int)this.x;
+ final int yTile = (int)this.y;
+ final int zTile = (int)this.z;
+ return this.level.isLit(xTile, yTile, zTile);
+ }
+
+ public void render(final float a) {
+ }
+}
diff --git a/src/com/mojang/minecraft/HitResult.java b/src/com/mojang/minecraft/HitResult.java
new file mode 100644
index 0000000..0819289
--- /dev/null
+++ b/src/com/mojang/minecraft/HitResult.java
@@ -0,0 +1,63 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft;
+
+public class HitResult
+{
+ public int type;
+ public int x;
+ public int y;
+ public int z;
+ public int f;
+
+ public HitResult(final int type, final int x, final int y, final int z, final int f) {
+ this.type = type;
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.f = f;
+ }
+
+ public boolean isCloserThan(final Player player, final HitResult o, final int editMode) {
+ float dist = this.distanceTo(player, 0);
+ float dist2 = o.distanceTo(player, 0);
+ if (dist < dist2) {
+ return true;
+ }
+ dist = this.distanceTo(player, editMode);
+ dist2 = o.distanceTo(player, editMode);
+ return dist < dist2;
+ }
+
+ private float distanceTo(final Player player, final int editMode) {
+ int xx = this.x;
+ int yy = this.y;
+ int zz = this.z;
+ if (editMode == 1) {
+ if (this.f == 0) {
+ --yy;
+ }
+ if (this.f == 1) {
+ ++yy;
+ }
+ if (this.f == 2) {
+ --zz;
+ }
+ if (this.f == 3) {
+ ++zz;
+ }
+ if (this.f == 4) {
+ --xx;
+ }
+ if (this.f == 5) {
+ ++xx;
+ }
+ }
+ final float xd = xx - player.x;
+ final float yd = yy - player.y;
+ final float zd = zz - player.z;
+ return xd * xd + yd * yd + zd * zd;
+ }
+}
diff --git a/src/com/mojang/minecraft/Minecraft.java b/src/com/mojang/minecraft/Minecraft.java
new file mode 100644
index 0000000..2b247e2
--- /dev/null
+++ b/src/com/mojang/minecraft/Minecraft.java
@@ -0,0 +1,748 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft;
+
+import com.mojang.minecraft.renderer.Tesselator;
+import com.mojang.minecraft.renderer.Frustum;
+import com.mojang.minecraft.phys.AABB;
+import com.mojang.minecraft.level.tile.Tile;
+import com.mojang.minecraft.gui.PauseScreen;
+import com.mojang.minecraft.level.Chunk;
+import java.awt.Component;
+import javax.swing.JOptionPane;
+import java.io.OutputStream;
+import java.io.FileOutputStream;
+import org.lwjgl.util.glu.GLU;
+import java.io.IOException;
+import com.mojang.minecraft.character.Zombie;
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.File;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.opengl.DisplayMode;
+import org.lwjgl.opengl.Display;
+import org.lwjgl.BufferUtils;
+import java.nio.IntBuffer;
+import com.mojang.minecraft.level.levelgen.LevelGen;
+import com.mojang.minecraft.level.LevelIO;
+import com.mojang.minecraft.gui.Screen;
+import com.mojang.minecraft.gui.Font;
+import com.mojang.minecraft.renderer.Textures;
+import org.lwjgl.input.Cursor;
+import java.awt.Canvas;
+import java.util.ArrayList;
+import com.mojang.minecraft.particle.ParticleEngine;
+import com.mojang.minecraft.level.LevelRenderer;
+import com.mojang.minecraft.level.Level;
+import java.nio.FloatBuffer;
+import com.mojang.minecraft.level.LevelLoaderListener;
+
+public class Minecraft implements Runnable, LevelLoaderListener
+{
+ public static final String VERSION_STRING = "grpf.0.0.13a";
+ private boolean fullscreen;
+ public int width;
+ public int height;
+ private FloatBuffer fogColor0;
+ private FloatBuffer fogColor1;
+ private Timer timer;
+ private Level level;
+ private LevelRenderer levelRenderer;
+ private Player player;
+ private int paintTexture;
+ private ParticleEngine particleEngine;
+ public User user;
+ private ArrayList entities;
+ private Canvas parent;
+ public boolean appletMode;
+ public volatile boolean pause;
+ private Cursor emptyCursor;
+ private int yMouseAxis;
+ public Textures textures;
+ public Font font;
+ private int editMode;
+ private Screen screen;
+ private LevelIO levelIo;
+ private LevelGen levelGen;
+ private volatile boolean running;
+ private String fpsString;
+ private boolean mouseGrabbed;
+ private IntBuffer viewportBuffer;
+ private IntBuffer selectBuffer;
+ private HitResult hitResult;
+ FloatBuffer lb;
+ private String title;
+
+ public Minecraft(final Canvas parent, final int width, final int height, final boolean fullscreen) {
+ this.fullscreen = false;
+ this.fogColor0 = BufferUtils.createFloatBuffer(4);
+ this.fogColor1 = BufferUtils.createFloatBuffer(4);
+ this.timer = new Timer(20.0f);
+ this.paintTexture = 1;
+ this.user = new User("noname");
+ this.entities = new ArrayList();
+ this.appletMode = false;
+ this.pause = false;
+ this.yMouseAxis = 1;
+ this.editMode = 0;
+ this.screen = null;
+ this.levelIo = new LevelIO(this);
+ this.levelGen = new LevelGen(this);
+ this.running = false;
+ this.fpsString = "";
+ this.mouseGrabbed = false;
+ this.viewportBuffer = BufferUtils.createIntBuffer(16);
+ this.selectBuffer = BufferUtils.createIntBuffer(2000);
+ this.hitResult = null;
+ this.lb = BufferUtils.createFloatBuffer(16);
+ this.title = "";
+ this.parent = parent;
+ this.width = width;
+ this.height = height;
+ this.fullscreen = fullscreen;
+ this.textures = new Textures();
+ }
+
+ public void init() throws LWJGLException, IOException {
+ final int col1 = 920330;
+ final float fr = 0.5f;
+ final float fg = 0.8f;
+ final float fb = 1.0f;
+ this.fogColor0.put(new float[] { fr, fg, fb, 1.0f });
+ this.fogColor0.flip();
+ this.fogColor1.put(new float[] { (col1 >> 16 & 0xFF) / 255.0f, (col1 >> 8 & 0xFF) / 255.0f, (col1 & 0xFF) / 255.0f, 1.0f });
+ this.fogColor1.flip();
+ if (this.parent != null) {
+ Display.setParent(this.parent);
+ }
+ 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 grpf.0.0.13a");
+ try {
+ Display.create();
+ }
+ catch (LWJGLException e) {
+ e.printStackTrace();
+ try {
+ Thread.sleep(1000L);
+ }
+ catch (InterruptedException ex) {}
+ Display.create();
+ }
+ Keyboard.create();
+ Mouse.create();
+ this.checkGlError("Pre startup");
+ GL11.glEnable(3553);
+ GL11.glShadeModel(7425);
+ GL11.glClearColor(fr, fg, fb, 0.0f);
+ GL11.glClearDepth(1.0);
+ GL11.glEnable(2929);
+ GL11.glDepthFunc(515);
+ GL11.glEnable(3008);
+ GL11.glAlphaFunc(516, 0.0f);
+ GL11.glCullFace(1029);
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ GL11.glMatrixMode(5888);
+ this.checkGlError("Startup");
+ this.font = new Font("/default.gif", this.textures);
+ final IntBuffer imgData = BufferUtils.createIntBuffer(256);
+ imgData.clear().limit(256);
+ GL11.glViewport(0, 0, this.width, this.height);
+ this.level = new Level();
+ boolean success = false;
+ try {
+ success = this.levelIo.load(this.level, new FileInputStream(new File("level.dat")));
+ if (!success) {
+ success = this.levelIo.loadLegacy(this.level, new FileInputStream(new File("level.dat")));
+ }
+ }
+ catch (Exception e3) {
+ success = false;
+ }
+ if (!success) {
+ this.levelGen.generateLevel(this.level, this.user.name, 256, 256, 64);
+ }
+ this.levelRenderer = new LevelRenderer(this.level, this.textures);
+ this.player = new Player(this.level);
+ this.particleEngine = new ParticleEngine(this.level, this.textures);
+ for (int i = 0; i < 10; ++i) {
+ final Zombie zombie = new Zombie(this.level, this.textures, 128.0f, 0.0f, 128.0f);
+ zombie.resetPos();
+ this.entities.add(zombie);
+ }
+ if (this.appletMode) {
+ try {
+ this.emptyCursor = new Cursor(16, 16, 0, 0, 1, imgData, (IntBuffer)null);
+ }
+ catch (LWJGLException e2) {
+ e2.printStackTrace();
+ }
+ }
+ this.checkGlError("Post startup");
+ }
+
+ public void setScreen(final Screen screen) {
+ this.screen = screen;
+ if (screen != null) {
+ final int screenWidth = this.width * 240 / this.height;
+ final int screenHeight = this.height * 240 / this.height;
+ screen.init(this, screenWidth, screenHeight);
+ }
+ }
+
+ private void checkGlError(final String string) {
+ final int errorCode = GL11.glGetError();
+ if (errorCode != 0) {
+ final String errorString = GLU.gluErrorString(errorCode);
+ System.out.println("########## GL ERROR ##########");
+ System.out.println("@ " + string);
+ System.out.println(String.valueOf(errorCode) + ": " + errorString);
+ System.exit(0);
+ }
+ }
+
+ protected void attemptSaveLevel() {
+ try {
+ this.levelIo.save(this.level, new FileOutputStream(new File("level.dat")));
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void destroy() {
+ this.attemptSaveLevel();
+ Mouse.destroy();
+ Keyboard.destroy();
+ Display.destroy();
+ }
+
+ public void run() {
+ this.running = true;
+ try {
+ this.init();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ JOptionPane.showMessageDialog(null, e.toString(), "Failed to start Minecraft [GRPF94 Fork]", 0);
+ return;
+ }
+ long lastTime = System.currentTimeMillis();
+ int frames = 0;
+ try {
+ while (this.running) {
+ if (this.pause) {
+ Thread.sleep(100L);
+ }
+ else {
+ if (this.parent == null && Display.isCloseRequested()) {
+ this.stop();
+ }
+ this.timer.advanceTime();
+ for (int i = 0; i < this.timer.ticks; ++i) {
+ this.tick();
+ }
+ this.checkGlError("Pre render");
+ this.render(this.timer.a);
+ this.checkGlError("Post render");
+ ++frames;
+ while (System.currentTimeMillis() >= lastTime + 1000L) {
+ this.fpsString = String.valueOf(frames) + " fps, " + Chunk.updates + " chunk updates";
+ Chunk.updates = 0;
+ lastTime += 1000L;
+ frames = 0;
+ }
+ }
+ }
+ }
+ catch (Exception e2) {
+ e2.printStackTrace();
+ return;
+ }
+ finally {
+ this.destroy();
+ }
+ this.destroy();
+ }
+
+ public void stop() {
+ this.running = false;
+ }
+
+ public void grabMouse() {
+ if (this.mouseGrabbed) {
+ return;
+ }
+ this.mouseGrabbed = true;
+ if (this.appletMode) {
+ try {
+ Mouse.setNativeCursor(this.emptyCursor);
+ Mouse.setCursorPosition(this.width / 2, this.height / 2);
+ }
+ catch (LWJGLException e) {
+ e.printStackTrace();
+ }
+ }
+ else {
+ Mouse.setGrabbed(true);
+ }
+ this.setScreen(null);
+ }
+
+ public void releaseMouse() {
+ if (!this.mouseGrabbed) {
+ return;
+ }
+ this.player.releaseAllKeys();
+ this.mouseGrabbed = false;
+ if (this.appletMode) {
+ try {
+ Mouse.setNativeCursor((Cursor)null);
+ }
+ catch (LWJGLException e) {
+ e.printStackTrace();
+ }
+ }
+ else {
+ Mouse.setGrabbed(false);
+ }
+ this.setScreen(new PauseScreen());
+ }
+
+ private void handleMouseClick() {
+ if (this.editMode == 0) {
+ if (this.hitResult != null) {
+ final Tile oldTile = Tile.tiles[this.level.getTile(this.hitResult.x, this.hitResult.y, this.hitResult.z)];
+ final boolean changed = this.level.setTile(this.hitResult.x, this.hitResult.y, this.hitResult.z, 0);
+ if (oldTile != null && changed) {
+ oldTile.destroy(this.level, this.hitResult.x, this.hitResult.y, this.hitResult.z, this.particleEngine);
+ }
+ }
+ }
+ else if (this.hitResult != null) {
+ int x = this.hitResult.x;
+ int y = this.hitResult.y;
+ int z = this.hitResult.z;
+ if (this.hitResult.f == 0) {
+ --y;
+ }
+ if (this.hitResult.f == 1) {
+ ++y;
+ }
+ if (this.hitResult.f == 2) {
+ --z;
+ }
+ if (this.hitResult.f == 3) {
+ ++z;
+ }
+ if (this.hitResult.f == 4) {
+ --x;
+ }
+ if (this.hitResult.f == 5) {
+ ++x;
+ }
+ final AABB aabb = Tile.tiles[this.paintTexture].getAABB(x, y, z);
+ if (aabb == null || this.isFree(aabb)) {
+ this.level.setTile(x, y, z, this.paintTexture);
+ }
+ }
+ }
+
+ public void tick() {
+ if (this.screen == null) {
+ while (Mouse.next()) {
+ if (!this.mouseGrabbed && Mouse.getEventButtonState()) {
+ this.grabMouse();
+ }
+ else {
+ if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState()) {
+ this.handleMouseClick();
+ }
+ if (Mouse.getEventButton() != 1 || !Mouse.getEventButtonState()) {
+ continue;
+ }
+ this.editMode = (this.editMode + 1) % 2;
+ }
+ }
+ while (Keyboard.next()) {
+ this.player.setKey(Keyboard.getEventKey(), Keyboard.getEventKeyState());
+ if (Keyboard.getEventKeyState()) {
+ if (Keyboard.getEventKey() == 1) {
+ this.releaseMouse();
+ }
+ if (Keyboard.getEventKey() == 28) {
+ this.attemptSaveLevel();
+ }
+ if (Keyboard.getEventKey() == 19) {
+ this.player.resetPos();
+ }
+ if (Keyboard.getEventKey() == 2) {
+ this.paintTexture = 1;
+ }
+ if (Keyboard.getEventKey() == 3) {
+ this.paintTexture = 3;
+ }
+ if (Keyboard.getEventKey() == 4) {
+ this.paintTexture = 4;
+ }
+ if (Keyboard.getEventKey() == 5) {
+ this.paintTexture = 5;
+ }
+ if (Keyboard.getEventKey() == 7) {
+ this.paintTexture = 6;
+ }
+ if (Keyboard.getEventKey() == 21) {
+ this.yMouseAxis *= -1;
+ }
+ if (Keyboard.getEventKey() == 34) {
+ this.entities.add(new Zombie(this.level, this.textures, this.player.x, this.player.y, this.player.z));
+ }
+ if (Keyboard.getEventKey() != 33) {
+ continue;
+ }
+ this.levelRenderer.toggleDrawDistance();
+ }
+ }
+ }
+ if (this.screen != null) {
+ this.screen.updateEvents();
+ if (this.screen != null) {
+ this.screen.tick();
+ }
+ }
+ this.level.tick();
+ this.particleEngine.tick();
+ for (int i = 0; i < this.entities.size(); ++i) {
+ this.entities.get(i).tick();
+ if (this.entities.get(i).removed) {
+ this.entities.remove(i--);
+ }
+ }
+ this.player.tick();
+ }
+
+ private boolean isFree(final AABB aabb) {
+ if (this.player.bb.intersects(aabb)) {
+ return false;
+ }
+ for (int i = 0; i < this.entities.size(); ++i) {
+ if (this.entities.get(i).bb.intersects(aabb)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private void moveCameraToPlayer(final float a) {
+ GL11.glTranslatef(0.0f, 0.0f, -0.3f);
+ GL11.glRotatef(this.player.xRot, 1.0f, 0.0f, 0.0f);
+ GL11.glRotatef(this.player.yRot, 0.0f, 1.0f, 0.0f);
+ final float x = this.player.xo + (this.player.x - this.player.xo) * a;
+ final float y = this.player.yo + (this.player.y - this.player.yo) * a;
+ final float z = this.player.zo + (this.player.z - this.player.zo) * a;
+ GL11.glTranslatef(-x, -y, -z);
+ }
+
+ private void setupCamera(final float a) {
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ GLU.gluPerspective(70.0f, this.width / (float)this.height, 0.05f, 1024.0f);
+ GL11.glMatrixMode(5888);
+ GL11.glLoadIdentity();
+ this.moveCameraToPlayer(a);
+ }
+
+ private void setupPickCamera(final float a, final int x, final int y) {
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ this.viewportBuffer.clear();
+ GL11.glGetInteger(2978, this.viewportBuffer);
+ this.viewportBuffer.flip();
+ this.viewportBuffer.limit(16);
+ GLU.gluPickMatrix((float)x, (float)y, 5.0f, 5.0f, this.viewportBuffer);
+ GLU.gluPerspective(70.0f, this.width / (float)this.height, 0.05f, 1024.0f);
+ GL11.glMatrixMode(5888);
+ GL11.glLoadIdentity();
+ this.moveCameraToPlayer(a);
+ }
+
+ private void pick(final float a) {
+ this.selectBuffer.clear();
+ GL11.glSelectBuffer(this.selectBuffer);
+ GL11.glRenderMode(7170);
+ this.setupPickCamera(a, this.width / 2, this.height / 2);
+ this.levelRenderer.pick(this.player, Frustum.getFrustum());
+ final int hits = GL11.glRenderMode(7168);
+ this.selectBuffer.flip();
+ this.selectBuffer.limit(this.selectBuffer.capacity());
+ final int[] names = new int[10];
+ HitResult bestResult = null;
+ for (int i = 0; i < hits; ++i) {
+ final int nameCount = this.selectBuffer.get();
+ this.selectBuffer.get();
+ this.selectBuffer.get();
+ for (int j = 0; j < nameCount; ++j) {
+ names[j] = this.selectBuffer.get();
+ }
+ this.hitResult = new HitResult(names[0], names[1], names[2], names[3], names[4]);
+ if (bestResult == null || this.hitResult.isCloserThan(this.player, bestResult, this.editMode)) {
+ bestResult = this.hitResult;
+ }
+ }
+ this.hitResult = bestResult;
+ }
+
+ public void render(final float a) {
+ if (!Display.isActive()) {
+ this.releaseMouse();
+ }
+ GL11.glViewport(0, 0, this.width, this.height);
+ if (this.mouseGrabbed) {
+ float xo = 0.0f;
+ float yo = 0.0f;
+ xo = (float)Mouse.getDX();
+ yo = (float)Mouse.getDY();
+ if (this.appletMode) {
+ Display.processMessages();
+ Mouse.poll();
+ xo = (float)(Mouse.getX() - this.width / 2);
+ yo = (float)(Mouse.getY() - this.height / 2);
+ Mouse.setCursorPosition(this.width / 2, this.height / 2);
+ }
+ this.player.turn(xo, yo * this.yMouseAxis);
+ }
+ this.checkGlError("Set viewport");
+ this.pick(a);
+ this.checkGlError("Picked");
+ GL11.glClear(16640);
+ this.setupCamera(a);
+ this.checkGlError("Set up camera");
+ GL11.glEnable(2884);
+ final Frustum frustum = Frustum.getFrustum();
+ this.levelRenderer.cull(frustum);
+ this.levelRenderer.updateDirtyChunks(this.player);
+ this.checkGlError("Update chunks");
+ this.setupFog(0);
+ GL11.glEnable(2912);
+ this.levelRenderer.render(this.player, 0);
+ this.checkGlError("Rendered level");
+ for (int i = 0; i < this.entities.size(); ++i) {
+ final Entity entity = this.entities.get(i);
+ if (entity.isLit() && frustum.isVisible(entity.bb)) {
+ this.entities.get(i).render(a);
+ }
+ }
+ this.checkGlError("Rendered entities");
+ this.particleEngine.render(this.player, a, 0);
+ this.checkGlError("Rendered particles");
+ this.setupFog(1);
+ this.levelRenderer.render(this.player, 1);
+ for (int i = 0; i < this.entities.size(); ++i) {
+ final Entity zombie = this.entities.get(i);
+ if (!zombie.isLit() && frustum.isVisible(zombie.bb)) {
+ this.entities.get(i).render(a);
+ }
+ }
+ this.particleEngine.render(this.player, a, 1);
+ this.levelRenderer.renderSurroundingGround();
+ if (this.hitResult != null) {
+ GL11.glDisable(2896);
+ GL11.glDisable(3008);
+ this.levelRenderer.renderHit(this.player, this.hitResult, this.editMode, this.paintTexture);
+ this.levelRenderer.renderHitOutline(this.player, this.hitResult, this.editMode, this.paintTexture);
+ GL11.glEnable(3008);
+ GL11.glEnable(2896);
+ }
+ GL11.glBlendFunc(770, 771);
+ this.setupFog(0);
+ this.levelRenderer.renderSurroundingWater();
+ GL11.glEnable(3042);
+ GL11.glColorMask(false, false, false, false);
+ this.levelRenderer.render(this.player, 2);
+ GL11.glColorMask(true, true, true, true);
+ this.levelRenderer.render(this.player, 2);
+ GL11.glDisable(3042);
+ GL11.glDisable(2896);
+ GL11.glDisable(3553);
+ GL11.glDisable(2912);
+ if (this.hitResult != null) {
+ GL11.glDepthFunc(513);
+ GL11.glDisable(3008);
+ this.levelRenderer.renderHit(this.player, this.hitResult, this.editMode, this.paintTexture);
+ this.levelRenderer.renderHitOutline(this.player, this.hitResult, this.editMode, this.paintTexture);
+ GL11.glEnable(3008);
+ GL11.glDepthFunc(515);
+ }
+ this.drawGui(a);
+ this.checkGlError("Rendered gui");
+ Display.update();
+ }
+
+ private void drawGui(final float a) {
+ final int screenWidth = this.width * 240 / this.height;
+ final int screenHeight = this.height * 240 / this.height;
+ final int xMouse = Mouse.getX() * screenWidth / this.width;
+ final int yMouse = screenHeight - Mouse.getY() * screenHeight / this.height - 1;
+ GL11.glClear(256);
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ GL11.glOrtho(0.0, (double)screenWidth, (double)screenHeight, 0.0, 100.0, 300.0);
+ GL11.glMatrixMode(5888);
+ GL11.glLoadIdentity();
+ GL11.glTranslatef(0.0f, 0.0f, -200.0f);
+ this.checkGlError("GUI: Init");
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)(screenWidth - 16), 16.0f, -50.0f);
+ final Tesselator t = Tesselator.instance;
+ GL11.glScalef(16.0f, 16.0f, 16.0f);
+ GL11.glRotatef(-30.0f, 1.0f, 0.0f, 0.0f);
+ GL11.glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
+ GL11.glTranslatef(-1.5f, 0.5f, 0.5f);
+ GL11.glScalef(-1.0f, -1.0f, -1.0f);
+ final int id = this.textures.loadTexture("/terrain.png", 9728);
+ GL11.glBindTexture(3553, id);
+ GL11.glEnable(3553);
+ t.begin();
+ Tile.tiles[this.paintTexture].render(t, this.level, 0, -2, 0, 0);
+ t.end();
+ GL11.glDisable(3553);
+ GL11.glPopMatrix();
+ this.checkGlError("GUI: Draw selected");
+ this.font.drawShadow("Minecraft grpf.0.0.13a", 2, 2, 16777215);
+ this.font.drawShadow(this.fpsString, 2, 12, 16777215);
+ this.checkGlError("GUI: Draw text");
+ final int wc = screenWidth / 2;
+ final int hc = screenHeight / 2;
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ t.begin();
+ t.vertex((float)(wc + 1), (float)(hc - 4), 0.0f);
+ t.vertex((float)(wc - 0), (float)(hc - 4), 0.0f);
+ t.vertex((float)(wc - 0), (float)(hc + 5), 0.0f);
+ t.vertex((float)(wc + 1), (float)(hc + 5), 0.0f);
+ t.vertex((float)(wc + 5), (float)(hc - 0), 0.0f);
+ t.vertex((float)(wc - 4), (float)(hc - 0), 0.0f);
+ t.vertex((float)(wc - 4), (float)(hc + 1), 0.0f);
+ t.vertex((float)(wc + 5), (float)(hc + 1), 0.0f);
+ t.end();
+ this.checkGlError("GUI: Draw crosshair");
+ if (this.screen != null) {
+ this.screen.render(xMouse, yMouse);
+ }
+ }
+
+ private void setupFog(final int i) {
+ final Tile currentTile = Tile.tiles[this.level.getTile((int)this.player.x, (int)(this.player.y + 0.12f), (int)this.player.z)];
+ if (currentTile != null && currentTile.getLiquidType() == 1) {
+ GL11.glFogi(2917, 2048);
+ GL11.glFogf(2914, 0.1f);
+ GL11.glFog(2918, this.getBuffer(0.02f, 0.02f, 0.2f, 1.0f));
+ GL11.glLightModel(2899, this.getBuffer(0.3f, 0.3f, 0.7f, 1.0f));
+ }
+ else if (currentTile != null && currentTile.getLiquidType() == 2) {
+ GL11.glFogi(2917, 2048);
+ GL11.glFogf(2914, 2.0f);
+ GL11.glFog(2918, this.getBuffer(0.6f, 0.1f, 0.0f, 1.0f));
+ GL11.glLightModel(2899, this.getBuffer(0.4f, 0.3f, 0.3f, 1.0f));
+ }
+ else if (i == 0) {
+ GL11.glFogi(2917, 2048);
+ GL11.glFogf(2914, 0.001f);
+ GL11.glFog(2918, this.fogColor0);
+ GL11.glLightModel(2899, this.getBuffer(1.0f, 1.0f, 1.0f, 1.0f));
+ }
+ else if (i == 1) {
+ GL11.glFogi(2917, 2048);
+ GL11.glFogf(2914, 0.01f);
+ GL11.glFog(2918, this.fogColor1);
+ final float br = 0.6f;
+ GL11.glLightModel(2899, this.getBuffer(br, br, br, 1.0f));
+ }
+ GL11.glEnable(2903);
+ GL11.glColorMaterial(1028, 4608);
+ GL11.glEnable(2896);
+ }
+
+ private FloatBuffer getBuffer(final float a, final float b, final float c, final float d) {
+ this.lb.clear();
+ this.lb.put(a).put(b).put(c).put(d);
+ this.lb.flip();
+ return this.lb;
+ }
+
+ public static void checkError() {
+ final int e = GL11.glGetError();
+ if (e != 0) {
+ throw new IllegalStateException(GLU.gluErrorString(e));
+ }
+ }
+
+ public void beginLevelLoading(final String title) {
+ this.title = title;
+ final int screenWidth = this.width * 240 / this.height;
+ final int screenHeight = this.height * 240 / this.height;
+ GL11.glClear(256);
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ GL11.glOrtho(0.0, (double)screenWidth, (double)screenHeight, 0.0, 100.0, 300.0);
+ GL11.glMatrixMode(5888);
+ GL11.glLoadIdentity();
+ GL11.glTranslatef(0.0f, 0.0f, -200.0f);
+ }
+
+ public void levelLoadUpdate(final String status) {
+ final int screenWidth = this.width * 240 / this.height;
+ final int screenHeight = this.height * 240 / this.height;
+ GL11.glClear(16640);
+ final Tesselator t = Tesselator.instance;
+ GL11.glEnable(3553);
+ final int id = this.textures.loadTexture("/dirt.png", 9728);
+ GL11.glBindTexture(3553, id);
+ t.begin();
+ t.color(8421504);
+ final float s = 32.0f;
+ t.vertexUV(0.0f, (float)screenHeight, 0.0f, 0.0f, screenHeight / s);
+ t.vertexUV((float)screenWidth, (float)screenHeight, 0.0f, screenWidth / s, screenHeight / s);
+ t.vertexUV((float)screenWidth, 0.0f, 0.0f, screenWidth / s, 0.0f);
+ t.vertexUV(0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+ t.end();
+ GL11.glEnable(3553);
+ this.font.drawShadow(this.title, (screenWidth - this.font.width(this.title)) / 2, screenHeight / 2 - 4 - 8, 16777215);
+ this.font.drawShadow(status, (screenWidth - this.font.width(status)) / 2, screenHeight / 2 - 4 + 4, 16777215);
+ Display.update();
+ try {
+ Thread.sleep(200L);
+ }
+ catch (Exception ex) {}
+ }
+
+ public void generateNewLevel() {
+ this.levelGen.generateLevel(this.level, this.user.name, 32, 512, 64);
+ this.player.resetPos();
+ for (int i = 0; i < this.entities.size(); ++i) {
+ this.entities.remove(i--);
+ }
+ }
+
+ public static void main(final String[] args) throws LWJGLException {
+ boolean fullScreen = false;
+ for (int i = 0; i < args.length; ++i) {
+ if (args[i].equalsIgnoreCase("-fullscreen")) {
+ fullScreen = true;
+ }
+ }
+ final Minecraft minecraft = new Minecraft(null, 854, 480, fullScreen);
+ new Thread(minecraft).start();
+ }
+}
diff --git a/src/com/mojang/minecraft/Minecraft.java_old b/src/com/mojang/minecraft/Minecraft.java_old
new file mode 100644
index 0000000..82cfb18
--- /dev/null
+++ b/src/com/mojang/minecraft/Minecraft.java_old
@@ -0,0 +1,406 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft;
+
+import com.mojang.minecraft.level.Tesselator;
+import com.mojang.minecraft.level.tile.Tile;
+import com.mojang.minecraft.level.Frustum;
+import org.lwjgl.util.glu.GLU;
+import com.mojang.minecraft.level.Chunk;
+import java.awt.Component;
+import javax.swing.JOptionPane;
+import java.io.IOException;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.Display;
+import org.lwjgl.opengl.DisplayMode;
+import org.lwjgl.BufferUtils;
+import java.nio.IntBuffer;
+import com.mojang.minecraft.character.Zombie;
+import java.util.ArrayList;
+import com.mojang.minecraft.particle.ParticleEngine;
+import com.mojang.minecraft.level.LevelRenderer;
+import com.mojang.minecraft.level.Level;
+import java.nio.FloatBuffer;
+
+public class RubyDung implements Runnable
+{
+ private static final boolean FULLSCREEN_MODE = false;
+ private int width;
+ private int height;
+ private FloatBuffer fogColor0;
+ private FloatBuffer fogColor1;
+ private Timer timer;
+ private Level level;
+ private LevelRenderer levelRenderer;
+ private Player player;
+ private int paintTexture;
+ private ParticleEngine particleEngine;
+ private ArrayList zombies;
+ private IntBuffer viewportBuffer;
+ private IntBuffer selectBuffer;
+ private HitResult hitResult;
+ FloatBuffer lb;
+
+ public RubyDung() {
+ this.fogColor0 = BufferUtils.createFloatBuffer(4);
+ this.fogColor1 = BufferUtils.createFloatBuffer(4);
+ this.timer = new Timer(20.0f);
+ this.paintTexture = 1;
+ this.zombies = new ArrayList();
+ this.viewportBuffer = BufferUtils.createIntBuffer(16);
+ this.selectBuffer = BufferUtils.createIntBuffer(2000);
+ this.hitResult = null;
+ this.lb = BufferUtils.createFloatBuffer(16);
+ }
+
+ public void init() throws LWJGLException, IOException {
+ final int col0 = 16710650;
+ final int col2 = 920330;
+ final float fr = 0.5f;
+ final float fg = 0.8f;
+ final float fb = 1.0f;
+ this.fogColor0.put(new float[] { (col0 >> 16 & 0xFF) / 255.0f, (col0 >> 8 & 0xFF) / 255.0f, (col0 & 0xFF) / 255.0f, 1.0f });
+ this.fogColor0.flip();
+ this.fogColor1.put(new float[] { (col2 >> 16 & 0xFF) / 255.0f, (col2 >> 8 & 0xFF) / 255.0f, (col2 & 0xFF) / 255.0f, 1.0f });
+ this.fogColor1.flip();
+ Display.setDisplayMode(new DisplayMode(1024, 768));
+ Display.create();
+ Keyboard.create();
+ Mouse.create();
+ this.width = Display.getDisplayMode().getWidth();
+ this.height = Display.getDisplayMode().getHeight();
+ GL11.glEnable(3553);
+ GL11.glShadeModel(7425);
+ GL11.glClearColor(fr, fg, fb, 0.0f);
+ GL11.glClearDepth(1.0);
+ GL11.glEnable(2929);
+ GL11.glDepthFunc(515);
+ GL11.glEnable(3008);
+ GL11.glAlphaFunc(516, 0.5f);
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ GL11.glMatrixMode(5888);
+ this.level = new Level(256, 256, 64);
+ this.levelRenderer = new LevelRenderer(this.level);
+ this.player = new Player(this.level);
+ this.particleEngine = new ParticleEngine(this.level);
+ Mouse.setGrabbed(true);
+ for (int i = 0; i < 10; ++i) {
+ final Zombie zombie = new Zombie(this.level, 128.0f, 0.0f, 128.0f);
+ zombie.resetPos();
+ this.zombies.add(zombie);
+ }
+ }
+
+ public void destroy() {
+ this.level.save();
+ Mouse.destroy();
+ Keyboard.destroy();
+ Display.destroy();
+ }
+
+ @Override
+ public void run() {
+ try {
+ this.init();
+ }
+ catch (Exception e) {
+ JOptionPane.showMessageDialog(null, e.toString(), "Failed to start RubyDung", 0);
+ System.exit(0);
+ }
+ long lastTime = System.currentTimeMillis();
+ int frames = 0;
+ try {
+ while (!Keyboard.isKeyDown(1)) {
+ if (Display.isCloseRequested()) {
+ break;
+ }
+ this.timer.advanceTime();
+ for (int i = 0; i < this.timer.ticks; ++i) {
+ this.tick();
+ }
+ this.render(this.timer.a);
+ ++frames;
+ while (System.currentTimeMillis() >= lastTime + 1000L) {
+ System.out.println(String.valueOf(frames) + " fps, " + Chunk.updates);
+ Chunk.updates = 0;
+ lastTime += 1000L;
+ frames = 0;
+ }
+ }
+ }
+ catch (Exception e2) {
+ e2.printStackTrace();
+ return;
+ }
+ finally {
+ this.destroy();
+ }
+ this.destroy();
+ }
+
+ public void tick() {
+ while (Keyboard.next()) {
+ if (Keyboard.getEventKeyState()) {
+ if (Keyboard.getEventKey() == 28) {
+ this.level.save();
+ }
+ if (Keyboard.getEventKey() == 2) {
+ this.paintTexture = 1;
+ }
+ if (Keyboard.getEventKey() == 3) {
+ this.paintTexture = 3;
+ }
+ if (Keyboard.getEventKey() == 4) {
+ this.paintTexture = 4;
+ }
+ if (Keyboard.getEventKey() == 5) {
+ this.paintTexture = 5;
+ }
+ if (Keyboard.getEventKey() == 7) {
+ this.paintTexture = 6;
+ }
+ if (Keyboard.getEventKey() != 34) {
+ continue;
+ }
+ this.zombies.add(new Zombie(this.level, this.player.x, this.player.y, this.player.z));
+ }
+ }
+ this.level.tick();
+ this.particleEngine.tick();
+ for (int i = 0; i < this.zombies.size(); ++i) {
+ this.zombies.get(i).tick();
+ if (this.zombies.get(i).removed) {
+ this.zombies.remove(i--);
+ }
+ }
+ this.player.tick();
+ }
+
+ private void moveCameraToPlayer(final float a) {
+ GL11.glTranslatef(0.0f, 0.0f, -0.3f);
+ GL11.glRotatef(this.player.xRot, 1.0f, 0.0f, 0.0f);
+ GL11.glRotatef(this.player.yRot, 0.0f, 1.0f, 0.0f);
+ final float x = this.player.xo + (this.player.x - this.player.xo) * a;
+ final float y = this.player.yo + (this.player.y - this.player.yo) * a;
+ final float z = this.player.zo + (this.player.z - this.player.zo) * a;
+ GL11.glTranslatef(-x, -y, -z);
+ }
+
+ private void setupCamera(final float a) {
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ GLU.gluPerspective(70.0f, this.width / (float)this.height, 0.05f, 1000.0f);
+ GL11.glMatrixMode(5888);
+ GL11.glLoadIdentity();
+ this.moveCameraToPlayer(a);
+ }
+
+ private void setupPickCamera(final float a, final int x, final int y) {
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ this.viewportBuffer.clear();
+ GL11.glGetInteger(2978, this.viewportBuffer);
+ this.viewportBuffer.flip();
+ this.viewportBuffer.limit(16);
+ GLU.gluPickMatrix((float)x, (float)y, 5.0f, 5.0f, this.viewportBuffer);
+ GLU.gluPerspective(70.0f, this.width / (float)this.height, 0.05f, 1000.0f);
+ GL11.glMatrixMode(5888);
+ GL11.glLoadIdentity();
+ this.moveCameraToPlayer(a);
+ }
+
+ private void pick(final float a) {
+ this.selectBuffer.clear();
+ GL11.glSelectBuffer(this.selectBuffer);
+ GL11.glRenderMode(7170);
+ this.setupPickCamera(a, this.width / 2, this.height / 2);
+ this.levelRenderer.pick(this.player, Frustum.getFrustum());
+ final int hits = GL11.glRenderMode(7168);
+ this.selectBuffer.flip();
+ this.selectBuffer.limit(this.selectBuffer.capacity());
+ long closest = 0L;
+ final int[] names = new int[10];
+ int hitNameCount = 0;
+ for (int i = 0; i < hits; ++i) {
+ final int nameCount = this.selectBuffer.get();
+ final long minZ = this.selectBuffer.get();
+ this.selectBuffer.get();
+ final long dist = minZ;
+ if (dist < closest || i == 0) {
+ closest = dist;
+ hitNameCount = nameCount;
+ for (int j = 0; j < nameCount; ++j) {
+ names[j] = this.selectBuffer.get();
+ }
+ }
+ else {
+ for (int j = 0; j < nameCount; ++j) {
+ this.selectBuffer.get();
+ }
+ }
+ }
+ if (hitNameCount > 0) {
+ this.hitResult = new HitResult(names[0], names[1], names[2], names[3], names[4]);
+ }
+ else {
+ this.hitResult = null;
+ }
+ }
+
+ public void render(final float a) {
+ final float xo = (float)Mouse.getDX();
+ final float yo = (float)Mouse.getDY();
+ this.player.turn(xo, yo);
+ this.pick(a);
+ while (Mouse.next()) {
+ if (Mouse.getEventButton() == 1 && Mouse.getEventButtonState() && this.hitResult != null) {
+ final Tile oldTile = Tile.tiles[this.level.getTile(this.hitResult.x, this.hitResult.y, this.hitResult.z)];
+ final boolean changed = this.level.setTile(this.hitResult.x, this.hitResult.y, this.hitResult.z, 0);
+ if (oldTile != null && changed) {
+ oldTile.destroy(this.level, this.hitResult.x, this.hitResult.y, this.hitResult.z, this.particleEngine);
+ }
+ }
+ if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState() && this.hitResult != null) {
+ int x = this.hitResult.x;
+ int y = this.hitResult.y;
+ int z = this.hitResult.z;
+ if (this.hitResult.f == 0) {
+ --y;
+ }
+ if (this.hitResult.f == 1) {
+ ++y;
+ }
+ if (this.hitResult.f == 2) {
+ --z;
+ }
+ if (this.hitResult.f == 3) {
+ ++z;
+ }
+ if (this.hitResult.f == 4) {
+ --x;
+ }
+ if (this.hitResult.f == 5) {
+ ++x;
+ }
+ this.level.setTile(x, y, z, this.paintTexture);
+ }
+ }
+ GL11.glClear(16640);
+ this.setupCamera(a);
+ GL11.glEnable(2884);
+ final Frustum frustum = Frustum.getFrustum();
+ this.levelRenderer.updateDirtyChunks(this.player);
+ this.setupFog(0);
+ GL11.glEnable(2912);
+ this.levelRenderer.render(this.player, 0);
+ for (int i = 0; i < this.zombies.size(); ++i) {
+ final Zombie zombie = this.zombies.get(i);
+ if (zombie.isLit() && frustum.isVisible(zombie.bb)) {
+ this.zombies.get(i).render(a);
+ }
+ }
+ this.particleEngine.render(this.player, a, 0);
+ this.setupFog(1);
+ this.levelRenderer.render(this.player, 1);
+ for (int i = 0; i < this.zombies.size(); ++i) {
+ final Zombie zombie = this.zombies.get(i);
+ if (!zombie.isLit() && frustum.isVisible(zombie.bb)) {
+ this.zombies.get(i).render(a);
+ }
+ }
+ this.particleEngine.render(this.player, a, 1);
+ GL11.glDisable(2896);
+ GL11.glDisable(3553);
+ GL11.glDisable(2912);
+ if (this.hitResult != null) {
+ GL11.glDisable(3008);
+ this.levelRenderer.renderHit(this.hitResult);
+ GL11.glEnable(3008);
+ }
+ this.drawGui(a);
+ Display.update();
+ }
+
+ private void drawGui(final float a) {
+ final int screenWidth = this.width * 240 / this.height;
+ final int screenHeight = this.height * 240 / this.height;
+ GL11.glClear(256);
+ GL11.glMatrixMode(5889);
+ GL11.glLoadIdentity();
+ GL11.glOrtho(0.0, (double)screenWidth, (double)screenHeight, 0.0, 100.0, 300.0);
+ GL11.glMatrixMode(5888);
+ GL11.glLoadIdentity();
+ GL11.glTranslatef(0.0f, 0.0f, -200.0f);
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)(screenWidth - 16), 16.0f, 0.0f);
+ final Tesselator t = Tesselator.instance;
+ GL11.glScalef(16.0f, 16.0f, 16.0f);
+ GL11.glRotatef(30.0f, 1.0f, 0.0f, 0.0f);
+ GL11.glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
+ GL11.glTranslatef(-1.5f, 0.5f, -0.5f);
+ GL11.glScalef(-1.0f, -1.0f, 1.0f);
+ final int id = Textures.loadTexture("/terrain.png", 9728);
+ GL11.glBindTexture(3553, id);
+ GL11.glEnable(3553);
+ t.init();
+ Tile.tiles[this.paintTexture].render(t, this.level, 0, -2, 0, 0);
+ t.flush();
+ GL11.glDisable(3553);
+ GL11.glPopMatrix();
+ final int wc = screenWidth / 2;
+ final int hc = screenHeight / 2;
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ t.init();
+ t.vertex((float)(wc + 1), (float)(hc - 4), 0.0f);
+ t.vertex((float)(wc - 0), (float)(hc - 4), 0.0f);
+ t.vertex((float)(wc - 0), (float)(hc + 5), 0.0f);
+ t.vertex((float)(wc + 1), (float)(hc + 5), 0.0f);
+ t.vertex((float)(wc + 5), (float)(hc - 0), 0.0f);
+ t.vertex((float)(wc - 4), (float)(hc - 0), 0.0f);
+ t.vertex((float)(wc - 4), (float)(hc + 1), 0.0f);
+ t.vertex((float)(wc + 5), (float)(hc + 1), 0.0f);
+ t.flush();
+ }
+
+ private void setupFog(final int i) {
+ if (i == 0) {
+ GL11.glFogi(2917, 2048);
+ GL11.glFogf(2914, 0.001f);
+ GL11.glFog(2918, this.fogColor0);
+ GL11.glDisable(2896);
+ }
+ else if (i == 1) {
+ GL11.glFogi(2917, 2048);
+ GL11.glFogf(2914, 0.06f);
+ GL11.glFog(2918, this.fogColor1);
+ GL11.glEnable(2896);
+ GL11.glEnable(2903);
+ final float br = 0.6f;
+ GL11.glLightModel(2899, this.getBuffer(br, br, br, 1.0f));
+ }
+ }
+
+ private FloatBuffer getBuffer(final float a, final float b, final float c, final float d) {
+ this.lb.clear();
+ this.lb.put(a).put(b).put(c).put(d);
+ this.lb.flip();
+ return this.lb;
+ }
+
+ public static void checkError() {
+ final int e = GL11.glGetError();
+ if (e != 0) {
+ throw new IllegalStateException(GLU.gluErrorString(e));
+ }
+ }
+
+ public static void main(final String[] args) throws LWJGLException {
+ new Thread(new RubyDung()).start();
+ }
+}
diff --git a/src/com/mojang/minecraft/MinecraftApplet.java b/src/com/mojang/minecraft/MinecraftApplet.java
new file mode 100644
index 0000000..1a40e0e
--- /dev/null
+++ b/src/com/mojang/minecraft/MinecraftApplet.java
@@ -0,0 +1,86 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft;
+
+import java.awt.Component;
+import java.awt.LayoutManager;
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.applet.Applet;
+
+public class MinecraftApplet extends Applet
+{
+ private Canvas canvas;
+ private Minecraft minecraft;
+ private Thread thread;
+
+ public MinecraftApplet() {
+ this.thread = null;
+ }
+
+ @Override
+ public void init() {
+ this.canvas = new Canvas() {
+ @Override
+ public void addNotify() {
+ super.addNotify();
+ MinecraftApplet.this.startGameThread();
+ }
+
+ @Override
+ public void removeNotify() {
+ MinecraftApplet.this.stopGameThread();
+ super.removeNotify();
+ }
+ };
+ this.minecraft = new Minecraft(this.canvas, this.getWidth(), this.getHeight(), false);
+ this.minecraft.appletMode = true;
+ this.setLayout(new BorderLayout());
+ this.add(this.canvas, "Center");
+ this.canvas.setFocusable(true);
+ this.validate();
+ }
+
+ public void startGameThread() {
+ if (this.thread != null) {
+ return;
+ }
+ (this.thread = new Thread(this.minecraft)).start();
+ }
+
+ @Override
+ public void start() {
+ this.minecraft.pause = false;
+ }
+
+ @Override
+ public void stop() {
+ this.minecraft.pause = true;
+ }
+
+ @Override
+ public void destroy() {
+ this.stopGameThread();
+ }
+
+ public void stopGameThread() {
+ if (this.thread == null) {
+ return;
+ }
+ this.minecraft.stop();
+ try {
+ this.thread.join(5000L);
+ }
+ catch (InterruptedException e) {
+ try {
+ this.minecraft.destroy();
+ }
+ catch (Exception ee) {
+ ee.printStackTrace();
+ }
+ }
+ this.thread = null;
+ }
+}
diff --git a/src/com/mojang/minecraft/Player.java b/src/com/mojang/minecraft/Player.java
new file mode 100644
index 0000000..017a814
--- /dev/null
+++ b/src/com/mojang/minecraft/Player.java
@@ -0,0 +1,122 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft;
+
+import com.mojang.minecraft.level.Level;
+
+public class Player extends Entity
+{
+ public static final int KEY_UP = 0;
+ public static final int KEY_DOWN = 1;
+ public static final int KEY_LEFT = 2;
+ public static final int KEY_RIGHT = 3;
+ public static final int KEY_JUMP = 4;
+ private boolean[] keys;
+
+ public Player(final Level level) {
+ super(level);
+ this.keys = new boolean[10];
+ this.heightOffset = 1.62f;
+ }
+
+ public void setKey(final int key, final boolean state) {
+ int id = -1;
+ if (key == 200 || key == 17) {
+ id = 0;
+ }
+ if (key == 208 || key == 31) {
+ id = 1;
+ }
+ if (key == 203 || key == 30) {
+ id = 2;
+ }
+ if (key == 205 || key == 32) {
+ id = 3;
+ }
+ if (key == 57 || key == 219) {
+ id = 4;
+ }
+ if (id >= 0) {
+ this.keys[id] = state;
+ }
+ }
+
+ public void releaseAllKeys() {
+ for (int i = 0; i < 10; ++i) {
+ this.keys[i] = false;
+ }
+ }
+
+ @Override
+ public void tick() {
+ this.xo = this.x;
+ this.yo = this.y;
+ this.zo = this.z;
+ float xa = 0.0f;
+ float ya = 0.0f;
+ final boolean inWater = this.isInWater();
+ final boolean inLava = this.isInLava();
+ if (this.keys[0]) {
+ --ya;
+ }
+ if (this.keys[1]) {
+ ++ya;
+ }
+ if (this.keys[2]) {
+ --xa;
+ }
+ if (this.keys[3]) {
+ ++xa;
+ }
+ if (this.keys[4]) {
+ if (inWater) {
+ this.yd += 0.04f;
+ }
+ else if (inLava) {
+ this.yd += 0.04f;
+ }
+ else if (this.onGround) {
+ this.yd = 0.42f;
+ this.keys[4] = false;
+ }
+ }
+ if (inWater) {
+ final float yo = this.y;
+ this.moveRelative(xa, ya, 0.02f);
+ this.move(this.xd, this.yd, this.zd);
+ this.xd *= 0.8f;
+ this.yd *= 0.8f;
+ this.zd *= 0.8f;
+ this.yd -= (float)0.02;
+ if (this.horizontalCollision && this.isFree(this.xd, this.yd + 0.6f - this.y + yo, this.zd)) {
+ this.yd = 0.3f;
+ }
+ }
+ else if (inLava) {
+ final float yo = this.y;
+ this.moveRelative(xa, ya, 0.02f);
+ this.move(this.xd, this.yd, this.zd);
+ this.xd *= 0.5f;
+ this.yd *= 0.5f;
+ this.zd *= 0.5f;
+ this.yd -= (float)0.02;
+ if (this.horizontalCollision && this.isFree(this.xd, this.yd + 0.6f - this.y + yo, this.zd)) {
+ this.yd = 0.3f;
+ }
+ }
+ else {
+ this.moveRelative(xa, ya, this.onGround ? 0.1f : 0.02f);
+ this.move(this.xd, this.yd, this.zd);
+ this.xd *= 0.91f;
+ this.yd *= 0.98f;
+ this.zd *= 0.91f;
+ this.yd -= (float)0.08;
+ if (this.onGround) {
+ this.xd *= 0.6f;
+ this.zd *= 0.6f;
+ }
+ }
+ }
+}
diff --git a/src/com/mojang/minecraft/Textures.java b/src/com/mojang/minecraft/Textures.java
new file mode 100644
index 0000000..7de8df8
--- /dev/null
+++ b/src/com/mojang/minecraft/Textures.java
@@ -0,0 +1,60 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft;
+
+import java.nio.ByteBuffer;
+import java.awt.image.BufferedImage;
+import java.nio.IntBuffer;
+import java.io.IOException;
+import org.lwjgl.util.glu.GLU;
+import javax.imageio.ImageIO;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.BufferUtils;
+import java.util.HashMap;
+
+public class Textures
+{
+ private static HashMap idMap;
+
+ static {
+ Textures.idMap = new HashMap();
+ }
+
+ public static int loadTexture(final String resourceName, final int mode) {
+ try {
+ if (Textures.idMap.containsKey(resourceName)) {
+ return Textures.idMap.get(resourceName);
+ }
+ final IntBuffer ib = BufferUtils.createIntBuffer(1);
+ ib.clear();
+ GL11.glGenTextures(ib);
+ final int id = ib.get(0);
+ Textures.idMap.put(resourceName, id);
+ System.out.println(String.valueOf(resourceName) + " -> " + id);
+ GL11.glBindTexture(3553, id);
+ GL11.glTexParameteri(3553, 10241, mode);
+ GL11.glTexParameteri(3553, 10240, mode);
+ final BufferedImage img = ImageIO.read(Textures.class.getResourceAsStream(resourceName));
+ final int w = img.getWidth();
+ final int h = img.getHeight();
+ final ByteBuffer pixels = BufferUtils.createByteBuffer(w * h * 4);
+ final int[] rawPixels = new int[w * h];
+ img.getRGB(0, 0, w, h, rawPixels, 0, w);
+ for (int i = 0; i < rawPixels.length; ++i) {
+ final int a = rawPixels[i] >> 24 & 0xFF;
+ final int r = rawPixels[i] >> 16 & 0xFF;
+ final int g = rawPixels[i] >> 8 & 0xFF;
+ final int b = rawPixels[i] & 0xFF;
+ rawPixels[i] = (a << 24 | b << 16 | g << 8 | r);
+ }
+ pixels.asIntBuffer().put(rawPixels);
+ GLU.gluBuild2DMipmaps(3553, 6408, w, h, 6408, 5121, pixels);
+ return id;
+ }
+ catch (IOException e) {
+ throw new RuntimeException("!!");
+ }
+ }
+}
diff --git a/src/com/mojang/minecraft/Timer.java b/src/com/mojang/minecraft/Timer.java
new file mode 100644
index 0000000..4e46957
--- /dev/null
+++ b/src/com/mojang/minecraft/Timer.java
@@ -0,0 +1,47 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft;
+
+public class Timer
+{
+ private static final long NS_PER_SECOND = 1000000000L;
+ private static final long MAX_NS_PER_UPDATE = 1000000000L;
+ private static final int MAX_TICKS_PER_UPDATE = 100;
+ private float ticksPerSecond;
+ private long lastTime;
+ public int ticks;
+ public float a;
+ public float timeScale;
+ public float fps;
+ public float passedTime;
+
+ public Timer(final float ticksPerSecond) {
+ this.timeScale = 1.0f;
+ this.fps = 0.0f;
+ this.passedTime = 0.0f;
+ this.ticksPerSecond = ticksPerSecond;
+ this.lastTime = System.nanoTime();
+ }
+
+ public void advanceTime() {
+ final long now = System.nanoTime();
+ long passedNs = now - this.lastTime;
+ this.lastTime = now;
+ if (passedNs < 0L) {
+ passedNs = 0L;
+ }
+ if (passedNs > 1000000000L) {
+ passedNs = 1000000000L;
+ }
+ this.fps = (float)(1000000000L / passedNs);
+ this.passedTime += passedNs * this.timeScale * this.ticksPerSecond / 1.0E9f;
+ this.ticks = (int)this.passedTime;
+ if (this.ticks > 100) {
+ this.ticks = 100;
+ }
+ this.passedTime -= this.ticks;
+ this.a = this.passedTime;
+ }
+}
diff --git a/src/com/mojang/minecraft/User.java b/src/com/mojang/minecraft/User.java
new file mode 100644
index 0000000..0de880f
--- /dev/null
+++ b/src/com/mojang/minecraft/User.java
@@ -0,0 +1,14 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft;
+
+public class User
+{
+ public String name;
+
+ public User(final String name) {
+ this.name = name;
+ }
+}
diff --git a/src/com/mojang/minecraft/character/Cube.java b/src/com/mojang/minecraft/character/Cube.java
new file mode 100644
index 0000000..81f5f2a
--- /dev/null
+++ b/src/com/mojang/minecraft/character/Cube.java
@@ -0,0 +1,96 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.character;
+
+import org.lwjgl.opengl.GL11;
+
+public class Cube
+{
+ private Vertex[] vertices;
+ private Polygon[] polygons;
+ private int xTexOffs;
+ private int yTexOffs;
+ public float x;
+ public float y;
+ public float z;
+ public float xRot;
+ public float yRot;
+ public float zRot;
+ private boolean compiled;
+ private int list;
+
+ public Cube(final int xTexOffs, final int yTexOffs) {
+ this.compiled = false;
+ this.list = 0;
+ this.xTexOffs = xTexOffs;
+ this.yTexOffs = yTexOffs;
+ }
+
+ public void setTexOffs(final int xTexOffs, final int yTexOffs) {
+ this.xTexOffs = xTexOffs;
+ this.yTexOffs = yTexOffs;
+ }
+
+ public void addBox(final float x0, final float y0, final float z0, final int w, final int h, final int d) {
+ this.vertices = new Vertex[8];
+ this.polygons = new Polygon[6];
+ final float x = x0 + w;
+ final float y = y0 + h;
+ final float z = z0 + d;
+ final Vertex u0 = new Vertex(x0, y0, z0, 0.0f, 0.0f);
+ final Vertex u2 = new Vertex(x, y0, z0, 0.0f, 8.0f);
+ final Vertex u3 = new Vertex(x, y, z0, 8.0f, 8.0f);
+ final Vertex u4 = new Vertex(x0, y, z0, 8.0f, 0.0f);
+ final Vertex l0 = new Vertex(x0, y0, z, 0.0f, 0.0f);
+ final Vertex l2 = new Vertex(x, y0, z, 0.0f, 8.0f);
+ final Vertex l3 = new Vertex(x, y, z, 8.0f, 8.0f);
+ final Vertex l4 = new Vertex(x0, y, z, 8.0f, 0.0f);
+ this.vertices[0] = u0;
+ this.vertices[1] = u2;
+ this.vertices[2] = u3;
+ this.vertices[3] = u4;
+ this.vertices[4] = l0;
+ this.vertices[5] = l2;
+ this.vertices[6] = l3;
+ this.vertices[7] = l4;
+ this.polygons[0] = new Polygon(new Vertex[] { l2, u2, u3, l3 }, this.xTexOffs + d + w, this.yTexOffs + d, this.xTexOffs + d + w + d, this.yTexOffs + d + h);
+ this.polygons[1] = new Polygon(new Vertex[] { u0, l0, l4, u4 }, this.xTexOffs + 0, this.yTexOffs + d, this.xTexOffs + d, this.yTexOffs + d + h);
+ this.polygons[2] = new Polygon(new Vertex[] { l2, l0, u0, u2 }, this.xTexOffs + d, this.yTexOffs + 0, this.xTexOffs + d + w, this.yTexOffs + d);
+ this.polygons[3] = new Polygon(new Vertex[] { u3, u4, l4, l3 }, this.xTexOffs + d + w, this.yTexOffs + 0, this.xTexOffs + d + w + w, this.yTexOffs + d);
+ this.polygons[4] = new Polygon(new Vertex[] { u2, u0, u4, u3 }, this.xTexOffs + d, this.yTexOffs + d, this.xTexOffs + d + w, this.yTexOffs + d + h);
+ this.polygons[5] = new Polygon(new Vertex[] { l0, l2, l3, l4 }, this.xTexOffs + d + w + d, this.yTexOffs + d, this.xTexOffs + d + w + d + w, this.yTexOffs + d + h);
+ }
+
+ public void setPos(final float x, final float y, final float z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ public void render() {
+ if (!this.compiled) {
+ this.compile();
+ }
+ final float c = 57.29578f;
+ GL11.glPushMatrix();
+ GL11.glTranslatef(this.x, this.y, this.z);
+ GL11.glRotatef(this.zRot * c, 0.0f, 0.0f, 1.0f);
+ GL11.glRotatef(this.yRot * c, 0.0f, 1.0f, 0.0f);
+ GL11.glRotatef(this.xRot * c, 1.0f, 0.0f, 0.0f);
+ GL11.glCallList(this.list);
+ GL11.glPopMatrix();
+ }
+
+ private void compile() {
+ GL11.glNewList(this.list = GL11.glGenLists(1), 4864);
+ GL11.glBegin(7);
+ for (int i = 0; i < this.polygons.length; ++i) {
+ this.polygons[i].render();
+ }
+ GL11.glEnd();
+ GL11.glEndList();
+ this.compiled = true;
+ }
+}
diff --git a/src/com/mojang/minecraft/character/Polygon.java b/src/com/mojang/minecraft/character/Polygon.java
new file mode 100644
index 0000000..0136c79
--- /dev/null
+++ b/src/com/mojang/minecraft/character/Polygon.java
@@ -0,0 +1,36 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.character;
+
+import org.lwjgl.opengl.GL11;
+
+public class Polygon
+{
+ public Vertex[] vertices;
+ public int vertexCount;
+
+ public Polygon(final Vertex[] vertices) {
+ this.vertexCount = 0;
+ this.vertices = vertices;
+ this.vertexCount = vertices.length;
+ }
+
+ public Polygon(final Vertex[] vertices, final int u0, final int v0, final int u1, final int v1) {
+ this(vertices);
+ vertices[0] = vertices[0].remap((float)u1, (float)v0);
+ vertices[1] = vertices[1].remap((float)u0, (float)v0);
+ vertices[2] = vertices[2].remap((float)u0, (float)v1);
+ vertices[3] = vertices[3].remap((float)u1, (float)v1);
+ }
+
+ public void render() {
+ GL11.glColor3f(1.0f, 1.0f, 1.0f);
+ for (int i = 3; i >= 0; --i) {
+ final Vertex v = this.vertices[i];
+ GL11.glTexCoord2f(v.u / 63.999f, v.v / 31.999f);
+ GL11.glVertex3f(v.pos.x, v.pos.y, v.pos.z);
+ }
+ }
+}
diff --git a/src/com/mojang/minecraft/character/Vec3.java b/src/com/mojang/minecraft/character/Vec3.java
new file mode 100644
index 0000000..2c8d8f8
--- /dev/null
+++ b/src/com/mojang/minecraft/character/Vec3.java
@@ -0,0 +1,31 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.character;
+
+public class Vec3
+{
+ public float x;
+ public float y;
+ public float z;
+
+ public Vec3(final float x, final float y, final float z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ public Vec3 interpolateTo(final Vec3 t, final float p) {
+ final float xt = this.x + (t.x - this.x) * p;
+ final float yt = this.y + (t.y - this.y) * p;
+ final float zt = this.z + (t.z - this.z) * p;
+ return new Vec3(xt, yt, zt);
+ }
+
+ public void set(final float x, final float y, final float z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+}
diff --git a/src/com/mojang/minecraft/character/Vertex.java b/src/com/mojang/minecraft/character/Vertex.java
new file mode 100644
index 0000000..696ecdd
--- /dev/null
+++ b/src/com/mojang/minecraft/character/Vertex.java
@@ -0,0 +1,32 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.character;
+
+public class Vertex
+{
+ public Vec3 pos;
+ public float u;
+ public float v;
+
+ public Vertex(final float x, final float y, final float z, final float u, final float v) {
+ this(new Vec3(x, y, z), u, v);
+ }
+
+ public Vertex remap(final float u, final float v) {
+ return new Vertex(this, u, v);
+ }
+
+ public Vertex(final Vertex vertex, final float u, final float v) {
+ this.pos = vertex.pos;
+ this.u = u;
+ this.v = v;
+ }
+
+ public Vertex(final Vec3 pos, final float u, final float v) {
+ this.pos = pos;
+ this.u = u;
+ this.v = v;
+ }
+}
diff --git a/src/com/mojang/minecraft/character/Zombie.java b/src/com/mojang/minecraft/character/Zombie.java
new file mode 100644
index 0000000..de74066
--- /dev/null
+++ b/src/com/mojang/minecraft/character/Zombie.java
@@ -0,0 +1,83 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.character;
+
+import org.lwjgl.opengl.GL11;
+import com.mojang.minecraft.level.Level;
+import com.mojang.minecraft.renderer.Textures;
+import com.mojang.minecraft.Entity;
+
+public class Zombie extends Entity
+{
+ public float rot;
+ public float timeOffs;
+ public float speed;
+ public float rotA;
+ private static ZombieModel zombieModel;
+ private Textures textures;
+
+ static {
+ Zombie.zombieModel = new ZombieModel();
+ }
+
+ public Zombie(final Level level, final Textures textures, final float x, final float y, final float z) {
+ super(level);
+ this.textures = textures;
+ this.rotA = (float)(Math.random() + 1.0) * 0.01f;
+ this.setPos(x, y, z);
+ this.timeOffs = (float)Math.random() * 1239813.0f;
+ this.rot = (float)(Math.random() * 3.141592653589793 * 2.0);
+ this.speed = 1.0f;
+ }
+
+ @Override
+ public void tick() {
+ this.xo = this.x;
+ this.yo = this.y;
+ this.zo = this.z;
+ float xa = 0.0f;
+ float ya = 0.0f;
+ if (this.y < -100.0f) {
+ this.remove();
+ }
+ this.rot += this.rotA;
+ this.rotA *= (float)0.99;
+ this.rotA += (float)((Math.random() - Math.random()) * Math.random() * Math.random() * 0.07999999821186066);
+ xa = (float)Math.sin(this.rot);
+ ya = (float)Math.cos(this.rot);
+ if (this.onGround && Math.random() < 0.08) {
+ this.yd = 0.5f;
+ }
+ this.moveRelative(xa, ya, this.onGround ? 0.1f : 0.02f);
+ this.yd -= (float)0.08;
+ this.move(this.xd, this.yd, this.zd);
+ this.xd *= 0.91f;
+ this.yd *= 0.98f;
+ this.zd *= 0.91f;
+ if (this.onGround) {
+ this.xd *= 0.7f;
+ this.zd *= 0.7f;
+ }
+ }
+
+ @Override
+ public void render(final float a) {
+ GL11.glEnable(3553);
+ GL11.glBindTexture(3553, this.textures.loadTexture("/char.png", 9728));
+ GL11.glPushMatrix();
+ final double time = System.nanoTime() / 1.0E9 * 10.0 * this.speed + this.timeOffs;
+ final float size = 0.058333334f;
+ final float yy = (float)(-Math.abs(Math.sin(time * 0.6662)) * 5.0 - 23.0);
+ GL11.glTranslatef(this.xo + (this.x - this.xo) * a, this.yo + (this.y - this.yo) * a, this.zo + (this.z - this.zo) * a);
+ GL11.glScalef(1.0f, -1.0f, 1.0f);
+ GL11.glScalef(size, size, size);
+ GL11.glTranslatef(0.0f, yy, 0.0f);
+ final float c = 57.29578f;
+ GL11.glRotatef(this.rot * c + 180.0f, 0.0f, 1.0f, 0.0f);
+ Zombie.zombieModel.render((float)time);
+ GL11.glPopMatrix();
+ GL11.glDisable(3553);
+ }
+}
diff --git a/src/com/mojang/minecraft/character/ZombieModel.java b/src/com/mojang/minecraft/character/ZombieModel.java
new file mode 100644
index 0000000..311fc2a
--- /dev/null
+++ b/src/com/mojang/minecraft/character/ZombieModel.java
@@ -0,0 +1,45 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.character;
+
+public class ZombieModel
+{
+ public Cube head;
+ public Cube body;
+ public Cube arm0;
+ public Cube arm1;
+ public Cube leg0;
+ public Cube leg1;
+
+ public ZombieModel() {
+ (this.head = new Cube(0, 0)).addBox(-4.0f, -8.0f, -4.0f, 8, 8, 8);
+ (this.body = new Cube(16, 16)).addBox(-4.0f, 0.0f, -2.0f, 8, 12, 4);
+ (this.arm0 = new Cube(40, 16)).addBox(-3.0f, -2.0f, -2.0f, 4, 12, 4);
+ this.arm0.setPos(-5.0f, 2.0f, 0.0f);
+ (this.arm1 = new Cube(40, 16)).addBox(-1.0f, -2.0f, -2.0f, 4, 12, 4);
+ this.arm1.setPos(5.0f, 2.0f, 0.0f);
+ (this.leg0 = new Cube(0, 16)).addBox(-2.0f, 0.0f, -2.0f, 4, 12, 4);
+ this.leg0.setPos(-2.0f, 12.0f, 0.0f);
+ (this.leg1 = new Cube(0, 16)).addBox(-2.0f, 0.0f, -2.0f, 4, 12, 4);
+ this.leg1.setPos(2.0f, 12.0f, 0.0f);
+ }
+
+ public void render(final float time) {
+ this.head.yRot = (float)Math.sin(time * 0.83) * 1.0f;
+ this.head.xRot = (float)Math.sin(time) * 0.8f;
+ this.arm0.xRot = (float)Math.sin(time * 0.6662 + 3.141592653589793) * 2.0f;
+ this.arm0.zRot = (float)(Math.sin(time * 0.2312) + 1.0) * 1.0f;
+ this.arm1.xRot = (float)Math.sin(time * 0.6662) * 2.0f;
+ this.arm1.zRot = (float)(Math.sin(time * 0.2812) - 1.0) * 1.0f;
+ this.leg0.xRot = (float)Math.sin(time * 0.6662) * 1.4f;
+ this.leg1.xRot = (float)Math.sin(time * 0.6662 + 3.141592653589793) * 1.4f;
+ this.head.render();
+ this.body.render();
+ this.arm0.render();
+ this.arm1.render();
+ this.leg0.render();
+ this.leg1.render();
+ }
+}
diff --git a/src/com/mojang/minecraft/comm/ConnectionListener.java b/src/com/mojang/minecraft/comm/ConnectionListener.java
new file mode 100644
index 0000000..40bf6cd
--- /dev/null
+++ b/src/com/mojang/minecraft/comm/ConnectionListener.java
@@ -0,0 +1,14 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.comm;
+
+import java.nio.ByteBuffer;
+
+public interface ConnectionListener
+{
+ void handleException(final Exception p0);
+
+ void command(final byte p0, final int p1, final ByteBuffer p2);
+}
diff --git a/src/com/mojang/minecraft/comm/ServerListener.java b/src/com/mojang/minecraft/comm/ServerListener.java
new file mode 100644
index 0000000..eb88820
--- /dev/null
+++ b/src/com/mojang/minecraft/comm/ServerListener.java
@@ -0,0 +1,12 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.comm;
+
+public interface ServerListener
+{
+ void clientConnected(final SocketConnection p0);
+
+ void clientException(final SocketConnection p0, final Exception p1);
+}
diff --git a/src/com/mojang/minecraft/comm/SocketConnection.java b/src/com/mojang/minecraft/comm/SocketConnection.java
new file mode 100644
index 0000000..c65e399
--- /dev/null
+++ b/src/com/mojang/minecraft/comm/SocketConnection.java
@@ -0,0 +1,128 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.comm;
+
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.net.SocketAddress;
+import java.net.InetSocketAddress;
+import java.io.BufferedOutputStream;
+import java.io.BufferedInputStream;
+import java.net.Socket;
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
+
+public class SocketConnection
+{
+ public static final int BUFFER_SIZE = 131068;
+ private boolean connected;
+ private SocketChannel socketChannel;
+ public ByteBuffer readBuffer;
+ public ByteBuffer writeBuffer;
+ protected long lastRead;
+ private ConnectionListener connectionListener;
+ private int bytesRead;
+ private int totalBytesWritten;
+ private Socket socket;
+ private BufferedInputStream in;
+ private BufferedOutputStream out;
+
+ public SocketConnection(final String ip, final int port) throws UnknownHostException, IOException {
+ this.readBuffer = ByteBuffer.allocate(131068);
+ this.writeBuffer = ByteBuffer.allocate(131068);
+ (this.socketChannel = SocketChannel.open()).connect(new InetSocketAddress(ip, port));
+ this.socketChannel.configureBlocking(false);
+ this.lastRead = System.currentTimeMillis();
+ this.connected = true;
+ this.readBuffer.clear();
+ this.writeBuffer.clear();
+ }
+
+ public String getIp() {
+ return this.socket.getInetAddress().toString();
+ }
+
+ public SocketConnection(final SocketChannel socketChannel) throws IOException {
+ this.readBuffer = ByteBuffer.allocate(131068);
+ this.writeBuffer = ByteBuffer.allocate(131068);
+ (this.socketChannel = socketChannel).configureBlocking(false);
+ this.lastRead = System.currentTimeMillis();
+ this.socket = socketChannel.socket();
+ this.connected = true;
+ this.readBuffer.clear();
+ this.writeBuffer.clear();
+ }
+
+ public ByteBuffer getBuffer() {
+ return this.writeBuffer;
+ }
+
+ public void setConnectionListener(final ConnectionListener connectionListener) {
+ this.connectionListener = connectionListener;
+ }
+
+ public boolean isConnected() {
+ return this.connected;
+ }
+
+ public void disconnect() {
+ this.connected = false;
+ try {
+ if (this.in != null) {
+ this.in.close();
+ }
+ this.in = null;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ try {
+ if (this.out != null) {
+ this.out.close();
+ }
+ this.out = null;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ try {
+ if (this.socket != null) {
+ this.socket.close();
+ }
+ this.socket = null;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void tick() throws IOException {
+ this.writeBuffer.flip();
+ this.socketChannel.write(this.writeBuffer);
+ this.writeBuffer.compact();
+ this.readBuffer.compact();
+ this.socketChannel.read(this.readBuffer);
+ this.readBuffer.flip();
+ if (this.readBuffer.remaining() > 0) {
+ this.connectionListener.command(this.readBuffer.get(0), this.readBuffer.remaining(), this.readBuffer);
+ }
+ }
+
+ public int getSentBytes() {
+ return this.totalBytesWritten;
+ }
+
+ public int getReadBytes() {
+ return this.bytesRead;
+ }
+
+ public void clearSentBytes() {
+ this.totalBytesWritten = 0;
+ }
+
+ public void clearReadBytes() {
+ this.bytesRead = 0;
+ }
+}
diff --git a/src/com/mojang/minecraft/comm/SocketServer.java b/src/com/mojang/minecraft/comm/SocketServer.java
new file mode 100644
index 0000000..9bb4a39
--- /dev/null
+++ b/src/com/mojang/minecraft/comm/SocketServer.java
@@ -0,0 +1,62 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.comm;
+
+import java.nio.channels.SocketChannel;
+import java.io.IOException;
+import java.net.SocketAddress;
+import java.net.InetSocketAddress;
+import java.net.InetAddress;
+import java.util.LinkedList;
+import java.util.List;
+import java.nio.channels.ServerSocketChannel;
+
+public class SocketServer
+{
+ private ServerSocketChannel ssc;
+ private ServerListener serverListener;
+ private List connections;
+
+ public SocketServer(final byte[] ips, final int port, final ServerListener serverListener) throws IOException {
+ this.connections = new LinkedList();
+ this.serverListener = serverListener;
+ final InetAddress hostip = InetAddress.getByAddress(ips);
+ this.ssc = ServerSocketChannel.open();
+ this.ssc.socket().bind(new InetSocketAddress(hostip, port));
+ this.ssc.configureBlocking(false);
+ }
+
+ public void tick() throws IOException {
+ SocketChannel socketChannel;
+ while ((socketChannel = this.ssc.accept()) != null) {
+ try {
+ socketChannel.configureBlocking(false);
+ final SocketConnection socketConnection = new SocketConnection(socketChannel);
+ this.connections.add(socketConnection);
+ this.serverListener.clientConnected(socketConnection);
+ }
+ catch (IOException e) {
+ socketChannel.close();
+ throw e;
+ }
+ }
+ for (int i = 0; i < this.connections.size(); ++i) {
+ final SocketConnection socketConnection2 = this.connections.get(i);
+ if (!socketConnection2.isConnected()) {
+ socketConnection2.disconnect();
+ this.connections.remove(i--);
+ }
+ else {
+ try {
+ socketConnection2.tick();
+ }
+ catch (Exception e2) {
+ socketConnection2.disconnect();
+ this.serverListener.clientException(socketConnection2, e2);
+ }
+ }
+ }
+ }
+}
diff --git a/src/com/mojang/minecraft/gui/Button.java b/src/com/mojang/minecraft/gui/Button.java
new file mode 100644
index 0000000..e1b922c
--- /dev/null
+++ b/src/com/mojang/minecraft/gui/Button.java
@@ -0,0 +1,24 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.gui;
+
+public class Button
+{
+ public int x;
+ public int y;
+ public int w;
+ public int h;
+ public String msg;
+ public int id;
+
+ public Button(final int id, final int x, final int y, final int w, final int h, final String msg) {
+ this.id = id;
+ this.x = x;
+ this.y = y;
+ this.w = w;
+ this.h = h;
+ this.msg = msg;
+ }
+}
diff --git a/src/com/mojang/minecraft/gui/Font.java b/src/com/mojang/minecraft/gui/Font.java
new file mode 100644
index 0000000..e54647a
--- /dev/null
+++ b/src/com/mojang/minecraft/gui/Font.java
@@ -0,0 +1,115 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.gui;
+
+import com.mojang.minecraft.renderer.Tesselator;
+import org.lwjgl.opengl.GL11;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import javax.imageio.ImageIO;
+import com.mojang.minecraft.renderer.Textures;
+
+public class Font
+{
+ private int[] charWidths;
+ private int fontTexture;
+
+ public Font(final String name, final Textures textures) {
+ this.charWidths = new int[256];
+ this.fontTexture = 0;
+ BufferedImage img;
+ try {
+ img = ImageIO.read(Textures.class.getResourceAsStream(name));
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ final int w = img.getWidth();
+ final int h = img.getHeight();
+ final int[] rawPixels = new int[w * h];
+ img.getRGB(0, 0, w, h, rawPixels, 0, w);
+ for (int i = 0; i < 128; ++i) {
+ final int xt = i % 16;
+ final int yt = i / 16;
+ int x = 0;
+ for (boolean emptyColumn = false; x < 8 && !emptyColumn; ++x) {
+ final int xPixel = xt * 8 + x;
+ emptyColumn = true;
+ for (int y = 0; y < 8 && emptyColumn; ++y) {
+ final int yPixel = (yt * 8 + y) * w;
+ final int pixel = rawPixels[xPixel + yPixel] & 0xFF;
+ if (pixel > 128) {
+ emptyColumn = false;
+ }
+ }
+ }
+ if (i == 32) {
+ x = 4;
+ }
+ this.charWidths[i] = x;
+ }
+ this.fontTexture = textures.loadTexture(name, 9728);
+ }
+
+ public void drawShadow(final String str, final int x, final int y, final int color) {
+ this.draw(str, x + 1, y + 1, color, true);
+ this.draw(str, x, y, color);
+ }
+
+ public void draw(final String str, final int x, final int y, final int color) {
+ this.draw(str, x, y, color, false);
+ }
+
+ public void draw(final String str, final int x, final int y, int color, final boolean darken) {
+ final char[] chars = str.toCharArray();
+ if (darken) {
+ color = (color & 0xFCFCFC) >> 2;
+ }
+ GL11.glEnable(3553);
+ GL11.glBindTexture(3553, this.fontTexture);
+ final Tesselator t = Tesselator.instance;
+ t.begin();
+ t.color(color);
+ int xo = 0;
+ for (int i = 0; i < chars.length; ++i) {
+ if (chars[i] == '&') {
+ final int cc = "0123456789abcdef".indexOf(chars[i + 1]);
+ final int br = (cc & 0x8) * 8;
+ final int b = (cc & 0x1) * 191 + br;
+ final int g = ((cc & 0x2) >> 1) * 191 + br;
+ final int r = ((cc & 0x4) >> 2) * 191 + br;
+ color = (r << 16 | g << 8 | b);
+ i += 2;
+ if (darken) {
+ color = (color & 0xFCFCFC) >> 2;
+ }
+ t.color(color);
+ }
+ final int ix = chars[i] % '\u0010' * 8;
+ final int iy = chars[i] / '\u0010' * 8;
+ t.vertexUV((float)(x + xo), (float)(y + 8), 0.0f, ix / 128.0f, (iy + 8) / 128.0f);
+ t.vertexUV((float)(x + xo + 8), (float)(y + 8), 0.0f, (ix + 8) / 128.0f, (iy + 8) / 128.0f);
+ t.vertexUV((float)(x + xo + 8), (float)y, 0.0f, (ix + 8) / 128.0f, iy / 128.0f);
+ t.vertexUV((float)(x + xo), (float)y, 0.0f, ix / 128.0f, iy / 128.0f);
+ xo += this.charWidths[chars[i]];
+ }
+ t.end();
+ GL11.glDisable(3553);
+ }
+
+ public int width(final String str) {
+ final char[] chars = str.toCharArray();
+ int len = 0;
+ for (int i = 0; i < chars.length; ++i) {
+ if (chars[i] == '&') {
+ ++i;
+ }
+ else {
+ len += this.charWidths[chars[i]];
+ }
+ }
+ return len;
+ }
+}
diff --git a/src/com/mojang/minecraft/gui/PauseScreen.java b/src/com/mojang/minecraft/gui/PauseScreen.java
new file mode 100644
index 0000000..cfb54eb
--- /dev/null
+++ b/src/com/mojang/minecraft/gui/PauseScreen.java
@@ -0,0 +1,71 @@
+//
+// Decompiled by Procyon v0.5.36
+//
+
+package com.mojang.minecraft.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PauseScreen extends Screen
+{
+ private List