Fix nulls in the mod list, start building the gui screen

This commit is contained in:
Christian Weeks 2012-05-12 00:47:04 -04:00
parent 053fd64bde
commit caa5384552
3 changed files with 27 additions and 5 deletions

View file

@ -15,6 +15,8 @@
package cpw.mods.fml.client;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.ModMetadata;
import net.minecraft.client.Minecraft;
import net.minecraft.src.GuiLanguage;
import net.minecraft.src.GuiSlot;
@ -63,13 +65,22 @@ public class GuiSlotModList extends GuiSlot
@Override
protected int func_22245_b()
{
return this.func_22249_a() * 18;
return this.func_22249_a() * 3 * (this.parent.getFontRenderer().field_41063_b +1);
}
@Override
protected void func_22242_a(int listIndex, int var2, int var3, int var4, Tessellator var5)
{
this.parent.func_548_a(this.parent.getFontRenderer(), Loader.getModList().get(listIndex).getName(), this.parent.field_951_c / 2, var3 + 1, 16777215);
ModContainer mc=Loader.getModList().get(listIndex);
ModMetadata meta=mc.getMetadata();
if (meta!=null) {
this.parent.func_548_a(this.parent.getFontRenderer(), meta.name, this.parent.field_951_c / 2, var3 + 1, 16777215);
this.parent.func_548_a(this.parent.getFontRenderer(), meta.description, this.parent.field_951_c / 2, var3 + this.parent.getFontRenderer().field_41063_b +1, 16777215);
this.parent.func_548_a(this.parent.getFontRenderer(), mc.getName(), this.parent.field_951_c / 2, var3 + this.parent.getFontRenderer().field_41063_b *2 +2, 16777215);
} else {
this.parent.func_548_a(this.parent.getFontRenderer(), mc.getName(), this.parent.field_951_c / 2, var3 + 1, 16777215);
this.parent.func_548_a(this.parent.getFontRenderer(), "Mod information not found", this.parent.field_951_c / 2, var3 + 1, 16777215);
}
}
}

View file

@ -451,7 +451,7 @@ public class FMLCommonHandler
try
{
ZipFile jar = new ZipFile(mod.getSource());
ZipEntry infoFile=jar.getEntry("/modinfo.json");
ZipEntry infoFile=jar.getEntry("/mcmod.info");
if (infoFile!=null) {
InputStream input=jar.getInputStream(infoFile);
ModMetadata data=sidedDelegate.readMetadataFrom(input, mod);
@ -463,7 +463,18 @@ public class FMLCommonHandler
// Something wrong but we don't care
}
} else {
getFMLLogger().fine(String.format("Unable to load metadata for mod %s as it is not a jar/zip packaged file",mod.getName()));
try
{
InputStream input=FMLCommonHandler.class.getClassLoader().getResourceAsStream("/"+mod.getName()+".info");
if (input!=null) {
ModMetadata data=sidedDelegate.readMetadataFrom(input, mod);
mod.setMetadata(data);
}
}
catch (Exception e)
{
// Something wrong but we don't care
}
}
}

View file

@ -398,7 +398,7 @@ public class ModLoaderModContainer implements ModContainer
for (ModContainer mc : Loader.getModList())
{
if (mc instanceof ModLoaderModContainer && mc.getModState().ordinal()>ModState.LOADED.ordinal())
if (mc instanceof ModLoaderModContainer && mc.getMod()!=null)
{
modList.add(((ModLoaderModContainer)mc).mod);
}