Starting work on the actual GUI. Still work to do. Needs an API.

This commit is contained in:
Christian committed 2014-01-01 00:57:24 -05:00
1 parent b3f98d1ee0
commit cdd9d92a4f
7 files changed
+158 -5

No files matched your search

@@ -20,6 +20,7 @@ import java.util.Map.Entry;
import java.util.logging.Logger;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.GuiIngameMenu;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSelectWorld;
import net.minecraft.client.multiplayer.WorldClient;
@@ -508,4 +509,9 @@ public class FMLClientHandler implements IFMLSidedHandler
{
selectWorldGUI.func_146615_e(selectedIndex);
}
public void showInGameModOptions(GuiIngameMenu guiIngameMenu)
{
showGuiScreen(new GuiIngameModOptions(guiIngameMenu));
}
}
@@ -0,0 +1,55 @@
package cpw.mods.fml.client;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
public class GuiIngameModOptions extends GuiScreen
{
private final GuiScreen parentScreen;
protected String title = "Mod Options";
private GuiModOptionList optionList;
public GuiIngameModOptions(GuiScreen parentScreen)
{
this.parentScreen = parentScreen;
}
@SuppressWarnings("unchecked")
@Override
public void func_73866_w_()
{
this.optionList=new GuiModOptionList(this);
this.optionList.registerScrollButtons(this.field_146292_n, 7, 8);
this.field_146292_n.add(new GuiButton(200, this.field_146294_l / 2 - 100, this.field_146295_m / 6 + 168, I18n.func_135052_a("gui.done", new Object[0])));
}
@Override
protected void func_146284_a(GuiButton p_146284_1_)
{
if (p_146284_1_.field_146124_l)
{
if (p_146284_1_.field_146127_k == 200)
{
this.field_146297_k.field_71474_y.func_74303_b();
this.field_146297_k.func_147108_a(this.parentScreen);
}
}
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
// force a non-transparent background
this.func_146278_c(1);
this.optionList.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
this.func_73732_a(this.field_146289_q, this.title, this.field_146294_l / 2, 15, 0xFFFFFF);
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
}
FontRenderer getFontRenderer() {
return field_146289_q;
}
}
@@ -39,6 +39,7 @@ import com.google.common.base.Strings;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.ModContainer.Disableable;
/**
* @author cpw
@@ -202,6 +203,25 @@ public class GuiModList extends GuiScreen
{
this.getFontRenderer().func_78279_b(selectedMod.getMetadata().description, offset, shifty + 10, rightSide, 0xDDDDDD);
}
Disableable disableable = selectedMod.canBeDisabled();
if (disableable == Disableable.RESTART)
{
disableModButton.field_146124_l = true;
disableModButton.field_146125_m = true;
disableModButton.packedFGColour = 0xFF3377;
}
else if (disableable == Disableable.YES)
{
disableModButton.field_146124_l = true;
disableModButton.field_146125_m = true;
disableModButton.packedFGColour = 0;
}
else
{
disableModButton.packedFGColour = 0;
disableModButton.field_146125_m = true;
disableModButton.field_146124_l = false;
}
} else {
offset = ( this.listWidth + this.field_146294_l ) / 2;
this.func_73732_a(this.field_146289_q, selectedMod.getName(), offset, 35, 0xFFFFFF);
@@ -0,0 +1,47 @@
package cpw.mods.fml.client;
import net.minecraft.client.renderer.Tessellator;
public class GuiModOptionList extends GuiScrollingList {
private GuiIngameModOptions parent;
public GuiModOptionList(GuiIngameModOptions parent)
{
super(parent.field_146297_k, 150, parent.field_146295_m, 32, parent.field_146295_m - 65 + 4, 10, 35);
this.parent = parent;
}
@Override
protected int getSize()
{
return 1;
}
@Override
protected void elementClicked(int index, boolean doubleClick)
{
// TODO Auto-generated method stub
}
@Override
protected boolean isSelected(int index)
{
return false;
}
@Override
protected void drawBackground()
{
}
@Override
protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5)
{
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a("Test 1", listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a("TEST 2", listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
}
}
@@ -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
*/
@@ -23,4 +23,10 @@ public class MCPDummyContainer extends DummyModContainer {
public boolean registerBus(EventBus bus, LoadController controller) {
return true;
}
@Override
public Disableable canBeDisabled()
{
return Disableable.YES;
}
}