diff --git a/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/Tessellator.java b/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/Tessellator.java index b9777c7..323ac4d 100644 --- a/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/Tessellator.java +++ b/src/lwjgl/java/net/lax1dude/eaglercraft/adapter/Tessellator.java @@ -278,7 +278,7 @@ public class Tessellator { if (this.addedVertices > 65534) return; ++this.addedVertices; - + this.rawBuffer[this.rawBufferIndex + 0] = Float.floatToRawIntBits((float) (par1 + this.xOffset)); this.rawBuffer[this.rawBufferIndex + 1] = Float.floatToRawIntBits((float) (par3 + this.yOffset)); this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits((float) (par5 + this.zOffset)); @@ -358,4 +358,17 @@ public class Tessellator { this.yOffset += (double) par2; this.zOffset += (double) par3; } + + public double debugGetTranslationX() { + return xOffset; + } + + public double debugGetTranslationY() { + return yOffset; + } + + public double debugGetTranslationZ() { + return zOffset; + } + } diff --git a/src/main/java/net/lax1dude/eaglercraft/glemu/EaglerAdapterGL30.java b/src/main/java/net/lax1dude/eaglercraft/glemu/EaglerAdapterGL30.java index c95b9d3..a6c72bf 100644 --- a/src/main/java/net/lax1dude/eaglercraft/glemu/EaglerAdapterGL30.java +++ b/src/main/java/net/lax1dude/eaglercraft/glemu/EaglerAdapterGL30.java @@ -65,7 +65,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 { public static final int GL_FRONT = RealOpenGLEnums.GL_FRONT; public static final int GL_COMPILE = RealOpenGLEnums.GL_COMPILE; public static final int GL_NEAREST = RealOpenGLEnums.GL_NEAREST; - public static final int GL_CLAMP = RealOpenGLEnums.GL_CLAMP; + public static final int GL_CLAMP = RealOpenGLEnums.GL_CLAMP_TO_EDGE; public static final int GL_TEXTURE_WRAP_S = RealOpenGLEnums.GL_TEXTURE_WRAP_S; public static final int GL_TEXTURE_WRAP_T = RealOpenGLEnums.GL_TEXTURE_WRAP_T; public static final int GL_REPEAT = RealOpenGLEnums.GL_REPEAT; @@ -354,7 +354,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 { deevis.set(p1, p2, p3); getMatrix().translate(deevis); if (isCompilingDisplayList) { - System.err.println("matrix is not supported while recording display list use tessellator class instead"); + throw new IllegalArgumentException("matrix is not supported while recording display list use tessellator class instead"); } } @@ -506,7 +506,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 { deevis.set(p2, p3, p4); getMatrix().rotate(p1 * toRad, deevis); if (isCompilingDisplayList) { - System.err.println("matrix is not supported while recording display list use tessellator class instead"); + throw new IllegalArgumentException("matrix is not supported while recording display list use tessellator class instead"); } } @@ -563,7 +563,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 { deevis.set(p1, p2, p3); getMatrix().scale(deevis); if (isCompilingDisplayList) { - System.err.println("matrix is not supported while recording display list use tessellator class instead"); + throw new IllegalArgumentException("matrix is not supported while recording display list use tessellator class instead"); } } diff --git a/src/main/java/net/lax1dude/eaglercraft/glemu/EffectPipelineFXAA.java b/src/main/java/net/lax1dude/eaglercraft/glemu/EffectPipelineFXAA.java deleted file mode 100644 index 6d275bb..0000000 --- a/src/main/java/net/lax1dude/eaglercraft/glemu/EffectPipelineFXAA.java +++ /dev/null @@ -1,259 +0,0 @@ -package net.lax1dude.eaglercraft.glemu; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.IntBuffer; - -import net.lax1dude.eaglercraft.EaglerAdapter; -import net.minecraft.client.Minecraft; - -import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_DEPTH_TEST; -import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDisable; -import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.*; - -public class EffectPipelineFXAA { - - private static boolean isUsingFXAA = false; - - private static FramebufferGL framebuffer = null; - private static RenderbufferGL framebuffer_color = null; - private static RenderbufferGL framebuffer_depth = null; - - private static ProgramGL fxaaProgram = null; - private static TextureGL fxaaSourceTexture = null; - private static UniformGL fxaaScreenSize = null; - - private static BufferArrayGL renderQuadArray = null; - private static BufferGL renderQuadBuffer; - - public static int displayWidth = -1; - public static int displayHeight = -1; - public static int width = -1; - public static int height = -1; - - private static int[] originalViewport = new int[4]; - - private static int state = 1; - private static int newState = -1; - private static boolean msaaInit = false; - - private static void initFXAA() { - if (fxaaProgram == null) { - renderQuadArray = _wglCreateVertexArray(); - renderQuadBuffer = _wglCreateBuffer(); - - IntBuffer upload = (isWebGL ? IntBuffer.wrap(new int[12]) - : ByteBuffer.allocateDirect(12 << 2).order(ByteOrder.nativeOrder()).asIntBuffer()); - upload.put(Float.floatToRawIntBits(0.0f)); - upload.put(Float.floatToRawIntBits(0.0f)); - upload.put(Float.floatToRawIntBits(0.0f)); - upload.put(Float.floatToRawIntBits(1.0f)); - upload.put(Float.floatToRawIntBits(1.0f)); - upload.put(Float.floatToRawIntBits(0.0f)); - upload.put(Float.floatToRawIntBits(0.0f)); - upload.put(Float.floatToRawIntBits(1.0f)); - upload.put(Float.floatToRawIntBits(1.0f)); - upload.put(Float.floatToRawIntBits(1.0f)); - upload.put(Float.floatToRawIntBits(1.0f)); - upload.put(Float.floatToRawIntBits(0.0f)); - upload.flip(); - - _wglBindVertexArray(renderQuadArray); - _wglBindBuffer(_wGL_ARRAY_BUFFER, renderQuadBuffer); - _wglBufferData0(_wGL_ARRAY_BUFFER, upload, _wGL_STATIC_DRAW); - _wglEnableVertexAttribArray(0); - _wglVertexAttribPointer(0, 2, _wGL_FLOAT, false, 8, 0); - - ShaderGL pvert_shader = _wglCreateShader(_wGL_VERTEX_SHADER); - - _wglShaderSource(pvert_shader, _wgetShaderHeader() + "\n" + fileContents("/glsl/pvert.glsl")); - _wglCompileShader(pvert_shader); - - if (!_wglGetShaderCompiled(pvert_shader)) - System.err.println( - ("\n" + _wglGetShaderInfoLog(pvert_shader)).replace("\n", "\n[/glsl/pvert.glsl] ") + "\n"); - - ShaderGL fxaa_shader = _wglCreateShader(_wGL_FRAGMENT_SHADER); - _wglShaderSource(fxaa_shader, _wgetShaderHeader() + "\n" + fileContents("/glsl/fxaa.glsl")); - _wglCompileShader(fxaa_shader); - - if (!_wglGetShaderCompiled(fxaa_shader)) - System.err.println( - ("\n" + _wglGetShaderInfoLog(fxaa_shader)).replace("\n", "\n[/glsl/fxaa.glsl] ") + "\n"); - - fxaaProgram = _wglCreateProgram(); - _wglAttachShader(fxaaProgram, pvert_shader); - _wglAttachShader(fxaaProgram, fxaa_shader); - _wglLinkProgram(fxaaProgram); - _wglDetachShader(fxaaProgram, pvert_shader); - _wglDetachShader(fxaaProgram, fxaa_shader); - _wglDeleteShader(pvert_shader); - _wglDeleteShader(fxaa_shader); - - if (!_wglGetProgramLinked(fxaaProgram)) { - System.err.println( - ("\n" + _wglGetProgramInfoLog(fxaaProgram)).replace("\n", "\n[/glsl/fxaa.glsl][LINKER] ") - + "\n"); - fxaaProgram = null; - throw new RuntimeException("Invalid shader code"); - } - - _wglUseProgram(fxaaProgram); - - UniformGL c = _wglGetUniformLocation(fxaaProgram, "f_color"); - if (c != null) - _wglUniform1i(c, 0); - - fxaaScreenSize = _wglGetUniformLocation(fxaaProgram, "screenSize"); - } - - destroy(); - - isUsingFXAA = true; - framebuffer = _wglCreateFramebuffer(); - fxaaSourceTexture = _wglGenTextures(); - - _wglBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture); - _wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST); - _wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST); - _wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP); - _wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_CLAMP); - _wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB8, width, height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, - (ByteBuffer) null); - - framebuffer_depth = _wglCreateRenderBuffer(); - _wglBindRenderbuffer(framebuffer_depth); - _wglRenderbufferStorage(_wGL_DEPTH_COMPONENT32F, width, height); - - _wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer); - _wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, fxaaSourceTexture); - _wglFramebufferRenderbuffer(_wGL_DEPTH_ATTACHMENT, framebuffer_depth); - } - - private static void initMSAA() { - destroy(); - msaaInit = true; - framebuffer = _wglCreateFramebuffer(); - framebuffer_color = _wglCreateRenderBuffer(); - framebuffer_depth = _wglCreateRenderBuffer(); - _wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer); - _wglBindRenderbuffer(framebuffer_color); - _wglRenderbufferStorageMultisample(state == 2 ? 4 : 8, _wGL_RGB8, width, height); - _wglBindRenderbuffer(framebuffer_depth); - _wglRenderbufferStorageMultisample(state == 2 ? 4 : 8, _wGL_DEPTH_COMPONENT32F, width, height); - _wglFramebufferRenderbuffer(_wGL_COLOR_ATTACHMENT0, framebuffer_color); - _wglFramebufferRenderbuffer(_wGL_DEPTH_ATTACHMENT, framebuffer_depth); - } - - public static void destroy() { - isUsingFXAA = false; - msaaInit = false; - if (framebuffer != null) - _wglDeleteFramebuffer(framebuffer); - if (framebuffer_color != null) - _wglDeleteRenderbuffer(framebuffer_color); - if (framebuffer_depth != null) - _wglDeleteRenderbuffer(framebuffer_depth); - if (fxaaSourceTexture != null) - _wglDeleteTextures(fxaaSourceTexture); - framebuffer = null; - framebuffer_color = null; - framebuffer_depth = null; - fxaaSourceTexture = null; - } - - public static void beginPipelineRender() { - if (displayWidth <= 0 || displayHeight <= 0) { - return; - } - int mode = 1; // Minecraft.getMinecraft().gameSettings.antialiasMode; //TODO: add - if (mode == 0) - newState = 0; - if (mode == 1) - newState = Minecraft.getMinecraft().gameSettings.fancyGraphics ? 1 : 0; - if (mode == 2) - newState = 1; - if (mode == 3) - newState = 2; - if (mode == 4) - newState = 3; - if (newState == 0) { - state = newState; - destroy(); - return; - } - if (newState != state && !(newState == 3 && state == 2)) { - destroy(); - } - // _wglGetParameter(_wGL_VIEWPORT, 4, originalViewport); - if (displayWidth != width || displayHeight != height || state != newState) { - state = newState; - width = displayWidth; - height = displayHeight; - originalViewport[0] = 0; - originalViewport[1] = 0; - originalViewport[2] = width; - originalViewport[3] = height; - if (state == 1) { - if (isUsingFXAA == false) { - initFXAA(); - } else { - _wglBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture); - _wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB8, width, height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, - (ByteBuffer) null); - _wglBindRenderbuffer(framebuffer_depth); - _wglRenderbufferStorage(_wGL_DEPTH_COMPONENT32F, width, height); - } - } else if (state == 2 || state == 3) { - if (msaaInit == false) { - initMSAA(); - } else { - _wglBindRenderbuffer(framebuffer_color); - _wglRenderbufferStorageMultisample(state == 2 ? 4 : 8, _wGL_RGB8, width, height); - _wglBindRenderbuffer(framebuffer_depth); - _wglRenderbufferStorageMultisample(state == 2 ? 4 : 8, _wGL_DEPTH_COMPONENT32F, width, height); - } - } - } - _wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer); - _wglViewport(0, 0, width, height); - if (!EaglerAdapter.isWebGL && (state == 2 || state == 3)) { - _wglEnable(_wGL_MULTISAMPLE); - _wglEnable(_wGL_LINE_SMOOTH); - } - } - - public static void endPipelineRender() { - if (displayWidth <= 0 || displayHeight <= 0 || state == 0) { - return; - } - _wglBindFramebuffer(_wGL_FRAMEBUFFER, null); - _wglClear(_wGL_COLOR_BUFFER_BIT | _wGL_DEPTH_BUFFER_BIT); - if (state == 1) { - _wglViewport(originalViewport[0], originalViewport[1], originalViewport[2], originalViewport[3]); - _wglActiveTexture(_wGL_TEXTURE0); - _wglBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture); - _wglDisable(_wGL_DEPTH_TEST); - _wglDisable(_wGL_CULL_FACE); - _wglDepthMask(false); - _wglUseProgram(fxaaProgram); - _wglUniform2f(fxaaScreenSize, width, height); - _wglBindVertexArray(renderQuadArray); - _wglDrawArrays(_wGL_TRIANGLES, 0, 6); - _wglEnable(_wGL_DEPTH_TEST); - _wglDepthMask(true); - } else if (state == 2 || state == 3) { - if (!EaglerAdapter.isWebGL) { - _wglDisable(_wGL_MULTISAMPLE); - _wglDisable(_wGL_LINE_SMOOTH); - } - _wglViewport(originalViewport[0], originalViewport[1], originalViewport[2], originalViewport[3]); - _wglBindFramebuffer(_wGL_READ_FRAMEBUFFER, framebuffer); - _wglBindFramebuffer(_wGL_DRAW_FRAMEBUFFER, null); - _wglDrawBuffer(_wGL_BACK); - _wglBlitFramebuffer(0, 0, width, height, 0, 0, width, height, _wGL_COLOR_BUFFER_BIT, _wGL_NEAREST); - _wglBindFramebuffer(_wGL_READ_FRAMEBUFFER, null); - } - } - -} diff --git a/src/main/java/net/lax1dude/eaglercraft/glemu/FixedFunctionShader.java b/src/main/java/net/lax1dude/eaglercraft/glemu/FixedFunctionShader.java index 600d0c9..2b56eaf 100644 --- a/src/main/java/net/lax1dude/eaglercraft/glemu/FixedFunctionShader.java +++ b/src/main/java/net/lax1dude/eaglercraft/glemu/FixedFunctionShader.java @@ -59,8 +59,7 @@ public class FixedFunctionShader { if ((i & UNIT0) == UNIT0) { CC_unit0 = true; } - s = new FixedFunctionShader(i, CC_a_color, CC_a_normal, CC_a_texture0, CC_lighting, CC_fog, CC_alphatest, - CC_unit0); + s = new FixedFunctionShader(i, CC_a_color, CC_a_normal, CC_a_texture0, CC_lighting, CC_fog, CC_alphatest, CC_unit0); instances[i] = s; } return s; diff --git a/src/main/java/net/minecraft/client/Minecraft.java b/src/main/java/net/minecraft/client/Minecraft.java index e6aa477..7db1bb3 100644 --- a/src/main/java/net/minecraft/client/Minecraft.java +++ b/src/main/java/net/minecraft/client/Minecraft.java @@ -19,12 +19,15 @@ public class Minecraft implements Runnable { instance = this; fullscreen = false; timer = new Timer(20F); - session = null; + session = new Session("fuck", "shit"); hideQuitButton = true; isWorldLoaded = false; currentScreen = null; + displayWidth = EaglerAdapter.getCanvasWidth(); + displayHeight = EaglerAdapter.getCanvasHeight(); loadingScreen = new LoadingScreenRenderer(this); entityRenderer = new EntityRenderer(this); + mouseHelper = new MouseHelper(); ticksRan = 0; field_6282_S = 0; field_6307_v = false; diff --git a/src/main/java/net/minecraft/src/FontRenderer.java b/src/main/java/net/minecraft/src/FontRenderer.java index ea68220..0d9bf41 100644 --- a/src/main/java/net/minecraft/src/FontRenderer.java +++ b/src/main/java/net/minecraft/src/FontRenderer.java @@ -17,7 +17,6 @@ public class FontRenderer { public FontRenderer(GameSettings gamesettings, String s, RenderEngine renderengine) { charWidth = new int[256]; fontTextureName = 0; - buffer = GLAllocation.createDirectIntBuffer(1024 /* GL_FRONT_LEFT */); BufferedImage bufferedimage; try { bufferedimage = ImageIO.read((RenderEngine.class).getResourceAsStream(s)); @@ -74,7 +73,6 @@ public class FontRenderer { tessellator.addVertexWithUV(0.0F + f, 0.0D, 0.0D, ((float) l1 + f) / 128F + f1, (float) k2 / 128F + f2); tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (float) l1 / 128F + f1, (float) k2 / 128F + f2); tessellator.draw(); - EaglerAdapter.glTranslatef(charWidth[i1], 0.0F, 0.0F); EaglerAdapter.glEndList(); } @@ -134,7 +132,6 @@ public class FontRenderer { f3 = 1.0F; } EaglerAdapter.glColor4f(f, f1, f2, f3); - buffer.clear(); EaglerAdapter.glPushMatrix(); EaglerAdapter.glTranslatef(i, j, 0.0F); for (int i1 = 0; i1 < s.length(); i1++) { @@ -143,29 +140,19 @@ public class FontRenderer { if (j1 < 0 || j1 > 15) { j1 = 15; } - buffer.put(fontDisplayLists + 256 + j1 + (flag ? 16 : 0)); - if (buffer.remaining() == 0) { - buffer.flip(); - EaglerAdapter.glCallLists(buffer); - buffer.clear(); - } + EaglerAdapter.glCallList(fontDisplayLists + 256 + j1 + (flag ? 16 : 0)); + EaglerAdapter.glTranslatef(charWidth[256 + j1 + (flag ? 16 : 0)] * 0.5f, 0.0F, 0.0F); } if (i1 < s.length()) { int k1 = FontAllowedCharacters.allowedCharacters.indexOf(s.charAt(i1)); if (k1 >= 0) { - buffer.put(fontDisplayLists + k1 + 32); + EaglerAdapter.glCallList(fontDisplayLists + k1 + 32); + EaglerAdapter.glTranslatef(charWidth[k1 + 32], 0.0F, 0.0F); } } - if (buffer.remaining() == 0) { - buffer.flip(); - EaglerAdapter.glCallLists(buffer); - buffer.clear(); - } } - - buffer.flip(); - EaglerAdapter.glCallLists(buffer); + EaglerAdapter.glPopMatrix(); } diff --git a/src/main/java/net/minecraft/src/GameSettings.java b/src/main/java/net/minecraft/src/GameSettings.java index 6fa62df..59a9628 100644 --- a/src/main/java/net/minecraft/src/GameSettings.java +++ b/src/main/java/net/minecraft/src/GameSettings.java @@ -5,8 +5,9 @@ package net.minecraft.src; // Decompiler options: packimports(3) braces deadcode import java.io.*; + +import net.lax1dude.eaglercraft.EaglerAdapter; import net.minecraft.client.Minecraft; -import org.lwjgl.input.Keyboard; public class GameSettings { @@ -91,7 +92,7 @@ public class GameSettings { } public String getOptionDisplayString(int i) { - return Keyboard.getKeyName(keyBindings[i].keyCode); + return EaglerAdapter.getKeyName(keyBindings[i].keyCode); } public void setKeyBinding(int i, int j) { diff --git a/src/main/java/net/minecraft/src/GuiChat.java b/src/main/java/net/minecraft/src/GuiChat.java index 716a64d..aad8566 100644 --- a/src/main/java/net/minecraft/src/GuiChat.java +++ b/src/main/java/net/minecraft/src/GuiChat.java @@ -1,8 +1,8 @@ package net.minecraft.src; +import net.lax1dude.eaglercraft.EaglerAdapter; + // Decompiled with: CFR 0.152 -// Class Version: 5 -import org.lwjgl.input.Keyboard; public class GuiChat extends GuiScreen { protected String field_985_a = ""; @@ -10,11 +10,11 @@ public class GuiChat extends GuiScreen { private static final String field_20082_i = FontAllowedCharacters.allowedCharacters; public void initGui() { - Keyboard.enableRepeatEvents(true); + EaglerAdapter.enableRepeatEvents(true); } public void onGuiClosed() { - Keyboard.enableRepeatEvents(false); + EaglerAdapter.enableRepeatEvents(false); } public void updateScreen() { diff --git a/src/main/java/net/minecraft/src/GuiCreateWorld.java b/src/main/java/net/minecraft/src/GuiCreateWorld.java index fdfbe05..cb849f9 100644 --- a/src/main/java/net/minecraft/src/GuiCreateWorld.java +++ b/src/main/java/net/minecraft/src/GuiCreateWorld.java @@ -6,8 +6,9 @@ package net.minecraft.src; import java.util.List; import java.util.Random; + +import net.lax1dude.eaglercraft.EaglerAdapter; import net.minecraft.client.Minecraft; -import org.lwjgl.input.Keyboard; public class GuiCreateWorld extends GuiScreen { @@ -22,7 +23,7 @@ public class GuiCreateWorld extends GuiScreen { public void initGui() { StringTranslate stringtranslate = StringTranslate.getInstance(); - Keyboard.enableRepeatEvents(true); + EaglerAdapter.enableRepeatEvents(true); controlList.clear(); controlList.add(new GuiButton(0, width / 2 - 100, height / 4 + 96 + 12, stringtranslate.translateKey("selectWorld.create"))); @@ -55,7 +56,7 @@ public class GuiCreateWorld extends GuiScreen { } public void onGuiClosed() { - Keyboard.enableRepeatEvents(false); + EaglerAdapter.enableRepeatEvents(false); } protected void actionPerformed(GuiButton guibutton) { diff --git a/src/main/java/net/minecraft/src/GuiMultiplayer.java b/src/main/java/net/minecraft/src/GuiMultiplayer.java index a6657a3..5adfc84 100644 --- a/src/main/java/net/minecraft/src/GuiMultiplayer.java +++ b/src/main/java/net/minecraft/src/GuiMultiplayer.java @@ -5,8 +5,9 @@ package net.minecraft.src; // Decompiler options: packimports(3) braces deadcode import java.util.List; + +import net.lax1dude.eaglercraft.EaglerAdapter; import net.minecraft.client.Minecraft; -import org.lwjgl.input.Keyboard; public class GuiMultiplayer extends GuiScreen { @@ -20,7 +21,7 @@ public class GuiMultiplayer extends GuiScreen { public void initGui() { StringTranslate stringtranslate = StringTranslate.getInstance(); - Keyboard.enableRepeatEvents(true); + EaglerAdapter.enableRepeatEvents(true); controlList.clear(); controlList.add(new GuiButton(0, width / 2 - 100, height / 4 + 96 + 12, stringtranslate.translateKey("multiplayer.connect"))); @@ -34,7 +35,7 @@ public class GuiMultiplayer extends GuiScreen { } public void onGuiClosed() { - Keyboard.enableRepeatEvents(false); + EaglerAdapter.enableRepeatEvents(false); } protected void actionPerformed(GuiButton guibutton) { diff --git a/src/main/java/net/minecraft/src/GuiRenameWorld.java b/src/main/java/net/minecraft/src/GuiRenameWorld.java index 92a7090..27029d9 100644 --- a/src/main/java/net/minecraft/src/GuiRenameWorld.java +++ b/src/main/java/net/minecraft/src/GuiRenameWorld.java @@ -5,9 +5,10 @@ package net.minecraft.src; // Decompiler options: packimports(3) braces deadcode import java.util.List; -import net.minecraft.client.Minecraft; import org.lwjgl.input.Keyboard; +import net.lax1dude.eaglercraft.EaglerAdapter; + public class GuiRenameWorld extends GuiScreen { public GuiRenameWorld(GuiScreen guiscreen, String s) { @@ -21,7 +22,7 @@ public class GuiRenameWorld extends GuiScreen { public void initGui() { StringTranslate stringtranslate = StringTranslate.getInstance(); - Keyboard.enableRepeatEvents(true); + EaglerAdapter.enableRepeatEvents(true); controlList.clear(); controlList.add(new GuiButton(0, width / 2 - 100, height / 4 + 96 + 12, stringtranslate.translateKey("selectWorld.renameButton"))); @@ -36,7 +37,7 @@ public class GuiRenameWorld extends GuiScreen { } public void onGuiClosed() { - Keyboard.enableRepeatEvents(false); + EaglerAdapter.enableRepeatEvents(false); } protected void actionPerformed(GuiButton guibutton) { diff --git a/src/main/java/net/minecraft/src/MouseHelper.java b/src/main/java/net/minecraft/src/MouseHelper.java index eed78e1..6557997 100644 --- a/src/main/java/net/minecraft/src/MouseHelper.java +++ b/src/main/java/net/minecraft/src/MouseHelper.java @@ -4,46 +4,36 @@ package net.minecraft.src; // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode -import java.awt.Component; import java.nio.IntBuffer; -import org.lwjgl.LWJGLException; -import org.lwjgl.input.Cursor; -import org.lwjgl.input.Mouse; + +import net.lax1dude.eaglercraft.EaglerAdapter; public class MouseHelper { - public MouseHelper(Component component) { + public MouseHelper() { field_1115_e = 10; - field_1117_c = component; IntBuffer intbuffer = GLAllocation.createDirectIntBuffer(1); intbuffer.put(0); intbuffer.flip(); IntBuffer intbuffer1 = GLAllocation.createDirectIntBuffer(1024); - try { - field_1116_d = new Cursor(32, 32, 16, 16, 1, intbuffer1, intbuffer); - } catch (LWJGLException lwjglexception) { - lwjglexception.printStackTrace(); - } } public void func_774_a() { - Mouse.setGrabbed(true); + EaglerAdapter.mouseSetGrabbed(true); deltaX = 0; deltaY = 0; } public void func_773_b() { - Mouse.setCursorPosition(field_1117_c.getWidth() / 2, field_1117_c.getHeight() / 2); - Mouse.setGrabbed(false); + EaglerAdapter.mouseSetCursorPosition(EaglerAdapter.getCanvasWidth() / 2, EaglerAdapter.getCanvasHeight() / 2); + EaglerAdapter.mouseSetGrabbed(false); } public void mouseXYChange() { - deltaX = Mouse.getDX(); - deltaY = Mouse.getDY(); + deltaX = EaglerAdapter.mouseGetDX(); + deltaY = EaglerAdapter.mouseGetDY(); } - - private Component field_1117_c; - private Cursor field_1116_d; + public int deltaX; public int deltaY; private int field_1115_e; diff --git a/src/main/java/net/minecraft/src/RenderGlobal.java b/src/main/java/net/minecraft/src/RenderGlobal.java index a950c86..f91049f 100644 --- a/src/main/java/net/minecraft/src/RenderGlobal.java +++ b/src/main/java/net/minecraft/src/RenderGlobal.java @@ -497,11 +497,11 @@ public class RenderGlobal implements IWorldAccess { double d1 = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * d; double d2 = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * d; double d3 = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * d; + /* int k1 = 0; for (int l1 = 0; l1 < field_1414_S.length; l1++) { field_1414_S[l1].func_859_b(); } - for (int i2 = 0; i2 < field_1415_R.size(); i2++) { WorldRenderer worldrenderer = (WorldRenderer) field_1415_R.get(i2); int j2 = -1; @@ -521,6 +521,16 @@ public class RenderGlobal implements IWorldAccess { } func_944_a(k, d); + */ + + for (int i2 = 0; i2 < field_1415_R.size(); i2++) { + WorldRenderer worldrenderer = (WorldRenderer) field_1415_R.get(i2); + EaglerAdapter.glPushMatrix(); + EaglerAdapter.glTranslatef((float)(worldrenderer.field_1755_i - d1), (float)(worldrenderer.field_1754_j - d2), (float)(worldrenderer.field_1753_k - d3)); + EaglerAdapter.glCallList(worldrenderer.getGLCallListForPass(k)); + EaglerAdapter.glPopMatrix(); + } + return l; } @@ -891,7 +901,7 @@ public class RenderGlobal implements IWorldAccess { aworldrenderer[k2] = worldrenderer1; continue; } - } else if (!worldrenderer1.isInFrustum) { + }else if (!worldrenderer1.isInFrustum) { continue; } if (arraylist == null) { diff --git a/src/main/java/net/minecraft/src/WorldRenderer.java b/src/main/java/net/minecraft/src/WorldRenderer.java index 259e704..4d775a1 100644 --- a/src/main/java/net/minecraft/src/WorldRenderer.java +++ b/src/main/java/net/minecraft/src/WorldRenderer.java @@ -40,9 +40,9 @@ public class WorldRenderer { field_1746_q = i + sizeWidth / 2; field_1743_r = j + sizeHeight / 2; field_1741_s = k + sizeDepth / 2; - field_1752_l = i & 0x3ff; + field_1752_l = i;// & 0x3ff; field_1751_m = j; - field_1750_n = k & 0x3ff; + field_1750_n = k;// & 0x3ff; field_1755_i = i - field_1752_l; field_1754_j = j - field_1751_m; field_1753_k = k - field_1750_n; @@ -103,16 +103,19 @@ public class WorldRenderer { if (!flag2) { flag2 = true; EaglerAdapter.glNewList(glRenderList + i2, 4864 /* GL_COMPILE */); - EaglerAdapter.glPushMatrix(); - setupGLTranslation(); + //EaglerAdapter.glPushMatrix(); + //tessellator.setTranslationF(field_1752_l, field_1751_m, field_1750_n); + //setupGLTranslation(); + /* float f = 1.000001F; EaglerAdapter.glTranslatef((float) (-sizeDepth) / 2.0F, (float) (-sizeHeight) / 2.0F, (float) (-sizeDepth) / 2.0F); EaglerAdapter.glScalef(f, f, f); EaglerAdapter.glTranslatef((float) sizeDepth / 2.0F, (float) sizeHeight / 2.0F, (float) sizeDepth / 2.0F); + */ tessellator.startDrawingQuads(); - tessellator.setTranslationD(-posX, -posY, -posZ); + //tessellator.setTranslationD(-posX, -posY, -posZ); } if (i2 == 0 && Block.isBlockContainer[i3]) { TileEntity tileentity = chunkcache.getBlockTileEntity(l2, j2, k2); @@ -137,7 +140,7 @@ public class WorldRenderer { if (flag2) { tessellator.draw(); - EaglerAdapter.glPopMatrix(); + //EaglerAdapter.glPopMatrix(); EaglerAdapter.glEndList(); tessellator.setTranslationD(0.0D, 0.0D, 0.0D); } else {