Fix up logos in the mod screen. Clean up some unnecessary casts and suppressions, use the -debug asm

library at dev time, since it contains full symbols and code in compiled form.
This commit is contained in:
Christian 2013-07-10 15:47:13 -04:00
parent 32680bb84d
commit e33a1a02bf
13 changed files with 98 additions and 35 deletions

View file

@ -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<ResourcePack> resourcePackList;
private ReloadableResourceManager resourceManager;
private Map<String, ResourcePack> 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);
}
}

View file

@ -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));
}
}

View file

@ -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));
}
}

View file

@ -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;

View file

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

@ -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();
}
}

View file

@ -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<FieldNode>) 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<MethodNode>) classNode.methods)
for (MethodNode n : classNode.methods)
{
if ((n.name.equals(m.name) && n.desc.equals(m.desc)) || m.name.equals("*"))
{

View file

@ -334,11 +334,10 @@ public class MCPMerger
return ann;
}
@SuppressWarnings("unchecked")
private static Hashtable<String, ZipEntry> getClassEntries(ZipFile inFile, ZipOutputStream outFile) throws IOException
{
Hashtable<String, ZipEntry> ret = new Hashtable<String, ZipEntry>();
for (ZipEntry entry : Collections.list((Enumeration<ZipEntry>)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<FieldNode> 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<MethodNode> cMethods = (List<MethodNode>)cClass.methods;

View file

@ -97,7 +97,6 @@ public class MarkerTransformer implements IClassTransformer
});
}
@SuppressWarnings("unchecked")
@Override
public byte[] transform(String name, String transformedName, byte[] bytes)
{

View file

@ -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)
{

View file

@ -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"],

View file

@ -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"

View file

@ -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)
{