diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..176a458f94 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.gitignore b/.gitignore index a55415a7d0..c5a46eb4c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ -/bin -/minecraft_server -/mods -/fmlbuild.properties -/fmlversion.properties -/difflist.txt -/.metadata/ -/eclipse/.metadata/ -/target -fmlbranding.properties -/fernflower.zip +/bin +/minecraft_server +/mods +/fmlbuild.properties +/fmlversion.properties +/difflist.txt +/.metadata/ +/eclipse/.metadata/ +/target +fmlbranding.properties +/fernflower.zip diff --git a/cleanup_source.py b/cleanup_source.py index 3faa5f01db..30b69b4371 100644 --- a/cleanup_source.py +++ b/cleanup_source.py @@ -1,43 +1,43 @@ -import sys -import os, os.path, shutil -import fnmatch -import re - -def main(): - sys.stdout.flush() - for x in range(1, len(sys.argv)): - cleanup_source(sys.argv[x]) - -count = 0 -def cleanup_source(path): - path = os.path.normpath(path) - regex_cases_before = re.compile(r'((case|default).+\r?\n)\r?\n', re.MULTILINE) #Fixes newline after case before case body - regex_cases_after = re.compile(r'\r?\n(\r?\n[ \t]+(case|default))', re.MULTILINE) #Fixes newline after case body before new case - - def updatefile(src_file): - global count - tmp_file = src_file + '.tmp' - count = 0 - with open(src_file, 'r') as fh: - buf = fh.read() - - def fix_cases(match): - global count - count += 1 - return match.group(1) - - buf = regex_cases_before.sub(fix_cases, buf) - buf = regex_cases_after.sub(fix_cases, buf) - if count > 0: - with open(tmp_file, 'w') as fh: - fh.write(buf) - shutil.move(tmp_file, src_file) - - for path, _, filelist in os.walk(path, followlinks=True): - sub_dir = os.path.relpath(path, path) - for cur_file in fnmatch.filter(filelist, '*.java'): - src_file = os.path.normpath(os.path.join(path, cur_file)) - updatefile(src_file) - -if __name__ == '__main__': - main() +import sys +import os, os.path, shutil +import fnmatch +import re + +def main(): + sys.stdout.flush() + for x in range(1, len(sys.argv)): + cleanup_source(sys.argv[x]) + +count = 0 +def cleanup_source(path): + path = os.path.normpath(path) + regex_cases_before = re.compile(r'((case|default).+\r?\n)\r?\n', re.MULTILINE) #Fixes newline after case before case body + regex_cases_after = re.compile(r'\r?\n(\r?\n[ \t]+(case|default))', re.MULTILINE) #Fixes newline after case body before new case + + def updatefile(src_file): + global count + tmp_file = src_file + '.tmp' + count = 0 + with open(src_file, 'r') as fh: + buf = fh.read() + + def fix_cases(match): + global count + count += 1 + return match.group(1) + + buf = regex_cases_before.sub(fix_cases, buf) + buf = regex_cases_after.sub(fix_cases, buf) + if count > 0: + with open(tmp_file, 'w') as fh: + fh.write(buf) + shutil.move(tmp_file, src_file) + + for path, _, filelist in os.walk(path, followlinks=True): + sub_dir = os.path.relpath(path, path) + for cur_file in fnmatch.filter(filelist, '*.java'): + src_file = os.path.normpath(os.path.join(path, cur_file)) + updatefile(src_file) + +if __name__ == '__main__': + main() diff --git a/client/cpw/mods/fml/client/FMLTextureFX.java b/client/cpw/mods/fml/client/FMLTextureFX.java index e41cdcea9d..2dbf232237 100644 --- a/client/cpw/mods/fml/client/FMLTextureFX.java +++ b/client/cpw/mods/fml/client/FMLTextureFX.java @@ -1,69 +1,69 @@ -/* - * The FML Forge Mod Loader suite. - * Copyright (C) 2012 cpw - * - * This library 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 2.1 of the License, or any later version. - * - * This library 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 this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package cpw.mods.fml.client; - -import java.awt.Dimension; -import java.util.List; -import java.util.logging.Logger; - -import cpw.mods.fml.common.FMLCommonHandler; - -import net.minecraft.src.RenderEngine; -import net.minecraft.src.TextureFX; -import net.minecraft.src.TexturePackBase; - -public class FMLTextureFX extends TextureFX implements ITextureFX -{ - public int tileSizeBase = 16; - public int tileSizeSquare = 256; - public int tileSizeMask = 15; - public int tileSizeSquareMask = 255; - public boolean errored = false; - protected Logger log = FMLCommonHandler.instance().getFMLLogger(); - - public FMLTextureFX(int icon) - { - super(icon); - } - - @Override public void setErrored(boolean err){ errored = err; } - @Override public boolean getErrored(){ return errored; } - @Override - public void onTexturePackChanged(RenderEngine engine, TexturePackBase texturepack, Dimension dimensions) - { - onTextureDimensionsUpdate(dimensions.width, dimensions.height); - } - @Override - public void onTextureDimensionsUpdate(int width, int height) - { - tileSizeBase = width >> 4; - tileSizeSquare = tileSizeBase * tileSizeBase; - tileSizeMask = tileSizeBase - 1; - tileSizeSquareMask = tileSizeSquare - 1; - setErrored(false); - setup(); - } - - protected void setup() - { - field_76852_a = new byte[tileSizeSquare << 2]; - } - - public boolean unregister(RenderEngine engine, List effects) - { - effects.remove(this); - return true; - } -} +/* + * The FML Forge Mod Loader suite. + * Copyright (C) 2012 cpw + * + * This library 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 2.1 of the License, or any later version. + * + * This library 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 this library; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package cpw.mods.fml.client; + +import java.awt.Dimension; +import java.util.List; +import java.util.logging.Logger; + +import cpw.mods.fml.common.FMLCommonHandler; + +import net.minecraft.src.RenderEngine; +import net.minecraft.src.TextureFX; +import net.minecraft.src.TexturePackBase; + +public class FMLTextureFX extends TextureFX implements ITextureFX +{ + public int tileSizeBase = 16; + public int tileSizeSquare = 256; + public int tileSizeMask = 15; + public int tileSizeSquareMask = 255; + public boolean errored = false; + protected Logger log = FMLCommonHandler.instance().getFMLLogger(); + + public FMLTextureFX(int icon) + { + super(icon); + } + + @Override public void setErrored(boolean err){ errored = err; } + @Override public boolean getErrored(){ return errored; } + @Override + public void onTexturePackChanged(RenderEngine engine, TexturePackBase texturepack, Dimension dimensions) + { + onTextureDimensionsUpdate(dimensions.width, dimensions.height); + } + @Override + public void onTextureDimensionsUpdate(int width, int height) + { + tileSizeBase = width >> 4; + tileSizeSquare = tileSizeBase * tileSizeBase; + tileSizeMask = tileSizeBase - 1; + tileSizeSquareMask = tileSizeSquare - 1; + setErrored(false); + setup(); + } + + protected void setup() + { + field_76852_a = new byte[tileSizeSquare << 2]; + } + + public boolean unregister(RenderEngine engine, List effects) + { + effects.remove(this); + return true; + } +} diff --git a/client/cpw/mods/fml/client/ITextureFX.java b/client/cpw/mods/fml/client/ITextureFX.java index b18ea2b7e3..ad8f897699 100644 --- a/client/cpw/mods/fml/client/ITextureFX.java +++ b/client/cpw/mods/fml/client/ITextureFX.java @@ -1,30 +1,30 @@ -/* - * The FML Forge Mod Loader suite. - * Copyright (C) 2012 cpw - * - * This library 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 2.1 of the License, or any later version. - * - * This library 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 this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package cpw.mods.fml.client; - -import java.awt.Dimension; - -import net.minecraft.src.*; - -public interface ITextureFX -{ - public void onTexturePackChanged(RenderEngine engine, TexturePackBase texturepack, Dimension dimensions); - - public void onTextureDimensionsUpdate(int width, int height); - - public void setErrored(boolean errored); - - public boolean getErrored(); -} +/* + * The FML Forge Mod Loader suite. + * Copyright (C) 2012 cpw + * + * This library 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 2.1 of the License, or any later version. + * + * This library 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 this library; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package cpw.mods.fml.client; + +import java.awt.Dimension; + +import net.minecraft.src.*; + +public interface ITextureFX +{ + public void onTexturePackChanged(RenderEngine engine, TexturePackBase texturepack, Dimension dimensions); + + public void onTextureDimensionsUpdate(int width, int height); + + public void setErrored(boolean errored); + + public boolean getErrored(); +} diff --git a/client/net/minecraft/src/EntityRendererProxy.java b/client/net/minecraft/src/EntityRendererProxy.java index 61f69a183e..a875e2654d 100644 --- a/client/net/minecraft/src/EntityRendererProxy.java +++ b/client/net/minecraft/src/EntityRendererProxy.java @@ -1,36 +1,36 @@ -/* - * The FML Forge Mod Loader suite. - * Copyright (C) 2012 cpw - * - * This library 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 2.1 of the License, or any later version. - * - * This library 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 this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraft.src; - -import net.minecraft.client.Minecraft; - -public class EntityRendererProxy extends EntityRenderer -{ - - private Minecraft game; - - public EntityRendererProxy(Minecraft minecraft) - { - super(minecraft); - game = minecraft; - } - - @Override - public void func_78480_b(float tick) - { - super.func_78480_b(tick); - //This is where ModLoader does all of it's ticking - } -} +/* + * The FML Forge Mod Loader suite. + * Copyright (C) 2012 cpw + * + * This library 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 2.1 of the License, or any later version. + * + * This library 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 this library; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.minecraft.src; + +import net.minecraft.client.Minecraft; + +public class EntityRendererProxy extends EntityRenderer +{ + + private Minecraft game; + + public EntityRendererProxy(Minecraft minecraft) + { + super(minecraft); + game = minecraft; + } + + @Override + public void func_78480_b(float tick) + { + super.func_78480_b(tick); + //This is where ModLoader does all of it's ticking + } +} diff --git a/client/net/minecraft/src/ModTextureAnimation.java b/client/net/minecraft/src/ModTextureAnimation.java index 8fd6bae237..dc10509f35 100644 --- a/client/net/minecraft/src/ModTextureAnimation.java +++ b/client/net/minecraft/src/ModTextureAnimation.java @@ -1,128 +1,128 @@ -/* - * The FML Forge Mod Loader suite. - * Copyright (C) 2012 cpw - * - * This library 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 2.1 of the License, or any later version. - * - * This library 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 this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraft.src; - -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.awt.image.ImageObserver; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.client.FMLTextureFX; -import cpw.mods.fml.common.FMLCommonHandler; -import static org.lwjgl.opengl.GL11.*; - -/** - * A texture override for animations, it takes a vertical image of - * texture frames and constantly rotates them in the texture. - */ -public class ModTextureAnimation extends FMLTextureFX -{ - private final int tickRate; - private byte[][] images; - private int index = 0; - private int ticks = 0; - - private String targetTex = null; - private BufferedImage imgData = null; - - public ModTextureAnimation(int icon, int target, BufferedImage image, int tickCount) - { - this(icon, 1, target, image, tickCount); - } - - public ModTextureAnimation(int icon, int size, int target, BufferedImage image, int tickCount) - { - this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image, tickCount); - } - - public ModTextureAnimation(int icon, int size, String target, BufferedImage image, int tickCount) - { - super(icon); - RenderEngine re = FMLClientHandler.instance().getClient().field_6315_n; - - targetTex = target; - field_1129_e = size; - field_1128_f = re.func_1070_a(target); - - tickRate = tickCount; - ticks = tickCount; - imgData = image; - } - - @Override - public void setup() - { - super.setup(); - - int sWidth = imgData.getWidth(); - int sHeight = imgData.getHeight(); - int tWidth = tileSizeBase; - int tHeight = tileSizeBase; - - - int frames = (int)Math.floor((double)(sHeight / sWidth)); - - if (frames < 1) - { - throw new IllegalArgumentException(String.format("Attempted to create a TextureAnimation with no complete frames: %dx%d", sWidth, sHeight)); - } - else - { - images = new byte[frames][]; - BufferedImage image = imgData; - - if (sWidth != tWidth) - { - BufferedImage b = new BufferedImage(tWidth, tHeight * frames, 6); - Graphics2D g = b.createGraphics(); - g.drawImage(imgData, 0, 0, tWidth, tHeight * frames, 0, 0, sWidth, sHeight, (ImageObserver)null); - g.dispose(); - image = b; - } - - for (int frame = 0; frame < frames; frame++) - { - int[] pixels = new int[tileSizeSquare]; - image.getRGB(0, tHeight * frame, tWidth, tHeight, pixels, 0, tWidth); - images[frame] = new byte[tileSizeSquare << 2]; - - for (int i = 0; i < pixels.length; i++) - { - int i4 = i * 4; - images[frame][i4 + 0] = (byte)(pixels[i] >> 16 & 255); - images[frame][i4 + 1] = (byte)(pixels[i] >> 8 & 255); - images[frame][i4 + 2] = (byte)(pixels[i] >> 0 & 255); - images[frame][i4 + 3] = (byte)(pixels[i] >> 24 & 255); - } - } - } - } - - public void func_783_a() - { - if (++ticks >= tickRate) - { - if (++index >= images.length) - { - index = 0; - } - - field_1127_a = images[index]; - ticks = 0; - } - } -} +/* + * The FML Forge Mod Loader suite. + * Copyright (C) 2012 cpw + * + * This library 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 2.1 of the License, or any later version. + * + * This library 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 this library; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.minecraft.src; + +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.FMLTextureFX; +import cpw.mods.fml.common.FMLCommonHandler; +import static org.lwjgl.opengl.GL11.*; + +/** + * A texture override for animations, it takes a vertical image of + * texture frames and constantly rotates them in the texture. + */ +public class ModTextureAnimation extends FMLTextureFX +{ + private final int tickRate; + private byte[][] images; + private int index = 0; + private int ticks = 0; + + private String targetTex = null; + private BufferedImage imgData = null; + + public ModTextureAnimation(int icon, int target, BufferedImage image, int tickCount) + { + this(icon, 1, target, image, tickCount); + } + + public ModTextureAnimation(int icon, int size, int target, BufferedImage image, int tickCount) + { + this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image, tickCount); + } + + public ModTextureAnimation(int icon, int size, String target, BufferedImage image, int tickCount) + { + super(icon); + RenderEngine re = FMLClientHandler.instance().getClient().field_6315_n; + + targetTex = target; + field_1129_e = size; + field_1128_f = re.func_1070_a(target); + + tickRate = tickCount; + ticks = tickCount; + imgData = image; + } + + @Override + public void setup() + { + super.setup(); + + int sWidth = imgData.getWidth(); + int sHeight = imgData.getHeight(); + int tWidth = tileSizeBase; + int tHeight = tileSizeBase; + + + int frames = (int)Math.floor((double)(sHeight / sWidth)); + + if (frames < 1) + { + throw new IllegalArgumentException(String.format("Attempted to create a TextureAnimation with no complete frames: %dx%d", sWidth, sHeight)); + } + else + { + images = new byte[frames][]; + BufferedImage image = imgData; + + if (sWidth != tWidth) + { + BufferedImage b = new BufferedImage(tWidth, tHeight * frames, 6); + Graphics2D g = b.createGraphics(); + g.drawImage(imgData, 0, 0, tWidth, tHeight * frames, 0, 0, sWidth, sHeight, (ImageObserver)null); + g.dispose(); + image = b; + } + + for (int frame = 0; frame < frames; frame++) + { + int[] pixels = new int[tileSizeSquare]; + image.getRGB(0, tHeight * frame, tWidth, tHeight, pixels, 0, tWidth); + images[frame] = new byte[tileSizeSquare << 2]; + + for (int i = 0; i < pixels.length; i++) + { + int i4 = i * 4; + images[frame][i4 + 0] = (byte)(pixels[i] >> 16 & 255); + images[frame][i4 + 1] = (byte)(pixels[i] >> 8 & 255); + images[frame][i4 + 2] = (byte)(pixels[i] >> 0 & 255); + images[frame][i4 + 3] = (byte)(pixels[i] >> 24 & 255); + } + } + } + } + + public void func_783_a() + { + if (++ticks >= tickRate) + { + if (++index >= images.length) + { + index = 0; + } + + field_1127_a = images[index]; + ticks = 0; + } + } +} diff --git a/client/net/minecraft/src/ModTextureStatic.java b/client/net/minecraft/src/ModTextureStatic.java index 2839dffa61..30482aa896 100644 --- a/client/net/minecraft/src/ModTextureStatic.java +++ b/client/net/minecraft/src/ModTextureStatic.java @@ -1,179 +1,179 @@ -/* - * The FML Forge Mod Loader suite. - * Copyright (C) 2012 cpw - * - * This library 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 2.1 of the License, or any later version. - * - * This library 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 this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraft.src; - -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.awt.image.ImageObserver; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.client.FMLTextureFX; -import cpw.mods.fml.common.FMLCommonHandler; -import static org.lwjgl.opengl.GL11.*; - -public class ModTextureStatic extends FMLTextureFX -{ - private boolean oldanaglyph = false; - private int[] pixels = null; - private String targetTex = null; - private int storedSize; - private BufferedImage overrideData = null; - private int needApply = 2; - - - public ModTextureStatic(int icon, int target, BufferedImage image) - { - this(icon, 1, target, image); - } - - public ModTextureStatic(int icon, int size, int target, BufferedImage image) - { - this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image); - } - - public ModTextureStatic(int icon, int size, String target, BufferedImage image) - { - super(icon); - RenderEngine re = FMLClientHandler.instance().getClient().field_6315_n; - - targetTex = target; - storedSize = size; - field_1129_e = size; - field_1128_f = re.func_1070_a(target); - overrideData = image; - } - - @Override - public void setup() - { - super.setup(); - int sWidth = overrideData.getWidth(); - int sHeight = overrideData.getHeight(); - - pixels = new int[tileSizeSquare]; - if (tileSizeBase == sWidth && tileSizeBase == sHeight) - { - overrideData.getRGB(0, 0, sWidth, sHeight, pixels, 0, sWidth); - } - else - { - BufferedImage tmp = new BufferedImage(tileSizeBase, tileSizeBase, 6); - Graphics2D gfx = tmp.createGraphics(); - gfx.drawImage(overrideData, 0, 0, tileSizeBase, tileSizeBase, 0, 0, sWidth, sHeight, (ImageObserver)null); - tmp.getRGB(0, 0, tileSizeBase, tileSizeBase, pixels, 0, tileSizeBase); - gfx.dispose(); - } - - update(); - } - - public void func_783_a() - { - if (oldanaglyph != field_1131_c) - { - update(); - } - // This makes it so we only apply the texture to the target texture when we need to, - //due to the fact that update is called when the Effect is first registered, we actually - //need to wait for the next one. - field_1129_e = (needApply == 0 ? 0 : storedSize); - if (needApply > 0) - { - needApply--; - } - } - - public void func_782_a(RenderEngine p_782_1_) - { - GL11.glBindTexture(GL_TEXTURE_2D, p_782_1_.func_1070_a(targetTex)); - } - - public void update() - { - needApply = 2; - for (int idx = 0; idx < pixels.length; idx++) - { - int i = idx * 4; - int a = pixels[idx] >> 24 & 255; - int r = pixels[idx] >> 16 & 255; - int g = pixels[idx] >> 8 & 255; - int b = pixels[idx] >> 0 & 255; - - if (field_1131_c) - { - r = g = b = (r + g + b) / 3; - } - - field_1127_a[i + 0] = (byte)r; - field_1127_a[i + 1] = (byte)g; - field_1127_a[i + 2] = (byte)b; - field_1127_a[i + 3] = (byte)a; - } - - oldanaglyph = field_1131_c; - } - - //Implementation of http://scale2x.sourceforge.net/algorithm.html - public static BufferedImage scale2x(BufferedImage image) - { - int w = image.getWidth(); - int h = image.getHeight(); - BufferedImage tmp = new BufferedImage(w * 2, h * 2, 2); - - for (int x = 0; x < h; ++x) - { - int x2 = x * 2; - for (int y = 0; y < w; ++y) - { - int y2 = y * 2; - int E = image.getRGB(y, x); - int D = (x == 0 ? E : image.getRGB(y, x - 1)); - int B = (y == 0 ? E : image.getRGB(y - 1, x )); - int H = (y >= w - 1 ? E : image.getRGB(y + 1, x )); - int F = (x >= h - 1 ? E : image.getRGB(y, x + 1)); - - int e0, e1, e2, e3; - - if (B != H && D != F) - { - e0 = D == B ? D : E; - e1 = B == F ? F : E; - e2 = D == H ? D : E; - e3 = H == F ? F : E; - } - else - { - e0 = e1 = e2 = e3 = E; - } - - tmp.setRGB(y2, x2, e0); - tmp.setRGB(y2 + 1, x2, e1); - tmp.setRGB(y2, x2 + 1, e2); - tmp.setRGB(y2 + 1, x2 + 1, e3); - } - } - - return tmp; - } - - - @Override - public String toString() - { - return String.format("ModTextureStatic %s @ %d", targetTex, field_1126_b); - } -} +/* + * The FML Forge Mod Loader suite. + * Copyright (C) 2012 cpw + * + * This library 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 2.1 of the License, or any later version. + * + * This library 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 this library; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.minecraft.src; + +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.FMLTextureFX; +import cpw.mods.fml.common.FMLCommonHandler; +import static org.lwjgl.opengl.GL11.*; + +public class ModTextureStatic extends FMLTextureFX +{ + private boolean oldanaglyph = false; + private int[] pixels = null; + private String targetTex = null; + private int storedSize; + private BufferedImage overrideData = null; + private int needApply = 2; + + + public ModTextureStatic(int icon, int target, BufferedImage image) + { + this(icon, 1, target, image); + } + + public ModTextureStatic(int icon, int size, int target, BufferedImage image) + { + this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image); + } + + public ModTextureStatic(int icon, int size, String target, BufferedImage image) + { + super(icon); + RenderEngine re = FMLClientHandler.instance().getClient().field_6315_n; + + targetTex = target; + storedSize = size; + field_1129_e = size; + field_1128_f = re.func_1070_a(target); + overrideData = image; + } + + @Override + public void setup() + { + super.setup(); + int sWidth = overrideData.getWidth(); + int sHeight = overrideData.getHeight(); + + pixels = new int[tileSizeSquare]; + if (tileSizeBase == sWidth && tileSizeBase == sHeight) + { + overrideData.getRGB(0, 0, sWidth, sHeight, pixels, 0, sWidth); + } + else + { + BufferedImage tmp = new BufferedImage(tileSizeBase, tileSizeBase, 6); + Graphics2D gfx = tmp.createGraphics(); + gfx.drawImage(overrideData, 0, 0, tileSizeBase, tileSizeBase, 0, 0, sWidth, sHeight, (ImageObserver)null); + tmp.getRGB(0, 0, tileSizeBase, tileSizeBase, pixels, 0, tileSizeBase); + gfx.dispose(); + } + + update(); + } + + public void func_783_a() + { + if (oldanaglyph != field_1131_c) + { + update(); + } + // This makes it so we only apply the texture to the target texture when we need to, + //due to the fact that update is called when the Effect is first registered, we actually + //need to wait for the next one. + field_1129_e = (needApply == 0 ? 0 : storedSize); + if (needApply > 0) + { + needApply--; + } + } + + public void func_782_a(RenderEngine p_782_1_) + { + GL11.glBindTexture(GL_TEXTURE_2D, p_782_1_.func_1070_a(targetTex)); + } + + public void update() + { + needApply = 2; + for (int idx = 0; idx < pixels.length; idx++) + { + int i = idx * 4; + int a = pixels[idx] >> 24 & 255; + int r = pixels[idx] >> 16 & 255; + int g = pixels[idx] >> 8 & 255; + int b = pixels[idx] >> 0 & 255; + + if (field_1131_c) + { + r = g = b = (r + g + b) / 3; + } + + field_1127_a[i + 0] = (byte)r; + field_1127_a[i + 1] = (byte)g; + field_1127_a[i + 2] = (byte)b; + field_1127_a[i + 3] = (byte)a; + } + + oldanaglyph = field_1131_c; + } + + //Implementation of http://scale2x.sourceforge.net/algorithm.html + public static BufferedImage scale2x(BufferedImage image) + { + int w = image.getWidth(); + int h = image.getHeight(); + BufferedImage tmp = new BufferedImage(w * 2, h * 2, 2); + + for (int x = 0; x < h; ++x) + { + int x2 = x * 2; + for (int y = 0; y < w; ++y) + { + int y2 = y * 2; + int E = image.getRGB(y, x); + int D = (x == 0 ? E : image.getRGB(y, x - 1)); + int B = (y == 0 ? E : image.getRGB(y - 1, x )); + int H = (y >= w - 1 ? E : image.getRGB(y + 1, x )); + int F = (x >= h - 1 ? E : image.getRGB(y, x + 1)); + + int e0, e1, e2, e3; + + if (B != H && D != F) + { + e0 = D == B ? D : E; + e1 = B == F ? F : E; + e2 = D == H ? D : E; + e3 = H == F ? F : E; + } + else + { + e0 = e1 = e2 = e3 = E; + } + + tmp.setRGB(y2, x2, e0); + tmp.setRGB(y2 + 1, x2, e1); + tmp.setRGB(y2, x2 + 1, e2); + tmp.setRGB(y2 + 1, x2 + 1, e3); + } + } + + return tmp; + } + + + @Override + public String toString() + { + return String.format("ModTextureStatic %s @ %d", targetTex, field_1126_b); + } +} diff --git a/download_fernflower.py b/download_fernflower.py index 597ebeaff3..44b0f659a0 100644 --- a/download_fernflower.py +++ b/download_fernflower.py @@ -1,17 +1,17 @@ -import urllib -import zipfile -import sys -import os - -if __name__ == '__main__': - try: - urllib.urlretrieve("http://goo.gl/PnJHp", './fernflower.zip') - if len(sys.argv)>1: - path = os.path.abspath(os.path.join(sys.argv[1],'runtime/bin')) - else: - path = os.path.abspath('../runtime/bin') - zf = zipfile.ZipFile('fernflower.zip') - zf.extract('fernflower.jar', path) - print "Fernflower downloaded into MCP at %s" % (path) - except: - print "Downloading Fernflower failed download manually from http://goo.gl/PnJHp" +import urllib +import zipfile +import sys +import os + +if __name__ == '__main__': + try: + urllib.urlretrieve("http://goo.gl/PnJHp", './fernflower.zip') + if len(sys.argv)>1: + path = os.path.abspath(os.path.join(sys.argv[1],'runtime/bin')) + else: + path = os.path.abspath('../runtime/bin') + zf = zipfile.ZipFile('fernflower.zip') + zf.extract('fernflower.jar', path) + print "Fernflower downloaded into MCP at %s" % (path) + except: + print "Downloading Fernflower failed download manually from http://goo.gl/PnJHp" diff --git a/eclipse/.gitignore b/eclipse/.gitignore index de4b290e2d..2b9ab7d6af 100644 --- a/eclipse/.gitignore +++ b/eclipse/.gitignore @@ -1,6 +1,6 @@ -/*/bin -/*/.settings/org.eclipse.ltk.core.refactoring.prefs -*.cdt.* -*.ajdt.* -/.log -*.m2e.* +/*/bin +/*/.settings/org.eclipse.ltk.core.refactoring.prefs +*.cdt.* +*.ajdt.* +/.log +*.m2e.* diff --git a/eclipse/.metadata/.gitignore b/eclipse/.metadata/.gitignore index 6c9c8ffc68..0ef40f1d0f 100644 --- a/eclipse/.metadata/.gitignore +++ b/eclipse/.metadata/.gitignore @@ -1,3 +1,3 @@ -/.mylyn/ -.lock +/.mylyn/ +.lock version.ini \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/.gitignore b/eclipse/.metadata/.plugins/.gitignore index 51c3bc8193..074e4a685f 100644 --- a/eclipse/.metadata/.plugins/.gitignore +++ b/eclipse/.metadata/.plugins/.gitignore @@ -1,12 +1,12 @@ -/org.eclipse.epp.usagedata.recording/ -/org.eclipse.jdt.core/ -/org.eclipse.jdt.launching/ -/org.eclipse.jdt.ui/ -/org.eclipse.ltk.core.refactoring/ -/org.eclipse.ltk.ui.refactoring/ -/org.eclipse.m2e.logback.configuration/ -/org.eclipse.mylyn.bugzilla.core/ -/org.eclipse.mylyn.tasks.ui/ -/org.eclipse.team.cvs.core/ -/org.eclipse.ui.workbench/ -/org.eclipse.wb.discovery.core/ +/org.eclipse.epp.usagedata.recording/ +/org.eclipse.jdt.core/ +/org.eclipse.jdt.launching/ +/org.eclipse.jdt.ui/ +/org.eclipse.ltk.core.refactoring/ +/org.eclipse.ltk.ui.refactoring/ +/org.eclipse.m2e.logback.configuration/ +/org.eclipse.mylyn.bugzilla.core/ +/org.eclipse.mylyn.tasks.ui/ +/org.eclipse.team.cvs.core/ +/org.eclipse.ui.workbench/ +/org.eclipse.wb.discovery.core/ diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.gitignore b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.gitignore index f12b989e9f..0618be6053 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.gitignore +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.gitignore @@ -1,7 +1,7 @@ -/.safetable/ -/.history/ -/.projects/*/*.snap -/.projects/*/.syncinfo -/.projects/*/.markers -/.projects/*/*/ -/.root/ +/.safetable/ +/.history/ +/.projects/*/*.snap +/.projects/*/.syncinfo +/.projects/*/.markers +/.projects/*/*/ +/.root/ diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/.gitignore b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/.gitignore index 874cb9214e..098f31643b 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/.gitignore +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/.gitignore @@ -1,12 +1,12 @@ -/org.eclipse.jdt.launching.prefs -/org.eclipse.m2e.discovery.prefs -/org.eclipse.mylyn.context.core.prefs -/org.eclipse.mylyn.monitor.ui.prefs -/org.eclipse.team.cvs.ui.prefs -/org.eclipse.team.ui.prefs -/org.eclipse.ui.workbench.prefs -/org.eclipse.wst.sse.core.prefs -/org.eclipse.epp.usagedata.gathering.prefs -/org.eclipse.debug.ui.prefs -/org.eclipse.jdt.ui.prefs -/org.eclipse.ui.ide.prefs +/org.eclipse.jdt.launching.prefs +/org.eclipse.m2e.discovery.prefs +/org.eclipse.mylyn.context.core.prefs +/org.eclipse.mylyn.monitor.ui.prefs +/org.eclipse.team.cvs.ui.prefs +/org.eclipse.team.ui.prefs +/org.eclipse.ui.workbench.prefs +/org.eclipse.wst.sse.core.prefs +/org.eclipse.epp.usagedata.gathering.prefs +/org.eclipse.debug.ui.prefs +/org.eclipse.jdt.ui.prefs +/org.eclipse.ui.ide.prefs diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Clean-Client.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Clean-Client.launch index d9bb1c9348..04cc3119ef 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Clean-Client.launch +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Clean-Client.launch @@ -1,13 +1,13 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Clean-Server.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Clean-Server.launch index e597a7f291..894e6123e8 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Clean-Server.launch +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Clean-Server.launch @@ -1,13 +1,13 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.ui/.gitignore b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/.gitignore index 6cef7ae61f..98148b4c13 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.debug.ui/.gitignore +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/.gitignore @@ -1,2 +1,2 @@ -/dialog_settings.xml -/launchConfigurationHistory.xml +/dialog_settings.xml +/launchConfigurationHistory.xml diff --git a/eclipse/Clean-Client/.classpath b/eclipse/Clean-Client/.classpath index 7155e084c4..6dd00b0613 100644 --- a/eclipse/Clean-Client/.classpath +++ b/eclipse/Clean-Client/.classpath @@ -1,24 +1,24 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse/Clean-Client/.project b/eclipse/Clean-Client/.project index b972e1a007..cee33cd241 100644 --- a/eclipse/Clean-Client/.project +++ b/eclipse/Clean-Client/.project @@ -1,74 +1,74 @@ - - - Clean-Client - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - - - jars - 2 - MCP_LOC/jars - - - lib - 2 - MCP_LOC/lib - - - src - 2 - MCP_LOC/src-base/minecraft - - - src-common - 2 - MCP_LOC/src-base/common - - - - - 0 - jars - 13 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-bin - - - - 1307293504507 - jars/bin - 5 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-*.jar - - - - 1307293480435 - jars/bin/natives - 6 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-* - - - - - - MCP_LOC - $%7BPARENT-2-WORKSPACE_LOC%7D - - - + + + Clean-Client + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + jars + 2 + MCP_LOC/jars + + + lib + 2 + MCP_LOC/lib + + + src + 2 + MCP_LOC/src-base/minecraft + + + src-common + 2 + MCP_LOC/src-base/common + + + + + 0 + jars + 13 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-bin + + + + 1307293504507 + jars/bin + 5 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-*.jar + + + + 1307293480435 + jars/bin/natives + 6 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-* + + + + + + MCP_LOC + $%7BPARENT-2-WORKSPACE_LOC%7D + + + diff --git a/eclipse/Clean-Client/.settings/org.eclipse.jdt.core.prefs b/eclipse/Clean-Client/.settings/org.eclipse.jdt.core.prefs index 64d36861d6..fff3b334bb 100644 --- a/eclipse/Clean-Client/.settings/org.eclipse.jdt.core.prefs +++ b/eclipse/Clean-Client/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ -#Thu Jun 02 15:56:40 CEST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +#Thu Jun 02 15:56:40 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eclipse/Clean-Server/.classpath b/eclipse/Clean-Server/.classpath index 8022c83cde..8e8da8d544 100644 --- a/eclipse/Clean-Server/.classpath +++ b/eclipse/Clean-Server/.classpath @@ -1,8 +1,8 @@ - - - - - - - - + + + + + + + + diff --git a/eclipse/Clean-Server/.project b/eclipse/Clean-Server/.project index b931a716ff..c37796bc39 100644 --- a/eclipse/Clean-Server/.project +++ b/eclipse/Clean-Server/.project @@ -1,51 +1,51 @@ - - - Clean-Server - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - - - jars - 2 - MCP_LOC/jars - - - src - 2 - MCP_LOC/src-base/minecraft_server - - - src-common - 2 - MCP_LOC/src-base/common - - - - - 0 - jars - 13 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-*.jar - - - - - - MCP_LOC - $%7BPARENT-2-WORKSPACE_LOC%7D - - - + + + Clean-Server + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + jars + 2 + MCP_LOC/jars + + + src + 2 + MCP_LOC/src-base/minecraft_server + + + src-common + 2 + MCP_LOC/src-base/common + + + + + 0 + jars + 13 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-*.jar + + + + + + MCP_LOC + $%7BPARENT-2-WORKSPACE_LOC%7D + + + diff --git a/eclipse/Clean-Server/.settings/org.eclipse.jdt.core.prefs b/eclipse/Clean-Server/.settings/org.eclipse.jdt.core.prefs index d255605541..96db542e64 100644 --- a/eclipse/Clean-Server/.settings/org.eclipse.jdt.core.prefs +++ b/eclipse/Clean-Server/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ -#Thu Jun 02 15:56:50 CEST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +#Thu Jun 02 15:56:50 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eclipse/FML-Server/.settings/org.eclipse.jdt.core.prefs b/eclipse/FML-Server/.settings/org.eclipse.jdt.core.prefs index d255605541..96db542e64 100644 --- a/eclipse/FML-Server/.settings/org.eclipse.jdt.core.prefs +++ b/eclipse/FML-Server/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ -#Thu Jun 02 15:56:50 CEST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +#Thu Jun 02 15:56:50 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/install/eclipse/Client/.classpath b/install/eclipse/Client/.classpath index 91b4c3a4c2..6251c5420c 100644 --- a/install/eclipse/Client/.classpath +++ b/install/eclipse/Client/.classpath @@ -1,26 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/install/eclipse/Client/.project b/install/eclipse/Client/.project index 60902bbefb..fb279657da 100644 --- a/install/eclipse/Client/.project +++ b/install/eclipse/Client/.project @@ -1,74 +1,74 @@ - - - Client - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - - - jars - 2 - MCP_LOC/jars - - - src - 2 - MCP_LOC/src/minecraft - - - common - 2 - MCP_LOC/src/common - - - lib - 2 - MCP_LOC/lib - - - - - 1307293455427 - jars - 13 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-bin - - - - 1307293504507 - jars/bin - 5 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-*.jar - - - - 1307293480435 - jars/bin/natives - 6 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-* - - - - - - MCP_LOC - $%7BPARENT-1-WORKSPACE_LOC%7D - - - + + + Client + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + jars + 2 + MCP_LOC/jars + + + src + 2 + MCP_LOC/src/minecraft + + + common + 2 + MCP_LOC/src/common + + + lib + 2 + MCP_LOC/lib + + + + + 1307293455427 + jars + 13 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-bin + + + + 1307293504507 + jars/bin + 5 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-*.jar + + + + 1307293480435 + jars/bin/natives + 6 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-* + + + + + + MCP_LOC + $%7BPARENT-1-WORKSPACE_LOC%7D + + + diff --git a/install/eclipse/Server/.classpath b/install/eclipse/Server/.classpath index 3e91196ef4..ce227638d9 100644 --- a/install/eclipse/Server/.classpath +++ b/install/eclipse/Server/.classpath @@ -1,8 +1,8 @@ - - - - - - - - + + + + + + + + diff --git a/install/eclipse/Server/.project b/install/eclipse/Server/.project index cd336f710c..87e696385e 100644 --- a/install/eclipse/Server/.project +++ b/install/eclipse/Server/.project @@ -1,51 +1,51 @@ - - - Server - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - - - jars - 2 - MCP_LOC/jars - - - src - 2 - MCP_LOC/src/minecraft_server - - - common - 2 - MCP_LOC/src/common - - - - - 1307293529292 - jars - 13 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-*.jar - - - - - - MCP_LOC - $%7BPARENT-1-WORKSPACE_LOC%7D - - - + + + Server + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + jars + 2 + MCP_LOC/jars + + + src + 2 + MCP_LOC/src/minecraft_server + + + common + 2 + MCP_LOC/src/common + + + + + 1307293529292 + jars + 13 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-*.jar + + + + + + MCP_LOC + $%7BPARENT-1-WORKSPACE_LOC%7D + + + diff --git a/install/install.py b/install/install.py index c318ddd083..5170dbc059 100644 --- a/install/install.py +++ b/install/install.py @@ -1,16 +1,16 @@ -import os, os.path, sys - -fml_dir = os.path.dirname(os.path.abspath(__file__)) -mcp_dir = os.path.abspath('..') - -from fml import setup_fml, finish_setup_fml, apply_fml_patches - -def main(): - print '================ Forge ModLoader Setup Start ===================' - setup_fml(fml_dir, mcp_dir) - apply_fml_patches(fml_dir, mcp_sir, os.path.join(mcp_dir, 'src')) - finish_setup_fml(fml_dir, mcp_dir) - print '================ Forge ModLoader Setup End ===================' - -if __name__ == '__main__': +import os, os.path, sys + +fml_dir = os.path.dirname(os.path.abspath(__file__)) +mcp_dir = os.path.abspath('..') + +from fml import setup_fml, finish_setup_fml, apply_fml_patches + +def main(): + print '================ Forge ModLoader Setup Start ===================' + setup_fml(fml_dir, mcp_dir) + apply_fml_patches(fml_dir, mcp_sir, os.path.join(mcp_dir, 'src')) + finish_setup_fml(fml_dir, mcp_dir) + print '================ Forge ModLoader Setup End ===================' + +if __name__ == '__main__': main() \ No newline at end of file diff --git a/transformers/cpw/mods/fml/common/asm/transformers/AccessTransformer.java b/transformers/cpw/mods/fml/common/asm/transformers/AccessTransformer.java index dd8c30845a..dd61f4ca9f 100644 --- a/transformers/cpw/mods/fml/common/asm/transformers/AccessTransformer.java +++ b/transformers/cpw/mods/fml/common/asm/transformers/AccessTransformer.java @@ -1,403 +1,403 @@ -package cpw.mods.fml.common.asm.transformers; - -import static org.objectweb.asm.Opcodes.ACC_PRIVATE; -import static org.objectweb.asm.Opcodes.ACC_PROTECTED; -import static org.objectweb.asm.Opcodes.ACC_PUBLIC; -import static org.objectweb.asm.Opcodes.ACC_FINAL; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URL; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; - -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.FieldNode; -import org.objectweb.asm.tree.MethodNode; - -import com.google.common.base.CharMatcher; -import com.google.common.base.Charsets; -import com.google.common.base.Splitter; -import com.google.common.base.Strings; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Multimap; -import com.google.common.io.LineProcessor; -import com.google.common.io.Resources; - -import cpw.mods.fml.relauncher.IClassTransformer; - -public class AccessTransformer implements IClassTransformer -{ - private class Modifier - { - public String name = ""; - public String desc = ""; - public int oldAccess = 0; - public int newAccess = 0; - public int targetAccess = 0; - public boolean changeFinal = false; - public boolean markFinal = false; - - private void setTargetAccess(String name) - { - if (name.startsWith("public")) targetAccess = ACC_PUBLIC; - else if (name.startsWith("private")) targetAccess = ACC_PRIVATE; - else if (name.startsWith("protected")) targetAccess = ACC_PROTECTED; - - if (name.endsWith("-f")) - { - changeFinal = true; - markFinal = false; - } - else if (name.endsWith("+f")) - { - changeFinal = true; - markFinal = true; - } - } - } - - private Multimap modifiers = ArrayListMultimap.create(); - - public AccessTransformer() throws IOException - { - this("fml_at.cfg"); - } - protected AccessTransformer(String rulesFile) throws IOException - { - readMapFile(rulesFile); - } - - private void readMapFile(String rulesFile) throws IOException - { - File file = new File(rulesFile); - URL rulesResource; - if (file.exists()) - { - rulesResource = file.toURI().toURL(); - } - else - { - rulesResource = Resources.getResource(rulesFile); - } - Resources.readLines(rulesResource, Charsets.UTF_8, new LineProcessor() - { - @Override - public Void getResult() - { - return null; - } - - @Override - public boolean processLine(String input) throws IOException - { - String line = Iterables.getFirst(Splitter.on('#').limit(2).split(input), "").trim(); - if (line.length()==0) - { - return true; - } - List parts = Lists.newArrayList(Splitter.on(" ").trimResults().split(line)); - if (parts.size()>2 || parts.get(1).indexOf('.') == -1) - { - throw new RuntimeException("Invalid config file line "+ input); - } - Modifier m = new Modifier(); - m.setTargetAccess(parts.get(0)); - List descriptor = Lists.newArrayList(Splitter.on(".").trimResults().split(parts.get(1))); - String nameReference = descriptor.get(1); - int parenIdx = nameReference.indexOf('('); - if (parenIdx>0) - { - m.desc = nameReference.substring(parenIdx); - m.name = nameReference.substring(0,parenIdx-1); - } - else - { - m.name = nameReference; - } - modifiers.put(descriptor.get(0), m); - return true; - } - }); - } - - @SuppressWarnings("unchecked") - @Override - public byte[] transform(String name, byte[] bytes) - { - if (!modifiers.containsKey(name)) { return bytes; } - - ClassNode classNode = new ClassNode(); - ClassReader classReader = new ClassReader(bytes); - classReader.accept(classNode, 0); - - Collection mods = modifiers.get(name); - for (Modifier m : mods) - { - if (m.desc.isEmpty()) - { - for (FieldNode n : (List) classNode.fields) - { - if (n.name.equals(m.name)) - { - n.access = getFixedAccess(n.access, m); - System.out.println(String.format("Field: %s.%s %s -> %s", name, m.name, Integer.toBinaryString(m.oldAccess), - Integer.toBinaryString(m.newAccess))); - break; - } - } - } - else - { - for (MethodNode n : (List) classNode.methods) - { - if (n.name.equals(m.name) && n.desc.equals(m.desc)) - { - n.access = getFixedAccess(n.access, m); - System.out.println(String.format("Method: %s.%s%s %s -> %s", name, m.name, m.desc, toBinary(m.oldAccess), toBinary(m.newAccess))); - break; - } - } - } - } - - ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); - classNode.accept(writer); - return writer.toByteArray(); - } - - private String toBinary(int num) - { - return String.format("%16s", Integer.toBinaryString(num)).replace(' ', '0'); - } - - private int getFixedAccess(int access, Modifier target) - { - target.oldAccess = access; - int t = target.targetAccess; - int ret = (access & ~7); - - switch (access & 7) - { - case ACC_PRIVATE: - ret |= t; - break; - case 0: // default - ret |= (t != ACC_PRIVATE ? t : 0 /* default */); - break; - case ACC_PROTECTED: - ret |= (t != ACC_PRIVATE && t != 0 /* default */? t : ACC_PROTECTED); - break; - case ACC_PUBLIC: - ret |= (t != ACC_PRIVATE && t != 0 /* default */&& t != ACC_PROTECTED ? t : ACC_PUBLIC); - break; - default: - throw new RuntimeException("The fuck?"); - } - - // Clear the "final" marker on fields only if specified in control field - if (target.changeFinal && target.desc == "") - { - if (target.markFinal) - { - ret |= ACC_FINAL; - } - else - { - ret &= ~ACC_FINAL; - } - } - target.newAccess = ret; - return ret; - } - - public static void main(String[] args) - { - if (args.length < 2) - { - System.out.println("Usage: AccessTransformer [MapFile2]... "); - return; - } - - boolean hasTransformer = false; - AccessTransformer[] trans = new AccessTransformer[args.length - 1]; - for (int x = 1; x < args.length; x++) - { - try - { - trans[x - 1] = new AccessTransformer(args[x]); - hasTransformer = true; - } - catch (IOException e) - { - System.out.println("Could not read Transformer Map: " + args[x]); - e.printStackTrace(); - } - } - - if (!hasTransformer) - { - System.out.println("Culd not find a valid transformer to perform"); - return; - } - - File orig = new File(args[0]); - File temp = new File(args[0] + ".ATBack"); - if (!orig.exists() && !temp.exists()) - { - System.out.println("Could not find target jar: " + orig); - return; - } -/* - if (temp.exists()) - { - if (orig.exists() && !orig.renameTo(new File(args[0] + (new SimpleDateFormat(".yyyy.MM.dd.HHmmss")).format(new Date())))) - { - System.out.println("Could not backup existing file: " + orig); - return; - } - if (!temp.renameTo(orig)) - { - System.out.println("Could not restore backup from previous run: " + temp); - return; - } - } -*/ - if (!orig.renameTo(temp)) - { - System.out.println("Could not rename file: " + orig + " -> " + temp); - return; - } - - try - { - processJar(temp, orig, trans); - } - catch (IOException e) - { - e.printStackTrace(); - } - - if (!temp.delete()) - { - System.out.println("Could not delete temp file: " + temp); - } - } - - private static void processJar(File inFile, File outFile, AccessTransformer[] transformers) throws IOException - { - ZipInputStream inJar = null; - ZipOutputStream outJar = null; - - try - { - try - { - inJar = new ZipInputStream(new BufferedInputStream(new FileInputStream(inFile))); - } - catch (FileNotFoundException e) - { - throw new FileNotFoundException("Could not open input file: " + e.getMessage()); - } - - try - { - outJar = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(outFile))); - } - catch (FileNotFoundException e) - { - throw new FileNotFoundException("Could not open output file: " + e.getMessage()); - } - - ZipEntry entry; - while ((entry = inJar.getNextEntry()) != null) - { - if (entry.isDirectory()) - { - outJar.putNextEntry(entry); - continue; - } - - byte[] data = new byte[4096]; - ByteArrayOutputStream entryBuffer = new ByteArrayOutputStream(); - - int len; - do - { - len = inJar.read(data); - if (len > 0) - { - entryBuffer.write(data, 0, len); - } - } - while (len != -1); - - byte[] entryData = entryBuffer.toByteArray(); - - String entryName = entry.getName(); - - if (entryName.endsWith(".class") && !entryName.startsWith(".")) - { - ClassNode cls = new ClassNode(); - ClassReader rdr = new ClassReader(entryData); - rdr.accept(cls, 0); - String name = cls.name.replace('/', '.').replace('\\', '.'); - - for (AccessTransformer trans : transformers) - { - entryData = trans.transform(name, entryData); - } - } - - ZipEntry newEntry = new ZipEntry(entryName); - outJar.putNextEntry(newEntry); - outJar.write(entryData); - } - } - finally - { - if (outJar != null) - { - try - { - outJar.close(); - } - catch (IOException e) - { - } - } - - if (inJar != null) - { - try - { - inJar.close(); - } - catch (IOException e) - { - } - } - } - } +package cpw.mods.fml.common.asm.transformers; + +import static org.objectweb.asm.Opcodes.ACC_PRIVATE; +import static org.objectweb.asm.Opcodes.ACC_PROTECTED; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACC_FINAL; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.ClassNode; +import org.objectweb.asm.tree.FieldNode; +import org.objectweb.asm.tree.MethodNode; + +import com.google.common.base.CharMatcher; +import com.google.common.base.Charsets; +import com.google.common.base.Splitter; +import com.google.common.base.Strings; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Multimap; +import com.google.common.io.LineProcessor; +import com.google.common.io.Resources; + +import cpw.mods.fml.relauncher.IClassTransformer; + +public class AccessTransformer implements IClassTransformer +{ + private class Modifier + { + public String name = ""; + public String desc = ""; + public int oldAccess = 0; + public int newAccess = 0; + public int targetAccess = 0; + public boolean changeFinal = false; + public boolean markFinal = false; + + private void setTargetAccess(String name) + { + if (name.startsWith("public")) targetAccess = ACC_PUBLIC; + else if (name.startsWith("private")) targetAccess = ACC_PRIVATE; + else if (name.startsWith("protected")) targetAccess = ACC_PROTECTED; + + if (name.endsWith("-f")) + { + changeFinal = true; + markFinal = false; + } + else if (name.endsWith("+f")) + { + changeFinal = true; + markFinal = true; + } + } + } + + private Multimap modifiers = ArrayListMultimap.create(); + + public AccessTransformer() throws IOException + { + this("fml_at.cfg"); + } + protected AccessTransformer(String rulesFile) throws IOException + { + readMapFile(rulesFile); + } + + private void readMapFile(String rulesFile) throws IOException + { + File file = new File(rulesFile); + URL rulesResource; + if (file.exists()) + { + rulesResource = file.toURI().toURL(); + } + else + { + rulesResource = Resources.getResource(rulesFile); + } + Resources.readLines(rulesResource, Charsets.UTF_8, new LineProcessor() + { + @Override + public Void getResult() + { + return null; + } + + @Override + public boolean processLine(String input) throws IOException + { + String line = Iterables.getFirst(Splitter.on('#').limit(2).split(input), "").trim(); + if (line.length()==0) + { + return true; + } + List parts = Lists.newArrayList(Splitter.on(" ").trimResults().split(line)); + if (parts.size()>2 || parts.get(1).indexOf('.') == -1) + { + throw new RuntimeException("Invalid config file line "+ input); + } + Modifier m = new Modifier(); + m.setTargetAccess(parts.get(0)); + List descriptor = Lists.newArrayList(Splitter.on(".").trimResults().split(parts.get(1))); + String nameReference = descriptor.get(1); + int parenIdx = nameReference.indexOf('('); + if (parenIdx>0) + { + m.desc = nameReference.substring(parenIdx); + m.name = nameReference.substring(0,parenIdx-1); + } + else + { + m.name = nameReference; + } + modifiers.put(descriptor.get(0), m); + return true; + } + }); + } + + @SuppressWarnings("unchecked") + @Override + public byte[] transform(String name, byte[] bytes) + { + if (!modifiers.containsKey(name)) { return bytes; } + + ClassNode classNode = new ClassNode(); + ClassReader classReader = new ClassReader(bytes); + classReader.accept(classNode, 0); + + Collection mods = modifiers.get(name); + for (Modifier m : mods) + { + if (m.desc.isEmpty()) + { + for (FieldNode n : (List) classNode.fields) + { + if (n.name.equals(m.name)) + { + n.access = getFixedAccess(n.access, m); + System.out.println(String.format("Field: %s.%s %s -> %s", name, m.name, Integer.toBinaryString(m.oldAccess), + Integer.toBinaryString(m.newAccess))); + break; + } + } + } + else + { + for (MethodNode n : (List) classNode.methods) + { + if (n.name.equals(m.name) && n.desc.equals(m.desc)) + { + n.access = getFixedAccess(n.access, m); + System.out.println(String.format("Method: %s.%s%s %s -> %s", name, m.name, m.desc, toBinary(m.oldAccess), toBinary(m.newAccess))); + break; + } + } + } + } + + ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); + classNode.accept(writer); + return writer.toByteArray(); + } + + private String toBinary(int num) + { + return String.format("%16s", Integer.toBinaryString(num)).replace(' ', '0'); + } + + private int getFixedAccess(int access, Modifier target) + { + target.oldAccess = access; + int t = target.targetAccess; + int ret = (access & ~7); + + switch (access & 7) + { + case ACC_PRIVATE: + ret |= t; + break; + case 0: // default + ret |= (t != ACC_PRIVATE ? t : 0 /* default */); + break; + case ACC_PROTECTED: + ret |= (t != ACC_PRIVATE && t != 0 /* default */? t : ACC_PROTECTED); + break; + case ACC_PUBLIC: + ret |= (t != ACC_PRIVATE && t != 0 /* default */&& t != ACC_PROTECTED ? t : ACC_PUBLIC); + break; + default: + throw new RuntimeException("The fuck?"); + } + + // Clear the "final" marker on fields only if specified in control field + if (target.changeFinal && target.desc == "") + { + if (target.markFinal) + { + ret |= ACC_FINAL; + } + else + { + ret &= ~ACC_FINAL; + } + } + target.newAccess = ret; + return ret; + } + + public static void main(String[] args) + { + if (args.length < 2) + { + System.out.println("Usage: AccessTransformer [MapFile2]... "); + return; + } + + boolean hasTransformer = false; + AccessTransformer[] trans = new AccessTransformer[args.length - 1]; + for (int x = 1; x < args.length; x++) + { + try + { + trans[x - 1] = new AccessTransformer(args[x]); + hasTransformer = true; + } + catch (IOException e) + { + System.out.println("Could not read Transformer Map: " + args[x]); + e.printStackTrace(); + } + } + + if (!hasTransformer) + { + System.out.println("Culd not find a valid transformer to perform"); + return; + } + + File orig = new File(args[0]); + File temp = new File(args[0] + ".ATBack"); + if (!orig.exists() && !temp.exists()) + { + System.out.println("Could not find target jar: " + orig); + return; + } +/* + if (temp.exists()) + { + if (orig.exists() && !orig.renameTo(new File(args[0] + (new SimpleDateFormat(".yyyy.MM.dd.HHmmss")).format(new Date())))) + { + System.out.println("Could not backup existing file: " + orig); + return; + } + if (!temp.renameTo(orig)) + { + System.out.println("Could not restore backup from previous run: " + temp); + return; + } + } +*/ + if (!orig.renameTo(temp)) + { + System.out.println("Could not rename file: " + orig + " -> " + temp); + return; + } + + try + { + processJar(temp, orig, trans); + } + catch (IOException e) + { + e.printStackTrace(); + } + + if (!temp.delete()) + { + System.out.println("Could not delete temp file: " + temp); + } + } + + private static void processJar(File inFile, File outFile, AccessTransformer[] transformers) throws IOException + { + ZipInputStream inJar = null; + ZipOutputStream outJar = null; + + try + { + try + { + inJar = new ZipInputStream(new BufferedInputStream(new FileInputStream(inFile))); + } + catch (FileNotFoundException e) + { + throw new FileNotFoundException("Could not open input file: " + e.getMessage()); + } + + try + { + outJar = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(outFile))); + } + catch (FileNotFoundException e) + { + throw new FileNotFoundException("Could not open output file: " + e.getMessage()); + } + + ZipEntry entry; + while ((entry = inJar.getNextEntry()) != null) + { + if (entry.isDirectory()) + { + outJar.putNextEntry(entry); + continue; + } + + byte[] data = new byte[4096]; + ByteArrayOutputStream entryBuffer = new ByteArrayOutputStream(); + + int len; + do + { + len = inJar.read(data); + if (len > 0) + { + entryBuffer.write(data, 0, len); + } + } + while (len != -1); + + byte[] entryData = entryBuffer.toByteArray(); + + String entryName = entry.getName(); + + if (entryName.endsWith(".class") && !entryName.startsWith(".")) + { + ClassNode cls = new ClassNode(); + ClassReader rdr = new ClassReader(entryData); + rdr.accept(cls, 0); + String name = cls.name.replace('/', '.').replace('\\', '.'); + + for (AccessTransformer trans : transformers) + { + entryData = trans.transform(name, entryData); + } + } + + ZipEntry newEntry = new ZipEntry(entryName); + outJar.putNextEntry(newEntry); + outJar.write(entryData); + } + } + finally + { + if (outJar != null) + { + try + { + outJar.close(); + } + catch (IOException e) + { + } + } + + if (inJar != null) + { + try + { + inJar.close(); + } + catch (IOException e) + { + } + } + } + } } \ No newline at end of file diff --git a/update_patches.bat b/update_patches.bat index 7c5f71c66b..5ab4a41039 100644 --- a/update_patches.bat +++ b/update_patches.bat @@ -1,2 +1,2 @@ -@echo off -..\runtime\bin\python\python_mcp update_patches.py .. patches +@echo off +..\runtime\bin\python\python_mcp update_patches.py .. patches