diff --git a/lwjgl-rundir/resources/glsl/core.glsl b/lwjgl-rundir/resources/glsl/core.glsl index 0b912f9..0c88351 100644 --- a/lwjgl-rundir/resources/glsl/core.glsl +++ b/lwjgl-rundir/resources/glsl/core.glsl @@ -108,9 +108,9 @@ void main(){ #ifdef CC_unit0 #ifdef CC_a_texture0 - color *= texture(tex0, (matrix_t * vec4(v_texture0, 0.0, 1.0)).xy).bgra; + color *= texture(tex0, (matrix_t * vec4(v_texture0, 0.0, 1.0)).xy).rgba; #else - color *= texture(tex0, (matrix_t * vec4(texCoordV0, 0.0, 1.0)).xy).bgra; + color *= texture(tex0, (matrix_t * vec4(texCoordV0, 0.0, 1.0)).xy).rgba; #endif #endif diff --git a/src/main/java/net/minecraft/client/Minecraft.java b/src/main/java/net/minecraft/client/Minecraft.java index 80fa185..3be74d0 100644 --- a/src/main/java/net/minecraft/client/Minecraft.java +++ b/src/main/java/net/minecraft/client/Minecraft.java @@ -60,7 +60,7 @@ public class Minecraft implements Runnable { mcDataDir = getMinecraftDir(); field_22008_V = new SaveConverterMcRegion(new File(mcDataDir, "saves")); gameSettings = new GameSettings(this, mcDataDir); - texturePackList = new TexturePackList(this, mcDataDir); + texturePackList = new TexturePackList(this); renderEngine = new RenderEngine(texturePackList, gameSettings); fontRenderer = new FontRenderer(gameSettings, "/font/default.png", renderEngine); checkGLError("Pre startup"); @@ -677,7 +677,7 @@ public class Minecraft implements Runnable { if (EaglerAdapter.getEventKey() == gameSettings.keyBindDrop.keyCode) { thePlayer.dropCurrentItem(); } - if (isMultiplayerWorld() && EaglerAdapter.getEventKey() == gameSettings.keyBindChat.keyCode) { + if (EaglerAdapter.getEventKey() == gameSettings.keyBindChat.keyCode) { displayGuiScreen(new GuiChat()); } } @@ -1007,8 +1007,10 @@ public class Minecraft implements Runnable { } public boolean func_22003_b(String s) { - if (!s.startsWith("/")) - ; + if (s.startsWith("/")) { + + return true; + } return false; } diff --git a/src/main/java/net/minecraft/src/ColorizerFoliage.java b/src/main/java/net/minecraft/src/ColorizerFoliage.java index 262d55e..f1345af 100644 --- a/src/main/java/net/minecraft/src/ColorizerFoliage.java +++ b/src/main/java/net/minecraft/src/ColorizerFoliage.java @@ -4,8 +4,9 @@ package net.minecraft.src; // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode -import java.awt.image.BufferedImage; -import javax.imageio.ImageIO; + +import net.lax1dude.eaglercraft.EaglerAdapter; +import net.lax1dude.eaglercraft.EaglerImage; public class ColorizerFoliage { @@ -13,6 +14,9 @@ public class ColorizerFoliage { } public static int getFoliageColor(double d, double d1) { + if(foliageBuffer == null) { + foliageBuffer = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/misc/foliagecolor.png")).data; + } d1 *= d; int i = (int) ((1.0D - d) * 255D); int j = (int) ((1.0D - d1) * 255D); @@ -26,24 +30,7 @@ public class ColorizerFoliage { public static int func_21174_b() { return 0x80a755; } + + private static int foliageBuffer[] = null; - static Class _mthclass$(String s) { - try { - return Class.forName(s); - } catch (ClassNotFoundException classnotfoundexception) { - throw new NoClassDefFoundError(classnotfoundexception.getMessage()); - } - } - - private static final int foliageBuffer[]; - - static { - foliageBuffer = new int[0x10000]; - try { - BufferedImage bufferedimage = ImageIO.read((ColorizerFoliage.class).getResource("/misc/foliagecolor.png")); - bufferedimage.getRGB(0, 0, 256, 256, foliageBuffer, 0, 256); - } catch (Exception exception) { - exception.printStackTrace(); - } - } } diff --git a/src/main/java/net/minecraft/src/ColorizerGrass.java b/src/main/java/net/minecraft/src/ColorizerGrass.java index 20c1b94..e713ce5 100644 --- a/src/main/java/net/minecraft/src/ColorizerGrass.java +++ b/src/main/java/net/minecraft/src/ColorizerGrass.java @@ -4,8 +4,9 @@ package net.minecraft.src; // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode -import java.awt.image.BufferedImage; -import javax.imageio.ImageIO; + +import net.lax1dude.eaglercraft.EaglerAdapter; +import net.lax1dude.eaglercraft.EaglerImage; public class ColorizerGrass { @@ -13,29 +14,14 @@ public class ColorizerGrass { } public static int getGrassColor(double d, double d1) { + if(grassBuffer == null) { + grassBuffer = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/misc/grasscolor.png")).data; + } d1 *= d; int i = (int) ((1.0D - d) * 255D); int j = (int) ((1.0D - d1) * 255D); return grassBuffer[j << 8 | i]; } - static Class _mthclass$(String s) { - try { - return Class.forName(s); - } catch (ClassNotFoundException classnotfoundexception) { - throw new NoClassDefFoundError(classnotfoundexception.getMessage()); - } - } - - private static final int grassBuffer[]; - - static { - grassBuffer = new int[0x10000]; - try { - BufferedImage bufferedimage = ImageIO.read((ColorizerFoliage.class).getResource("/misc/grasscolor.png")); - bufferedimage.getRGB(0, 0, 256, 256, grassBuffer, 0, 256); - } catch (Exception exception) { - exception.printStackTrace(); - } - } + private static int grassBuffer[] = null; } diff --git a/src/main/java/net/minecraft/src/FontAllowedCharacters.java b/src/main/java/net/minecraft/src/FontAllowedCharacters.java index 7a66461..f3763cc 100644 --- a/src/main/java/net/minecraft/src/FontAllowedCharacters.java +++ b/src/main/java/net/minecraft/src/FontAllowedCharacters.java @@ -7,6 +7,8 @@ package net.minecraft.src; import java.io.BufferedReader; import java.io.InputStreamReader; +import net.lax1dude.eaglercraft.EaglerAdapter; + public class FontAllowedCharacters { public FontAllowedCharacters() { @@ -15,8 +17,7 @@ public class FontAllowedCharacters { private static String getAllowedCharacters() { String s = ""; try { - BufferedReader bufferedreader = new BufferedReader( - new InputStreamReader((FontAllowedCharacters.class).getResourceAsStream("/font.txt"), "UTF-8")); + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(EaglerAdapter.loadResource("/font.txt"), "UTF-8")); String s1 = ""; do { String s2; @@ -34,7 +35,6 @@ public class FontAllowedCharacters { } public static final String allowedCharacters = getAllowedCharacters(); - public static final char field_22286_b[] = { '/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', - '"', ':' }; + public static final char field_22286_b[] = { '/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '"', ':' }; } diff --git a/src/main/java/net/minecraft/src/FontRenderer.java b/src/main/java/net/minecraft/src/FontRenderer.java index 0d9bf41..ceafbd5 100644 --- a/src/main/java/net/minecraft/src/FontRenderer.java +++ b/src/main/java/net/minecraft/src/FontRenderer.java @@ -4,12 +4,10 @@ package net.minecraft.src; // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode -import java.awt.image.BufferedImage; -import java.io.IOException; import java.nio.IntBuffer; -import javax.imageio.ImageIO; import net.lax1dude.eaglercraft.EaglerAdapter; +import net.lax1dude.eaglercraft.EaglerImage; import net.lax1dude.eaglercraft.adapter.Tessellator; public class FontRenderer { @@ -17,16 +15,10 @@ public class FontRenderer { public FontRenderer(GameSettings gamesettings, String s, RenderEngine renderengine) { charWidth = new int[256]; fontTextureName = 0; - BufferedImage bufferedimage; - try { - bufferedimage = ImageIO.read((RenderEngine.class).getResourceAsStream(s)); - } catch (IOException ioexception) { - throw new RuntimeException(ioexception); - } - int i = bufferedimage.getWidth(); - int j = bufferedimage.getHeight(); - int ai[] = new int[i * j]; - bufferedimage.getRGB(0, 0, i, j, ai, 0, i); + EaglerImage bufferedimage = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes(s)); + int i = bufferedimage.w; + int j = bufferedimage.h; + int ai[] = bufferedimage.data; for (int k = 0; k < 256; k++) { int l = k % 16; int k1 = k / 16; diff --git a/src/main/java/net/minecraft/src/GuiChat.java b/src/main/java/net/minecraft/src/GuiChat.java index aad8566..a021c1d 100644 --- a/src/main/java/net/minecraft/src/GuiChat.java +++ b/src/main/java/net/minecraft/src/GuiChat.java @@ -30,7 +30,11 @@ public class GuiChat extends GuiScreen { String string; String string2 = this.field_985_a.trim(); if (string2.length() > 0 && !this.mc.func_22003_b(string = this.field_985_a.trim())) { - this.mc.thePlayer.sendChatMessage(string); + if(mc.isMultiplayerWorld()) { + this.mc.thePlayer.sendChatMessage(string); + }else { + this.mc.ingameGUI.addChatMessage(string); + } } this.mc.displayGuiScreen(null); return; diff --git a/src/main/java/net/minecraft/src/ImageBuffer.java b/src/main/java/net/minecraft/src/ImageBuffer.java index b724462..688e871 100644 --- a/src/main/java/net/minecraft/src/ImageBuffer.java +++ b/src/main/java/net/minecraft/src/ImageBuffer.java @@ -1,12 +1,13 @@ package net.minecraft.src; + +import net.lax1dude.eaglercraft.EaglerImage; + // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode -import java.awt.image.BufferedImage; - public interface ImageBuffer { - public abstract BufferedImage parseUserSkin(BufferedImage bufferedimage); + public abstract EaglerImage parseUserSkin(EaglerImage bufferedimage); } diff --git a/src/main/java/net/minecraft/src/ImageBufferDownload.java b/src/main/java/net/minecraft/src/ImageBufferDownload.java deleted file mode 100644 index 26ee13c..0000000 --- a/src/main/java/net/minecraft/src/ImageBufferDownload.java +++ /dev/null @@ -1,96 +0,0 @@ -package net.minecraft.src; -// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. - -// Jad home page: http://www.kpdus.com/jad.html -// Decompiler options: packimports(3) braces deadcode - -import java.awt.Graphics; -import java.awt.image.*; - -public class ImageBufferDownload implements ImageBuffer { - - public ImageBufferDownload() { - } - - public BufferedImage parseUserSkin(BufferedImage bufferedimage) { - if (bufferedimage == null) { - return null; - } - imageWidth = 64; - imageHeight = 32; - BufferedImage bufferedimage1 = new BufferedImage(imageWidth, imageHeight, 2); - Graphics g = bufferedimage1.getGraphics(); - g.drawImage(bufferedimage, 0, 0, null); - g.dispose(); - imageData = ((DataBufferInt) bufferedimage1.getRaster().getDataBuffer()).getData(); - func_884_b(0, 0, 32, 16); - func_885_a(32, 0, 64, 32); - func_884_b(0, 16, 64, 32); - boolean flag = false; - for (int i = 32; i < 64; i++) { - for (int k = 0; k < 16; k++) { - int i1 = imageData[i + k * 64]; - if ((i1 >> 24 & 0xff) < 128) { - flag = true; - } - } - - } - - if (!flag) { - for (int j = 32; j < 64; j++) { - for (int l = 0; l < 16; l++) { - int j1 = imageData[j + l * 64]; - boolean flag1; - if ((j1 >> 24 & 0xff) < 128) { - flag1 = true; - } - } - - } - - } - return bufferedimage1; - } - - private void func_885_a(int i, int j, int k, int l) { - if (func_886_c(i, j, k, l)) { - return; - } - for (int i1 = i; i1 < k; i1++) { - for (int j1 = j; j1 < l; j1++) { - imageData[i1 + j1 * imageWidth] &= 0xffffff; - } - - } - - } - - private void func_884_b(int i, int j, int k, int l) { - for (int i1 = i; i1 < k; i1++) { - for (int j1 = j; j1 < l; j1++) { - imageData[i1 + j1 * imageWidth] |= 0xff000000; - } - - } - - } - - private boolean func_886_c(int i, int j, int k, int l) { - for (int i1 = i; i1 < k; i1++) { - for (int j1 = j; j1 < l; j1++) { - int k1 = imageData[i1 + j1 * imageWidth]; - if ((k1 >> 24 & 0xff) < 128) { - return true; - } - } - - } - - return false; - } - - private int imageData[]; - private int imageWidth; - private int imageHeight; -} diff --git a/src/main/java/net/minecraft/src/RenderEngine.java b/src/main/java/net/minecraft/src/RenderEngine.java index 0186aa0..f072553 100644 --- a/src/main/java/net/minecraft/src/RenderEngine.java +++ b/src/main/java/net/minecraft/src/RenderEngine.java @@ -4,22 +4,16 @@ package net.minecraft.src; // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode -import java.awt.Graphics; -import java.awt.image.BufferedImage; import java.io.IOException; -import java.io.InputStream; -import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import java.util.Set; -import javax.imageio.ImageIO; import net.lax1dude.eaglercraft.EaglerAdapter; +import net.lax1dude.eaglercraft.EaglerImage; import net.lax1dude.eaglercraft.TextureLocation; public class RenderEngine { @@ -49,9 +43,10 @@ public class RenderEngine { singleIntBuffer.clear(); GLAllocation.generateTextureNames(singleIntBuffer); int i = singleIntBuffer.get(0); - if (s.startsWith("##")) { - setupTexture(unwrapImageByColumns(readTextureImage(texturepackbase.func_6481_a(s.substring(2)))), i); - } else if (s.startsWith("%clamp%")) { + //if (s.startsWith("##")) { + // setupTexture(unwrapImageByColumns(readTextureImage(texturepackbase.func_6481_a(s.substring(2)))), i); + //} else + if (s.startsWith("%clamp%")) { clampTexture = true; setupTexture(readTextureImage(texturepackbase.func_6481_a(s.substring(7))), i); clampTexture = false; @@ -72,7 +67,7 @@ public class RenderEngine { throw new RuntimeException("!!"); } } - +/* private BufferedImage unwrapImageByColumns(BufferedImage bufferedimage) { int i = bufferedimage.getWidth() / 16; BufferedImage bufferedimage1 = new BufferedImage(16, bufferedimage.getHeight() * i, 2); @@ -84,8 +79,8 @@ public class RenderEngine { g.dispose(); return bufferedimage1; } - - public int allocateAndSetupTexture(BufferedImage bufferedimage) { +*/ + public int allocateAndSetupTexture(EaglerImage bufferedimage) { singleIntBuffer.clear(); GLAllocation.generateTextureNames(singleIntBuffer); int i = singleIntBuffer.get(0); @@ -94,7 +89,7 @@ public class RenderEngine { return i; } - public void setupTexture(BufferedImage bufferedimage, int i) { + public void setupTexture(EaglerImage bufferedimage, int i) { EaglerAdapter.glBindTexture(3553 /* GL_TEXTURE_2D */, i); if (useMipmaps) { EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, EaglerAdapter.GL_NEAREST_MIPMAP_LINEAR); @@ -115,16 +110,15 @@ public class RenderEngine { EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10497 /* GL_REPEAT */); EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10497 /* GL_REPEAT */); } - int j = bufferedimage.getWidth(); - int k = bufferedimage.getHeight(); - int ai[] = new int[j * k]; + int j = bufferedimage.w; + int k = bufferedimage.h; + int ai[] = bufferedimage.data; byte abyte0[] = new byte[j * k * 4]; - bufferedimage.getRGB(0, 0, j, k, ai, 0, j); for (int l = 0; l < ai.length; l++) { int j1 = ai[l] >> 24 & 0xff; int l1 = ai[l] >> 16 & 0xff; int j2 = ai[l] >> 8 & 0xff; - int l2 = ai[l] & 0xff; + int l2 = ai[l] >> 0 & 0xff; if (options != null && options.anaglyph) { int j3 = (l1 * 30 + j2 * 59 + l2 * 11) / 100; int l3 = (l1 * 30 + j2 * 70) / 100; @@ -138,7 +132,6 @@ public class RenderEngine { abyte0[l * 4 + 2] = (byte) l2; abyte0[l * 4 + 3] = (byte) j1; } - imageDataB1.clear(); imageDataB1.put(abyte0); imageDataB1.position(0).limit(abyte0.length); @@ -177,6 +170,7 @@ public class RenderEngine { } public int getTextureForDownloadableImage(String s, String s1) { + /* ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData) urlToImageDataMap.get(s); if (threaddownloadimagedata != null && threaddownloadimagedata.image != null && !threaddownloadimagedata.textureSetupComplete) { @@ -196,8 +190,10 @@ public class RenderEngine { } else { return threaddownloadimagedata.textureName; } + */ + return getTexture("/mob/char.png"); } - +/* public ThreadDownloadImageData obtainImageData(String s, ImageBuffer imagebuffer) { ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData) urlToImageDataMap.get(s); if (threaddownloadimagedata == null) { @@ -220,7 +216,7 @@ public class RenderEngine { } } } - +*/ public void registerTextureFX(TextureFX texturefx) { textureList.add(texturefx); texturefx.onTick(); @@ -327,7 +323,7 @@ public class RenderEngine { return ((k + l >> 1) << 24) + ((i & 0xfefefe) + (j & 0xfefefe) >> 1); } - +/* private int weightedAverageColor(int i, int j) { int k = (i & 0xff000000) >> 24 & 0xff; int l = (j & 0xff000000) >> 24 & 0xff; @@ -348,31 +344,34 @@ public class RenderEngine { int i3 = (k1 + j2) / (k + l); return c << 24 | k2 << 16 | l2 << 8 | i3; } - +*/ public void refreshTextures() { TextureLocation.freeTextures(); TexturePackBase texturepackbase = field_6527_k.selectedTexturePack; int i; - BufferedImage bufferedimage; + EaglerImage bufferedimage; for (Iterator iterator = textureNameToImageMap.keySet().iterator(); iterator .hasNext(); setupTexture(bufferedimage, i)) { i = ((Integer) iterator.next()).intValue(); - bufferedimage = (BufferedImage) textureNameToImageMap.get(Integer.valueOf(i)); + bufferedimage = (EaglerImage) textureNameToImageMap.get(Integer.valueOf(i)); } - for (Iterator iterator1 = urlToImageDataMap.values().iterator(); iterator1.hasNext();) { - ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData) iterator1.next(); - threaddownloadimagedata.textureSetupComplete = false; - } + //for (Iterator iterator1 = urlToImageDataMap.values().iterator(); iterator1.hasNext();) { + // ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData) iterator1.next(); + // threaddownloadimagedata.textureSetupComplete = false; + //} for (Iterator iterator2 = textureMap.keySet().iterator(); iterator2.hasNext();) { String s = (String) iterator2.next(); try { - BufferedImage bufferedimage1; + EaglerImage bufferedimage1; + /* if (s.startsWith("##")) { bufferedimage1 = unwrapImageByColumns( readTextureImage(texturepackbase.func_6481_a(s.substring(2)))); - } else if (s.startsWith("%clamp%")) { + } else + */ + if (s.startsWith("%clamp%")) { clampTexture = true; bufferedimage1 = readTextureImage(texturepackbase.func_6481_a(s.substring(7))); } else if (s.startsWith("%blur%")) { @@ -392,10 +391,8 @@ public class RenderEngine { } - private BufferedImage readTextureImage(InputStream inputstream) throws IOException { - BufferedImage bufferedimage = ImageIO.read(inputstream); - inputstream.close(); - return bufferedimage; + private EaglerImage readTextureImage(byte[] inputstream) throws IOException { + return EaglerImage.loadImage(inputstream); } public void bindTexture(int i) { diff --git a/src/main/java/net/minecraft/src/RenderGlobal.java b/src/main/java/net/minecraft/src/RenderGlobal.java index ebecf26..aa0ca60 100644 --- a/src/main/java/net/minecraft/src/RenderGlobal.java +++ b/src/main/java/net/minecraft/src/RenderGlobal.java @@ -535,13 +535,6 @@ public class RenderGlobal implements IWorldAccess { return l; } - public void func_944_a(int i, double d) { - for (int j = 0; j < field_1414_S.length; j++) { - field_1414_S[j].func_860_a(); - } - - } - public void func_945_d() { field_1435_x++; } @@ -985,7 +978,7 @@ public class RenderGlobal implements IWorldAccess { movingobjectposition.blockZ); Block block = k <= 0 ? null : Block.blocksList[k]; EaglerAdapter.glDisable(3008 /* GL_ALPHA_TEST */); - EaglerAdapter.glPolygonOffset(-3F, -3F); + EaglerAdapter.glPolygonOffset(3F, 3F); EaglerAdapter.glEnable(32823 /* GL_POLYGON_OFFSET_FILL */); tessellator.startDrawingQuads(); double d = entityplayer.lastTickPosX + (entityplayer.posX - entityplayer.lastTickPosX) * (double) f; @@ -1201,22 +1194,22 @@ public class RenderGlobal implements IWorldAccess { } public void obtainEntitySkin(Entity entity) { - entity.updateCloak(); - if (entity.skinUrl != null) { - renderEngine.obtainImageData(entity.skinUrl, new ImageBufferDownload()); - } - if (entity.cloakUrl != null) { - renderEngine.obtainImageData(entity.cloakUrl, new ImageBufferDownload()); - } + //entity.updateCloak(); + //if (entity.skinUrl != null) { + // renderEngine.obtainImageData(entity.skinUrl, new ImageBufferDownload()); + //} + //if (entity.cloakUrl != null) { + // renderEngine.obtainImageData(entity.cloakUrl, new ImageBufferDownload()); + //} } public void releaseEntitySkin(Entity entity) { - if (entity.skinUrl != null) { - renderEngine.releaseImageData(entity.skinUrl); - } - if (entity.cloakUrl != null) { - renderEngine.releaseImageData(entity.cloakUrl); - } + //if (entity.skinUrl != null) { + // renderEngine.releaseImageData(entity.skinUrl); + //} + //if (entity.cloakUrl != null) { + // renderEngine.releaseImageData(entity.cloakUrl); + //} } public void updateAllRenderers() { @@ -1270,7 +1263,6 @@ public class RenderGlobal implements IWorldAccess { private int field_1416_Q; private int field_21156_R; private List field_1415_R; - private RenderList field_1414_S[] = { new RenderList(), new RenderList(), new RenderList(), new RenderList() }; int field_1455_d; int field_1454_e; double field_1453_f; diff --git a/src/main/java/net/minecraft/src/RenderHelper.java b/src/main/java/net/minecraft/src/RenderHelper.java index 26c75c7..386ef74 100644 --- a/src/main/java/net/minecraft/src/RenderHelper.java +++ b/src/main/java/net/minecraft/src/RenderHelper.java @@ -27,7 +27,11 @@ public class RenderHelper { public static void enableStandardItemLighting() { EaglerAdapter.glEnable(EaglerAdapter.GL_LIGHTING); EaglerAdapter.glEnable(EaglerAdapter.GL_COLOR_MATERIAL); + EaglerAdapter.glPushMatrix(); + EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F); EaglerAdapter.copyModelToLightMatrix(); + //EaglerAdapter.flipLightMatrix(); + EaglerAdapter.glPopMatrix(); /* EaglerAdapter.glColorMaterial(EaglerAdapter.GL_FRONT_AND_BACK, EaglerAdapter.GL_AMBIENT_AND_DIFFUSE); float var0 = 0.4F; @@ -47,7 +51,7 @@ public class RenderHelper { } public static void enableStandardItemLighting2() { EaglerAdapter.glPushMatrix(); - EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F); + //EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F); enableStandardItemLighting(); EaglerAdapter.glPopMatrix(); } @@ -60,7 +64,7 @@ public class RenderHelper { EaglerAdapter.glPushMatrix(); EaglerAdapter.glRotatef(-30.0F, 0.0F, 1.0F, 0.0F); EaglerAdapter.glRotatef(165.0F, 1.0F, 0.0F, 0.0F); - //EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F); + EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F); enableStandardItemLighting(); EaglerAdapter.glPopMatrix(); } @@ -69,7 +73,7 @@ public class RenderHelper { EaglerAdapter.glPushMatrix(); EaglerAdapter.glRotatef(-30.0F, 0.0F, 1.0F, 0.0F); EaglerAdapter.glRotatef(165.0F, 1.0F, 0.0F, 0.0F); - EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F); + //EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F); enableStandardItemLighting(); EaglerAdapter.glPopMatrix(); } diff --git a/src/main/java/net/minecraft/src/RenderList.java b/src/main/java/net/minecraft/src/RenderList.java deleted file mode 100644 index c7a5119..0000000 --- a/src/main/java/net/minecraft/src/RenderList.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.minecraft.src; -// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. - -// Jad home page: http://www.kpdus.com/jad.html -// Decompiler options: packimports(3) braces deadcode - -import java.nio.IntBuffer; - -import net.lax1dude.eaglercraft.EaglerAdapter; - -public class RenderList { - - public RenderList() { - field_1236_g = GLAllocation.createDirectIntBuffer(0x10000); - field_1235_h = false; - field_1234_i = false; - } - - public void func_861_a(int i, int j, int k, double d, double d1, double d2) { - field_1235_h = true; - field_1236_g.clear(); - field_1242_a = i; - field_1241_b = j; - field_1240_c = k; - field_1239_d = (float) d; - field_1238_e = (float) d1; - field_1237_f = (float) d2; - } - - public boolean func_862_a(int i, int j, int k) { - if (!field_1235_h) { - return false; - } else { - return i == field_1242_a && j == field_1241_b && k == field_1240_c; - } - } - - public void func_858_a(int i) { - field_1236_g.put(i); - if (field_1236_g.remaining() == 0) { - func_860_a(); - } - } - - public void func_860_a() { - if (!field_1235_h) { - return; - } - if (!field_1234_i) { - field_1236_g.flip(); - field_1234_i = true; - } - if (field_1236_g.remaining() > 0) { - EaglerAdapter.glPushMatrix(); - EaglerAdapter.glTranslatef((float) field_1242_a - field_1239_d, (float) field_1241_b - field_1238_e, - (float) field_1240_c - field_1237_f); - EaglerAdapter.glCallLists(field_1236_g); - EaglerAdapter.glPopMatrix(); - } - } - - public void func_859_b() { - field_1235_h = false; - field_1234_i = false; - } - - private int field_1242_a; - private int field_1241_b; - private int field_1240_c; - private float field_1239_d; - private float field_1238_e; - private float field_1237_f; - private IntBuffer field_1236_g; - private boolean field_1235_h; - private boolean field_1234_i; -} diff --git a/src/main/java/net/minecraft/src/RenderPlayer.java b/src/main/java/net/minecraft/src/RenderPlayer.java index d5f18fd..67b71e9 100644 --- a/src/main/java/net/minecraft/src/RenderPlayer.java +++ b/src/main/java/net/minecraft/src/RenderPlayer.java @@ -123,6 +123,7 @@ public class RenderPlayer extends RenderLiving { renderManager.itemRenderer.renderItem(itemstack); EaglerAdapter.glPopMatrix(); } + /* if (entityplayer.username.equals("deadmau5") && loadDownloadableImageTexture(entityplayer.skinUrl, null)) { for (int i = 0; i < 2; i++) { float f2 = (entityplayer.prevRotationYaw @@ -145,6 +146,8 @@ public class RenderPlayer extends RenderLiving { } } + */ + /* if (loadDownloadableImageTexture(entityplayer.field_20067_q, null)) { EaglerAdapter.glPushMatrix(); EaglerAdapter.glTranslatef(0.0F, 0.0F, 0.125F); @@ -185,6 +188,7 @@ public class RenderPlayer extends RenderLiving { modelBipedMain.renderCloak(0.0625F); EaglerAdapter.glPopMatrix(); } + */ ItemStack itemstack1 = entityplayer.inventory.getCurrentItem(); if (itemstack1 != null) { EaglerAdapter.glPushMatrix(); diff --git a/src/main/java/net/minecraft/src/StringTranslate.java b/src/main/java/net/minecraft/src/StringTranslate.java index fa88dca..3a45c1c 100644 --- a/src/main/java/net/minecraft/src/StringTranslate.java +++ b/src/main/java/net/minecraft/src/StringTranslate.java @@ -7,12 +7,14 @@ package net.minecraft.src; import java.io.IOException; import java.util.Properties; +import net.lax1dude.eaglercraft.EaglerAdapter; + public class StringTranslate { private StringTranslate() { translateTable = new Properties(); try { - translateTable.load((StringTranslate.class).getResourceAsStream("/lang/en_US.lang")); + translateTable.load(EaglerAdapter.loadResource("/lang/en_US.lang")); } catch (IOException ioexception) { ioexception.printStackTrace(); } diff --git a/src/main/java/net/minecraft/src/TerrainTextureManager.java b/src/main/java/net/minecraft/src/TerrainTextureManager.java index f61fe4c..8c39f30 100644 --- a/src/main/java/net/minecraft/src/TerrainTextureManager.java +++ b/src/main/java/net/minecraft/src/TerrainTextureManager.java @@ -4,11 +4,12 @@ package net.minecraft.src; // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode -import java.awt.image.BufferedImage; import java.io.IOException; -import java.util.Arrays; import javax.imageio.ImageIO; +import net.lax1dude.eaglercraft.EaglerAdapter; +import net.lax1dude.eaglercraft.EaglerImage; + public class TerrainTextureManager { public TerrainTextureManager() { @@ -19,41 +20,34 @@ public class TerrainTextureManager { field_1184_e = new int[5120]; field_1183_f = new int[34]; field_1182_g = new int[768]; - try { - BufferedImage bufferedimage = ImageIO.read((TerrainTextureManager.class).getResource("/terrain.png")); - int ai[] = new int[0x10000]; - bufferedimage.getRGB(0, 0, 256, 256, ai, 0, 256); - for (int j = 0; j < 256; j++) { - int k = 0; - int l = 0; - int i1 = 0; - int j1 = (j % 16) * 16; - int k1 = (j / 16) * 16; - int l1 = 0; - for (int i2 = 0; i2 < 16; i2++) { - for (int j2 = 0; j2 < 16; j2++) { - int k2 = ai[j2 + j1 + (i2 + k1) * 256]; - int l2 = k2 >> 24 & 0xff; - if (l2 > 128) { - k += k2 >> 16 & 0xff; - l += k2 >> 8 & 0xff; - i1 += k2 & 0xff; - l1++; - } - } - - if (l1 == 0) { + int ai[] = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/terrain.png")).data; + for (int j = 0; j < 256; j++) { + int k = 0; + int l = 0; + int i1 = 0; + int j1 = (j % 16) * 16; + int k1 = (j / 16) * 16; + int l1 = 0; + for (int i2 = 0; i2 < 16; i2++) { + for (int j2 = 0; j2 < 16; j2++) { + int k2 = ai[j2 + j1 + (i2 + k1) * 256]; + int l2 = k2 >> 24 & 0xff; + if (l2 > 128) { + k += k2 >> 16 & 0xff; + l += k2 >> 8 & 0xff; + i1 += k2 & 0xff; l1++; } - field_1181_a[j * 3 + 0] = k / l1; - field_1181_a[j * 3 + 1] = l / l1; - field_1181_a[j * 3 + 2] = i1 / l1; } + if (l1 == 0) { + l1++; + } + field_1181_a[j * 3 + 0] = k / l1; + field_1181_a[j * 3 + 1] = l / l1; + field_1181_a[j * 3 + 2] = i1 / l1; } - } catch (IOException ioexception) { - ioexception.printStackTrace(); } for (int i = 0; i < 256; i++) { if (Block.blocksList[i] != null) { diff --git a/src/main/java/net/minecraft/src/TextureCompassFX.java b/src/main/java/net/minecraft/src/TextureCompassFX.java index 2cba93b..217bb29 100644 --- a/src/main/java/net/minecraft/src/TextureCompassFX.java +++ b/src/main/java/net/minecraft/src/TextureCompassFX.java @@ -4,27 +4,21 @@ package net.minecraft.src; // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode -import java.awt.image.BufferedImage; -import java.io.IOException; -import javax.imageio.ImageIO; + +import net.lax1dude.eaglercraft.EaglerAdapter; +import net.lax1dude.eaglercraft.EaglerImage; import net.minecraft.client.Minecraft; public class TextureCompassFX extends TextureFX { public TextureCompassFX(Minecraft minecraft) { super(Item.compass.getIconIndex(null)); - field_4230_h = new int[256]; mc = minecraft; tileImage = 1; - try { - BufferedImage bufferedimage = ImageIO - .read((net.minecraft.client.Minecraft.class).getResource("/gui/items.png")); - int i = (iconIndex % 16) * 16; - int j = (iconIndex / 16) * 16; - bufferedimage.getRGB(i, j, 16, 16, field_4230_h, 0, 16); - } catch (IOException ioexception) { - ioexception.printStackTrace(); - } + EaglerImage bufferedimage = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/gui/items.png")); + int i = (iconIndex % 16) * 16; + int j = (iconIndex / 16) * 16; + field_4230_h = bufferedimage.getSubImage(i, j, 16, 16).data; } public void onTick() { diff --git a/src/main/java/net/minecraft/src/TexturePackBase.java b/src/main/java/net/minecraft/src/TexturePackBase.java index 2837b83..65007a5 100644 --- a/src/main/java/net/minecraft/src/TexturePackBase.java +++ b/src/main/java/net/minecraft/src/TexturePackBase.java @@ -5,6 +5,8 @@ package net.minecraft.src; // Decompiler options: packimports(3) braces deadcode import java.io.InputStream; + +import net.lax1dude.eaglercraft.EaglerAdapter; import net.minecraft.client.Minecraft; public abstract class TexturePackBase { @@ -27,8 +29,8 @@ public abstract class TexturePackBase { public void func_6483_c(Minecraft minecraft) { } - public InputStream func_6481_a(String s) { - return (TexturePackBase.class).getResourceAsStream(s); + public byte[] func_6481_a(String s) { + return EaglerAdapter.loadResourceBytes(s); } public String texturePackFileName; diff --git a/src/main/java/net/minecraft/src/TexturePackCustom.java b/src/main/java/net/minecraft/src/TexturePackCustom.java deleted file mode 100644 index 2275b7c..0000000 --- a/src/main/java/net/minecraft/src/TexturePackCustom.java +++ /dev/null @@ -1,116 +0,0 @@ -package net.minecraft.src; -// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. - -// Jad home page: http://www.kpdus.com/jad.html -// Decompiler options: packimports(3) braces deadcode - -import java.awt.image.BufferedImage; -import java.io.*; -import java.util.zip.ZipFile; -import javax.imageio.ImageIO; - -import net.lax1dude.eaglercraft.EaglerAdapter; -import net.lax1dude.eaglercraft.TextureLocation; -import net.minecraft.client.Minecraft; - -public class TexturePackCustom extends TexturePackBase { - - private static final TextureLocation unknownPack = new TextureLocation("/gui/unknown_pack.png"); - - public TexturePackCustom(File file) { - texturePackName = -1; - texturePackFileName = file.getName(); - texturePackFile = file; - } - - private String truncateString(String s) { - if (s != null && s.length() > 34) { - s = s.substring(0, 34); - } - return s; - } - - public void func_6485_a(Minecraft minecraft) { - ZipFile zipfile = null; - InputStream inputstream = null; - try { - zipfile = new ZipFile(texturePackFile); - try { - inputstream = zipfile.getInputStream(zipfile.getEntry("pack.txt")); - BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream)); - firstDescriptionLine = truncateString(bufferedreader.readLine()); - secondDescriptionLine = truncateString(bufferedreader.readLine()); - bufferedreader.close(); - inputstream.close(); - } catch (Exception exception) { - } - try { - inputstream = zipfile.getInputStream(zipfile.getEntry("pack.png")); - texturePackThumbnail = ImageIO.read(inputstream); - inputstream.close(); - } catch (Exception exception1) { - } - zipfile.close(); - } catch (Exception exception2) { - exception2.printStackTrace(); - } finally { - try { - inputstream.close(); - } catch (Exception exception4) { - } - try { - zipfile.close(); - } catch (Exception exception5) { - } - } - } - - public void func_6484_b(Minecraft minecraft) { - if (texturePackThumbnail != null) { - minecraft.renderEngine.deleteTexture(texturePackName); - } - closeTexturePackFile(); - } - - public void func_6483_c(Minecraft minecraft) { - if (texturePackThumbnail != null && texturePackName < 0) { - texturePackName = minecraft.renderEngine.allocateAndSetupTexture(texturePackThumbnail); - } - if (texturePackThumbnail != null) { - minecraft.renderEngine.bindTexture(texturePackName); - } else { - unknownPack.bindTexture(); - } - } - - public void func_6482_a() { - try { - texturePackZipFile = new ZipFile(texturePackFile); - } catch (Exception exception) { - } - } - - public void closeTexturePackFile() { - try { - texturePackZipFile.close(); - } catch (Exception exception) { - } - texturePackZipFile = null; - } - - public InputStream func_6481_a(String s) { - try { - java.util.zip.ZipEntry zipentry = texturePackZipFile.getEntry(s.substring(1)); - if (zipentry != null) { - return texturePackZipFile.getInputStream(zipentry); - } - } catch (Exception exception) { - } - return (TexturePackBase.class).getResourceAsStream(s); - } - - private ZipFile texturePackZipFile; - private int texturePackName; - private BufferedImage texturePackThumbnail; - private File texturePackFile; -} diff --git a/src/main/java/net/minecraft/src/TexturePackDefault.java b/src/main/java/net/minecraft/src/TexturePackDefault.java index a0abbe8..0d54f01 100644 --- a/src/main/java/net/minecraft/src/TexturePackDefault.java +++ b/src/main/java/net/minecraft/src/TexturePackDefault.java @@ -4,11 +4,6 @@ package net.minecraft.src; // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode -import java.awt.image.BufferedImage; -import java.io.IOException; -import javax.imageio.ImageIO; - -import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.TextureLocation; import net.minecraft.client.Minecraft; @@ -20,20 +15,23 @@ public class TexturePackDefault extends TexturePackBase { texturePackName = -1; texturePackFileName = "Default"; firstDescriptionLine = "The default look of Minecraft"; + /* try { texturePackThumbnail = ImageIO.read((TexturePackDefault.class).getResource("/pack.png")); } catch (IOException ioexception) { ioexception.printStackTrace(); } + */ } public void func_6484_b(Minecraft minecraft) { - if (texturePackThumbnail != null) { - minecraft.renderEngine.deleteTexture(texturePackName); - } + //if (texturePackThumbnail != null) { + // minecraft.renderEngine.deleteTexture(texturePackName); + //} } public void func_6483_c(Minecraft minecraft) { + /* if (texturePackThumbnail != null && texturePackName < 0) { texturePackName = minecraft.renderEngine.allocateAndSetupTexture(texturePackThumbnail); } @@ -42,8 +40,10 @@ public class TexturePackDefault extends TexturePackBase { } else { unknownPack.bindTexture(); } + */ + unknownPack.bindTexture(); } private int texturePackName; - private BufferedImage texturePackThumbnail; + //private BufferedImage texturePackThumbnail; } diff --git a/src/main/java/net/minecraft/src/TexturePackList.java b/src/main/java/net/minecraft/src/TexturePackList.java index 81b02a3..1a3b7b8 100644 --- a/src/main/java/net/minecraft/src/TexturePackList.java +++ b/src/main/java/net/minecraft/src/TexturePackList.java @@ -4,22 +4,22 @@ package net.minecraft.src; // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode -import java.io.File; -import java.io.IOException; import java.util.*; import net.minecraft.client.Minecraft; public class TexturePackList { - public TexturePackList(Minecraft minecraft, File file) { + public TexturePackList(Minecraft minecraft) { availableTexturePacks = new ArrayList(); defaultTexturePack = new TexturePackDefault(); field_6538_d = new HashMap(); mc = minecraft; + /* texturePackDir = new File(file, "texturepacks"); if (!texturePackDir.exists()) { texturePackDir.mkdirs(); } + */ currentTexturePack = minecraft.gameSettings.skin; func_6532_a(); selectedTexturePack.func_6482_a(); @@ -43,6 +43,7 @@ public class TexturePackList { ArrayList arraylist = new ArrayList(); selectedTexturePack = null; arraylist.add(defaultTexturePack); + /* if (texturePackDir.exists() && texturePackDir.isDirectory()) { File afile[] = texturePackDir.listFiles(); File afile1[] = afile; @@ -68,6 +69,7 @@ public class TexturePackList { } } + */ if (selectedTexturePack == null) { selectedTexturePack = defaultTexturePack; } @@ -91,6 +93,5 @@ public class TexturePackList { public TexturePackBase selectedTexturePack; private Map field_6538_d; private Minecraft mc; - private File texturePackDir; private String currentTexturePack; } diff --git a/src/main/java/net/minecraft/src/TextureWatchFX.java b/src/main/java/net/minecraft/src/TextureWatchFX.java index a96e54d..a496809 100644 --- a/src/main/java/net/minecraft/src/TextureWatchFX.java +++ b/src/main/java/net/minecraft/src/TextureWatchFX.java @@ -7,6 +7,9 @@ package net.minecraft.src; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; + +import net.lax1dude.eaglercraft.EaglerAdapter; +import net.lax1dude.eaglercraft.EaglerImage; import net.minecraft.client.Minecraft; public class TextureWatchFX extends TextureFX { @@ -17,17 +20,11 @@ public class TextureWatchFX extends TextureFX { field_4223_i = new int[256]; field_4225_g = minecraft; tileImage = 1; - try { - BufferedImage bufferedimage = ImageIO - .read((net.minecraft.client.Minecraft.class).getResource("/gui/items.png")); - int i = (iconIndex % 16) * 16; - int j = (iconIndex / 16) * 16; - bufferedimage.getRGB(i, j, 16, 16, field_4224_h, 0, 16); - bufferedimage = ImageIO.read((net.minecraft.client.Minecraft.class).getResource("/misc/dial.png")); - bufferedimage.getRGB(0, 0, 16, 16, field_4223_i, 0, 16); - } catch (IOException ioexception) { - ioexception.printStackTrace(); - } + EaglerImage bufferedimage = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/gui/items.png")); + int i = (iconIndex % 16) * 16; + int j = (iconIndex / 16) * 16; + field_4224_h = bufferedimage.getSubImage(i, j, 16, 16).data; + field_4223_i = EaglerImage.loadImage(EaglerAdapter.loadResourceBytes("/misc/dial.png")).data; } public void onTick() { diff --git a/src/main/java/net/minecraft/src/ThreadDownloadImage.java b/src/main/java/net/minecraft/src/ThreadDownloadImage.java deleted file mode 100644 index 4bc0df9..0000000 --- a/src/main/java/net/minecraft/src/ThreadDownloadImage.java +++ /dev/null @@ -1,45 +0,0 @@ -package net.minecraft.src; -// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. - -// Jad home page: http://www.kpdus.com/jad.html -// Decompiler options: packimports(3) braces deadcode - -import java.net.HttpURLConnection; -import java.net.URL; -import javax.imageio.ImageIO; - -class ThreadDownloadImage extends Thread { - - ThreadDownloadImage(ThreadDownloadImageData threaddownloadimagedata, String s, ImageBuffer imagebuffer) { - imageData = threaddownloadimagedata; - location = s; - buffer = imagebuffer; - } - - public void run() { - HttpURLConnection httpurlconnection = null; - try { - URL url = new URL(location); - httpurlconnection = (HttpURLConnection) url.openConnection(); - httpurlconnection.setDoInput(true); - httpurlconnection.setDoOutput(false); - httpurlconnection.connect(); - if (httpurlconnection.getResponseCode() / 100 == 4) { - return; - } - if (buffer == null) { - imageData.image = ImageIO.read(httpurlconnection.getInputStream()); - } else { - imageData.image = buffer.parseUserSkin(ImageIO.read(httpurlconnection.getInputStream())); - } - } catch (Exception exception) { - exception.printStackTrace(); - } finally { - httpurlconnection.disconnect(); - } - } - - final String location; /* synthetic field */ - final ImageBuffer buffer; /* synthetic field */ - final ThreadDownloadImageData imageData; /* synthetic field */ -} diff --git a/src/main/java/net/minecraft/src/ThreadDownloadImageData.java b/src/main/java/net/minecraft/src/ThreadDownloadImageData.java deleted file mode 100644 index 10648ae..0000000 --- a/src/main/java/net/minecraft/src/ThreadDownloadImageData.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.minecraft.src; -// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. - -// Jad home page: http://www.kpdus.com/jad.html -// Decompiler options: packimports(3) braces deadcode - -import java.awt.image.BufferedImage; - -public class ThreadDownloadImageData { - - public ThreadDownloadImageData(String s, ImageBuffer imagebuffer) { - referenceCount = 1; - textureName = -1; - textureSetupComplete = false; - (new ThreadDownloadImage(this, s, imagebuffer)).start(); - } - - public BufferedImage image; - public int referenceCount; - public int textureName; - public boolean textureSetupComplete; -}