Files
MinecraftForge/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch
T
LexManos 125b134d87 Updated FML:
MinecraftForge/FML@155e846818 Add in support for mods/<mcversion> as a mod location. Also drop coremods as a location. They go in mods too now.
MinecraftForge/FML@3f4bf61ae6 Update key
MinecraftForge/FML@4545beb49d Add deobf-data to setup env.
MinecraftForge/FML@e24f949517 Fix eclipse workspaces and launch configurations.
MinecraftForge/FML@532bee7ce1 Update to new MCP bugfix version, Fixes: Missing Armor/Item rendering, and Boss health mapping issues.
2013-07-03 18:54:47 -07:00

115 lines
3.9 KiB
Diff

--- ../src_base/minecraft/net/minecraft/client/gui/GuiControls.java
+++ ../src_work/minecraft/net/minecraft/client/gui/GuiControls.java
@@ -6,6 +6,8 @@
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.util.EnumChatFormatting;
+
+import net.minecraftforge.client.GuiControlsScrollPanel;
@SideOnly(Side.CLIENT)
public class GuiControls extends GuiScreen
@@ -23,6 +25,8 @@
/** The ID of the button that has been pressed. */
private int buttonId = -1;
+
+ private GuiControlsScrollPanel scrollPane;
public GuiControls(GuiScreen par1GuiScreen, GameSettings par2GameSettings)
{
@@ -43,14 +47,9 @@
*/
public void initGui()
{
- int i = this.getLeftBorder();
-
- for (int j = 0; j < this.options.keyBindings.length; ++j)
- {
- this.buttonList.add(new GuiSmallButton(j, i + j % 2 * 160, this.height / 6 + 24 * (j >> 1), 70, 20, this.options.getOptionDisplayString(j)));
- }
-
- this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.func_135053_a("gui.done")));
+ scrollPane = new GuiControlsScrollPanel(this, options, mc);
+ this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, I18n.func_135053_a("gui.done")));
+ scrollPane.registerScrollButtons(7, 8);
this.screenTitle = I18n.func_135053_a("controls.title");
}
@@ -58,20 +57,10 @@
* Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
*/
protected void actionPerformed(GuiButton par1GuiButton)
- {
- for (int i = 0; i < this.options.keyBindings.length; ++i)
- {
- ((GuiButton)this.buttonList.get(i)).displayString = this.options.getOptionDisplayString(i);
- }
-
+ {
if (par1GuiButton.id == 200)
{
this.mc.displayGuiScreen(this.parentScreen);
- }
- else
- {
- this.buttonId = par1GuiButton.id;
- par1GuiButton.displayString = "> " + this.options.getOptionDisplayString(par1GuiButton.id) + " <";
}
}
@@ -80,17 +69,7 @@
*/
protected void mouseClicked(int par1, int par2, int par3)
{
- if (this.buttonId >= 0)
- {
- this.options.setKeyBinding(this.buttonId, -100 + par3);
- ((GuiButton)this.buttonList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId);
- this.buttonId = -1;
- KeyBinding.resetKeyBindingArrayAndHash();
- }
- else
- {
- super.mouseClicked(par1, par2, par3);
- }
+ super.mouseClicked(par1, par2, par3);
}
/**
@@ -98,14 +77,7 @@
*/
protected void keyTyped(char par1, int par2)
{
- if (this.buttonId >= 0)
- {
- this.options.setKeyBinding(this.buttonId, par2);
- ((GuiButton)this.buttonList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId);
- this.buttonId = -1;
- KeyBinding.resetKeyBindingArrayAndHash();
- }
- else
+ if (scrollPane.keyTyped(par1, par2))
{
super.keyTyped(par1, par2);
}
@@ -117,6 +89,7 @@
public void drawScreen(int par1, int par2, float par3)
{
this.drawDefaultBackground();
+ /* Forge Start: Moved all rendering to GuiControlsScrollPanel
this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215);
int k = this.getLeftBorder();
int l = 0;
@@ -157,6 +130,10 @@
break;
}
}
+ */
+ scrollPane.drawScreen(par1, par2, par3);
+ drawCenteredString(fontRenderer, screenTitle, width / 2, 4, 0xffffff);
+ //Forge End
super.drawScreen(par1, par2, par3);
}