diff --git a/client/cpw/mods/fml/client/FMLClientHandler.java b/client/cpw/mods/fml/client/FMLClientHandler.java index 64c587945b..3261f09453 100644 --- a/client/cpw/mods/fml/client/FMLClientHandler.java +++ b/client/cpw/mods/fml/client/FMLClientHandler.java @@ -32,7 +32,9 @@ import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.resources.FileResourcePack; import net.minecraft.client.resources.FolderResourcePack; +import net.minecraft.client.resources.ReloadableResourceManager; import net.minecraft.client.resources.ResourcePack; +import net.minecraft.client.resources.SimpleReloadableResourceManager; import net.minecraft.crash.CrashReport; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; @@ -49,6 +51,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.MapDifference; import com.google.common.collect.MapDifference.ValueDifference; +import com.google.common.collect.Maps; import cpw.mods.fml.client.modloader.ModLoaderClientHelper; import cpw.mods.fml.client.registry.KeyBindingRegistry; @@ -133,16 +136,23 @@ public class FMLClientHandler implements IFMLSidedHandler private List resourcePackList; + private ReloadableResourceManager resourceManager; + + private Map resourcePackMap; + /** * Called to start the whole game off * * @param minecraft The minecraft instance being launched * @param resourcePackList The resource pack list we will populate with mods + * @param resourceManager The resource manager */ - public void beginMinecraftLoading(Minecraft minecraft, List resourcePackList) + public void beginMinecraftLoading(Minecraft minecraft, List resourcePackList, ReloadableResourceManager resourceManager) { client = minecraft; this.resourcePackList = resourcePackList; + this.resourceManager = resourceManager; + this.resourcePackMap = Maps.newHashMap(); if (minecraft.func_71355_q()) { FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now."); @@ -572,6 +582,7 @@ public class FMLClientHandler implements IFMLSidedHandler { ResourcePack pack = (ResourcePack) resourcePackType.getConstructor(ModContainer.class).newInstance(container); resourcePackList.add(pack); + resourcePackMap.put(container.getModId(), pack); } catch (NoSuchMethodException e) { @@ -591,4 +602,9 @@ public class FMLClientHandler implements IFMLSidedHandler { client.func_110436_a(); } + + public ResourcePack getResourcePackFor(String modId) + { + return resourcePackMap.get(modId); + } } diff --git a/client/cpw/mods/fml/client/FMLFileResourcePack.java b/client/cpw/mods/fml/client/FMLFileResourcePack.java index 05c32c907b..81a87af7d5 100644 --- a/client/cpw/mods/fml/client/FMLFileResourcePack.java +++ b/client/cpw/mods/fml/client/FMLFileResourcePack.java @@ -1,11 +1,14 @@ package cpw.mods.fml.client; +import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.logging.Level; +import javax.imageio.ImageIO; + import com.google.common.base.Charsets; import cpw.mods.fml.common.FMLLog; @@ -50,4 +53,10 @@ public class FMLFileResourcePack extends FileResourcePack { else throw ioe; } } + + @Override + public BufferedImage func_110586_a() throws IOException + { + return ImageIO.read(func_110591_a(container.getMetadata().logoFile)); + } } diff --git a/client/cpw/mods/fml/client/FMLFolderResourcePack.java b/client/cpw/mods/fml/client/FMLFolderResourcePack.java index 5f7debf9b7..30281549f4 100644 --- a/client/cpw/mods/fml/client/FMLFolderResourcePack.java +++ b/client/cpw/mods/fml/client/FMLFolderResourcePack.java @@ -1,10 +1,13 @@ package cpw.mods.fml.client; +import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.logging.Level; +import javax.imageio.ImageIO; + import net.minecraft.client.resources.FolderResourcePack; import com.google.common.base.Charsets; @@ -49,4 +52,11 @@ public class FMLFolderResourcePack extends FolderResourcePack { else throw ioe; } } + + @Override + public BufferedImage func_110586_a() throws IOException + { + return ImageIO.read(func_110591_a(container.getMetadata().logoFile)); + } + } diff --git a/client/cpw/mods/fml/client/GuiModList.java b/client/cpw/mods/fml/client/GuiModList.java index ad55dca1ba..518e70d159 100644 --- a/client/cpw/mods/fml/client/GuiModList.java +++ b/client/cpw/mods/fml/client/GuiModList.java @@ -15,15 +15,25 @@ package cpw.mods.fml.client; import java.awt.Dimension; +import java.awt.image.BufferedImage; +import java.io.IOException; import java.util.ArrayList; +import javax.imageio.ImageIO; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiSmallButton; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.SimpleTexture; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureObject; import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.ResourcePack; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringTranslate; import org.lwjgl.opengl.GL11; @@ -117,31 +127,49 @@ public class GuiModList extends GuiScreen if (!selectedMod.getMetadata().autogenerated) { int shifty = 35; String logoFile = selectedMod.getMetadata().logoFile; - if (!logoFile.isEmpty() && false) //TODO Re-enable when updated + if (!logoFile.isEmpty()) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - // TODO -// this.field_73882_e.field_71446_o.func_98187_b(logoFile); - Dimension dim = TextureFXManager.instance().getTextureDimensions(logoFile); - double scaleX = dim.width / 200.0; - double scaleY = dim.height / 65.0; - double scale = 1.0; - if (scaleX > 1 || scaleY > 1) + TextureManager tm = field_73882_e.func_110434_K(); + ResourcePack pack = FMLClientHandler.instance().getResourcePackFor(selectedMod.getModId()); + try { - scale = 1.0 / Math.max(scaleX, scaleY); - } - dim.width *= scale; - dim.height *= scale; - int top = 32; - Tessellator tess = Tessellator.field_78398_a; - tess.func_78382_b(); - tess.func_78374_a(offset, top + dim.height, field_73735_i, 0, 1); - tess.func_78374_a(offset + dim.width, top + dim.height, field_73735_i, 1, 1); - tess.func_78374_a(offset + dim.width, top, field_73735_i, 1, 0); - tess.func_78374_a(offset, top, field_73735_i, 0, 0); - tess.func_78381_a(); + BufferedImage logo; + if (pack!=null) + { + logo = pack.func_110586_a(); + } + else + { + logo = ImageIO.read(getClass().getResourceAsStream(logoFile)); + } + ResourceLocation rl = tm.func_110578_a("modlogo", new DynamicTexture(logo)); + this.field_73882_e.field_71446_o.func_110577_a(rl); + Dimension dim = new Dimension(logo.getWidth(), logo.getHeight()); + double scaleX = dim.width / 200.0; + double scaleY = dim.height / 65.0; + double scale = 1.0; + if (scaleX > 1 || scaleY > 1) + { + scale = 1.0 / Math.max(scaleX, scaleY); + } + dim.width *= scale; + dim.height *= scale; + int top = 32; + Tessellator tess = Tessellator.field_78398_a; + tess.func_78382_b(); + tess.func_78374_a(offset, top + dim.height, field_73735_i, 0, 1); + tess.func_78374_a(offset + dim.width, top + dim.height, field_73735_i, 1, 1); + tess.func_78374_a(offset + dim.width, top, field_73735_i, 1, 0); + tess.func_78374_a(offset, top, field_73735_i, 0, 0); + tess.func_78381_a(); - shifty += 65; + shifty += 65; + } + catch (IOException e) + { + ; + } } this.field_73886_k.func_78261_a(selectedMod.getMetadata().name, offset, shifty, 0xFFFFFF); shifty += 12; diff --git a/client/mcp.png b/client/mcplogo.png similarity index 100% rename from client/mcp.png rename to client/mcplogo.png diff --git a/common/cpw/mods/fml/common/FMLDummyContainer.java b/common/cpw/mods/fml/common/FMLDummyContainer.java index 5d65e51788..083a471d8c 100644 --- a/common/cpw/mods/fml/common/FMLDummyContainer.java +++ b/common/cpw/mods/fml/common/FMLDummyContainer.java @@ -5,7 +5,7 @@ * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * + * * Contributors: * cpw - implementation */ @@ -123,4 +123,10 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC Certificate[] certificates = getClass().getProtectionDomain().getCodeSource().getCertificates(); return certificates != null ? certificates[0] : null; } + + @Override + public Class getCustomResourcePackClass() + { + return super.getCustomResourcePackClass(); + } } diff --git a/common/cpw/mods/fml/common/asm/transformers/AccessTransformer.java b/common/cpw/mods/fml/common/asm/transformers/AccessTransformer.java index 5daed3f70d..f1c5a93285 100644 --- a/common/cpw/mods/fml/common/asm/transformers/AccessTransformer.java +++ b/common/cpw/mods/fml/common/asm/transformers/AccessTransformer.java @@ -157,7 +157,6 @@ public class AccessTransformer implements IClassTransformer System.out.printf("Loaded %d rules from AccessTransformer config file %s\n", modifiers.size(), rulesFile); } - @SuppressWarnings("unchecked") @Override public byte[] transform(String name, String transformedName, byte[] bytes) { @@ -212,7 +211,7 @@ public class AccessTransformer implements IClassTransformer } if (m.desc.isEmpty()) { - for (FieldNode n : (List) classNode.fields) + for (FieldNode n : classNode.fields) { if (n.name.equals(m.name) || m.name.equals("*")) { @@ -231,7 +230,7 @@ public class AccessTransformer implements IClassTransformer } else { - for (MethodNode n : (List) classNode.methods) + for (MethodNode n : classNode.methods) { if ((n.name.equals(m.name) && n.desc.equals(m.desc)) || m.name.equals("*")) { diff --git a/common/cpw/mods/fml/common/asm/transformers/MCPMerger.java b/common/cpw/mods/fml/common/asm/transformers/MCPMerger.java index ede598ff1c..b332dc7b23 100644 --- a/common/cpw/mods/fml/common/asm/transformers/MCPMerger.java +++ b/common/cpw/mods/fml/common/asm/transformers/MCPMerger.java @@ -334,11 +334,10 @@ public class MCPMerger return ann; } - @SuppressWarnings("unchecked") private static Hashtable getClassEntries(ZipFile inFile, ZipOutputStream outFile) throws IOException { Hashtable ret = new Hashtable(); - for (ZipEntry entry : Collections.list((Enumeration)inFile.entries())) + for (ZipEntry entry : Collections.list(inFile.entries())) { if (entry.isDirectory()) { @@ -423,7 +422,6 @@ public class MCPMerger return classNode; } - @SuppressWarnings("unchecked") private static void processFields(ClassNode cClass, ClassNode sClass, ClassInfo info) { List cFields = cClass.fields; @@ -537,7 +535,6 @@ public class MCPMerger return Objects.toStringHelper(this).add("name", node.name).add("desc",node.desc).add("server",server).add("client",client).toString(); } } - @SuppressWarnings("unchecked") private static void processMethods(ClassNode cClass, ClassNode sClass, ClassInfo info) { List cMethods = (List)cClass.methods; diff --git a/common/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java b/common/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java index 72194a02a4..8f05923dca 100644 --- a/common/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java +++ b/common/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java @@ -97,7 +97,6 @@ public class MarkerTransformer implements IClassTransformer }); } - @SuppressWarnings("unchecked") @Override public byte[] transform(String name, String transformedName, byte[] bytes) { diff --git a/common/cpw/mods/fml/common/asm/transformers/SideTransformer.java b/common/cpw/mods/fml/common/asm/transformers/SideTransformer.java index def030e7f1..3f45115ee1 100644 --- a/common/cpw/mods/fml/common/asm/transformers/SideTransformer.java +++ b/common/cpw/mods/fml/common/asm/transformers/SideTransformer.java @@ -32,7 +32,6 @@ public class SideTransformer implements IClassTransformer { private static String SIDE = FMLLaunchHandler.side().name(); private static final boolean DEBUG = false; - @SuppressWarnings("unchecked") @Override public byte[] transform(String name, String transformedName, byte[] bytes) { diff --git a/common/mcpmod.info b/common/mcpmod.info index 66cb7555d5..94154109ee 100644 --- a/common/mcpmod.info +++ b/common/mcpmod.info @@ -5,7 +5,7 @@ "description": "Modding toolkit to decompile and deobfuscate the Minecraft client and server files.", "version": "8.04", "mcversion": "1.6.2", - "logoFile": "/mcp.png", + "logoFile": "/mcplogo.png", "url": "http://mcp.ocean-labs.de/", "updateUrl": "", "authors": ["Searge", "ProfMobius", "IngisKahn", "Fesh0r", "ZeuX", "R4wk", "Others"], diff --git a/jsons/1.6.2-dev.json b/jsons/1.6.2-dev.json index 0c749a18c1..d2969ded14 100644 --- a/jsons/1.6.2-dev.json +++ b/jsons/1.6.2-dev.json @@ -12,7 +12,7 @@ "comment" : "Important for FML, we add this" }, { - "name": "org.ow2.asm:asm-all:4.1", + "name": "org.ow2.asm:asm-debug-all:4.1", "children" : ["sources"], "url" : "http://repo.maven.apache.org/maven2", "comment" : "Important for FML, we add this" diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index f50a232d47..f8afdd307a 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -25,7 +25,7 @@ this.func_71357_I(); this.field_71466_p = new FontRenderer(this.field_71474_y, new ResourceLocation("textures/font/ascii.png"), this.field_71446_o, false); -+ FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao); ++ FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am); + if (this.field_71474_y.field_74363_ab != null) {