Java tutorial
/* Stereoscopic3D-for-Minecraft - A Minecraft mod to allow stereoscopic 3D imaging. Copyright 2013 zsawyer (https://github.com/zsawyer, http://sourceforge.net/users/zsawyer) This file is part of Stereoscopic3D-for-Minecraft (https://github.com/zsawyer/Stereoscopic3D-for-Minecraft). Stereoscopic3D-for-Minecraft is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Stereoscopic3D-for-Minecraft is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Stereoscopic3D-for-Minecraft. If not, see <http://www.gnu.org/licenses/>. */ package zsawyer.mods.stereoscopic3d; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.Tessellator; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; /** * asm replacement/preview class of Minecarft.java * * @author zsawyer */ public class MinecraftCopy { private MinecraftCopy() { } private final static Minecraft mc = FMLClientHandler.instance().getClient(); /** * Displays a new screen. */ public static void loadScreen() throws LWJGLException { ScaledResolution var1 = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); GL11.glClear(16640); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0.0D, var1.getScaledWidth_double(), var1.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight); GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_FOG); Tessellator var2 = Tessellator.instance; GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture("/title/mojang.png")); var2.startDrawingQuads(); var2.setColorOpaque_I(16777215); var2.addVertexWithUV(0.0D, (double) mc.displayHeight, 0.0D, 0.0D, 0.0D); var2.addVertexWithUV((double) mc.displayWidth, (double) mc.displayHeight, 0.0D, 0.0D, 0.0D); var2.addVertexWithUV((double) mc.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); var2.draw(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); var2.setColorOpaque_I(16777215); short var3 = 256; short var4 = 256; mc.scaledTessellator((var1.getScaledWidth() - var3) / 2, (var1.getScaledHeight() - var4) / 2, 0, 0, var3, var4); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); Display.swapBuffers(); } /** * private function copied from Minecraft.java (MC 1.4.7 | MCP 7.26a) */ public static int mc_func_90020_K() { return mc.currentScreen != null && mc.currentScreen instanceof GuiMainMenu ? 2 : mc.gameSettings.limitFramerate; } }