diff --git a/client/cpw/mods/fml/client/GuiModList.java b/client/cpw/mods/fml/client/GuiModList.java new file mode 100644 index 0000000000..060e76fee1 --- /dev/null +++ b/client/cpw/mods/fml/client/GuiModList.java @@ -0,0 +1,77 @@ +/* + * 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 net.minecraft.client.Minecraft; +import net.minecraft.src.FontRenderer; +import net.minecraft.src.GuiButton; +import net.minecraft.src.GuiScreen; +import net.minecraft.src.GuiSmallButton; +import net.minecraft.src.StringTranslate; + +/** + * @author cpw + * + */ +public class GuiModList extends GuiScreen +{ + + private GuiScreen mainMenu; + private GuiSlotModList modList; + + /** + * @param guiMainMenu + */ + public GuiModList(GuiScreen mainMenu) + { + this.mainMenu=mainMenu; + } + + public void func_6448_a() + { + StringTranslate translations = StringTranslate.func_20162_a(); + this.field_949_e.add(new GuiSmallButton(6, this.field_951_c / 2 - 75, this.field_950_d - 38, translations.func_20163_a("gui.done"))); + this.modList=new GuiSlotModList(this); + this.modList.func_22240_a(this.field_949_e, 7, 8); + } + + protected void func_572_a(GuiButton button) { + if (button.field_937_g) + { + switch (button.field_938_f) + { + case 6: + this.field_945_b.func_6272_a(this.mainMenu); + + } + } + + } + + public void func_571_a(int p_571_1_, int p_571_2_, float p_571_3_) + { + this.modList.func_22243_a(p_571_1_, p_571_2_, p_571_3_); + this.func_548_a(this.field_6451_g, "Mod List", this.field_951_c / 2, 16, 16777215); + super.func_571_a(p_571_1_, p_571_2_, p_571_3_); + } + + Minecraft getMinecraftInstance() { + return field_945_b; + } + + FontRenderer getFontRenderer() { + return field_6451_g; + } +} diff --git a/client/cpw/mods/fml/client/GuiSlotModList.java b/client/cpw/mods/fml/client/GuiSlotModList.java new file mode 100644 index 0000000000..c7dbd5042e --- /dev/null +++ b/client/cpw/mods/fml/client/GuiSlotModList.java @@ -0,0 +1,75 @@ +/* + * 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 cpw.mods.fml.common.Loader; +import net.minecraft.client.Minecraft; +import net.minecraft.src.GuiLanguage; +import net.minecraft.src.GuiSlot; +import net.minecraft.src.StringTranslate; +import net.minecraft.src.Tessellator; + +/** + * @author cpw + * + */ +public class GuiSlotModList extends GuiSlot +{ + private GuiModList parent; + + public GuiSlotModList(GuiModList parent) + { + super(parent.getMinecraftInstance(), parent.field_951_c, parent.field_950_d, 32, parent.field_950_d - 65 + 4, 18); + this.parent=parent; + } + + @Override + protected int func_22249_a() + { + return Loader.getModList().size(); + } + + @Override + protected void func_22247_a(int var1, boolean var2) + { + // TODO Auto-generated method stub + + } + + @Override + protected boolean func_22246_a(int var1) + { + return false; + } + + @Override + protected void func_22248_c() + { + this.parent.func_578_i(); + } + + @Override + protected int func_22245_b() + { + return this.func_22249_a() * 18; + } + + @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); + } + +} diff --git a/common/cpw/mods/fml/common/FMLCommonHandler.java b/common/cpw/mods/fml/common/FMLCommonHandler.java index cd2eac444b..df0855d956 100644 --- a/common/cpw/mods/fml/common/FMLCommonHandler.java +++ b/common/cpw/mods/fml/common/FMLCommonHandler.java @@ -16,6 +16,8 @@ package cpw.mods.fml.common; import java.io.File; import java.io.UnsupportedEncodingException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -403,4 +405,30 @@ public class FMLCommonHandler throw new RuntimeException(exception); } + /** + * @param string + * @return + */ + public String[] getBrandingStrings(String mcVersion) + { + ArrayList brandings=new ArrayList(); + brandings.add(mcVersion); + brandings.add(Loader.instance().getFMLVersionString()); + try { + brandings.add((String)Class.forName("forge.MinecraftForge").getMethod("getVersionString").invoke(null)); + } catch (Exception ex) { + // Ignore- forge isn't loaded + } + try { + Properties props=new Properties(); + props.load(FMLCommonHandler.class.getClassLoader().getResourceAsStream("fmlbranding.properties")); + brandings.add(props.getProperty("fmlbranding")); + } catch (Exception ex) { + // Ignore - no branding file found + } + brandings.add(String.format("%d mod%s loaded",Loader.getModList().size(), Loader.getModList().size()>1?"s":"")); + Collections.reverse(brandings); + return brandings.toArray(new String[brandings.size()]); + } + } diff --git a/common/cpw/mods/fml/common/Loader.java b/common/cpw/mods/fml/common/Loader.java index 89f222c644..3a4a5f5db5 100644 --- a/common/cpw/mods/fml/common/Loader.java +++ b/common/cpw/mods/fml/common/Loader.java @@ -614,4 +614,12 @@ public class Loader } return ret.toString(); } + + /** + * @return + */ + public String getFMLVersionString() + { + return String.format("FML v%s.%s.%s.%s", major, minor, rev, build); + } } diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/FML-Client.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/FML-Client.launch index 86f3ae860a..32a6901308 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/FML-Client.launch +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/FML-Client.launch @@ -1,13 +1,13 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/eclipse/FML-Client/.project b/eclipse/FML-Client/.project index 0b1c80f225..04aedf6df0 100644 --- a/eclipse/FML-Client/.project +++ b/eclipse/FML-Client/.project @@ -1,74 +1,79 @@ - - - FML-Client - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - - - client - 2 - MCP_LOC/FML/client - - - common - 2 - MCP_LOC/FML/common - - - jars - 2 - MCP_LOC/jars - - - src - 2 - MCP_LOC/src-work/minecraft - - - - - 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 - - - + + + FML-Client + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + client + 2 + MCP_LOC/FML/client + + + common + 2 + MCP_LOC/FML/common + + + jars + 2 + MCP_LOC/jars + + + src + 2 + MCP_LOC/src-work/minecraft + + + common/fmlversion.properties + 1 + /home/cpw/projects/mcworkspace/fmltestbed/FML/fmlversion.properties + + + + + 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/patches/minecraft/net/minecraft/src/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/src/GuiMainMenu.java.patch new file mode 100644 index 0000000000..a32efb8a6b --- /dev/null +++ b/patches/minecraft/net/minecraft/src/GuiMainMenu.java.patch @@ -0,0 +1,46 @@ +--- ../src-base/minecraft/net/minecraft/src/GuiMainMenu.java 0000-00-00 00:00:00.000000000 -0000 ++++ ../src-work/minecraft/net/minecraft/src/GuiMainMenu.java 0000-00-00 00:00:00.000000000 -0000 +@@ -11,6 +11,9 @@ + import org.lwjgl.opengl.GL11; + import org.lwjgl.util.glu.GLU; + ++import cpw.mods.fml.client.GuiModList; ++import cpw.mods.fml.common.FMLCommonHandler; ++ + public class GuiMainMenu extends GuiScreen + { + private static final Random field_6463_h = new Random(); +@@ -91,7 +94,8 @@ + int var4 = this.field_950_d / 4 + 48; + this.field_949_e.add(new GuiButton(1, this.field_951_c / 2 - 100, var4, var2.func_20163_a("menu.singleplayer"))); + this.field_949_e.add(this.field_25096_l = new GuiButton(2, this.field_951_c / 2 - 100, var4 + 24, var2.func_20163_a("menu.multiplayer"))); +- this.field_949_e.add(new GuiButton(3, this.field_951_c / 2 - 100, var4 + 48, var2.func_20163_a("menu.mods"))); ++ this.field_949_e.add(new GuiButton(3, this.field_951_c / 2 - 100, var4 + 48, 98, 20, var2.func_20163_a("menu.mods"))); ++ this.field_949_e.add(new GuiButton(6, this.field_951_c / 2 + 2, var4 + 48, 98, 20, "Mods")); + + if (this.field_945_b.field_6317_l) + { +@@ -142,6 +146,11 @@ + { + this.field_945_b.func_6244_d(); + } ++ ++ if (p_572_1_.field_938_f == 6) ++ { ++ this.field_945_b.func_6272_a(new GuiModList(this)); ++ } + } + + private void func_35355_b(int p_35355_1_, int p_35355_2_, float p_35355_3_) +@@ -324,7 +333,10 @@ + GL11.glScalef(var8, var8, var8); + this.func_548_a(this.field_6451_g, this.field_6462_l, 0, -8, 16776960); + GL11.glPopMatrix(); +- this.func_547_b(this.field_6451_g, "Minecraft 1.2.5", 2, this.field_950_d - 10, 16777215); ++ String[] brandings=FMLCommonHandler.instance().getBrandingStrings("Minecraft 1.2.5"); ++ for (int i=0; i