Rewrite game to use OpenGL emulator

This commit is contained in:
PeytonPlayz595 2024-05-08 19:42:46 -04:00
parent 67c0742ac3
commit 89976e5119
63 changed files with 462 additions and 2786 deletions

View File

@ -547,6 +547,14 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
}
}
public static final void glScaled(double p1, double p2, double p3) {
deevis.set((float)p1, (float)p2, (float)p3);
getMatrix().scale(deevis);
if (isCompilingDisplayList) {
throw new IllegalArgumentException("matrix is not supported while recording display list use tessellator class instead");
}
}
public static final void glBlendFunc(int p1, int p2) {
fogPremultiply = (p1 == GL_ONE && p2 == GL_ONE_MINUS_SRC_ALPHA);
if(overlayFBOBlending) {

View File

@ -1,32 +1,39 @@
package net.lax1dude.eaglercraft;
public class EaglerImage {
public class BufferedImage {
public final int[] data;
public final int w;
public final int h;
public final boolean alpha;
public EaglerImage(int width, int height, int[] pixels, boolean alpha) {
public BufferedImage(int width, int height, int[] pixels, boolean alpha) {
this.w = width;
this.h = height;
this.data = pixels;
this.alpha = alpha;
}
public EaglerImage(int width, int height, boolean alpha) {
public BufferedImage(int width, int height, boolean alpha) {
this.w = width;
this.h = height;
this.data = new int[width * height];
this.alpha = alpha;
}
public EaglerImage getSubImage(int x, int y, int pw, int ph) {
public BufferedImage(int w, int h, int k) {
this.w = w;
this.h = h;
this.alpha = true;
this.data = new int[w * h];
}
public BufferedImage getSubImage(int x, int y, int pw, int ph) {
int[] img = new int[pw * ph];
for(int i = 0; i < ph; ++i) {
System.arraycopy(data, (i + y) * this.w + x, img, i * pw, pw);
}
return new EaglerImage(pw, ph, img, alpha);
return new BufferedImage(pw, ph, img, alpha);
}
public int[] data() {
@ -56,4 +63,12 @@ public class EaglerImage {
return rgbArray;
}
public int getWidth() {
return w;
}
public int getHeight() {
return h;
}
}

View File

@ -40,8 +40,9 @@ public class Client {
private static void run0() {
System.out.println(" -------- starting minecraft -------- ");
instance = new Minecraft();
instance.field_6320_i = new Session("Player");
//instance = new Minecraft();
Session session = new Session("Player", "mcpass");
instance.session = session;
LocalStorageManager.loadStorage();
run1();
}

View File

@ -0,0 +1,17 @@
package net.lax1dude.eaglercraft;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import net.PeytonPlayz585.opengl.GL11;
public class ImageIO {
public static BufferedImage read(InputStream var1) {
ByteArrayInputStream bais = (ByteArrayInputStream)var1;
byte[] data = bais.readAllBytes();
return GL11.loadPNG(data);
}
}

View File

@ -71,7 +71,7 @@ import net.PeytonPlayz585.storage.LocalStorageManager;
import net.lax1dude.eaglercraft.AssetRepository;
import net.lax1dude.eaglercraft.Base64;
import net.lax1dude.eaglercraft.Client;
import net.lax1dude.eaglercraft.EaglerImage;
import net.lax1dude.eaglercraft.BufferedImage;
import net.lax1dude.eaglercraft.JSONObject;
import net.lax1dude.eaglercraft.adapter.teavm.IndexedDBFilesystem;
import net.lax1dude.eaglercraft.adapter.teavm.IndexedDBFilesystem.OpenState;
@ -896,7 +896,7 @@ public class EaglerAdapterImpl2 {
@JSBody(params = { "url" }, script = "URL.revokeObjectURL(url);")
private static native void freeDataURL(String url);
public static final EaglerImage loadPNG(byte[] data) {
public static final BufferedImage loadPNG(byte[] data) {
ArrayBuffer arr = ArrayBuffer.create(data.length);
Uint8Array.create(arr).set(data);
return loadPNG0(arr);
@ -906,9 +906,9 @@ public class EaglerAdapterImpl2 {
private static native void setImageSmoothingMode(CanvasRenderingContext2D cc, boolean en);
@Async
private static native EaglerImage loadPNG0(ArrayBuffer data);
private static native BufferedImage loadPNG0(ArrayBuffer data);
private static void loadPNG0(ArrayBuffer data, final AsyncCallback<EaglerImage> ret) {
private static void loadPNG0(ArrayBuffer data, final AsyncCallback<BufferedImage> ret) {
final HTMLImageElement toLoad = (HTMLImageElement) doc.createElement("img");
toLoad.addEventListener("load", new EventListener<Event>() {
public void handleEvent(Event evt) {
@ -941,7 +941,7 @@ public class EaglerAdapterImpl2 {
j = dv.getUint32(i << 2, false);
pixels[i] = ((j >> 8) & 0xFFFFFF) | ((j & 0xFF) << 24);
}
ret.complete(new EaglerImage(pxlsDat.getWidth(), pxlsDat.getHeight(), pixels, true));
ret.complete(new BufferedImage(pxlsDat.getWidth(), pxlsDat.getHeight(), pixels, true));
}
});
toLoad.addEventListener("error", new EventListener<Event>() {

View File

@ -1,13 +1,10 @@
package net.minecraft.client;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
import java.io.File;
import net.PeytonPlayz585.input.Keyboard;
import net.PeytonPlayz585.input.Mouse;
import net.PeytonPlayz585.opengl.GL11;
import net.minecraft.src.AchievementList;
import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.Block;
@ -29,7 +26,6 @@ import net.minecraft.src.EnumOptions;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.GLAllocation;
import net.minecraft.src.GameSettings;
import net.minecraft.src.GameWindowListener;
import net.minecraft.src.GuiAchievement;
import net.minecraft.src.GuiChat;
import net.minecraft.src.GuiConflictWarning;
@ -52,13 +48,11 @@ import net.minecraft.src.LoadingScreenRenderer;
import net.minecraft.src.MathHelper;
import net.minecraft.src.MinecraftError;
import net.minecraft.src.MinecraftException;
import net.minecraft.src.MinecraftImpl;
import net.minecraft.src.ModelBiped;
import net.minecraft.src.MouseHelper;
import net.minecraft.src.MovementInputFromOptions;
import net.minecraft.src.MovingObjectPosition;
import net.minecraft.src.NetClientHandler;
import net.minecraft.src.OpenGlCapsChecker;
import net.minecraft.src.PlayerController;
import net.minecraft.src.PlayerControllerTest;
import net.minecraft.src.RenderBlocks;
@ -67,7 +61,6 @@ import net.minecraft.src.RenderGlobal;
import net.minecraft.src.RenderManager;
import net.minecraft.src.SaveConverterMcRegion;
import net.minecraft.src.ScaledResolution;
import net.minecraft.src.ScreenShotHelper;
import net.minecraft.src.Session;
import net.minecraft.src.SoundManager;
import net.minecraft.src.StatFileWriter;
@ -79,13 +72,10 @@ import net.minecraft.src.TextureCompassFX;
import net.minecraft.src.TextureFlamesFX;
import net.minecraft.src.TextureLavaFX;
import net.minecraft.src.TextureLavaFlowFX;
import net.minecraft.src.TexturePackList;
import net.minecraft.src.TexturePortalFX;
import net.minecraft.src.TextureWatchFX;
import net.minecraft.src.TextureWaterFX;
import net.minecraft.src.TextureWaterFlowFX;
import net.minecraft.src.ThreadCheckHasPaid;
import net.minecraft.src.ThreadDownloadResources;
import net.minecraft.src.ThreadSleepForever;
import net.minecraft.src.Timer;
import net.minecraft.src.UnexpectedThrowable;
@ -93,24 +83,14 @@ import net.minecraft.src.Vec3D;
import net.minecraft.src.World;
import net.minecraft.src.WorldProvider;
import net.minecraft.src.WorldRenderer;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Controllers;
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;
public abstract class Minecraft implements Runnable {
public static byte[] field_28006_b = new byte[10485760];
private static Minecraft theMinecraft;
public PlayerController playerController;
private boolean fullscreen = false;
private boolean hasCrashed = false;
public int displayWidth;
public int displayHeight;
private OpenGlCapsChecker glCapabilities;
private Timer timer = new Timer(20.0F);
public World theWorld;
public RenderGlobal renderGlobal;
@ -119,15 +99,12 @@ public abstract class Minecraft implements Runnable {
public EffectRenderer effectRenderer;
public Session session = null;
public String minecraftUri;
public Canvas mcCanvas;
public boolean hideQuitButton = true;
public volatile boolean isGamePaused = false;
public RenderEngine renderEngine;
public FontRenderer fontRenderer;
public GuiScreen currentScreen = null;
public LoadingScreenRenderer loadingScreen = new LoadingScreenRenderer(this);
public EntityRenderer entityRenderer;
private ThreadDownloadResources downloadResourcesThread;
private int ticksRan = 0;
private int leftClickCounter = 0;
private int tempDisplayWidth;
@ -138,10 +115,8 @@ public abstract class Minecraft implements Runnable {
public ModelBiped field_9242_w = new ModelBiped(0.0F);
public MovingObjectPosition objectMouseOver = null;
public GameSettings gameSettings;
protected MinecraftApplet mcApplet;
public SoundManager sndManager = new SoundManager();
public MouseHelper mouseHelper;
public TexturePackList texturePackList;
private File mcDataDir;
private ISaveFormat saveLoader;
public static long[] frameTimes = new long[512];
@ -164,19 +139,12 @@ public abstract class Minecraft implements Runnable {
long systemTime = System.currentTimeMillis();
private int joinPlayerCounter = 0;
public Minecraft(Component var1, Canvas var2, MinecraftApplet var3, int var4, int var5, boolean var6) {
public Minecraft() {
StatList.func_27360_a();
this.tempDisplayHeight = var5;
this.fullscreen = var6;
this.mcApplet = var3;
this.tempDisplayHeight = GL11.getCanvasHeight();
new ThreadSleepForever(this, "Timer hack thread");
this.mcCanvas = var2;
this.displayWidth = var4;
this.displayHeight = var5;
this.fullscreen = var6;
if(var3 == null || "true".equals(var3.getParameter("stand-alone"))) {
this.hideQuitButton = false;
}
this.displayWidth = GL11.getCanvasWidth();
this.displayHeight = GL11.getCanvasHeight();
theMinecraft = this;
}
@ -193,51 +161,11 @@ public abstract class Minecraft implements Runnable {
this.serverPort = var2;
}
public void startGame() throws LWJGLException {
if(this.mcCanvas != null) {
Graphics var1 = this.mcCanvas.getGraphics();
if(var1 != null) {
var1.setColor(Color.BLACK);
var1.fillRect(0, 0, this.displayWidth, this.displayHeight);
var1.dispose();
}
Display.setParent(this.mcCanvas);
} else if(this.fullscreen) {
Display.setFullscreen(true);
this.displayWidth = Display.getDisplayMode().getWidth();
this.displayHeight = Display.getDisplayMode().getHeight();
if(this.displayWidth <= 0) {
this.displayWidth = 1;
}
if(this.displayHeight <= 0) {
this.displayHeight = 1;
}
} else {
Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight));
}
Display.setTitle("Minecraft Minecraft Beta 1.7.3");
try {
Display.create();
} catch (LWJGLException var6) {
var6.printStackTrace();
try {
Thread.sleep(1000L);
} catch (InterruptedException var5) {
}
Display.create();
}
public void startGame() {
this.mcDataDir = getMinecraftDir();
this.saveLoader = new SaveConverterMcRegion(new File(this.mcDataDir, "saves"));
this.gameSettings = new GameSettings(this, this.mcDataDir);
this.texturePackList = new TexturePackList(this, this.mcDataDir);
this.renderEngine = new RenderEngine(this.texturePackList, this.gameSettings);
this.renderEngine = new RenderEngine(this.gameSettings);
this.fontRenderer = new FontRenderer(this.gameSettings, "/font/default.png", this.renderEngine);
ColorizerWater.func_28182_a(this.renderEngine.func_28149_a("/misc/watercolor.png"));
ColorizerGrass.func_28181_a(this.renderEngine.func_28149_a("/misc/grasscolor.png"));
@ -247,20 +175,11 @@ public abstract class Minecraft implements Runnable {
this.statFileWriter = new StatFileWriter(this.session, this.mcDataDir);
AchievementList.openInventory.setStatStringFormatter(new StatStringFormatKeyInv(this));
this.loadScreen();
Keyboard.create();
Mouse.create();
this.mouseHelper = new MouseHelper(this.mcCanvas);
try {
Controllers.create();
} catch (Exception var4) {
var4.printStackTrace();
}
this.mouseHelper = new MouseHelper();
this.checkGLError("Pre startup");
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glClearDepth(1.0D);
GL11.glClearDepth(1.0F);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glEnable(GL11.GL_ALPHA_TEST);
@ -270,7 +189,6 @@ public abstract class Minecraft implements Runnable {
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
this.checkGLError("Startup");
this.glCapabilities = new OpenGlCapsChecker();
this.sndManager.loadSoundSettings(this.gameSettings);
this.renderEngine.registerTextureFX(this.textureLavaFX);
this.renderEngine.registerTextureFX(this.textureWaterFX);
@ -285,12 +203,6 @@ public abstract class Minecraft implements Runnable {
GL11.glViewport(0, 0, this.displayWidth, this.displayHeight);
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
try {
this.downloadResourcesThread = new ThreadDownloadResources(this.mcDataDir, this);
this.downloadResourcesThread.start();
} catch (Exception var3) {
}
this.checkGLError("Post startup");
this.ingameGUI = new GuiIngame(this);
if(this.serverName != null) {
@ -301,7 +213,7 @@ public abstract class Minecraft implements Runnable {
}
private void loadScreen() throws LWJGLException {
private void loadScreen() {
ScaledResolution var1 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight);
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT);
GL11.glMatrixMode(GL11.GL_PROJECTION);
@ -333,7 +245,11 @@ public abstract class Minecraft implements Runnable {
GL11.glDisable(GL11.GL_FOG);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
Display.swapBuffers();
//Emulate Display.swapBuffers()
GL11.glFlush();
GL11.updateDisplay();
GL11.optimize();
}
public void func_6274_a(int var1, int var2, int var3, int var4, int var5, int var6) {
@ -434,7 +350,7 @@ public abstract class Minecraft implements Runnable {
private void checkGLError(String var1) {
int var2 = GL11.glGetError();
if(var2 != 0) {
String var3 = GLU.gluErrorString(var2);
String var3 = GL11.gluErrorString(var2);
System.out.println("########## GL ERROR ##########");
System.out.println("@ " + var1);
System.out.println(var2 + ": " + var3);
@ -446,16 +362,6 @@ public abstract class Minecraft implements Runnable {
try {
this.statFileWriter.func_27175_b();
this.statFileWriter.syncStats();
if(this.mcApplet != null) {
this.mcApplet.clearApplet();
}
try {
if(this.downloadResourcesThread != null) {
this.downloadResourcesThread.closeMinecraft();
}
} catch (Exception var9) {
}
System.out.println("Stopping!");
@ -470,13 +376,7 @@ public abstract class Minecraft implements Runnable {
}
this.sndManager.closeMinecraft();
Mouse.destroy();
Keyboard.destroy();
} finally {
Display.destroy();
if(!this.hasCrashed) {
System.exit(0);
}
} catch(Exception e) {
}
@ -500,15 +400,12 @@ public abstract class Minecraft implements Runnable {
while(this.running) {
try {
if(this.mcApplet != null && !this.mcApplet.isActive()) {
if(!GL11.hasBeenActive()) {
break;
}
AxisAlignedBB.clearBoundingBoxPool();
Vec3D.initialize();
if(this.mcCanvas == null && Display.isCloseRequested()) {
this.shutdown();
}
if(this.isGamePaused && this.theWorld != null) {
float var4 = this.timer.renderPartialTicks;
@ -541,9 +438,7 @@ public abstract class Minecraft implements Runnable {
this.theWorld.updatingLighting();
}
if(!Keyboard.isKeyDown(Keyboard.KEY_F7)) {
Display.update();
}
GL11.updateDisplay();
if(this.thePlayer != null && this.thePlayer.isEntityInsideOpaqueBlock()) {
this.gameSettings.thirdPersonView = false;
@ -557,11 +452,7 @@ public abstract class Minecraft implements Runnable {
this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks);
}
if(!Display.isActive()) {
if(this.fullscreen) {
this.toggleFullscreen();
}
if(!GL11.hasBeenActive()) {
Thread.sleep(10L);
}
@ -573,14 +464,10 @@ public abstract class Minecraft implements Runnable {
this.guiAchievement.updateAchievementWindow();
Thread.yield();
if(Keyboard.isKeyDown(Keyboard.KEY_F7)) {
Display.update();
}
this.screenshotListener();
if(this.mcCanvas != null && !this.fullscreen && (this.mcCanvas.getWidth() != this.displayWidth || this.mcCanvas.getHeight() != this.displayHeight)) {
this.displayWidth = this.mcCanvas.getWidth();
this.displayHeight = this.mcCanvas.getHeight();
if(GL11.getCanvasWidth() != this.displayWidth || GL11.getCanvasHeight() != this.displayHeight) {
this.displayWidth = GL11.getCanvasWidth();
this.displayHeight = GL11.getCanvasHeight();
if(this.displayWidth <= 0) {
this.displayWidth = 1;
}
@ -593,6 +480,7 @@ public abstract class Minecraft implements Runnable {
}
this.checkGLError("Post render");
GL11.optimize();
++var3;
for(this.isGamePaused = !this.isMultiplayerWorld() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame(); System.currentTimeMillis() >= var1 + 1000L; var3 = 0) {
@ -644,18 +532,6 @@ public abstract class Minecraft implements Runnable {
System.gc();
}
private void screenshotListener() {
if(Keyboard.isKeyDown(Keyboard.KEY_F2)) {
if(!this.isTakingScreenshot) {
this.isTakingScreenshot = true;
this.ingameGUI.addChatMessage(ScreenShotHelper.saveScreenshot(minecraftDir, this.displayWidth, this.displayHeight));
}
} else {
this.isTakingScreenshot = false;
}
}
private void displayDebugInfo(long var1) {
long var3 = 16666666L;
if(this.prevFrameTime == -1L) {
@ -736,7 +612,7 @@ public abstract class Minecraft implements Runnable {
}
public void setIngameFocus() {
if(Display.isActive()) {
if(GL11.hasBeenActive()) {
if(!this.inGameHasFocus) {
this.inGameHasFocus = true;
this.mouseHelper.grabMouseCursor();
@ -841,50 +717,6 @@ public abstract class Minecraft implements Runnable {
}
}
public void toggleFullscreen() {
try {
this.fullscreen = !this.fullscreen;
if(this.fullscreen) {
Display.setDisplayMode(Display.getDesktopDisplayMode());
this.displayWidth = Display.getDisplayMode().getWidth();
this.displayHeight = Display.getDisplayMode().getHeight();
if(this.displayWidth <= 0) {
this.displayWidth = 1;
}
if(this.displayHeight <= 0) {
this.displayHeight = 1;
}
} else {
if(this.mcCanvas != null) {
this.displayWidth = this.mcCanvas.getWidth();
this.displayHeight = this.mcCanvas.getHeight();
} else {
this.displayWidth = this.tempDisplayWidth;
this.displayHeight = this.tempDisplayHeight;
}
if(this.displayWidth <= 0) {
this.displayWidth = 1;
}
if(this.displayHeight <= 0) {
this.displayHeight = 1;
}
}
if(this.currentScreen != null) {
this.resize(this.displayWidth, this.displayHeight);
}
Display.setFullscreen(this.fullscreen);
Display.update();
} catch (Exception var2) {
var2.printStackTrace();
}
}
private void resize(int var1, int var2) {
if(var1 <= 0) {
var1 = 1;
@ -926,7 +758,7 @@ public abstract class Minecraft implements Runnable {
}
private void func_28001_B() {
(new ThreadCheckHasPaid(this)).start();
//Fuck Mojang L :P
}
public void runTick() {
@ -1015,33 +847,26 @@ public abstract class Minecraft implements Runnable {
this.thePlayer.handleKeyPress(Keyboard.getEventKey(), Keyboard.getEventKeyState());
} while(!Keyboard.getEventKeyState());
if(Keyboard.getEventKey() == Keyboard.KEY_F11) {
this.toggleFullscreen();
} else {
if(this.currentScreen != null) {
this.currentScreen.handleKeyboardInput();
} else {
if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
if(Keyboard.getEventKey() == 1) {
this.displayInGameMenu();
}
if(Keyboard.getEventKey() == Keyboard.KEY_S && Keyboard.isKeyDown(Keyboard.KEY_F3)) {
this.forceReload();
}
if(Keyboard.getEventKey() == Keyboard.KEY_F1) {
if(Keyboard.getEventKey() == 33 && GL11.isKeyDown(2)) {
this.gameSettings.hideGUI = !this.gameSettings.hideGUI;
}
if(Keyboard.getEventKey() == Keyboard.KEY_F3) {
if(Keyboard.getEventKey() == 33 && GL11.isKeyDown(4)) {
this.gameSettings.showDebugInfo = !this.gameSettings.showDebugInfo;
}
if(Keyboard.getEventKey() == Keyboard.KEY_F5) {
if(Keyboard.getEventKey() == 33 && GL11.isKeyDown(6)) {
this.gameSettings.thirdPersonView = !this.gameSettings.thirdPersonView;
}
if(Keyboard.getEventKey() == Keyboard.KEY_F8) {
if(Keyboard.getEventKey() == 33 && GL11.isKeyDown(9)) {
this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera;
}
@ -1059,14 +884,13 @@ public abstract class Minecraft implements Runnable {
}
for(int var6 = 0; var6 < 9; ++var6) {
if(Keyboard.getEventKey() == Keyboard.KEY_1 + var6) {
if(Keyboard.getEventKey() == 2 + var6) {
this.thePlayer.inventory.currentItem = var6;
}
}
if(Keyboard.getEventKey() == this.gameSettings.keyBindToggleFog.keyCode) {
this.gameSettings.setOptionValue(EnumOptions.RENDER_DISTANCE, !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ? 1 : -1);
}
this.gameSettings.setOptionValue(EnumOptions.RENDER_DISTANCE, !Keyboard.isKeyDown(42) && !Keyboard.isKeyDown(54) ? 1 : -1);
}
}
}
@ -1168,7 +992,6 @@ public abstract class Minecraft implements Runnable {
System.out.println("FORCING RELOAD!");
this.sndManager = new SoundManager();
this.sndManager.loadSoundSettings(this.gameSettings);
this.downloadResourcesThread.reloadResources();
}
public boolean isMultiplayerWorld() {
@ -1382,10 +1205,6 @@ public abstract class Minecraft implements Runnable {
}
public OpenGlCapsChecker getOpenGlCapsChecker() {
return this.glCapabilities;
}
public String func_6241_m() {
return this.renderGlobal.getDebugInfoRenders();
}
@ -1462,59 +1281,10 @@ public abstract class Minecraft implements Runnable {
}
public static void func_6269_a(String var0, String var1) {
startMainThread(var0, var1, (String)null);
}
public static void startMainThread(String var0, String var1, String var2) {
boolean var3 = false;
Frame var5 = new Frame("Minecraft");
Canvas var6 = new Canvas();
var5.setLayout(new BorderLayout());
var5.add(var6, "Center");
var6.setPreferredSize(new Dimension(854, 480));
var5.pack();
var5.setLocationRelativeTo((Component)null);
MinecraftImpl var7 = new MinecraftImpl(var5, var6, (MinecraftApplet)null, 854, 480, var3, var5);
Thread var8 = new Thread(var7, "Minecraft main thread");
var8.setPriority(10);
var7.minecraftUri = "www.minecraft.net";
if(var0 != null && var1 != null) {
var7.session = new Session(var0, var1);
} else {
var7.session = new Session("Player" + System.currentTimeMillis() % 1000L, "");
}
if(var2 != null) {
String[] var9 = var2.split(":");
var7.setServer(var9[0], Integer.parseInt(var9[1]));
}
var5.setVisible(true);
var5.addWindowListener(new GameWindowListener(var7, var8));
var8.start();
}
public NetClientHandler getSendQueue() {
return this.thePlayer instanceof EntityClientPlayerMP ? ((EntityClientPlayerMP)this.thePlayer).sendQueue : null;
}
public static void main(String[] var0) {
String var1 = null;
String var2 = null;
var1 = "Player" + System.currentTimeMillis() % 1000L;
if(var0.length > 0) {
var1 = var0[0];
}
var2 = "-";
if(var0.length > 1) {
var2 = var0[1];
}
func_6269_a(var1, var2);
}
public static boolean isGuiEnabled() {
return theMinecraft == null || !theMinecraft.gameSettings.hideGUI;
}

View File

@ -1,104 +0,0 @@
package net.minecraft.client;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Canvas;
import net.minecraft.src.CanvasMinecraftApplet;
import net.minecraft.src.MinecraftAppletImpl;
import net.minecraft.src.Session;
public class MinecraftApplet extends Applet {
private Canvas mcCanvas;
private Minecraft mc;
private Thread mcThread = null;
public void init() {
this.mcCanvas = new CanvasMinecraftApplet(this);
boolean var1 = false;
if(this.getParameter("fullscreen") != null) {
var1 = this.getParameter("fullscreen").equalsIgnoreCase("true");
}
this.mc = new MinecraftAppletImpl(this, this, this.mcCanvas, this, this.getWidth(), this.getHeight(), var1);
this.mc.minecraftUri = this.getDocumentBase().getHost();
if(this.getDocumentBase().getPort() > 0) {
this.mc.minecraftUri = this.mc.minecraftUri + ":" + this.getDocumentBase().getPort();
}
if(this.getParameter("username") != null && this.getParameter("sessionid") != null) {
this.mc.session = new Session(this.getParameter("username"), this.getParameter("sessionid"));
System.out.println("Setting user: " + this.mc.session.username + ", " + this.mc.session.sessionId);
if(this.getParameter("mppass") != null) {
this.mc.session.mpPassParameter = this.getParameter("mppass");
}
} else {
this.mc.session = new Session("Player", "");
}
if(this.getParameter("server") != null && this.getParameter("port") != null) {
this.mc.setServer(this.getParameter("server"), Integer.parseInt(this.getParameter("port")));
}
this.mc.hideQuitButton = true;
this.setLayout(new BorderLayout());
this.add(this.mcCanvas, "Center");
this.mcCanvas.setFocusable(true);
this.validate();
}
public void startMainThread() {
if(this.mcThread == null) {
this.mcThread = new Thread(this.mc, "Minecraft main thread");
this.mcThread.start();
}
}
public void start() {
if(this.mc != null) {
this.mc.isGamePaused = false;
}
}
public void stop() {
if(this.mc != null) {
this.mc.isGamePaused = true;
}
}
public void destroy() {
this.shutdown();
}
public void shutdown() {
if(this.mcThread != null) {
this.mc.shutdown();
try {
this.mcThread.join(10000L);
} catch (InterruptedException var4) {
try {
this.mc.shutdownMinecraftApplet();
} catch (Exception var3) {
var3.printStackTrace();
}
}
this.mcThread = null;
}
}
public void clearApplet() {
this.mcCanvas = null;
this.mc = null;
this.mcThread = null;
try {
this.removeAll();
this.validate();
} catch (Exception var2) {
}
}
}

View File

@ -1,22 +0,0 @@
package net.minecraft.isom;
import java.applet.Applet;
import java.awt.BorderLayout;
import net.minecraft.src.CanvasIsomPreview;
public class IsomPreviewApplet extends Applet {
private CanvasIsomPreview a = new CanvasIsomPreview();
public IsomPreviewApplet() {
this.setLayout(new BorderLayout());
this.add(this.a, "Center");
}
public void start() {
this.a.func_1272_b();
}
public void stop() {
this.a.exit();
}
}

View File

@ -1,11 +0,0 @@
package net.minecraft.src;
import java.awt.Canvas;
import java.awt.Dimension;
class CanvasCrashReport extends Canvas {
public CanvasCrashReport(int var1) {
this.setPreferredSize(new Dimension(var1, var1));
this.setMinimumSize(new Dimension(var1, var1));
}
}

View File

@ -1,380 +0,0 @@
package net.minecraft.src;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferStrategy;
import java.awt.image.ImageObserver;
import java.io.File;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
public class CanvasIsomPreview extends Canvas implements KeyListener, MouseListener, MouseMotionListener, Runnable {
private int field_1793_a = 0;
private int zoomLevel = 2;
private boolean displayHelpText = true;
private World worldObj;
private File dataFolder = this.getMinecraftDir();
private boolean running = true;
private List imageBufferList = Collections.synchronizedList(new LinkedList());
private IsoImageBuffer[][] imageBuffers = new IsoImageBuffer[64][64];
private int field_1785_i;
private int field_1784_j;
private int xPosition;
private int yPosition;
public File getMinecraftDir() {
if(this.dataFolder == null) {
this.dataFolder = this.getAppDir("minecraft");
}
return this.dataFolder;
}
public File getAppDir(String var1) {
String var2 = System.getProperty("user.home", ".");
File var3;
switch(OsMap.field_1193_a[getOs().ordinal()]) {
case 1:
case 2:
var3 = new File(var2, '.' + var1 + '/');
break;
case 3:
String var4 = System.getenv("APPDATA");
if(var4 != null) {
var3 = new File(var4, "." + var1 + '/');
} else {
var3 = new File(var2, '.' + var1 + '/');
}
break;
case 4:
var3 = new File(var2, "Library/Application Support/" + var1);
break;
default:
var3 = new File(var2, var1 + '/');
}
if(!var3.exists() && !var3.mkdirs()) {
throw new RuntimeException("The working directory could not be created: " + var3);
} else {
return var3;
}
}
private static EnumOS1 getOs() {
String var0 = System.getProperty("os.name").toLowerCase();
return var0.contains("win") ? EnumOS1.windows : (var0.contains("mac") ? EnumOS1.macos : (var0.contains("solaris") ? EnumOS1.solaris : (var0.contains("sunos") ? EnumOS1.solaris : (var0.contains("linux") ? EnumOS1.linux : (var0.contains("unix") ? EnumOS1.linux : EnumOS1.unknown)))));
}
public CanvasIsomPreview() {
for(int var1 = 0; var1 < 64; ++var1) {
for(int var2 = 0; var2 < 64; ++var2) {
this.imageBuffers[var1][var2] = new IsoImageBuffer((World)null, var1, var2);
}
}
this.addMouseListener(this);
this.addMouseMotionListener(this);
this.addKeyListener(this);
this.setFocusable(true);
this.requestFocus();
this.setBackground(Color.red);
}
public void loadWorld(String var1) {
this.field_1785_i = this.field_1784_j = 0;
this.worldObj = new World(new SaveHandler(new File(this.dataFolder, "saves"), var1, false), var1, (new Random()).nextLong());
this.worldObj.skylightSubtracted = 0;
List var2 = this.imageBufferList;
synchronized(var2) {
this.imageBufferList.clear();
for(int var3 = 0; var3 < 64; ++var3) {
for(int var4 = 0; var4 < 64; ++var4) {
this.imageBuffers[var3][var4].func_888_a(this.worldObj, var3, var4);
}
}
}
}
private void setTimeOfDay(int var1) {
List var2 = this.imageBufferList;
synchronized(var2) {
this.worldObj.skylightSubtracted = var1;
this.imageBufferList.clear();
for(int var3 = 0; var3 < 64; ++var3) {
for(int var4 = 0; var4 < 64; ++var4) {
this.imageBuffers[var3][var4].func_888_a(this.worldObj, var3, var4);
}
}
}
}
public void func_1272_b() {
(new ThreadRunIsoClient(this)).start();
for(int var1 = 0; var1 < 8; ++var1) {
(new Thread(this)).start();
}
}
public void exit() {
this.running = false;
}
private IsoImageBuffer getImageBuffer(int var1, int var2) {
int var3 = var1 & 63;
int var4 = var2 & 63;
IsoImageBuffer var5 = this.imageBuffers[var3][var4];
if(var5.field_1354_c == var1 && var5.field_1353_d == var2) {
return var5;
} else {
List var6 = this.imageBufferList;
synchronized(var6) {
this.imageBufferList.remove(var5);
}
var5.func_889_a(var1, var2);
return var5;
}
}
public void run() {
TerrainTextureManager var1 = new TerrainTextureManager();
while(this.running) {
IsoImageBuffer var2 = null;
List var3 = this.imageBufferList;
synchronized(var3) {
if(this.imageBufferList.size() > 0) {
var2 = (IsoImageBuffer)this.imageBufferList.remove(0);
}
}
if(var2 != null) {
if(this.field_1793_a - var2.field_1350_g < 2) {
var1.func_799_a(var2);
this.repaint();
} else {
var2.field_1349_h = false;
}
}
try {
Thread.sleep(2L);
} catch (InterruptedException var5) {
var5.printStackTrace();
}
}
}
public void update(Graphics var1) {
}
public void paint(Graphics var1) {
}
public void showNextBuffer() {
BufferStrategy var1 = this.getBufferStrategy();
if(var1 == null) {
this.createBufferStrategy(2);
} else {
this.drawScreen((Graphics2D)var1.getDrawGraphics());
var1.show();
}
}
public void drawScreen(Graphics2D var1) {
++this.field_1793_a;
AffineTransform var2 = var1.getTransform();
var1.setClip(0, 0, this.getWidth(), this.getHeight());
var1.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
var1.translate(this.getWidth() / 2, this.getHeight() / 2);
var1.scale((double)this.zoomLevel, (double)this.zoomLevel);
var1.translate(this.field_1785_i, this.field_1784_j);
if(this.worldObj != null) {
ChunkCoordinates var3 = this.worldObj.getSpawnPoint();
var1.translate(-(var3.x + var3.z), -(-var3.x + var3.z) + 64);
}
Rectangle var17 = var1.getClipBounds();
var1.setColor(new Color(-15724512));
var1.fillRect(var17.x, var17.y, var17.width, var17.height);
byte var4 = 16;
byte var5 = 3;
int var6 = var17.x / var4 / 2 - 2 - var5;
int var7 = (var17.x + var17.width) / var4 / 2 + 1 + var5;
int var8 = var17.y / var4 - 1 - var5 * 2;
int var9 = (var17.y + var17.height + 16 + 128) / var4 + 1 + var5 * 2;
int var10;
for(var10 = var8; var10 <= var9; ++var10) {
for(int var11 = var6; var11 <= var7; ++var11) {
int var12 = var11 - (var10 >> 1);
int var13 = var11 + (var10 + 1 >> 1);
IsoImageBuffer var14 = this.getImageBuffer(var12, var13);
var14.field_1350_g = this.field_1793_a;
if(!var14.field_1352_e) {
if(!var14.field_1349_h) {
var14.field_1349_h = true;
this.imageBufferList.add(var14);
}
} else {
var14.field_1349_h = false;
if(!var14.field_1351_f) {
int var15 = var11 * var4 * 2 + (var10 & 1) * var4;
int var16 = var10 * var4 - 128 - 16;
var1.drawImage(var14.field_1348_a, var15, var16, (ImageObserver)null);
}
}
}
}
if(this.displayHelpText) {
var1.setTransform(var2);
var10 = this.getHeight() - 32 - 4;
var1.setColor(new Color(Integer.MIN_VALUE, true));
var1.fillRect(4, this.getHeight() - 32 - 4, this.getWidth() - 8, 32);
var1.setColor(Color.WHITE);
String var18 = "F1 - F5: load levels | 0-9: Set time of day | Space: return to spawn | Double click: zoom | Escape: hide this text";
var1.drawString(var18, this.getWidth() / 2 - var1.getFontMetrics().stringWidth(var18) / 2, var10 + 20);
}
var1.dispose();
}
public void mouseDragged(MouseEvent var1) {
int var2 = var1.getX() / this.zoomLevel;
int var3 = var1.getY() / this.zoomLevel;
this.field_1785_i += var2 - this.xPosition;
this.field_1784_j += var3 - this.yPosition;
this.xPosition = var2;
this.yPosition = var3;
this.repaint();
}
public void mouseMoved(MouseEvent var1) {
}
public void mouseClicked(MouseEvent var1) {
if(var1.getClickCount() == 2) {
this.zoomLevel = 3 - this.zoomLevel;
this.repaint();
}
}
public void mouseEntered(MouseEvent var1) {
}
public void mouseExited(MouseEvent var1) {
}
public void mousePressed(MouseEvent var1) {
int var2 = var1.getX() / this.zoomLevel;
int var3 = var1.getY() / this.zoomLevel;
this.xPosition = var2;
this.yPosition = var3;
}
public void mouseReleased(MouseEvent var1) {
}
public void keyPressed(KeyEvent var1) {
if(var1.getKeyCode() == 48) {
this.setTimeOfDay(11);
}
if(var1.getKeyCode() == 49) {
this.setTimeOfDay(10);
}
if(var1.getKeyCode() == 50) {
this.setTimeOfDay(9);
}
if(var1.getKeyCode() == 51) {
this.setTimeOfDay(7);
}
if(var1.getKeyCode() == 52) {
this.setTimeOfDay(6);
}
if(var1.getKeyCode() == 53) {
this.setTimeOfDay(5);
}
if(var1.getKeyCode() == 54) {
this.setTimeOfDay(3);
}
if(var1.getKeyCode() == 55) {
this.setTimeOfDay(2);
}
if(var1.getKeyCode() == 56) {
this.setTimeOfDay(1);
}
if(var1.getKeyCode() == 57) {
this.setTimeOfDay(0);
}
if(var1.getKeyCode() == 112) {
this.loadWorld("World1");
}
if(var1.getKeyCode() == 113) {
this.loadWorld("World2");
}
if(var1.getKeyCode() == 114) {
this.loadWorld("World3");
}
if(var1.getKeyCode() == 115) {
this.loadWorld("World4");
}
if(var1.getKeyCode() == 116) {
this.loadWorld("World5");
}
if(var1.getKeyCode() == 32) {
this.field_1785_i = this.field_1784_j = 0;
}
if(var1.getKeyCode() == 27) {
this.displayHelpText = !this.displayHelpText;
}
this.repaint();
}
public void keyReleased(KeyEvent var1) {
}
public void keyTyped(KeyEvent var1) {
}
static boolean isRunning(CanvasIsomPreview var0) {
return var0.running;
}
}

View File

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

View File

@ -1,29 +0,0 @@
package net.minecraft.src;
import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.io.IOException;
import javax.imageio.ImageIO;
class CanvasMojangLogo extends Canvas {
private BufferedImage logo;
public CanvasMojangLogo() {
try {
this.logo = ImageIO.read(PanelCrashReport.class.getResource("/gui/logo.png"));
} catch (IOException var2) {
}
byte var1 = 100;
this.setPreferredSize(new Dimension(var1, var1));
this.setMinimumSize(new Dimension(var1, var1));
}
public void paint(Graphics var1) {
super.paint(var1);
var1.drawImage(this.logo, this.getWidth() / 2 - this.logo.getWidth() / 2, 32, (ImageObserver)null);
}
}

View File

@ -1,11 +0,0 @@
package net.minecraft.src;
import java.io.IOException;
import java.io.InputStream;
import paulscode.sound.codecs.CodecJOrbis;
public class CodecMus extends CodecJOrbis {
protected InputStream openInputStream() throws IOException {
return new MusInputStream(this, this.url, this.urlConnection.getInputStream());
}
}

View File

@ -75,7 +75,7 @@ public abstract class EntityLiving extends Entity {
}
public String getEntityTexture() {
return this.texture;
return "mob/char.png";
}
public boolean canBeCollidedWith() {

View File

@ -5,10 +5,7 @@ import java.util.List;
import java.util.Random;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.opengl.NVFogDistance;
import org.lwjgl.util.glu.GLU;
public class EntityRenderer {
@ -327,7 +324,7 @@ public class EntityRenderer {
}
public void updateCameraAndRender(float var1) {
if(!Display.isActive()) {
if(!GL11.hasBeenActive()) {
if(System.currentTimeMillis() - this.prevFrameTime > 500L) {
this.mc.displayInGameMenu();
}
@ -475,9 +472,6 @@ public class EntityRenderer {
GL11.glEnable(GL11.GL_FOG);
this.setupFog(1, var1);
if(this.mc.gameSettings.ambientOcclusion) {
GL11.glShadeModel(GL11.GL_SMOOTH);
}
Frustrum var19 = new Frustrum();
var19.setPosition(var7, var9, var11);
@ -496,7 +490,6 @@ public class EntityRenderer {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
RenderHelper.disableStandardItemLighting();
var5.sortAndRender(var4, 0, (double)var1);
GL11.glShadeModel(GL11.GL_FLAT);
RenderHelper.enableStandardItemLighting();
var5.renderEntities(var4.getPosition(var1), var19, var1);
var6.func_1187_b(var4, var1);
@ -518,10 +511,6 @@ public class EntityRenderer {
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
if(this.mc.gameSettings.fancyGraphics) {
if(this.mc.gameSettings.ambientOcclusion) {
GL11.glShadeModel(GL11.GL_SMOOTH);
}
GL11.glColorMask(false, false, false, false);
var16 = var5.sortAndRender(var4, 1, (double)var1);
if(this.mc.gameSettings.anaglyph) {
@ -537,8 +526,6 @@ public class EntityRenderer {
if(var16 > 0) {
var5.renderAllRenderLists(1, (double)var1);
}
GL11.glShadeModel(GL11.GL_FLAT);
} else {
var5.sortAndRender(var4, 1, (double)var1);
}
@ -904,10 +891,6 @@ public class EntityRenderer {
GL11.glFogf(GL11.GL_FOG_END, this.farPlaneDistance * 0.8F);
}
if(GLContext.getCapabilities().GL_NV_fog_distance) {
GL11.glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV);
}
if(this.mc.theWorld.worldProvider.isNether) {
GL11.glFogf(GL11.GL_FOG_START, 0.0F);
}

View File

@ -1,11 +1,11 @@
package net.minecraft.src;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.nio.IntBuffer;
import javax.imageio.ImageIO;
import org.lwjgl.opengl.GL11;
import net.lax1dude.eaglercraft.BufferedImage;
import net.lax1dude.eaglercraft.ImageIO;
public class FontRenderer {
private int[] charWidth = new int[256];
public int fontTextureName = 0;
@ -15,8 +15,8 @@ public class FontRenderer {
public FontRenderer(GameSettings var1, String var2, RenderEngine var3) {
BufferedImage var4;
try {
var4 = ImageIO.read(RenderEngine.class.getResourceAsStream(var2));
} catch (IOException var18) {
var4 = ImageIO.read(GL11.getResourceAsStream(var2));
} catch (Exception var18) {
throw new RuntimeException(var18);
}

View File

@ -20,12 +20,11 @@ public class GLAllocation {
}
public static synchronized void generateTextureNames(IntBuffer var0) {
GL11.glGenTextures(var0);
for(int var1 = var0.position(); var1 < var0.limit(); ++var1) {
textureNames.add(Integer.valueOf(var0.get(var1)));
for (int i = var0.position(); i < var0.limit(); i++) {
int tx = GL11.glGenTextures();
var0.put(i, tx);
textureNames.add(Integer.valueOf(tx));
}
}
public static synchronized void func_28194_b(int var0) {
@ -36,34 +35,28 @@ public class GLAllocation {
}
public static synchronized void deleteTexturesAndDisplayLists() {
for(int var0 = 0; var0 < displayLists.size(); var0 += 2) {
GL11.glDeleteLists(((Integer)displayLists.get(var0)).intValue(), ((Integer)displayLists.get(var0 + 1)).intValue());
for (int i = 0; i < displayLists.size(); i += 2) {
GL11.glDeleteLists(((Integer) displayLists.get(i)).intValue(),
((Integer) displayLists.get(i + 1)).intValue());
}
IntBuffer var2 = createDirectIntBuffer(textureNames.size());
var2.flip();
GL11.glDeleteTextures(var2);
for(int var1 = 0; var1 < textureNames.size(); ++var1) {
var2.put(((Integer)textureNames.get(var1)).intValue());
for (int j = 0; j < textureNames.size(); j++) {
GL11.glDeleteTextures(((Integer) textureNames.get(j)).intValue());
}
var2.flip();
GL11.glDeleteTextures(var2);
displayLists.clear();
textureNames.clear();
}
public static synchronized ByteBuffer createDirectByteBuffer(int var0) {
ByteBuffer var1 = ByteBuffer.allocateDirect(var0).order(ByteOrder.nativeOrder());
return var1;
public static ByteBuffer createDirectByteBuffer(int par0) {
return GL11.isWebGL ? ByteBuffer.wrap(new byte[par0]).order(ByteOrder.nativeOrder()) : ByteBuffer.allocateDirect(par0).order(ByteOrder.nativeOrder());
}
public static IntBuffer createDirectIntBuffer(int var0) {
return createDirectByteBuffer(var0 << 2).asIntBuffer();
public static IntBuffer createDirectIntBuffer(int par0) {
return GL11.isWebGL ? IntBuffer.wrap(new int[par0]) : createDirectByteBuffer(par0 << 2).asIntBuffer();
}
public static FloatBuffer createDirectFloatBuffer(int var0) {
return createDirectByteBuffer(var0 << 2).asFloatBuffer();
public static FloatBuffer createDirectFloatBuffer(int par0) {
return GL11.isWebGL ? FloatBuffer.wrap(new float[par0]) : createDirectByteBuffer(par0 << 2).asFloatBuffer();
}
}

View File

@ -1,27 +0,0 @@
package net.minecraft.src;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import net.minecraft.client.Minecraft;
public final class GameWindowListener extends WindowAdapter {
final Minecraft mc;
final Thread mcThread;
public GameWindowListener(Minecraft var1, Thread var2) {
this.mc = var1;
this.mcThread = var2;
}
public void windowClosing(WindowEvent var1) {
this.mc.shutdown();
try {
this.mcThread.join();
} catch (InterruptedException var3) {
var3.printStackTrace();
}
System.exit(0);
}
}

View File

@ -71,7 +71,6 @@ public class Gui {
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator var15 = Tessellator.instance;
var15.startDrawingQuads();
var15.setColorRGBA_F(var8, var9, var10, var7);
@ -81,7 +80,6 @@ public class Gui {
var15.addVertex((double)var1, (double)var4, 0.0D);
var15.addVertex((double)var3, (double)var4, 0.0D);
var15.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);

View File

@ -9,7 +9,7 @@ public class GuiConnecting extends GuiScreen {
public GuiConnecting(Minecraft var1, String var2, int var3) {
System.out.println("Connecting to " + var2 + ", " + var3);
var1.changeWorld1((World)null);
(new ThreadConnectToServer(this, var1, var2, var3)).start();
//(new ThreadConnectToServer(this, var1, var2, var3)).start();
}
public void updateScreen() {

View File

@ -140,7 +140,7 @@ public abstract class GuiContainer extends GuiScreen {
}
if(var8 != -1) {
boolean var9 = var8 != -999 && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT));
boolean var9 = var8 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54));
this.mc.playerController.func_27174_a(this.inventorySlots.windowId, var8, var3, var9, this.mc.thePlayer);
}
}

View File

@ -62,13 +62,10 @@ public class GuiMainMenu extends GuiScreen {
int var4 = this.height / 4 + 48;
this.controlList.add(new GuiButton(1, this.width / 2 - 100, var4, var2.translateKey("menu.singleplayer")));
this.controlList.add(this.multiplayerButton = new GuiButton(2, this.width / 2 - 100, var4 + 24, var2.translateKey("menu.multiplayer")));
this.controlList.add(new GuiButton(3, this.width / 2 - 100, var4 + 48, var2.translateKey("menu.mods")));
if(this.mc.hideQuitButton) {
GuiButton button;
this.controlList.add(button = new GuiButton(3, this.width / 2 - 100, var4 + 48, var2.translateKey("menu.mods")));
button.enabled = false;
this.controlList.add(new GuiButton(0, this.width / 2 - 100, var4 + 72, var2.translateKey("menu.options")));
} else {
this.controlList.add(new GuiButton(0, this.width / 2 - 100, var4 + 72 + 12, 98, 20, var2.translateKey("menu.options")));
this.controlList.add(new GuiButton(4, this.width / 2 + 2, var4 + 72 + 12, 98, 20, var2.translateKey("menu.quit")));
}
if(this.mc.session == null) {
this.multiplayerButton.enabled = false;
@ -89,10 +86,6 @@ public class GuiMainMenu extends GuiScreen {
this.mc.displayGuiScreen(new GuiMultiplayer(this));
}
if(var1.id == 3) {
this.mc.displayGuiScreen(new GuiTexturePacks(this));
}
if(var1.id == 4) {
this.mc.shutdown();
}

View File

@ -115,11 +115,6 @@ public class GuiScreen extends Gui {
public void handleKeyboardInput() {
if(Keyboard.getEventKeyState()) {
if(Keyboard.getEventKey() == Keyboard.KEY_F11) {
this.mc.toggleFullscreen();
return;
}
this.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
}

View File

@ -237,7 +237,6 @@ public abstract class GuiSlot {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_TEXTURE_2D);
var16.startDrawingQuads();
var16.setColorRGBA_I(0, 0);
@ -296,7 +295,6 @@ public abstract class GuiSlot {
this.func_27257_b(var1, var2);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
}

View File

@ -1,53 +0,0 @@
package net.minecraft.src;
import java.util.List;
import org.lwjgl.opengl.GL11;
class GuiTexturePackSlot extends GuiSlot {
final GuiTexturePacks parentTexturePackGui;
public GuiTexturePackSlot(GuiTexturePacks var1) {
super(GuiTexturePacks.func_22124_a(var1), var1.width, var1.height, 32, var1.height - 55 + 4, 36);
this.parentTexturePackGui = var1;
}
protected int getSize() {
List var1 = GuiTexturePacks.func_22126_b(this.parentTexturePackGui).texturePackList.availableTexturePacks();
return var1.size();
}
protected void elementClicked(int var1, boolean var2) {
List var3 = GuiTexturePacks.func_22119_c(this.parentTexturePackGui).texturePackList.availableTexturePacks();
GuiTexturePacks.func_22122_d(this.parentTexturePackGui).texturePackList.setTexturePack((TexturePackBase)var3.get(var1));
GuiTexturePacks.func_22117_e(this.parentTexturePackGui).renderEngine.refreshTextures();
}
protected boolean isSelected(int var1) {
List var2 = GuiTexturePacks.func_22118_f(this.parentTexturePackGui).texturePackList.availableTexturePacks();
return GuiTexturePacks.func_22116_g(this.parentTexturePackGui).texturePackList.selectedTexturePack == var2.get(var1);
}
protected int getContentHeight() {
return this.getSize() * 36;
}
protected void drawBackground() {
this.parentTexturePackGui.drawDefaultBackground();
}
protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5) {
TexturePackBase var6 = (TexturePackBase)GuiTexturePacks.func_22121_h(this.parentTexturePackGui).texturePackList.availableTexturePacks().get(var1);
var6.bindThumbnailTexture(GuiTexturePacks.func_22123_i(this.parentTexturePackGui));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
var5.startDrawingQuads();
var5.setColorOpaque_I(16777215);
var5.addVertexWithUV((double)var2, (double)(var3 + var4), 0.0D, 0.0D, 1.0D);
var5.addVertexWithUV((double)(var2 + 32), (double)(var3 + var4), 0.0D, 1.0D, 1.0D);
var5.addVertexWithUV((double)(var2 + 32), (double)var3, 0.0D, 1.0D, 0.0D);
var5.addVertexWithUV((double)var2, (double)var3, 0.0D, 0.0D, 0.0D);
var5.draw();
this.parentTexturePackGui.drawString(GuiTexturePacks.func_22127_j(this.parentTexturePackGui), var6.texturePackFileName, var2 + 32 + 2, var3 + 1, 16777215);
this.parentTexturePackGui.drawString(GuiTexturePacks.func_22120_k(this.parentTexturePackGui), var6.firstDescriptionLine, var2 + 32 + 2, var3 + 12, 8421504);
this.parentTexturePackGui.drawString(GuiTexturePacks.func_22125_l(this.parentTexturePackGui), var6.secondDescriptionLine, var2 + 32 + 2, var3 + 12 + 10, 8421504);
}
}

View File

@ -1,114 +0,0 @@
package net.minecraft.src;
import java.io.File;
import net.minecraft.client.Minecraft;
import org.lwjgl.Sys;
public class GuiTexturePacks extends GuiScreen {
protected GuiScreen guiScreen;
private int field_6454_o = -1;
private String fileLocation = "";
private GuiTexturePackSlot guiTexturePackSlot;
public GuiTexturePacks(GuiScreen var1) {
this.guiScreen = var1;
}
public void initGui() {
StringTranslate var1 = StringTranslate.getInstance();
this.controlList.add(new GuiSmallButton(5, this.width / 2 - 154, this.height - 48, var1.translateKey("texturePack.openFolder")));
this.controlList.add(new GuiSmallButton(6, this.width / 2 + 4, this.height - 48, var1.translateKey("gui.done")));
this.mc.texturePackList.updateAvaliableTexturePacks();
this.fileLocation = (new File(Minecraft.getMinecraftDir(), "texturepacks")).getAbsolutePath();
this.guiTexturePackSlot = new GuiTexturePackSlot(this);
this.guiTexturePackSlot.registerScrollButtons(this.controlList, 7, 8);
}
protected void actionPerformed(GuiButton var1) {
if(var1.enabled) {
if(var1.id == 5) {
Sys.openURL("file://" + this.fileLocation);
} else if(var1.id == 6) {
this.mc.renderEngine.refreshTextures();
this.mc.displayGuiScreen(this.guiScreen);
} else {
this.guiTexturePackSlot.actionPerformed(var1);
}
}
}
protected void mouseClicked(int var1, int var2, int var3) {
super.mouseClicked(var1, var2, var3);
}
protected void mouseMovedOrUp(int var1, int var2, int var3) {
super.mouseMovedOrUp(var1, var2, var3);
}
public void drawScreen(int var1, int var2, float var3) {
this.guiTexturePackSlot.drawScreen(var1, var2, var3);
if(this.field_6454_o <= 0) {
this.mc.texturePackList.updateAvaliableTexturePacks();
this.field_6454_o += 20;
}
StringTranslate var4 = StringTranslate.getInstance();
this.drawCenteredString(this.fontRenderer, var4.translateKey("texturePack.title"), this.width / 2, 16, 16777215);
this.drawCenteredString(this.fontRenderer, var4.translateKey("texturePack.folderInfo"), this.width / 2 - 77, this.height - 26, 8421504);
super.drawScreen(var1, var2, var3);
}
public void updateScreen() {
super.updateScreen();
--this.field_6454_o;
}
static Minecraft func_22124_a(GuiTexturePacks var0) {
return var0.mc;
}
static Minecraft func_22126_b(GuiTexturePacks var0) {
return var0.mc;
}
static Minecraft func_22119_c(GuiTexturePacks var0) {
return var0.mc;
}
static Minecraft func_22122_d(GuiTexturePacks var0) {
return var0.mc;
}
static Minecraft func_22117_e(GuiTexturePacks var0) {
return var0.mc;
}
static Minecraft func_22118_f(GuiTexturePacks var0) {
return var0.mc;
}
static Minecraft func_22116_g(GuiTexturePacks var0) {
return var0.mc;
}
static Minecraft func_22121_h(GuiTexturePacks var0) {
return var0.mc;
}
static Minecraft func_22123_i(GuiTexturePacks var0) {
return var0.mc;
}
static FontRenderer func_22127_j(GuiTexturePacks var0) {
return var0.fontRenderer;
}
static FontRenderer func_22120_k(GuiTexturePacks var0) {
return var0.fontRenderer;
}
static FontRenderer func_22125_l(GuiTexturePacks var0) {
return var0.fontRenderer;
}
}

View File

@ -1,7 +1,6 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
public class LoadingScreenRenderer implements IProgressUpdate {
@ -110,7 +109,7 @@ public class LoadingScreenRenderer implements IProgressUpdate {
this.mc.fontRenderer.drawStringWithShadow(this.field_1007_c, (var5 - this.mc.fontRenderer.getStringWidth(this.field_1007_c)) / 2, var6 / 2 - 4 - 16, 16777215);
this.mc.fontRenderer.drawStringWithShadow(this.field_1004_a, (var5 - this.mc.fontRenderer.getStringWidth(this.field_1004_a)) / 2, var6 / 2 - 4 + 8, 16777215);
Display.update();
GL11.updateDisplay();
try {
Thread.yield();

View File

@ -1,9 +1,10 @@
package net.minecraft.src;
import java.awt.image.BufferedImage;
import java.util.Iterator;
import org.lwjgl.opengl.GL11;
import net.lax1dude.eaglercraft.BufferedImage;
public class MapItemRenderer {
private int[] field_28159_a = new int[16384];
private int field_28158_b;

View File

@ -1,23 +0,0 @@
package net.minecraft.src;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Component;
import net.minecraft.client.Minecraft;
import net.minecraft.client.MinecraftApplet;
public class MinecraftAppletImpl extends Minecraft {
final MinecraftApplet mainFrame;
public MinecraftAppletImpl(MinecraftApplet var1, Component var2, Canvas var3, MinecraftApplet var4, int var5, int var6, boolean var7) {
super(var2, var3, var4, var5, var6, var7);
this.mainFrame = var1;
}
public void displayUnexpectedThrowable(UnexpectedThrowable var1) {
this.mainFrame.removeAll();
this.mainFrame.setLayout(new BorderLayout());
this.mainFrame.add(new PanelCrashReport(var1), "Center");
this.mainFrame.validate();
}
}

View File

@ -1,22 +0,0 @@
package net.minecraft.src;
import java.awt.Canvas;
import java.awt.Component;
import java.awt.Frame;
import net.minecraft.client.Minecraft;
import net.minecraft.client.MinecraftApplet;
public final class MinecraftImpl extends Minecraft {
final Frame mcFrame;
public MinecraftImpl(Component var1, Canvas var2, MinecraftApplet var3, int var4, int var5, boolean var6, Frame var7) {
super(var1, var2, var3, var4, var5, var6);
this.mcFrame = var7;
}
public void displayUnexpectedThrowable(UnexpectedThrowable var1) {
this.mcFrame.removeAll();
this.mcFrame.add(new PanelCrashReport(var1), "Center");
this.mcFrame.validate();
}
}

View File

@ -1,31 +1,12 @@
package net.minecraft.src;
import java.awt.Component;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Cursor;
import org.lwjgl.input.Mouse;
import net.PeytonPlayz585.input.Mouse;
public class MouseHelper {
private Component field_1117_c;
private Cursor cursor;
public int deltaX;
public int deltaY;
private int field_1115_e = 10;
public MouseHelper(Component var1) {
this.field_1117_c = var1;
IntBuffer var2 = GLAllocation.createDirectIntBuffer(1);
var2.put(0);
var2.flip();
IntBuffer var3 = GLAllocation.createDirectIntBuffer(1024);
try {
this.cursor = new Cursor(32, 32, 16, 16, 1, var3, var2);
} catch (LWJGLException var5) {
var5.printStackTrace();
}
public MouseHelper() {
}
public void grabMouseCursor() {
@ -35,7 +16,6 @@ public class MouseHelper {
}
public void ungrabMouseCursor() {
Mouse.setCursorPosition(this.field_1117_c.getWidth() / 2, this.field_1117_c.getHeight() / 2);
Mouse.setGrabbed(false);
}

View File

@ -1,37 +0,0 @@
package net.minecraft.src;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
class MusInputStream extends InputStream {
private int hash;
private InputStream inputStream;
byte[] buffer;
final CodecMus codec;
public MusInputStream(CodecMus var1, URL var2, InputStream var3) {
this.codec = var1;
this.buffer = new byte[1];
this.inputStream = var3;
String var4 = var2.getPath();
var4 = var4.substring(var4.lastIndexOf("/") + 1);
this.hash = var4.hashCode();
}
public int read() throws IOException {
int var1 = this.read(this.buffer, 0, 1);
return var1 < 0 ? var1 : this.buffer[0];
}
public int read(byte[] var1, int var2, int var3) throws IOException {
var3 = this.inputStream.read(var1, var2, var3);
for(int var4 = 0; var4 < var3; ++var4) {
byte var5 = var1[var2 + var4] = (byte)(var1[var2 + var4] ^ this.hash >> 8);
this.hash = this.hash * 498729871 + 85731 * var5;
}
return var3;
}
}

View File

@ -1,12 +1,10 @@
package net.minecraft.src;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.Socket;
import java.net.URL;
import java.net.UnknownHostException;
//import java.net.InetAddress;
//import java.net.Socket;
//import java.net.URL;
//import java.net.UnknownHostException;
import java.util.List;
import java.util.Random;
import net.minecraft.client.Minecraft;
@ -21,10 +19,10 @@ public class NetClientHandler extends NetHandler {
public MapStorage field_28118_b = new MapStorage((ISaveHandler)null);
Random rand = new Random();
public NetClientHandler(Minecraft var1, String var2, int var3) throws IOException, UnknownHostException {
public NetClientHandler(Minecraft var1, String var2, int var3) throws IOException {
this.mc = var1;
Socket var4 = new Socket(InetAddress.getByName(var2), var3);
this.netManager = new NetworkManager(var4, "Client", this);
//Socket var4 = new Socket(InetAddress.getByName(var2), var3);
//this.netManager = new NetworkManager(var4, "Client", this);
}
public void processReadPackets() {
@ -379,25 +377,7 @@ public class NetClientHandler extends NetHandler {
}
public void handleHandshake(Packet2Handshake var1) {
if(var1.username.equals("-")) {
this.addToSendQueue(new Packet1Login(this.mc.session.username, 14));
} else {
try {
URL var2 = new URL("http://www.minecraft.net/game/joinserver.jsp?user=" + this.mc.session.username + "&sessionId=" + this.mc.session.sessionId + "&serverId=" + var1.username);
BufferedReader var3 = new BufferedReader(new InputStreamReader(var2.openStream()));
String var4 = var3.readLine();
var3.close();
if(var4.equalsIgnoreCase("ok")) {
this.addToSendQueue(new Packet1Login(this.mc.session.username, 14));
} else {
this.netManager.networkShutdown("disconnect.loginFailedInfo", new Object[]{var4});
}
} catch (Exception var5) {
var5.printStackTrace();
this.netManager.networkShutdown("disconnect.genericReason", new Object[]{"Internal client error: " + var5.toString()});
}
}
}
public void disconnect() {

View File

@ -4,9 +4,9 @@ import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
//import java.net.Socket;
//import java.net.SocketAddress;
//import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -16,8 +16,8 @@ public class NetworkManager {
public static int numReadThreads;
public static int numWriteThreads;
private Object sendQueueLock = new Object();
private Socket networkSocket;
private final SocketAddress remoteSocketAddress;
//private Socket networkSocket;
//private final SocketAddress remoteSocketAddress;
private DataInputStream socketInputStream;
private DataOutputStream socketOutputStream;
private boolean isRunning = true;
@ -38,25 +38,25 @@ public class NetworkManager {
public int chunkDataSendCounter = 0;
private int field_20100_w = 50;
public NetworkManager(Socket var1, String var2, NetHandler var3) throws IOException {
this.networkSocket = var1;
this.remoteSocketAddress = var1.getRemoteSocketAddress();
this.netHandler = var3;
try {
var1.setSoTimeout(30000);
var1.setTrafficClass(24);
} catch (SocketException var5) {
System.err.println(var5.getMessage());
}
this.socketInputStream = new DataInputStream(var1.getInputStream());
this.socketOutputStream = new DataOutputStream(new BufferedOutputStream(var1.getOutputStream(), 5120));
this.readThread = new NetworkReaderThread(this, var2 + " read thread");
this.writeThread = new NetworkWriterThread(this, var2 + " write thread");
this.readThread.start();
this.writeThread.start();
}
// public NetworkManager(Socket var1, String var2, NetHandler var3) throws IOException {
// this.networkSocket = var1;
// this.remoteSocketAddress = var1.getRemoteSocketAddress();
// this.netHandler = var3;
//
// try {
// var1.setSoTimeout(30000);
// var1.setTrafficClass(24);
// } catch (SocketException var5) {
// System.err.println(var5.getMessage());
// }
//
// this.socketInputStream = new DataInputStream(var1.getInputStream());
// this.socketOutputStream = new DataOutputStream(new BufferedOutputStream(var1.getOutputStream(), 5120));
// this.readThread = new NetworkReaderThread(this, var2 + " read thread");
// this.writeThread = new NetworkWriterThread(this, var2 + " write thread");
// this.readThread.start();
// this.writeThread.start();
// }
public void addToSendQueue(Packet var1) {
if(!this.isServerTerminating) {
@ -160,7 +160,7 @@ public class NetworkManager {
this.isTerminating = true;
this.terminationReason = var1;
this.field_20101_t = var2;
(new NetworkMasterThread(this)).start();
//(new NetworkMasterThread(this)).start();
this.isRunning = false;
try {
@ -176,8 +176,8 @@ public class NetworkManager {
}
try {
this.networkSocket.close();
this.networkSocket = null;
//this.networkSocket.close();
//this.networkSocket = null;
} catch (Throwable var4) {
}
@ -215,7 +215,7 @@ public class NetworkManager {
this.wakeThreads();
this.isServerTerminating = true;
this.readThread.interrupt();
(new ThreadCloseConnection(this)).start();
//(new ThreadCloseConnection(this)).start();
}
static boolean isRunning(NetworkManager var0) {

View File

@ -1,31 +0,0 @@
package net.minecraft.src;
class NetworkMasterThread extends Thread {
final NetworkManager netManager;
NetworkMasterThread(NetworkManager var1) {
this.netManager = var1;
}
public void run() {
try {
Thread.sleep(5000L);
if(NetworkManager.getReadThread(this.netManager).isAlive()) {
try {
NetworkManager.getReadThread(this.netManager).stop();
} catch (Throwable var3) {
}
}
if(NetworkManager.getWriteThread(this.netManager).isAlive()) {
try {
NetworkManager.getWriteThread(this.netManager).stop();
} catch (Throwable var2) {
}
}
} catch (InterruptedException var4) {
var4.printStackTrace();
}
}
}

View File

@ -1,54 +0,0 @@
package net.minecraft.src;
class NetworkReaderThread extends Thread {
final NetworkManager netManager;
NetworkReaderThread(NetworkManager var1, String var2) {
super(var2);
this.netManager = var1;
}
public void run() {
Object var1 = NetworkManager.threadSyncObject;
synchronized(var1) {
++NetworkManager.numReadThreads;
}
while(true) {
boolean var12 = false;
try {
var12 = true;
if(!NetworkManager.isRunning(this.netManager)) {
var12 = false;
break;
}
if(NetworkManager.isServerTerminating(this.netManager)) {
var12 = false;
break;
}
while(NetworkManager.readNetworkPacket(this.netManager)) {
}
try {
sleep(100L);
} catch (InterruptedException var15) {
}
} finally {
if(var12) {
Object var5 = NetworkManager.threadSyncObject;
synchronized(var5) {
--NetworkManager.numReadThreads;
}
}
}
}
var1 = NetworkManager.threadSyncObject;
synchronized(var1) {
--NetworkManager.numReadThreads;
}
}
}

View File

@ -1,63 +0,0 @@
package net.minecraft.src;
import java.io.IOException;
class NetworkWriterThread extends Thread {
final NetworkManager netManager;
NetworkWriterThread(NetworkManager var1, String var2) {
super(var2);
this.netManager = var1;
}
public void run() {
Object var1 = NetworkManager.threadSyncObject;
synchronized(var1) {
++NetworkManager.numWriteThreads;
}
while(true) {
boolean var13 = false;
try {
var13 = true;
if(!NetworkManager.isRunning(this.netManager)) {
var13 = false;
break;
}
while(NetworkManager.sendNetworkPacket(this.netManager)) {
}
try {
sleep(100L);
} catch (InterruptedException var16) {
}
try {
if(NetworkManager.func_28140_f(this.netManager) != null) {
NetworkManager.func_28140_f(this.netManager).flush();
}
} catch (IOException var18) {
if(!NetworkManager.func_28138_e(this.netManager)) {
NetworkManager.func_30005_a(this.netManager, var18);
}
var18.printStackTrace();
}
} finally {
if(var13) {
Object var5 = NetworkManager.threadSyncObject;
synchronized(var5) {
--NetworkManager.numWriteThreads;
}
}
}
}
var1 = NetworkManager.threadSyncObject;
synchronized(var1) {
--NetworkManager.numWriteThreads;
}
}
}

View File

@ -1,11 +0,0 @@
package net.minecraft.src;
import org.lwjgl.opengl.GLContext;
public class OpenGlCapsChecker {
private static boolean tryCheckOcclusionCapable = true;
public boolean checkARBOcclusion() {
return tryCheckOcclusionCapable && GLContext.getCapabilities().GL_ARB_occlusion_query;
}
}

View File

@ -1,28 +0,0 @@
package net.minecraft.src;
class OsMap {
static final int[] field_1193_a = new int[EnumOS1.values().length];
static {
try {
field_1193_a[EnumOS1.linux.ordinal()] = 1;
} catch (NoSuchFieldError var4) {
}
try {
field_1193_a[EnumOS1.solaris.ordinal()] = 2;
} catch (NoSuchFieldError var3) {
}
try {
field_1193_a[EnumOS1.windows.ordinal()] = 3;
} catch (NoSuchFieldError var2) {
}
try {
field_1193_a[EnumOS1.macos.ordinal()] = 4;
} catch (NoSuchFieldError var1) {
}
}
}

View File

@ -1,85 +0,0 @@
package net.minecraft.src;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Panel;
import java.awt.TextArea;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.lwjgl.Sys;
import org.lwjgl.opengl.GL11;
public class PanelCrashReport extends Panel {
public PanelCrashReport(UnexpectedThrowable var1) {
this.setBackground(new Color(3028036));
this.setLayout(new BorderLayout());
StringWriter var2 = new StringWriter();
var1.exception.printStackTrace(new PrintWriter(var2));
String var3 = var2.toString();
String var4 = "";
String var5 = "";
try {
var5 = var5 + "Generated " + (new SimpleDateFormat()).format(new Date()) + "\n";
var5 = var5 + "\n";
var5 = var5 + "Minecraft: Minecraft Beta 1.7.3\n";
var5 = var5 + "OS: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version") + "\n";
var5 = var5 + "Java: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor") + "\n";
var5 = var5 + "VM: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor") + "\n";
var5 = var5 + "LWJGL: " + Sys.getVersion() + "\n";
var4 = GL11.glGetString(GL11.GL_VENDOR);
var5 = var5 + "OpenGL: " + GL11.glGetString(GL11.GL_RENDERER) + " version " + GL11.glGetString(GL11.GL_VERSION) + ", " + GL11.glGetString(GL11.GL_VENDOR) + "\n";
} catch (Throwable var8) {
var5 = var5 + "[failed to get system properties (" + var8 + ")]\n";
}
var5 = var5 + "\n";
var5 = var5 + var3;
String var6 = "";
var6 = var6 + "\n";
var6 = var6 + "\n";
if(var3.contains("Pixel format not accelerated")) {
var6 = var6 + " Bad video card drivers! \n";
var6 = var6 + " ----------------------- \n";
var6 = var6 + "\n";
var6 = var6 + "Minecraft was unable to start because it failed to find an accelerated OpenGL mode.\n";
var6 = var6 + "This can usually be fixed by updating the video card drivers.\n";
if(var4.toLowerCase().contains("nvidia")) {
var6 = var6 + "\n";
var6 = var6 + "You might be able to find drivers for your video card here:\n";
var6 = var6 + " http://www.nvidia.com/\n";
} else if(var4.toLowerCase().contains("ati")) {
var6 = var6 + "\n";
var6 = var6 + "You might be able to find drivers for your video card here:\n";
var6 = var6 + " http://www.amd.com/\n";
}
} else {
var6 = var6 + " Minecraft has crashed! \n";
var6 = var6 + " ---------------------- \n";
var6 = var6 + "\n";
var6 = var6 + "Minecraft has stopped running because it encountered a problem.\n";
var6 = var6 + "\n";
var6 = var6 + "If you wish to report this, please copy this entire text and email it to support@mojang.com.\n";
var6 = var6 + "Please include a description of what you did when the error occured.\n";
}
var6 = var6 + "\n";
var6 = var6 + "\n";
var6 = var6 + "\n";
var6 = var6 + "--- BEGIN ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " --------\n";
var6 = var6 + var5;
var6 = var6 + "--- END ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " ----------\n";
var6 = var6 + "\n";
var6 = var6 + "\n";
TextArea var7 = new TextArea(var6, 0, 0, 1);
var7.setFont(new Font("Monospaced", 0, 12));
this.add(new CanvasMojangLogo(), "North");
this.add(new CanvasCrashReport(80), "East");
this.add(new CanvasCrashReport(80), "West");
this.add(new CanvasCrashReport(100), "South");
this.add(var7, "Center");
}
}

View File

@ -1,9 +1,6 @@
package net.minecraft.src;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
@ -13,9 +10,11 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.imageio.ImageIO;
import org.lwjgl.opengl.GL11;
import net.lax1dude.eaglercraft.BufferedImage;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.TextureGL;
public class RenderEngine {
public static boolean useMipmaps = false;
private HashMap textureMap = new HashMap();
@ -24,44 +23,39 @@ public class RenderEngine {
private IntBuffer singleIntBuffer = GLAllocation.createDirectIntBuffer(1);
private ByteBuffer imageData = GLAllocation.createDirectByteBuffer(1048576);
private List textureList = new ArrayList();
private Map urlToImageDataMap = new HashMap();
private GameSettings options;
private boolean clampTexture = false;
private boolean blurTexture = false;
private TexturePackList texturePack;
private BufferedImage missingTextureImage = new BufferedImage(64, 64, 2);
public RenderEngine(TexturePackList var1, GameSettings var2) {
this.texturePack = var1;
private BufferedImage missingTextureImage;
public RenderEngine(GameSettings var2) {
this.options = var2;
Graphics var3 = this.missingTextureImage.getGraphics();
var3.setColor(Color.WHITE);
var3.fillRect(0, 0, 64, 64);
var3.setColor(Color.BLACK);
var3.drawString("missingtex", 1, 10);
var3.dispose();
int[] missingTexture = new int[256];
for(int i = 0; i < 256; ++i) {
missingTexture[i] = ((i / 16 + (i % 16)) % 2 == 0) ? 0xffff00ff : 0xff000000;
}
this.missingTextureImage = new BufferedImage(16, 16, missingTexture, true);
}
public int[] func_28149_a(String var1) {
TexturePackBase var2 = this.texturePack.selectedTexturePack;
int[] var3 = (int[])this.field_28151_c.get(var1);
if(var3 != null) {
return var3;
} else {
try {
Object var6 = null;
if(var1.startsWith("##")) {
var3 = this.func_28148_b(this.unwrapImageByColumns(this.readTextureImage(var2.getResourceAsStream(var1.substring(2)))));
} else if(var1.startsWith("%clamp%")) {
if(var1.startsWith("%clamp%")) {
this.clampTexture = true;
var3 = this.func_28148_b(this.readTextureImage(var2.getResourceAsStream(var1.substring(7))));
var3 = this.func_28148_b(this.readTextureImage(GL11.getResourceAsStream(var1.substring(7))));
this.clampTexture = false;
} else if(var1.startsWith("%blur%")) {
this.blurTexture = true;
var3 = this.func_28148_b(this.readTextureImage(var2.getResourceAsStream(var1.substring(6))));
var3 = this.func_28148_b(this.readTextureImage(GL11.getResourceAsStream(var1.substring(6))));
this.blurTexture = false;
} else {
InputStream var7 = var2.getResourceAsStream(var1);
InputStream var7 = GL11.getResourceAsStream(var1);
if(var7 == null) {
var3 = this.func_28148_b(this.missingTextureImage);
} else {
@ -96,7 +90,6 @@ public class RenderEngine {
}
public int getTexture(String var1) {
TexturePackBase var2 = this.texturePack.selectedTexturePack;
Integer var3 = (Integer)this.textureMap.get(var1);
if(var3 != null) {
return var3.intValue();
@ -105,18 +98,16 @@ public class RenderEngine {
this.singleIntBuffer.clear();
GLAllocation.generateTextureNames(this.singleIntBuffer);
int var6 = this.singleIntBuffer.get(0);
if(var1.startsWith("##")) {
this.setupTexture(this.unwrapImageByColumns(this.readTextureImage(var2.getResourceAsStream(var1.substring(2)))), var6);
} else if(var1.startsWith("%clamp%")) {
if(var1.startsWith("%clamp%")) {
this.clampTexture = true;
this.setupTexture(this.readTextureImage(var2.getResourceAsStream(var1.substring(7))), var6);
this.setupTexture(this.readTextureImage(GL11.getResourceAsStream(var1.substring(7))), var6);
this.clampTexture = false;
} else if(var1.startsWith("%blur%")) {
this.blurTexture = true;
this.setupTexture(this.readTextureImage(var2.getResourceAsStream(var1.substring(6))), var6);
this.setupTexture(this.readTextureImage(GL11.getResourceAsStream(var1.substring(6))), var6);
this.blurTexture = false;
} else {
InputStream var7 = var2.getResourceAsStream(var1);
InputStream var7 = GL11.getResourceAsStream(var1);
if(var7 == null) {
this.setupTexture(this.missingTextureImage, var6);
} else {
@ -137,19 +128,6 @@ public class RenderEngine {
}
}
private BufferedImage unwrapImageByColumns(BufferedImage var1) {
int var2 = var1.getWidth() / 16;
BufferedImage var3 = new BufferedImage(16, var1.getHeight() * var2, 2);
Graphics var4 = var3.getGraphics();
for(int var5 = 0; var5 < var2; ++var5) {
var4.drawImage(var1, -var5 * 16, var5 * var1.getHeight(), (ImageObserver)null);
}
var4.dispose();
return var3;
}
public int allocateAndSetupTexture(BufferedImage var1) {
this.singleIntBuffer.clear();
GLAllocation.generateTextureNames(this.singleIntBuffer);
@ -299,48 +277,7 @@ public class RenderEngine {
this.singleIntBuffer.clear();
this.singleIntBuffer.put(var1);
this.singleIntBuffer.flip();
GL11.glDeleteTextures(this.singleIntBuffer);
}
public int getTextureForDownloadableImage(String var1, String var2) {
ThreadDownloadImageData var3 = (ThreadDownloadImageData)this.urlToImageDataMap.get(var1);
if(var3 != null && var3.image != null && !var3.textureSetupComplete) {
if(var3.textureName < 0) {
var3.textureName = this.allocateAndSetupTexture(var3.image);
} else {
this.setupTexture(var3.image, var3.textureName);
}
var3.textureSetupComplete = true;
}
return var3 != null && var3.textureName >= 0 ? var3.textureName : (var2 == null ? -1 : this.getTexture(var2));
}
public ThreadDownloadImageData obtainImageData(String var1, ImageBuffer var2) {
ThreadDownloadImageData var3 = (ThreadDownloadImageData)this.urlToImageDataMap.get(var1);
if(var3 == null) {
this.urlToImageDataMap.put(var1, new ThreadDownloadImageData(var1, var2));
} else {
++var3.referenceCount;
}
return var3;
}
public void releaseImageData(String var1) {
ThreadDownloadImageData var2 = (ThreadDownloadImageData)this.urlToImageDataMap.get(var1);
if(var2 != null) {
--var2.referenceCount;
if(var2.referenceCount == 0) {
if(var2.textureName >= 0) {
this.deleteTexture(var2.textureName);
}
this.urlToImageDataMap.remove(var1);
}
}
GL11.glDeleteTextures(var1);
}
public void registerTextureFX(TextureFX var1) {
@ -457,7 +394,6 @@ public class RenderEngine {
}
public void refreshTextures() {
TexturePackBase var1 = this.texturePack.selectedTexturePack;
Iterator var2 = this.textureNameToImageMap.keySet().iterator();
BufferedImage var4;
@ -467,11 +403,6 @@ public class RenderEngine {
this.setupTexture(var4, var3);
}
ThreadDownloadImageData var8;
for(var2 = this.urlToImageDataMap.values().iterator(); var2.hasNext(); var8.textureSetupComplete = false) {
var8 = (ThreadDownloadImageData)var2.next();
}
var2 = this.textureMap.keySet().iterator();
String var9;
@ -479,16 +410,14 @@ public class RenderEngine {
var9 = (String)var2.next();
try {
if(var9.startsWith("##")) {
var4 = this.unwrapImageByColumns(this.readTextureImage(var1.getResourceAsStream(var9.substring(2))));
} else if(var9.startsWith("%clamp%")) {
if(var9.startsWith("%clamp%")) {
this.clampTexture = true;
var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(7)));
var4 = this.readTextureImage(GL11.getResourceAsStream(var9.substring(7)));
} else if(var9.startsWith("%blur%")) {
this.blurTexture = true;
var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(6)));
var4 = this.readTextureImage(GL11.getResourceAsStream(var9.substring(6)));
} else {
var4 = this.readTextureImage(var1.getResourceAsStream(var9));
var4 = this.readTextureImage(GL11.getResourceAsStream(var9));
}
int var5 = ((Integer)this.textureMap.get(var9)).intValue();
@ -506,16 +435,14 @@ public class RenderEngine {
var9 = (String)var2.next();
try {
if(var9.startsWith("##")) {
var4 = this.unwrapImageByColumns(this.readTextureImage(var1.getResourceAsStream(var9.substring(2))));
} else if(var9.startsWith("%clamp%")) {
if(var9.startsWith("%clamp%")) {
this.clampTexture = true;
var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(7)));
var4 = this.readTextureImage(GL11.getResourceAsStream(var9.substring(7)));
} else if(var9.startsWith("%blur%")) {
this.blurTexture = true;
var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(6)));
var4 = this.readTextureImage(GL11.getResourceAsStream(var9.substring(6)));
} else {
var4 = this.readTextureImage(var1.getResourceAsStream(var9));
var4 = this.readTextureImage(GL11.getResourceAsStream(var9));
}
this.func_28147_a(var4, (int[])this.field_28151_c.get(var9));
@ -529,9 +456,7 @@ public class RenderEngine {
}
private BufferedImage readTextureImage(InputStream var1) throws IOException {
BufferedImage var2 = ImageIO.read(var1);
var1.close();
return var2;
return GL11.loadPNG(((ByteArrayInputStream)var1).readAllBytes());
}
public void bindTexture(int var1) {
@ -539,4 +464,9 @@ public class RenderEngine {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, var1);
}
}
public int getTextureForDownloadableImage(String skinUrl, String entityTexture) {
int i = this.getTexture(entityTexture);
return i;
}
}

View File

@ -1,15 +1,12 @@
package net.minecraft.src;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.ARBOcclusionQuery;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
public class RenderGlobal implements IWorldAccess {
public List tileEntities = new ArrayList();
@ -24,8 +21,6 @@ public class RenderGlobal implements IWorldAccess {
private int glRenderListBase;
private Minecraft mc;
private RenderBlocks globalRenderBlocks;
private IntBuffer glOcclusionQueryBase;
private boolean occlusionEnabled = false;
private int cloudOffsetX = 0;
private int starGLCallList;
private int glSkyList;
@ -42,7 +37,6 @@ public class RenderGlobal implements IWorldAccess {
private int countEntitiesRendered;
private int countEntitiesHidden;
int[] dummyBuf50k = new int['\uc350'];
IntBuffer occlusionResult = GLAllocation.createDirectIntBuffer(64);
private int renderersLoaded;
private int renderersBeingClipped;
private int renderersBeingOccluded;
@ -64,16 +58,6 @@ public class RenderGlobal implements IWorldAccess {
this.renderEngine = var2;
byte var3 = 64;
this.glRenderListBase = GLAllocation.generateDisplayLists(var3 * var3 * var3 * 3);
this.occlusionEnabled = var1.getOpenGlCapsChecker().checkARBOcclusion();
if(this.occlusionEnabled) {
this.occlusionResult.clear();
this.glOcclusionQueryBase = GLAllocation.createDirectIntBuffer(var3 * var3 * var3);
this.glOcclusionQueryBase.clear();
this.glOcclusionQueryBase.position(0);
this.glOcclusionQueryBase.limit(var3 * var3 * var3);
ARBOcclusionQuery.glGenQueriesARB(this.glOcclusionQueryBase);
}
this.starGLCallList = GLAllocation.generateDisplayLists(3);
GL11.glPushMatrix();
GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
@ -225,10 +209,6 @@ public class RenderGlobal implements IWorldAccess {
for(int var5 = 0; var5 < this.renderChunksTall; ++var5) {
for(int var6 = 0; var6 < this.renderChunksDeep; ++var6) {
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4] = new WorldRenderer(this.worldObj, this.tileEntities, var4 * 16, var5 * 16, var6 * 16, 16, this.glRenderListBase + var2);
if(this.occlusionEnabled) {
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].glOcclusionQuery = this.glOcclusionQueryBase.get(var3);
}
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isWaitingOnOcclusionQuery = false;
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isVisible = true;
this.worldRenderers[(var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4].isInFrustum = true;
@ -421,110 +401,7 @@ public class RenderGlobal implements IWorldAccess {
RenderHelper.disableStandardItemLighting();
byte var17 = 0;
int var34;
if(this.occlusionEnabled && this.mc.gameSettings.advancedOpengl && !this.mc.gameSettings.anaglyph && var2 == 0) {
byte var18 = 0;
int var19 = 16;
this.checkOcclusionQueryResult(var18, var19);
for(int var20 = var18; var20 < var19; ++var20) {
this.sortedWorldRenderers[var20].isVisible = true;
}
var34 = var17 + this.renderSortedRenderers(var18, var19, var2, var3);
do {
int var35 = var19;
var19 *= 2;
if(var19 > this.sortedWorldRenderers.length) {
var19 = this.sortedWorldRenderers.length;
}
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_FOG);
GL11.glColorMask(false, false, false, false);
GL11.glDepthMask(false);
this.checkOcclusionQueryResult(var35, var19);
GL11.glPushMatrix();
float var36 = 0.0F;
float var21 = 0.0F;
float var22 = 0.0F;
for(int var23 = var35; var23 < var19; ++var23) {
if(this.sortedWorldRenderers[var23].skipAllRenderPasses()) {
this.sortedWorldRenderers[var23].isInFrustum = false;
} else {
if(!this.sortedWorldRenderers[var23].isInFrustum) {
this.sortedWorldRenderers[var23].isVisible = true;
}
if(this.sortedWorldRenderers[var23].isInFrustum && !this.sortedWorldRenderers[var23].isWaitingOnOcclusionQuery) {
float var24 = MathHelper.sqrt_float(this.sortedWorldRenderers[var23].distanceToEntitySquared(var1));
int var25 = (int)(1.0F + var24 / 128.0F);
if(this.cloudOffsetX % var25 == var23 % var25) {
WorldRenderer var26 = this.sortedWorldRenderers[var23];
float var27 = (float)((double)var26.posXMinus - var33);
float var28 = (float)((double)var26.posYMinus - var7);
float var29 = (float)((double)var26.posZMinus - var9);
float var30 = var27 - var36;
float var31 = var28 - var21;
float var32 = var29 - var22;
if(var30 != 0.0F || var31 != 0.0F || var32 != 0.0F) {
GL11.glTranslatef(var30, var31, var32);
var36 += var30;
var21 += var31;
var22 += var32;
}
ARBOcclusionQuery.glBeginQueryARB(GL15.GL_SAMPLES_PASSED, this.sortedWorldRenderers[var23].glOcclusionQuery);
this.sortedWorldRenderers[var23].callOcclusionQueryList();
ARBOcclusionQuery.glEndQueryARB(GL15.GL_SAMPLES_PASSED);
this.sortedWorldRenderers[var23].isWaitingOnOcclusionQuery = true;
}
}
}
}
GL11.glPopMatrix();
if(this.mc.gameSettings.anaglyph) {
if(EntityRenderer.anaglyphField == 0) {
GL11.glColorMask(false, true, true, true);
} else {
GL11.glColorMask(true, false, false, true);
}
} else {
GL11.glColorMask(true, true, true, true);
}
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_FOG);
var34 += this.renderSortedRenderers(var35, var19, var2, var3);
} while(var19 < this.sortedWorldRenderers.length);
} else {
var34 = var17 + this.renderSortedRenderers(0, this.sortedWorldRenderers.length, var2, var3);
}
return var34;
}
private void checkOcclusionQueryResult(int var1, int var2) {
for(int var3 = var1; var3 < var2; ++var3) {
if(this.sortedWorldRenderers[var3].isWaitingOnOcclusionQuery) {
this.occlusionResult.clear();
ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[var3].glOcclusionQuery, GL15.GL_QUERY_RESULT_AVAILABLE, this.occlusionResult);
if(this.occlusionResult.get(0) != 0) {
this.sortedWorldRenderers[var3].isWaitingOnOcclusionQuery = false;
this.occlusionResult.clear();
ARBOcclusionQuery.glGetQueryObjectuARB(this.sortedWorldRenderers[var3].glOcclusionQuery, GL15.GL_QUERY_RESULT, this.occlusionResult);
this.sortedWorldRenderers[var3].isVisible = this.occlusionResult.get(0) != 0;
}
}
}
return var17 + this.renderSortedRenderers(0, this.sortedWorldRenderers.length, var2, var3);
}
private int renderSortedRenderers(int var1, int var2, int var3, double var4) {
@ -538,14 +415,12 @@ public class RenderGlobal implements IWorldAccess {
++this.renderersSkippingRenderPass;
} else if(!this.sortedWorldRenderers[var7].isInFrustum) {
++this.renderersBeingClipped;
} else if(this.occlusionEnabled && !this.sortedWorldRenderers[var7].isVisible) {
++this.renderersBeingOccluded;
} else {
++this.renderersBeingRendered;
}
}
if(!this.sortedWorldRenderers[var7].skipRenderPass[var3] && this.sortedWorldRenderers[var7].isInFrustum && (!this.occlusionEnabled || this.sortedWorldRenderers[var7].isVisible)) {
if(!this.sortedWorldRenderers[var7].skipRenderPass[var3] && this.sortedWorldRenderers[var7].isInFrustum) {
int var8 = this.sortedWorldRenderers[var7].getGLCallListForPass(var3);
if(var8 >= 0) {
this.glRenderLists.add(this.sortedWorldRenderers[var7]);
@ -634,7 +509,6 @@ public class RenderGlobal implements IWorldAccess {
float var12;
if(var18 != null) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glPushMatrix();
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
var8 = this.worldObj.getCelestialAngle(var1);
@ -667,7 +541,6 @@ public class RenderGlobal implements IWorldAccess {
var17.draw();
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
@ -1318,25 +1191,9 @@ public class RenderGlobal implements IWorldAccess {
public void obtainEntitySkin(Entity var1) {
var1.updateCloak();
if(var1.skinUrl != null) {
this.renderEngine.obtainImageData(var1.skinUrl, new ImageBufferDownload());
}
if(var1.cloakUrl != null) {
this.renderEngine.obtainImageData(var1.cloakUrl, new ImageBufferDownload());
}
}
public void releaseEntitySkin(Entity var1) {
if(var1.skinUrl != null) {
this.renderEngine.releaseImageData(var1.skinUrl);
}
if(var1.cloakUrl != null) {
this.renderEngine.releaseImageData(var1.cloakUrl);
}
}
public void updateAllRenderers() {

View File

@ -1,11 +1,8 @@
package net.minecraft.src;
import java.nio.FloatBuffer;
import org.lwjgl.opengl.GL11;
public class RenderHelper {
private static FloatBuffer field_1695_a = GLAllocation.createDirectFloatBuffer(16);
public static void disableStandardItemLighting() {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHT0);
@ -23,27 +20,16 @@ public class RenderHelper {
float var1 = 0.6F;
float var2 = 0.0F;
Vec3D var3 = Vec3D.createVector((double)0.2F, 1.0D, (double)-0.7F).normalize();
GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, func_1157_a(var3.xCoord, var3.yCoord, var3.zCoord, 0.0D));
GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, func_1156_a(var1, var1, var1, 1.0F));
GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, func_1156_a(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, func_1156_a(var2, var2, var2, 1.0F));
GL11.glRotatef((float)var3.xCoord, (float)var3.yCoord, (float)var3.zCoord, 0.0F);
GL11.glRotatef(var1, var1, var1, 1.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(var2, var2, var2, 1.0F);
GL11.glRotatef(var2, var0, var1, var2);
var3 = Vec3D.createVector((double)-0.2F, 1.0D, (double)0.7F).normalize();
GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, func_1157_a(var3.xCoord, var3.yCoord, var3.zCoord, 0.0D));
GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, func_1156_a(var1, var1, var1, 1.0F));
GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, func_1156_a(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glLight(GL11.GL_LIGHT1, GL11.GL_SPECULAR, func_1156_a(var2, var2, var2, 1.0F));
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, func_1156_a(var0, var0, var0, 1.0F));
}
private static FloatBuffer func_1157_a(double var0, double var2, double var4, double var6) {
return func_1156_a((float)var0, (float)var2, (float)var4, (float)var6);
}
private static FloatBuffer func_1156_a(float var0, float var1, float var2, float var3) {
field_1695_a.clear();
field_1695_a.put(var0).put(var1).put(var2).put(var3);
field_1695_a.flip();
return field_1695_a;
GL11.glRotatef((float)var3.xCoord, (float)var3.yCoord, (float)var3.zCoord, 0.0F);
GL11.glRotatef(var1, var1, var1, 1.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(var2, var2, var2, 1.0F);
GL11.glPopMatrix();
}
}

View File

@ -1,69 +0,0 @@
package net.minecraft.src;
import java.awt.image.BufferedImage;
import java.io.File;
import java.nio.ByteBuffer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.imageio.ImageIO;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
public class ScreenShotHelper {
private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss");
private static ByteBuffer buffer;
private static byte[] pixelData;
private static int[] imageData;
public static String saveScreenshot(File var0, int var1, int var2) {
try {
File var3 = new File(var0, "screenshots");
var3.mkdir();
if(buffer == null || buffer.capacity() < var1 * var2) {
buffer = BufferUtils.createByteBuffer(var1 * var2 * 3);
}
if(imageData == null || imageData.length < var1 * var2 * 3) {
pixelData = new byte[var1 * var2 * 3];
imageData = new int[var1 * var2];
}
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
buffer.clear();
GL11.glReadPixels(0, 0, var1, var2, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)buffer);
buffer.clear();
String var4 = "" + dateFormat.format(new Date());
int var6 = 1;
while(true) {
File var5 = new File(var3, var4 + (var6 == 1 ? "" : "_" + var6) + ".png");
if(!var5.exists()) {
buffer.get(pixelData);
for(int var7 = 0; var7 < var1; ++var7) {
for(int var8 = 0; var8 < var2; ++var8) {
int var9 = var7 + (var2 - var8 - 1) * var1;
int var10 = pixelData[var9 * 3 + 0] & 255;
int var11 = pixelData[var9 * 3 + 1] & 255;
int var12 = pixelData[var9 * 3 + 2] & 255;
int var13 = -16777216 | var10 << 16 | var11 << 8 | var12;
imageData[var7 + var8 * var1] = var13;
}
}
BufferedImage var15 = new BufferedImage(var1, var2, 1);
var15.setRGB(0, 0, var1, var2, imageData, 0, var1);
ImageIO.write(var15, "png", var5);
return "Saved screenshot as " + var5.getName();
}
++var6;
}
} catch (Exception var14) {
var14.printStackTrace();
return "Failed to save: " + var14;
}
}
}

View File

@ -1,196 +1,196 @@
package net.minecraft.src;
import java.io.File;
import java.util.Random;
import paulscode.sound.SoundSystem;
import paulscode.sound.SoundSystemConfig;
import paulscode.sound.codecs.CodecJOrbis;
import paulscode.sound.codecs.CodecWav;
import paulscode.sound.libraries.LibraryLWJGLOpenAL;
//import java.util.Random;
//import paulscode.sound.SoundSystem;
//import paulscode.sound.SoundSystemConfig;
//import paulscode.sound.codecs.CodecJOrbis;
//import paulscode.sound.codecs.CodecWav;
//import paulscode.sound.libraries.LibraryLWJGLOpenAL;
public class SoundManager {
private static SoundSystem sndSystem;
private SoundPool soundPoolSounds = new SoundPool();
private SoundPool soundPoolStreaming = new SoundPool();
private SoundPool soundPoolMusic = new SoundPool();
private int field_587_e = 0;
private GameSettings options;
private static boolean loaded = false;
private Random rand = new Random();
private int ticksBeforeMusic = this.rand.nextInt(12000);
// private static SoundSystem sndSystem;
// private SoundPool soundPoolSounds = new SoundPool();
// private SoundPool soundPoolStreaming = new SoundPool();
// private SoundPool soundPoolMusic = new SoundPool();
// private int field_587_e = 0;
// private GameSettings options;
// private static boolean loaded = false;
// private Random rand = new Random();
// private int ticksBeforeMusic = this.rand.nextInt(12000);
public void loadSoundSettings(GameSettings var1) {
this.soundPoolStreaming.field_1657_b = false;
this.options = var1;
if(!loaded && (var1 == null || var1.soundVolume != 0.0F || var1.musicVolume != 0.0F)) {
this.tryToSetLibraryAndCodecs();
}
// this.soundPoolStreaming.field_1657_b = false;
// this.options = var1;
// if(!loaded && (var1 == null || var1.soundVolume != 0.0F || var1.musicVolume != 0.0F)) {
// this.tryToSetLibraryAndCodecs();
// }
}
private void tryToSetLibraryAndCodecs() {
try {
float var1 = this.options.soundVolume;
float var2 = this.options.musicVolume;
this.options.soundVolume = 0.0F;
this.options.musicVolume = 0.0F;
this.options.saveOptions();
SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
SoundSystemConfig.setCodec("mus", CodecMus.class);
SoundSystemConfig.setCodec("wav", CodecWav.class);
sndSystem = new SoundSystem();
this.options.soundVolume = var1;
this.options.musicVolume = var2;
this.options.saveOptions();
} catch (Throwable var3) {
var3.printStackTrace();
System.err.println("error linking with the LibraryJavaSound plug-in");
}
loaded = true;
// try {
// float var1 = this.options.soundVolume;
// float var2 = this.options.musicVolume;
// this.options.soundVolume = 0.0F;
// this.options.musicVolume = 0.0F;
// this.options.saveOptions();
// SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
// SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
// SoundSystemConfig.setCodec("mus", CodecMus.class);
// SoundSystemConfig.setCodec("wav", CodecWav.class);
// sndSystem = new SoundSystem();
// this.options.soundVolume = var1;
// this.options.musicVolume = var2;
// this.options.saveOptions();
// } catch (Throwable var3) {
// var3.printStackTrace();
// System.err.println("error linking with the LibraryJavaSound plug-in");
// }
//
// loaded = true;
}
public void onSoundOptionsChanged() {
if(!loaded && (this.options.soundVolume != 0.0F || this.options.musicVolume != 0.0F)) {
this.tryToSetLibraryAndCodecs();
}
if(loaded) {
if(this.options.musicVolume == 0.0F) {
sndSystem.stop("BgMusic");
} else {
sndSystem.setVolume("BgMusic", this.options.musicVolume);
}
}
// if(!loaded && (this.options.soundVolume != 0.0F || this.options.musicVolume != 0.0F)) {
// this.tryToSetLibraryAndCodecs();
// }
//
// if(loaded) {
// if(this.options.musicVolume == 0.0F) {
// sndSystem.stop("BgMusic");
// } else {
// sndSystem.setVolume("BgMusic", this.options.musicVolume);
// }
// }
}
public void closeMinecraft() {
if(loaded) {
sndSystem.cleanup();
}
//if(loaded) {
//sndSystem.cleanup();
//}
}
public void addSound(String var1, File var2) {
this.soundPoolSounds.addSound(var1, var2);
//this.soundPoolSounds.addSound(var1, var2);
}
public void addStreaming(String var1, File var2) {
this.soundPoolStreaming.addSound(var1, var2);
//this.soundPoolStreaming.addSound(var1, var2);
}
public void addMusic(String var1, File var2) {
this.soundPoolMusic.addSound(var1, var2);
//this.soundPoolMusic.addSound(var1, var2);
}
public void playRandomMusicIfReady() {
if(loaded && this.options.musicVolume != 0.0F) {
if(!sndSystem.playing("BgMusic") && !sndSystem.playing("streaming")) {
if(this.ticksBeforeMusic > 0) {
--this.ticksBeforeMusic;
return;
}
SoundPoolEntry var1 = this.soundPoolMusic.getRandomSound();
if(var1 != null) {
this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000;
sndSystem.backgroundMusic("BgMusic", var1.soundUrl, var1.soundName, false);
sndSystem.setVolume("BgMusic", this.options.musicVolume);
sndSystem.play("BgMusic");
}
}
}
// if(loaded && this.options.musicVolume != 0.0F) {
// if(!sndSystem.playing("BgMusic") && !sndSystem.playing("streaming")) {
// if(this.ticksBeforeMusic > 0) {
// --this.ticksBeforeMusic;
// return;
// }
//
// SoundPoolEntry var1 = this.soundPoolMusic.getRandomSound();
// if(var1 != null) {
// this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000;
// sndSystem.backgroundMusic("BgMusic", var1.soundUrl, var1.soundName, false);
// sndSystem.setVolume("BgMusic", this.options.musicVolume);
// sndSystem.play("BgMusic");
// }
// }
//
// }
}
public void func_338_a(EntityLiving var1, float var2) {
if(loaded && this.options.soundVolume != 0.0F) {
if(var1 != null) {
float var3 = var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var2;
double var4 = var1.prevPosX + (var1.posX - var1.prevPosX) * (double)var2;
double var6 = var1.prevPosY + (var1.posY - var1.prevPosY) * (double)var2;
double var8 = var1.prevPosZ + (var1.posZ - var1.prevPosZ) * (double)var2;
float var10 = MathHelper.cos(-var3 * ((float)Math.PI / 180.0F) - (float)Math.PI);
float var11 = MathHelper.sin(-var3 * ((float)Math.PI / 180.0F) - (float)Math.PI);
float var12 = -var11;
float var13 = 0.0F;
float var14 = -var10;
float var15 = 0.0F;
float var16 = 1.0F;
float var17 = 0.0F;
sndSystem.setListenerPosition((float)var4, (float)var6, (float)var8);
sndSystem.setListenerOrientation(var12, var13, var14, var15, var16, var17);
}
}
// if(loaded && this.options.soundVolume != 0.0F) {
// if(var1 != null) {
// float var3 = var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var2;
// double var4 = var1.prevPosX + (var1.posX - var1.prevPosX) * (double)var2;
// double var6 = var1.prevPosY + (var1.posY - var1.prevPosY) * (double)var2;
// double var8 = var1.prevPosZ + (var1.posZ - var1.prevPosZ) * (double)var2;
// float var10 = MathHelper.cos(-var3 * ((float)Math.PI / 180.0F) - (float)Math.PI);
// float var11 = MathHelper.sin(-var3 * ((float)Math.PI / 180.0F) - (float)Math.PI);
// float var12 = -var11;
// float var13 = 0.0F;
// float var14 = -var10;
// float var15 = 0.0F;
// float var16 = 1.0F;
// float var17 = 0.0F;
// sndSystem.setListenerPosition((float)var4, (float)var6, (float)var8);
// sndSystem.setListenerOrientation(var12, var13, var14, var15, var16, var17);
// }
// }
}
public void playStreaming(String var1, float var2, float var3, float var4, float var5, float var6) {
if(loaded && this.options.soundVolume != 0.0F) {
String var7 = "streaming";
if(sndSystem.playing("streaming")) {
sndSystem.stop("streaming");
}
if(var1 != null) {
SoundPoolEntry var8 = this.soundPoolStreaming.getRandomSoundFromSoundPool(var1);
if(var8 != null && var5 > 0.0F) {
if(sndSystem.playing("BgMusic")) {
sndSystem.stop("BgMusic");
}
float var9 = 16.0F;
sndSystem.newStreamingSource(true, var7, var8.soundUrl, var8.soundName, false, var2, var3, var4, 2, var9 * 4.0F);
sndSystem.setVolume(var7, 0.5F * this.options.soundVolume);
sndSystem.play(var7);
}
}
}
// if(loaded && this.options.soundVolume != 0.0F) {
// String var7 = "streaming";
// if(sndSystem.playing("streaming")) {
// sndSystem.stop("streaming");
// }
//
// if(var1 != null) {
// SoundPoolEntry var8 = this.soundPoolStreaming.getRandomSoundFromSoundPool(var1);
// if(var8 != null && var5 > 0.0F) {
// if(sndSystem.playing("BgMusic")) {
// sndSystem.stop("BgMusic");
// }
//
// float var9 = 16.0F;
// sndSystem.newStreamingSource(true, var7, var8.soundUrl, var8.soundName, false, var2, var3, var4, 2, var9 * 4.0F);
// sndSystem.setVolume(var7, 0.5F * this.options.soundVolume);
// sndSystem.play(var7);
// }
//
// }
// }
}
public void playSound(String var1, float var2, float var3, float var4, float var5, float var6) {
if(loaded && this.options.soundVolume != 0.0F) {
SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(var1);
if(var7 != null && var5 > 0.0F) {
this.field_587_e = (this.field_587_e + 1) % 256;
String var8 = "sound_" + this.field_587_e;
float var9 = 16.0F;
if(var5 > 1.0F) {
var9 *= var5;
}
sndSystem.newSource(var5 > 1.0F, var8, var7.soundUrl, var7.soundName, false, var2, var3, var4, 2, var9);
sndSystem.setPitch(var8, var6);
if(var5 > 1.0F) {
var5 = 1.0F;
}
sndSystem.setVolume(var8, var5 * this.options.soundVolume);
sndSystem.play(var8);
}
}
// if(loaded && this.options.soundVolume != 0.0F) {
// SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(var1);
// if(var7 != null && var5 > 0.0F) {
// this.field_587_e = (this.field_587_e + 1) % 256;
// String var8 = "sound_" + this.field_587_e;
// float var9 = 16.0F;
// if(var5 > 1.0F) {
// var9 *= var5;
// }
//
// sndSystem.newSource(var5 > 1.0F, var8, var7.soundUrl, var7.soundName, false, var2, var3, var4, 2, var9);
// sndSystem.setPitch(var8, var6);
// if(var5 > 1.0F) {
// var5 = 1.0F;
// }
//
// sndSystem.setVolume(var8, var5 * this.options.soundVolume);
// sndSystem.play(var8);
// }
//
// }
}
public void playSoundFX(String var1, float var2, float var3) {
if(loaded && this.options.soundVolume != 0.0F) {
SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(var1);
if(var4 != null) {
this.field_587_e = (this.field_587_e + 1) % 256;
String var5 = "sound_" + this.field_587_e;
sndSystem.newSource(false, var5, var4.soundUrl, var4.soundName, false, 0.0F, 0.0F, 0.0F, 0, 0.0F);
if(var2 > 1.0F) {
var2 = 1.0F;
}
var2 *= 0.25F;
sndSystem.setPitch(var5, var3);
sndSystem.setVolume(var5, var2 * this.options.soundVolume);
sndSystem.play(var5);
}
}
// if(loaded && this.options.soundVolume != 0.0F) {
// SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(var1);
// if(var4 != null) {
// this.field_587_e = (this.field_587_e + 1) % 256;
// String var5 = "sound_" + this.field_587_e;
// sndSystem.newSource(false, var5, var4.soundUrl, var4.soundName, false, 0.0F, 0.0F, 0.0F, 0, 0.0F);
// if(var2 > 1.0F) {
// var2 = 1.0F;
// }
//
// var2 *= 0.25F;
// sndSystem.setPitch(var5, var3);
// sndSystem.setVolume(var5, var2 * this.options.soundVolume);
// sndSystem.play(var5);
// }
//
// }
}
}

View File

@ -1,21 +1,14 @@
package net.minecraft.src;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import org.lwjgl.opengl.ARBVertexBufferObject;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GLContext;
import org.teavm.jso.typedarrays.ArrayBuffer;
import org.teavm.jso.typedarrays.Float32Array;
import org.teavm.jso.typedarrays.Int32Array;
public class Tessellator {
private static boolean convertQuadsToTriangles = true;
private static boolean tryVBO = false;
private ByteBuffer byteBuffer;
private IntBuffer intBuffer;
private FloatBuffer floatBuffer;
private int[] rawBuffer;
private Float32Array floatBuffer;
private int vertexCount = 0;
private double textureU;
private double textureV;
@ -33,24 +26,12 @@ public class Tessellator {
private int normal;
public static final Tessellator instance = new Tessellator(2097152);
private boolean isDrawing = false;
private boolean useVBO = false;
private IntBuffer vertexBuffers;
private int vboIndex = 0;
private int vboCount = 10;
private int bufferSize;
private Tessellator(int var1) {
this.bufferSize = var1;
this.byteBuffer = GLAllocation.createDirectByteBuffer(var1 * 4);
this.intBuffer = this.byteBuffer.asIntBuffer();
this.floatBuffer = this.byteBuffer.asFloatBuffer();
this.rawBuffer = new int[var1];
this.useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
if(this.useVBO) {
this.vertexBuffers = GLAllocation.createDirectIntBuffer(this.vboCount);
ARBVertexBufferObject.glGenBuffersARB(this.vertexBuffers);
}
ArrayBuffer a = ArrayBuffer.create(var1 * 4);
this.floatBuffer = Float32Array.create(a);
}
public void draw() {
@ -59,61 +40,23 @@ public class Tessellator {
} else {
this.isDrawing = false;
if(this.vertexCount > 0) {
this.intBuffer.clear();
this.intBuffer.put(this.rawBuffer, 0, this.rawBufferIndex);
this.byteBuffer.position(0);
this.byteBuffer.limit(this.rawBufferIndex * 4);
if(this.useVBO) {
this.vboIndex = (this.vboIndex + 1) % this.vboCount;
ARBVertexBufferObject.glBindBufferARB(GL15.GL_ARRAY_BUFFER, this.vertexBuffers.get(this.vboIndex));
ARBVertexBufferObject.glBufferDataARB(GL15.GL_ARRAY_BUFFER, this.byteBuffer, GL15.GL_STREAM_DRAW);
}
if(this.hasTexture) {
if(this.useVBO) {
GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 32, 12L);
} else {
this.floatBuffer.position(3);
GL11.glTexCoordPointer(2, 32, (FloatBuffer)this.floatBuffer);
}
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
}
if(this.hasColor) {
if(this.useVBO) {
GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 32, 20L);
} else {
this.byteBuffer.position(20);
GL11.glColorPointer(4, true, 32, this.byteBuffer);
}
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
}
if(this.hasNormals) {
if(this.useVBO) {
GL11.glNormalPointer(GL11.GL_BYTE, 32, 24L);
} else {
this.byteBuffer.position(24);
GL11.glNormalPointer(32, (ByteBuffer)this.byteBuffer);
}
GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
}
if(this.useVBO) {
GL11.glVertexPointer(3, GL11.GL_FLOAT, 32, 0L);
} else {
this.floatBuffer.position(0);
GL11.glVertexPointer(3, 32, (FloatBuffer)this.floatBuffer);
}
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
if(this.drawMode == 7 && convertQuadsToTriangles) {
GL11.glDrawArrays(GL11.GL_TRIANGLES, GL11.GL_POINTS, this.vertexCount);
GL11.glDrawArrays(GL11.GL_TRIANGLES, GL11.GL_POINTS, this.vertexCount, Int32Array.create(floatBuffer.getBuffer(), 0, this.vertexCount * 7));
} else {
GL11.glDrawArrays(this.drawMode, GL11.GL_POINTS, this.vertexCount);
GL11.glDrawArrays(this.drawMode, GL11.GL_POINTS, this.vertexCount, Int32Array.create(floatBuffer.getBuffer(), 0, this.vertexCount * 7));
}
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
@ -136,7 +79,6 @@ public class Tessellator {
private void reset() {
this.vertexCount = 0;
this.byteBuffer.clear();
this.rawBufferIndex = 0;
this.addedVertices = 0;
}
@ -228,42 +170,45 @@ public class Tessellator {
public void addVertex(double var1, double var3, double var5) {
++this.addedVertices;
Float32Array floatBuffer0 = floatBuffer;
if(this.drawMode == 7 && convertQuadsToTriangles && this.addedVertices % 4 == 0) {
for(int var7 = 0; var7 < 2; ++var7) {
int var8 = 8 * (3 - var7);
if(this.hasTexture) {
this.rawBuffer[this.rawBufferIndex + 3] = this.rawBuffer[this.rawBufferIndex - var8 + 3];
this.rawBuffer[this.rawBufferIndex + 4] = this.rawBuffer[this.rawBufferIndex - var8 + 4];
floatBuffer0.set(this.rawBufferIndex + 3, this.rawBufferIndex - var8 + 3);
floatBuffer0.set(this.rawBufferIndex + 4, this.rawBufferIndex - var8 + 4);
}
if(this.hasColor) {
this.rawBuffer[this.rawBufferIndex + 5] = this.rawBuffer[this.rawBufferIndex - var8 + 5];
floatBuffer0.set(this.rawBufferIndex + 5, this.rawBufferIndex - var8 + 5);
}
this.rawBuffer[this.rawBufferIndex + 0] = this.rawBuffer[this.rawBufferIndex - var8 + 0];
this.rawBuffer[this.rawBufferIndex + 1] = this.rawBuffer[this.rawBufferIndex - var8 + 1];
this.rawBuffer[this.rawBufferIndex + 2] = this.rawBuffer[this.rawBufferIndex - var8 + 2];
floatBuffer0.set(this.rawBufferIndex + 0, this.rawBufferIndex - var8 + 0);
floatBuffer0.set(this.rawBufferIndex + 1, this.rawBufferIndex - var8 + 1);
floatBuffer0.set(this.rawBufferIndex + 2, this.rawBufferIndex - var8 + 2);
++this.vertexCount;
this.rawBufferIndex += 8;
}
}
if(this.hasTexture) {
this.rawBuffer[this.rawBufferIndex + 3] = Float.floatToRawIntBits((float)this.textureU);
this.rawBuffer[this.rawBufferIndex + 4] = Float.floatToRawIntBits((float)this.textureV);
floatBuffer0.set(this.rawBufferIndex + 3, Float.floatToRawIntBits((float)this.textureU));
floatBuffer0.set(this.rawBufferIndex + 4, Float.floatToRawIntBits((float)this.textureV));
}
if(this.hasColor) {
this.rawBuffer[this.rawBufferIndex + 5] = this.color;
floatBuffer0.set(this.rawBufferIndex + 5, this.color);
}
if(this.hasNormals) {
this.rawBuffer[this.rawBufferIndex + 6] = this.normal;
floatBuffer0.set(this.rawBufferIndex + 6, this.normal);
}
this.rawBuffer[this.rawBufferIndex + 0] = Float.floatToRawIntBits((float)(var1 + this.xOffset));
this.rawBuffer[this.rawBufferIndex + 1] = Float.floatToRawIntBits((float)(var3 + this.yOffset));
this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits((float)(var5 + this.zOffset));
floatBuffer0.set(this.rawBufferIndex + 0, Float.floatToRawIntBits((float)(var1 + this.xOffset)));
floatBuffer0.set(this.rawBufferIndex + 1, Float.floatToRawIntBits((float)(var3 + this.yOffset)));
floatBuffer0.set(this.rawBufferIndex + 2, Float.floatToRawIntBits((float)(var5 + this.zOffset)));
this.rawBufferIndex += 8;
++this.vertexCount;
if(this.vertexCount % 4 == 0 && this.rawBufferIndex >= this.bufferSize - 32) {

View File

@ -1,31 +0,0 @@
package net.minecraft.src;
import java.io.IOException;
import java.io.InputStream;
import net.minecraft.client.Minecraft;
public abstract class TexturePackBase {
public String texturePackFileName;
public String firstDescriptionLine;
public String secondDescriptionLine;
public String field_6488_d;
public void func_6482_a() {
}
public void closeTexturePackFile() {
}
public void func_6485_a(Minecraft var1) throws IOException {
}
public void func_6484_b(Minecraft var1) {
}
public void bindThumbnailTexture(Minecraft var1) {
}
public InputStream getResourceAsStream(String var1) {
return TexturePackBase.class.getResourceAsStream(var1);
}
}

View File

@ -1,125 +0,0 @@
package net.minecraft.src;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
public class TexturePackCustom extends TexturePackBase {
private ZipFile texturePackZipFile;
private int texturePackName = -1;
private BufferedImage texturePackThumbnail;
private File texturePackFile;
public TexturePackCustom(File var1) {
this.texturePackFileName = var1.getName();
this.texturePackFile = var1;
}
private String truncateString(String var1) {
if(var1 != null && var1.length() > 34) {
var1 = var1.substring(0, 34);
}
return var1;
}
public void func_6485_a(Minecraft var1) throws IOException {
ZipFile var2 = null;
InputStream var3 = null;
try {
var2 = new ZipFile(this.texturePackFile);
try {
var3 = var2.getInputStream(var2.getEntry("pack.txt"));
BufferedReader var4 = new BufferedReader(new InputStreamReader(var3));
this.firstDescriptionLine = this.truncateString(var4.readLine());
this.secondDescriptionLine = this.truncateString(var4.readLine());
var4.close();
var3.close();
} catch (Exception var20) {
}
try {
var3 = var2.getInputStream(var2.getEntry("pack.png"));
this.texturePackThumbnail = ImageIO.read(var3);
var3.close();
} catch (Exception var19) {
}
var2.close();
} catch (Exception var21) {
var21.printStackTrace();
} finally {
try {
var3.close();
} catch (Exception var18) {
}
try {
var2.close();
} catch (Exception var17) {
}
}
}
public void func_6484_b(Minecraft var1) {
if(this.texturePackThumbnail != null) {
var1.renderEngine.deleteTexture(this.texturePackName);
}
this.closeTexturePackFile();
}
public void bindThumbnailTexture(Minecraft var1) {
if(this.texturePackThumbnail != null && this.texturePackName < 0) {
this.texturePackName = var1.renderEngine.allocateAndSetupTexture(this.texturePackThumbnail);
}
if(this.texturePackThumbnail != null) {
var1.renderEngine.bindTexture(this.texturePackName);
} else {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, var1.renderEngine.getTexture("/gui/unknown_pack.png"));
}
}
public void func_6482_a() {
try {
this.texturePackZipFile = new ZipFile(this.texturePackFile);
} catch (Exception var2) {
}
}
public void closeTexturePackFile() {
try {
this.texturePackZipFile.close();
} catch (Exception var2) {
}
this.texturePackZipFile = null;
}
public InputStream getResourceAsStream(String var1) {
try {
ZipEntry var2 = this.texturePackZipFile.getEntry(var1.substring(1));
if(var2 != null) {
return this.texturePackZipFile.getInputStream(var2);
}
} catch (Exception var3) {
}
return TexturePackBase.class.getResourceAsStream(var1);
}
}

View File

@ -1,44 +0,0 @@
package net.minecraft.src;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
public class TexturePackDefault extends TexturePackBase {
private int texturePackName = -1;
private BufferedImage texturePackThumbnail;
public TexturePackDefault() {
this.texturePackFileName = "Default";
this.firstDescriptionLine = "The default look of Minecraft";
try {
this.texturePackThumbnail = ImageIO.read(TexturePackDefault.class.getResource("/pack.png"));
} catch (IOException var2) {
var2.printStackTrace();
}
}
public void func_6484_b(Minecraft var1) {
if(this.texturePackThumbnail != null) {
var1.renderEngine.deleteTexture(this.texturePackName);
}
}
public void bindThumbnailTexture(Minecraft var1) {
if(this.texturePackThumbnail != null && this.texturePackName < 0) {
this.texturePackName = var1.renderEngine.allocateAndSetupTexture(this.texturePackThumbnail);
}
if(this.texturePackThumbnail != null) {
var1.renderEngine.bindTexture(this.texturePackName);
} else {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, var1.renderEngine.getTexture("/gui/unknown_pack.png"));
}
}
}

View File

@ -1,101 +0,0 @@
package net.minecraft.src;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.minecraft.client.Minecraft;
public class TexturePackList {
private List availableTexturePacks = new ArrayList();
private TexturePackBase defaultTexturePack = new TexturePackDefault();
public TexturePackBase selectedTexturePack;
private Map field_6538_d = new HashMap();
private Minecraft mc;
private File texturePackDir;
private String currentTexturePack;
public TexturePackList(Minecraft var1, File var2) {
this.mc = var1;
this.texturePackDir = new File(var2, "texturepacks");
if(!this.texturePackDir.exists()) {
this.texturePackDir.mkdirs();
}
this.currentTexturePack = var1.gameSettings.skin;
this.updateAvaliableTexturePacks();
this.selectedTexturePack.func_6482_a();
}
public boolean setTexturePack(TexturePackBase var1) {
if(var1 == this.selectedTexturePack) {
return false;
} else {
this.selectedTexturePack.closeTexturePackFile();
this.currentTexturePack = var1.texturePackFileName;
this.selectedTexturePack = var1;
this.mc.gameSettings.skin = this.currentTexturePack;
this.mc.gameSettings.saveOptions();
this.selectedTexturePack.func_6482_a();
return true;
}
}
public void updateAvaliableTexturePacks() {
ArrayList var1 = new ArrayList();
this.selectedTexturePack = null;
var1.add(this.defaultTexturePack);
if(this.texturePackDir.exists() && this.texturePackDir.isDirectory()) {
File[] var2 = this.texturePackDir.listFiles();
File[] var3 = var2;
int var4 = var2.length;
for(int var5 = 0; var5 < var4; ++var5) {
File var6 = var3[var5];
if(var6.isFile() && var6.getName().toLowerCase().endsWith(".zip")) {
String var7 = var6.getName() + ":" + var6.length() + ":" + var6.lastModified();
try {
if(!this.field_6538_d.containsKey(var7)) {
TexturePackCustom var8 = new TexturePackCustom(var6);
var8.field_6488_d = var7;
this.field_6538_d.put(var7, var8);
var8.func_6485_a(this.mc);
}
TexturePackBase var12 = (TexturePackBase)this.field_6538_d.get(var7);
if(var12.texturePackFileName.equals(this.currentTexturePack)) {
this.selectedTexturePack = var12;
}
var1.add(var12);
} catch (IOException var9) {
var9.printStackTrace();
}
}
}
}
if(this.selectedTexturePack == null) {
this.selectedTexturePack = this.defaultTexturePack;
}
this.availableTexturePacks.removeAll(var1);
Iterator var10 = this.availableTexturePacks.iterator();
while(var10.hasNext()) {
TexturePackBase var11 = (TexturePackBase)var10.next();
var11.func_6484_b(this.mc);
this.field_6538_d.remove(var11.field_6488_d);
}
this.availableTexturePacks = var1;
}
public List availableTexturePacks() {
return new ArrayList(this.availableTexturePacks);
}
}

View File

@ -1,28 +0,0 @@
package net.minecraft.src;
import java.net.HttpURLConnection;
import java.net.URL;
import net.minecraft.client.Minecraft;
public class ThreadCheckHasPaid extends Thread {
final Minecraft field_28146_a;
public ThreadCheckHasPaid(Minecraft var1) {
this.field_28146_a = var1;
}
public void run() {
try {
HttpURLConnection var1 = (HttpURLConnection)(new URL("https://login.minecraft.net/session?name=" + this.field_28146_a.session.username + "&session=" + this.field_28146_a.session.sessionId)).openConnection();
var1.connect();
if(var1.getResponseCode() == 400) {
Minecraft.hasPaidCheckTime = System.currentTimeMillis();
}
var1.disconnect();
} catch (Exception var2) {
var2.printStackTrace();
}
}
}

View File

@ -1,22 +0,0 @@
package net.minecraft.src;
class ThreadCloseConnection extends Thread {
final NetworkManager field_28109_a;
ThreadCloseConnection(NetworkManager var1) {
this.field_28109_a = var1;
}
public void run() {
try {
Thread.sleep(2000L);
if(NetworkManager.isRunning(this.field_28109_a)) {
NetworkManager.getWriteThread(this.field_28109_a).interrupt();
this.field_28109_a.networkShutdown("disconnect.closed", new Object[0]);
}
} catch (Exception var2) {
var2.printStackTrace();
}
}
}

View File

@ -1,50 +0,0 @@
package net.minecraft.src;
import java.net.ConnectException;
import java.net.UnknownHostException;
import net.minecraft.client.Minecraft;
class ThreadConnectToServer extends Thread {
final Minecraft mc;
final String hostName;
final int port;
final GuiConnecting connectingGui;
ThreadConnectToServer(GuiConnecting var1, Minecraft var2, String var3, int var4) {
this.connectingGui = var1;
this.mc = var2;
this.hostName = var3;
this.port = var4;
}
public void run() {
try {
GuiConnecting.setNetClientHandler(this.connectingGui, new NetClientHandler(this.mc, this.hostName, this.port));
if(GuiConnecting.isCancelled(this.connectingGui)) {
return;
}
GuiConnecting.getNetClientHandler(this.connectingGui).addToSendQueue(new Packet2Handshake(this.mc.session.username));
} catch (UnknownHostException var2) {
if(GuiConnecting.isCancelled(this.connectingGui)) {
return;
}
this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", new Object[]{"Unknown host \'" + this.hostName + "\'"}));
} catch (ConnectException var3) {
if(GuiConnecting.isCancelled(this.connectingGui)) {
return;
}
this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", new Object[]{var3.getMessage()}));
} catch (Exception var4) {
if(GuiConnecting.isCancelled(this.connectingGui)) {
return;
}
var4.printStackTrace();
this.mc.displayGuiScreen(new GuiConnectFailed("connect.failed", "disconnect.genericReason", new Object[]{var4.toString()}));
}
}
}

View File

@ -1,44 +0,0 @@
package net.minecraft.src;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.imageio.ImageIO;
class ThreadDownloadImage extends Thread {
final String location;
final ImageBuffer buffer;
final ThreadDownloadImageData imageData;
ThreadDownloadImage(ThreadDownloadImageData var1, String var2, ImageBuffer var3) {
this.imageData = var1;
this.location = var2;
this.buffer = var3;
}
public void run() {
HttpURLConnection var1 = null;
try {
URL var2 = new URL(this.location);
var1 = (HttpURLConnection)var2.openConnection();
var1.setDoInput(true);
var1.setDoOutput(false);
var1.connect();
if(var1.getResponseCode() / 100 != 4) {
if(this.buffer == null) {
this.imageData.image = ImageIO.read(var1.getInputStream());
} else {
this.imageData.image = this.buffer.parseUserSkin(ImageIO.read(var1.getInputStream()));
}
return;
}
} catch (Exception var6) {
var6.printStackTrace();
return;
} finally {
var1.disconnect();
}
}
}

View File

@ -1,14 +0,0 @@
package net.minecraft.src;
import java.awt.image.BufferedImage;
public class ThreadDownloadImageData {
public BufferedImage image;
public int referenceCount = 1;
public int textureName = -1;
public boolean textureSetupComplete = false;
public ThreadDownloadImageData(String var1, ImageBuffer var2) {
(new ThreadDownloadImage(this, var1, var2)).start();
}
}

View File

@ -1,135 +0,0 @@
package net.minecraft.src;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import net.minecraft.client.Minecraft;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class ThreadDownloadResources extends Thread {
public File resourcesFolder;
private Minecraft mc;
private boolean closing = false;
public ThreadDownloadResources(File var1, Minecraft var2) {
this.mc = var2;
this.setName("Resource download thread");
this.setDaemon(true);
this.resourcesFolder = new File(var1, "resources/");
if(!this.resourcesFolder.exists() && !this.resourcesFolder.mkdirs()) {
throw new RuntimeException("The working directory could not be created: " + this.resourcesFolder);
}
}
public void run() {
try {
URL var1 = new URL("http://s3.amazonaws.com/MinecraftResources/");
DocumentBuilderFactory var2 = DocumentBuilderFactory.newInstance();
DocumentBuilder var3 = var2.newDocumentBuilder();
Document var4 = var3.parse(var1.openStream());
NodeList var5 = var4.getElementsByTagName("Contents");
for(int var6 = 0; var6 < 2; ++var6) {
for(int var7 = 0; var7 < var5.getLength(); ++var7) {
Node var8 = var5.item(var7);
if(var8.getNodeType() == 1) {
Element var9 = (Element)var8;
String var10 = ((Element)var9.getElementsByTagName("Key").item(0)).getChildNodes().item(0).getNodeValue();
long var11 = Long.parseLong(((Element)var9.getElementsByTagName("Size").item(0)).getChildNodes().item(0).getNodeValue());
if(var11 > 0L) {
this.downloadAndInstallResource(var1, var10, var11, var6);
if(this.closing) {
return;
}
}
}
}
}
} catch (Exception var13) {
this.loadResource(this.resourcesFolder, "");
var13.printStackTrace();
}
}
public void reloadResources() {
this.loadResource(this.resourcesFolder, "");
}
private void loadResource(File var1, String var2) {
File[] var3 = var1.listFiles();
for(int var4 = 0; var4 < var3.length; ++var4) {
if(var3[var4].isDirectory()) {
this.loadResource(var3[var4], var2 + var3[var4].getName() + "/");
} else {
try {
this.mc.installResource(var2 + var3[var4].getName(), var3[var4]);
} catch (Exception var6) {
System.out.println("Failed to add " + var2 + var3[var4].getName());
}
}
}
}
private void downloadAndInstallResource(URL var1, String var2, long var3, int var5) {
try {
int var6 = var2.indexOf("/");
String var7 = var2.substring(0, var6);
if(!var7.equals("sound") && !var7.equals("newsound")) {
if(var5 != 1) {
return;
}
} else if(var5 != 0) {
return;
}
File var8 = new File(this.resourcesFolder, var2);
if(!var8.exists() || var8.length() != var3) {
var8.getParentFile().mkdirs();
String var9 = var2.replaceAll(" ", "%20");
this.downloadResource(new URL(var1, var9), var8, var3);
if(this.closing) {
return;
}
}
this.mc.installResource(var2, var8);
} catch (Exception var10) {
var10.printStackTrace();
}
}
private void downloadResource(URL var1, File var2, long var3) throws IOException {
byte[] var5 = new byte[4096];
DataInputStream var6 = new DataInputStream(var1.openStream());
DataOutputStream var7 = new DataOutputStream(new FileOutputStream(var2));
boolean var8 = false;
do {
int var9 = var6.read(var5);
if(var9 < 0) {
var6.close();
var7.close();
return;
}
var7.write(var5, 0, var9);
} while(!this.closing);
}
public void closeMinecraft() {
this.closing = true;
}
}

View File

@ -1,21 +0,0 @@
package net.minecraft.src;
class ThreadRunIsoClient extends Thread {
final CanvasIsomPreview isoCanvas;
ThreadRunIsoClient(CanvasIsomPreview var1) {
this.isoCanvas = var1;
}
public void run() {
while(CanvasIsomPreview.isRunning(this.isoCanvas)) {
this.isoCanvas.showNextBuffer();
try {
Thread.sleep(1L);
} catch (Exception var2) {
}
}
}
}

View File

@ -1,6 +1,5 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
public class TileEntityRendererPiston extends TileEntitySpecialRenderer {
@ -15,11 +14,6 @@ public class TileEntityRendererPiston extends TileEntitySpecialRenderer {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_CULL_FACE);
if(Minecraft.isAmbientOcclusionEnabled()) {
GL11.glShadeModel(GL11.GL_SMOOTH);
} else {
GL11.glShadeModel(GL11.GL_FLAT);
}
var10.startDrawingQuads();
var10.setTranslationD((double)((float)var2 - (float)var1.xCoord + var1.func_31017_b(var8)), (double)((float)var4 - (float)var1.yCoord + var1.func_31014_c(var8)), (double)((float)var6 - (float)var1.zCoord + var1.func_31013_d(var8)));

View File

@ -0,0 +1,5 @@
package org.lwjgl.input;
public class Keyboard extends net.PeytonPlayz585.input.Keyboard {
}

View File

@ -0,0 +1,5 @@
package org.lwjgl.input;
public class Mouse extends net.PeytonPlayz585.input.Mouse {
}

View File

@ -0,0 +1,22 @@
package org.lwjgl.opengl;
import java.io.InputStream;
public class GL11 extends net.PeytonPlayz585.opengl.GL11 {
public static final int GL_GEQUAL = webgl.GEQUAL;
public static final int GL_POINTS = 0;
public static InputStream getResourceAsStream(String var1) {
return loadResource(var1);
}
public static void glEnableClientState(int glTextureState) {
glEnableVertexAttrib(glTextureState);
}
public static void glDisableClientState(int glTextureState) {
glDisableVertexAttrib(glTextureState);
}
}

View File

@ -0,0 +1,5 @@
package org.lwjgl.opengl;
public class GL12 extends net.PeytonPlayz585.opengl.GL11 {
}

View File

@ -0,0 +1,7 @@
package org.lwjgl.util.glu;
import org.lwjgl.opengl.GL11;
public class GLU extends GL11 {
}