mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
More tweaks to stuff: mod list, branding, more hooks
This commit is contained in:
1 parent
b1ee6c3c95
commit
7ec180ee7c
7 files changed
+326
-87
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<String> brandings=new ArrayList<String>();
|
||||
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()]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/FML-Client/src/Start.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="Start"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="FML-Client"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xincgc -Xmx1024M -Xms1024M"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:FML-Client/jars}"/>
|
||||
</launchConfiguration>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/FML-Client/src/Start.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="Start"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="FML-Client"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xincgc -Xmx1024M -Xms1024M"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:FML-Client/jars}"/>
|
||||
</launchConfiguration>
|
||||
+79
-74
@@ -1,74 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>FML-Client</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>client</name>
|
||||
<type>2</type>
|
||||
<locationURI>MCP_LOC/FML/client</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>common</name>
|
||||
<type>2</type>
|
||||
<locationURI>MCP_LOC/FML/common</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>jars</name>
|
||||
<type>2</type>
|
||||
<locationURI>MCP_LOC/jars</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>src</name>
|
||||
<type>2</type>
|
||||
<locationURI>MCP_LOC/src-work/minecraft</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>jars</name>
|
||||
<type>13</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-bin</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1307293504507</id>
|
||||
<name>jars/bin</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*.jar</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1307293480435</id>
|
||||
<name>jars/bin/natives</name>
|
||||
<type>6</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
<variableList>
|
||||
<variable>
|
||||
<name>MCP_LOC</name>
|
||||
<value>$%7BPARENT-2-WORKSPACE_LOC%7D</value>
|
||||
</variable>
|
||||
</variableList>
|
||||
</projectDescription>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>FML-Client</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>client</name>
|
||||
<type>2</type>
|
||||
<locationURI>MCP_LOC/FML/client</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>common</name>
|
||||
<type>2</type>
|
||||
<locationURI>MCP_LOC/FML/common</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>jars</name>
|
||||
<type>2</type>
|
||||
<locationURI>MCP_LOC/jars</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>src</name>
|
||||
<type>2</type>
|
||||
<locationURI>MCP_LOC/src-work/minecraft</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>common/fmlversion.properties</name>
|
||||
<type>1</type>
|
||||
<location>/home/cpw/projects/mcworkspace/fmltestbed/FML/fmlversion.properties</location>
|
||||
</link>
|
||||
</linkedResources>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>jars</name>
|
||||
<type>13</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-bin</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1307293504507</id>
|
||||
<name>jars/bin</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*.jar</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1307293480435</id>
|
||||
<name>jars/bin/natives</name>
|
||||
<type>6</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
<variableList>
|
||||
<variable>
|
||||
<name>MCP_LOC</name>
|
||||
<value>$%7BPARENT-2-WORKSPACE_LOC%7D</value>
|
||||
</variable>
|
||||
</variableList>
|
||||
</projectDescription>
|
||||
@@ -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<brandings.length; i++) {
|
||||
+ this.func_547_b(this.field_6451_g, brandings[i], 2, this.field_950_d - ( 10 + i * (this.field_6451_g.field_41063_b +1)), 16777215);
|
||||
+ }
|
||||
String var9 = "Copyright Mojang AB. Do not distribute!";
|
||||
this.func_547_b(this.field_6451_g, var9, this.field_951_c - this.field_6451_g.func_871_a(var9) - 2, this.field_950_d - 10, 16777215);
|
||||
super.func_571_a(p_571_1_, p_571_2_, p_571_3_);
|
||||
Reference in new issue
Block a user