diff --git a/client/net/minecraftforge/client/ModCompatibilityClient.java b/client/net/minecraftforge/client/ModCompatibilityClient.java deleted file mode 100644 index d3203d6ce..000000000 --- a/client/net/minecraftforge/client/ModCompatibilityClient.java +++ /dev/null @@ -1,278 +0,0 @@ -package net.minecraftforge.client; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.logging.Level; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.common.FMLLog; - -import paulscode.sound.SoundSystemConfig; -import paulscode.sound.codecs.CodecIBXM; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.SoundManager; -import net.minecraft.client.audio.SoundPool; -import net.minecraft.client.audio.SoundPoolEntry; -import net.minecraft.entity.Entity; -import net.minecraft.network.packet.Packet100OpenWindow; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -public class ModCompatibilityClient -{ - /** - * Tries to get the class for the specified name, will also try the - * net.minecraft.src package in case we are in MCP - * Returns null if not found. - * - * @param name The class name - * @return The Class, or null if not found - */ - private static Class getClass(String name) - { - try - { - return Class.forName(name); - } - catch (Exception e) - { - try - { - return Class.forName("net.minecraft.src." + name); - } - catch (Exception e2) - { - return null; - } - } - } - - /************************************************************************************************ - * Risugami's AudioMod Compatibility - * http://www.minecraftforum.net/topic/75440- - * - * AudioMod adds a few extra codecs, loads audio from /resources/mods/*, - * introduces the concept of 'cave' sounds, which are determined by if - * the player is underneath a solid block. - * - * It also lowers the interval between background music songs to 6000 - */ - public static SoundPool audioModSoundPoolCave; - - /** - * Populates the sound pools with with sounds from the /resources/mods folder - * And sets the interval between background music to 6000 - * - * @param mngr The SoundManager instance - */ - public static void audioModLoad(SoundManager mngr) - { - audioModSoundPoolCave = new SoundPool(); - audioModLoadModAudio("resources/mod/sound", mngr.soundPoolSounds); - audioModLoadModAudio("resources/mod/streaming", mngr.soundPoolStreaming); - audioModLoadModAudio("resources/mod/music", mngr.soundPoolMusic); - audioModLoadModAudio("resources/mod/cavemusic", audioModSoundPoolCave); - - if (mngr.MUSIC_INTERVAL == 12000) - { - mngr.MUSIC_INTERVAL = 6000; - } - } - - /** - * Walks the given path in the Minecraft app directory and adds audio to the SoundPool - * - * @param path The path to walk - * @param pool The pool to add sound to - */ - private static void audioModLoadModAudio(String path, SoundPool pool) - { - File folder = new File(Minecraft.getMinecraftDir(), path); - - try - { - audioModWalkFolder(folder, folder, pool); - } - catch (IOException ex) - { - FMLLog.log(Level.FINE, ex, "Loading Mod audio failed for folder: %s", path); - ex.printStackTrace(); - } - } - - /** - * Walks the folder path recursively and calls pool.addSound on any file it finds. - * - * @param base The base path for the folder, determines the name when calling addSound - * @param folder The current folder - * @param pool The SoundPool to add the sound to - * @throws IOException - */ - private static void audioModWalkFolder(File base, File folder, SoundPool pool) throws IOException - { - if (folder.exists() || folder.mkdirs()) - { - for (File file : folder.listFiles()) - { - if (!file.getName().startsWith(".")) - { - if (file.isDirectory()) - { - audioModWalkFolder(base, file, pool); - } - else if (file.isFile()) - { - String subpath = file.getPath().substring(base.getPath().length() + 1).replace('\\', '/'); - pool.addSound(subpath, file); - } - } - } - } - } - - /** - * Adds the IBXM codec and associates it with .xm, .s3m, and .mod - */ - public static void audioModAddCodecs() - { - SoundSystemConfig.setCodec("xm", CodecIBXM.class); - SoundSystemConfig.setCodec("s3m", CodecIBXM.class); - SoundSystemConfig.setCodec("mod", CodecIBXM.class); - } - - /** - * If the current player is underground, it picks a random song from the cave sound pool, - * if they are not it returns the passed in entry. - * - * @param soundManager The SoundManager instance - * @param current The currently selected entry - * @return A soundPool entry to be played as the background music - */ - public static SoundPoolEntry audioModPickBackgroundMusic(SoundManager soundManager, SoundPoolEntry current) - { - Minecraft mc = FMLClientHandler.instance().getClient(); - if (mc != null && mc.theWorld != null && audioModSoundPoolCave != null) - { - Entity ent = mc.renderViewEntity; - int x = MathHelper.truncateDoubleToInt(ent.posX); - int y = MathHelper.truncateDoubleToInt(ent.posY); - int z = MathHelper.truncateDoubleToInt(ent.posZ); - return (mc.theWorld.canBlockSeeTheSky(x, y, z) ? current : audioModSoundPoolCave.getRandomSound()); - } - return current; - } - - /*********************************************************************************************************** - * SDK's ModLoaderMP - * http://www.minecraftforum.net/topic/86765- - * - * ModLoaderMP was supposed to be a reliable server side version of ModLoader, however it has - * gotten the reputation of being really slow to update. Never having bugfixes, breaking compatibility - * with the client side ModLoader. - * - * So we have replaced it with our own system called FML (Forge ModLoader) - * it is a stand alone mod, that Forge relies on, and that is open source/community driven. - * https://github.com/cpw/FML - * - * However, for compatibilities sake, we provide the ModLoaderMP's hooks so that the end user - * does not need to make a choice between the two on the client side. - **/ - private static int isMLMPInstalled = -1; - - /** - * Determine if ModLoaderMP is installed by checking for the existence of the BaseModMp class. - * @return True if BaseModMp was installed (indicating the existance of MLMP) - */ - public static boolean isMLMPInstalled() - { - if (isMLMPInstalled == -1) - { - isMLMPInstalled = (getClass("ModLoaderMp") != null ? 1 : 0); - } - return isMLMPInstalled == 1; - } - - /** - * Attempts to spawn a vehicle using ModLoaderMP's vehicle spawn registry, if MLMP is not installed - * it returns the passed in currentEntity - * - * @param type The Type ID of the vehicle - * @param world The current world - * @param x The spawn X position - * @param y The spawn Y position - * @param z The spawn Z position - * @param thrower The entity that spawned the vehicle {possibly null} - * @param currentEntity The current value to return if MLMP is not installed - * @return The new spawned entity - * @throws Exception - */ - public static Object mlmpVehicleSpawn(int type, World world, double x, double y, double z, Entity thrower, Object currentEntity) throws Exception - { - Class mlmp = getClass("ModLoaderMp"); - if (!isMLMPInstalled() || mlmp == null) - { - return currentEntity; - } - - Object entry = mlmp.getDeclaredMethod("handleNetClientHandlerEntities", int.class).invoke(null, type); - if (entry == null) - { - return currentEntity; - } - - Class entityClass = (Class)entry.getClass().getDeclaredField("entityClass").get(entry); - Object ret = (Entity)entityClass.getConstructor(World.class, Double.TYPE, Double.TYPE, Double.TYPE).newInstance(world, x, y, z); - - if (entry.getClass().getDeclaredField("entityHasOwner").getBoolean(entry)) - { - Field owner = entityClass.getField("owner"); - - if (!Entity.class.isAssignableFrom(owner.getType())) - { - throw new Exception(String.format("Entity\'s owner field must be of type Entity, but it is of type %s.", owner.getType())); - } - - if (thrower == null) - { - System.out.println("Received spawn packet for entity with owner, but owner was not found."); - FMLLog.fine("Received spawn packet for entity with owner, but owner was not found."); - } - else - { - if (!owner.getType().isAssignableFrom(thrower.getClass())) - { - throw new Exception(String.format("Tried to assign an entity of type %s to entity owner, which is of type %s.", thrower.getClass(), owner.getType())); - } - - owner.set(ret, thrower); - } - } - return ret; - } - - /** - * Attempts to invoke ModLoaderMp.handleGUI if ModLoaderMP is installed. - * If not, it does nothing - * - * @param pkt The open window packet - */ - public static void mlmpOpenWindow(Packet100OpenWindow pkt) - { - Class mlmp = getClass("ModLoaderMp"); - if (!isMLMPInstalled() || mlmp == null) - { - return; - } - - try - { - mlmp.getDeclaredMethod("handleGUI", Packet100OpenWindow.class).invoke(null, pkt); - } - catch (Exception e) - { - e.printStackTrace(); - } - } -} diff --git a/common/net/minecraftforge/common/IArmorTextureProvider.java b/common/net/minecraftforge/common/IArmorTextureProvider.java deleted file mode 100644 index 4106d170e..000000000 --- a/common/net/minecraftforge/common/IArmorTextureProvider.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This software is provided under the terms of the Minecraft Forge Public - * License v1.0. - */ - -package net.minecraftforge.common; - -import net.minecraft.item.ItemStack; - -/** - * This interface has to be implemented by an instance of ItemArmor. - * It allows for the application of a custom texture file to the player skin - * when the armor is worn. - */ -@Deprecated //See Item.getArmorTexture -public interface IArmorTextureProvider -{ - - /** - * This interface has to return the path to a file that is the same - * format as iron_1.png (or any of the other armor files). It will be - * applied to the player skin when the armor is worn. - */ - public String getArmorTextureFile(ItemStack itemstack); - -} - diff --git a/fml b/fml index 05a854cd2..2766f9a29 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 05a854cd2af53ca822ee8b249b0b3bbe44f94675 +Subproject commit 2766f9a293f3e1da650693991d16a43a089ae65b diff --git a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch deleted file mode 100644 index 996a89563..000000000 --- a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/audio/SoundPool.java -+++ ../src_work/minecraft/net/minecraft/client/audio/SoundPool.java -@@ -4,6 +4,7 @@ - import cpw.mods.fml.relauncher.SideOnly; - import java.io.File; - import java.net.MalformedURLException; -+import java.net.URL; - import java.util.ArrayList; - import java.util.HashMap; - import java.util.List; -@@ -36,6 +37,26 @@ - */ - public SoundPoolEntry addSound(String par1Str, File par2File) - { -+ try -+ { -+ return addSound(par1Str, par2File.toURI().toURL()); -+ } -+ catch (MalformedURLException ex) -+ { -+ ex.printStackTrace(); -+ throw new RuntimeException(ex); -+ } -+ } -+ -+ /** -+ * URL version of addSound, as the back-end sound engine has full support for various types of URLs -+ * -+ * @param par1Str The name of the sound to add -+ * @param url The url of the sound resource -+ * @return A SoundPoolEntry for the newly added sound -+ */ -+ public SoundPoolEntry addSound(String par1Str, URL url) -+ { - try - { - String s1 = par1Str; -@@ -56,13 +77,13 @@ - this.nameToSoundPoolEntriesMapping.put(par1Str, new ArrayList()); - } - -- SoundPoolEntry soundpoolentry = new SoundPoolEntry(s1, par2File.toURI().toURL()); -+ SoundPoolEntry soundpoolentry = new SoundPoolEntry(s1, url); - ((List)this.nameToSoundPoolEntriesMapping.get(par1Str)).add(soundpoolentry); - this.allSoundPoolEntries.add(soundpoolentry); - ++this.numberOfSoundPoolEntries; - return soundpoolentry; - } -- catch (MalformedURLException malformedurlexception) -+ catch (Exception malformedurlexception) - { - malformedurlexception.printStackTrace(); - throw new RuntimeException(malformedurlexception); diff --git a/patches/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java.patch deleted file mode 100644 index 23c473d43..000000000 --- a/patches/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java -+++ ../src_work/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java -@@ -40,6 +40,10 @@ - } - } - } -+ catch (java.io.FileNotFoundException e) -+ { -+ //NomNomNom, Don't print the error when the flag isn't found. -+ } - catch (Throwable throwable) - { - throwable.printStackTrace(); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch deleted file mode 100644 index cdc1e6649..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -+++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -@@ -66,17 +66,42 @@ - - public List createTexture(String par1Str) - { -+ return createNewTexture(par1Str, par1Str, null); -+ } -+ -+ public List createNewTexture(String textureName, String textureFile, TextureStitched stitched) -+ { -+ String par1Str = textureFile; - ArrayList arraylist = new ArrayList(); - ITexturePack itexturepack = Minecraft.getMinecraft().texturePackList.getSelectedTexturePack(); - - try - { -- BufferedImage bufferedimage = ImageIO.read(itexturepack.getResourceAsStream("/" + par1Str)); -- int i = bufferedimage.getHeight(); -- int j = bufferedimage.getWidth(); -- String s1 = this.getBasename(par1Str); -+ BufferedImage bufferedimage = null; -+ int i = 0; -+ int j = 0; -+ FileNotFoundException fnfe = null; -+ try -+ { -+ bufferedimage = ImageIO.read(itexturepack.getResourceAsStream("/" + textureFile)); -+ i = bufferedimage.getHeight(); -+ j = bufferedimage.getWidth(); -+ } -+ catch (FileNotFoundException e) -+ { -+ fnfe = e; -+ } -+ String s1 = textureName; - -- if (this.hasAnimationTxt(par1Str, itexturepack)) -+ if (stitched != null && stitched.loadTexture(this, itexturepack, textureName, textureFile, bufferedimage, arraylist)) -+ { -+ ; -+ } -+ else if (fnfe != null) -+ { -+ throw fnfe; -+ } -+ else if (this.hasAnimationTxt(par1Str, itexturepack)) - { - int k = j; - int l = j; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch deleted file mode 100644 index 2337b1ecd..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java -+++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java -@@ -3,9 +3,13 @@ - import cpw.mods.fml.client.TextureFXManager; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+ -+import java.awt.image.BufferedImage; - import java.io.BufferedReader; - import java.util.ArrayList; - import java.util.List; -+ -+import net.minecraft.client.texturepacks.ITexturePack; - import net.minecraft.util.Icon; - import net.minecraft.util.Tuple; - -@@ -252,4 +256,28 @@ - t.createAndUploadTexture(); - } - } -+ -+ //=================================================================================================== -+ // Forge Start -+ //=================================================================================================== -+ /** -+ * Called when texture packs are refreshed, from TextureManager.createNewTexture, -+ * allows for finer control over loading the animation lists and verification of the image. -+ * If the return value from this is true, no further loading will be done by vanilla code. -+ * -+ * You need to add all Texture's to the textures argument. At the end of this function at least one -+ * entry should be in that argument, or a error should of been thrown. -+ * -+ * @param manager The invoking manager -+ * @param texturepack Current texture pack -+ * @param name The name of the texture -+ * @param fileName Resource path for this texture -+ * @param image Buffered image of the loaded resource -+ * @param textures ArrayList of element type Texture, split textures should be added to this list for the stitcher to handle. -+ * @return Return true to skip further vanilla texture loading for this texture -+ */ -+ public boolean loadTexture(TextureManager manager, ITexturePack texturepack, String name, String fileName, BufferedImage image, ArrayList textures) -+ { -+ return false; -+ } - } diff --git a/patches/minecraft/net/minecraft/util/ChunkCoordinates.java.patch b/patches/minecraft/net/minecraft/util/ChunkCoordinates.java.patch deleted file mode 100644 index df4f80f89..000000000 --- a/patches/minecraft/net/minecraft/util/ChunkCoordinates.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/util/ChunkCoordinates.java -+++ ../src_work/minecraft/net/minecraft/util/ChunkCoordinates.java -@@ -64,10 +64,10 @@ - */ - public float getDistanceSquared(int par1, int par2, int par3) - { -- int l = this.posX - par1; -- int i1 = this.posY - par2; -- int j1 = this.posZ - par3; -- return (float)(l * l + i1 * i1 + j1 * j1); -+ float l = this.posX - par1; -+ float i1 = this.posY - par2; -+ float j1 = this.posZ - par3; -+ return l * l + i1 * i1 + j1 * j1; - } - - /** diff --git a/patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch b/patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch deleted file mode 100644 index cf4942a11..000000000 --- a/patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/util/ThreadDownloadResources.java -+++ ../src_work/minecraft/net/minecraft/util/ThreadDownloadResources.java -@@ -8,6 +8,8 @@ - import java.io.FileOutputStream; - import java.io.IOException; - import java.net.URL; -+import java.net.URLConnection; -+ - import javax.xml.parsers.DocumentBuilder; - import javax.xml.parsers.DocumentBuilderFactory; - import net.minecraft.client.Minecraft; -@@ -48,7 +50,11 @@ - URL url = new URL("http://s3.amazonaws.com/MinecraftResources/"); - DocumentBuilderFactory documentbuilderfactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentbuilder = documentbuilderfactory.newDocumentBuilder(); -- Document document = documentbuilder.parse(url.openStream()); -+ //Add a timeout of 60 seconds to getting the list, MC stalls without sound for some users. -+ URLConnection con = url.openConnection(); -+ con.setConnectTimeout(60000); -+ con.setReadTimeout(60000); -+ Document document = documentbuilder.parse(con.getInputStream()); - NodeList nodelist = document.getElementsByTagName("Contents"); - - for (int i = 0; i < 2; ++i) -@@ -168,7 +174,11 @@ - private void downloadResource(URL par1URL, File par2File, long par3) throws IOException - { - byte[] abyte = new byte[4096]; -- DataInputStream datainputstream = new DataInputStream(par1URL.openStream()); -+ //Add a timeout of 60 seconds to getting the list, MC stalls without sound for some users. -+ URLConnection con = par1URL.openConnection(); -+ con.setConnectTimeout(60000); -+ con.setReadTimeout(60000); -+ DataInputStream datainputstream = new DataInputStream(con.getInputStream()); - DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(par2File)); - boolean flag = false; -