Add modifier support to vanilla keybindings.
Add Orange conflict color for modifier/key conflicts (like Ctrl and Ctrl-Z conflicting) Related to #2692
This commit is contained in:
parent
2ae47c0903
commit
8f49ea7c5f
12 changed files with 249 additions and 81 deletions
|
@ -21,6 +21,15 @@
|
||||||
this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az);
|
this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az);
|
||||||
this.field_71469_aa = new AnvilSaveConverter(new File(this.field_71412_D, "saves"), this.field_184131_U);
|
this.field_71469_aa = new AnvilSaveConverter(new File(this.field_71412_D, "saves"), this.field_184131_U);
|
||||||
this.field_147127_av = new SoundHandler(this.field_110451_am, this.field_71474_y);
|
this.field_147127_av = new SoundHandler(this.field_110451_am, this.field_71474_y);
|
||||||
|
@@ -460,7 +459,7 @@
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
- return String.format(p_74535_1_, new Object[] {GameSettings.func_74298_c(Minecraft.this.field_71474_y.field_151445_Q.func_151463_i())});
|
||||||
|
+ return String.format(p_74535_1_, new Object[] {Minecraft.this.field_71474_y.field_151445_Q.getDisplayName()});
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
@@ -469,6 +468,8 @@
|
@@ -469,6 +468,8 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -474,7 +483,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean func_70002_Q()
|
public boolean func_70002_Q()
|
||||||
@@ -3066,6 +2958,7 @@
|
@@ -3057,15 +2949,16 @@
|
||||||
|
{
|
||||||
|
if (Keyboard.getEventKeyState())
|
||||||
|
{
|
||||||
|
- if (i == this.field_71474_y.field_152395_am.func_151463_i())
|
||||||
|
+ if (this.field_71474_y.field_152395_am.isActiveAndMatches(i))
|
||||||
|
{
|
||||||
|
this.func_71352_k();
|
||||||
|
}
|
||||||
|
- else if (i == this.field_71474_y.field_151447_Z.func_151463_i())
|
||||||
|
+ else if (this.field_71474_y.field_151447_Z.isActiveAndMatches(i))
|
||||||
|
{
|
||||||
this.field_71456_v.func_146158_b().func_146227_a(ScreenShotHelper.func_148260_a(this.field_71412_D, this.field_71443_c, this.field_71440_d, this.field_147124_at));
|
this.field_71456_v.func_146158_b().func_146227_a(ScreenShotHelper.func_148260_a(this.field_71412_D, this.field_71443_c, this.field_71440_d, this.field_147124_at));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,37 @@
|
||||||
--- ../src-base/minecraft/net/minecraft/client/gui/GuiControls.java
|
--- ../src-base/minecraft/net/minecraft/client/gui/GuiControls.java
|
||||||
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiControls.java
|
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiControls.java
|
||||||
@@ -66,6 +66,7 @@
|
@@ -65,7 +65,7 @@
|
||||||
|
{
|
||||||
for (KeyBinding keybinding : this.field_146297_k.field_71474_y.field_74324_K)
|
for (KeyBinding keybinding : this.field_146297_k.field_71474_y.field_74324_K)
|
||||||
{
|
{
|
||||||
keybinding.func_151462_b(keybinding.func_151469_h());
|
- keybinding.func_151462_b(keybinding.func_151469_h());
|
||||||
+ keybinding.setKeyModifier(keybinding.getKeyModifierDefault());
|
+ keybinding.setToDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyBinding.func_74508_b();
|
KeyBinding.func_74508_b();
|
||||||
@@ -81,6 +82,7 @@
|
@@ -81,6 +81,7 @@
|
||||||
{
|
{
|
||||||
if (this.field_146491_f != null)
|
if (this.field_146491_f != null)
|
||||||
{
|
{
|
||||||
+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.getActiveModifier());
|
+ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), -100 + p_73864_3_);
|
||||||
this.field_146497_i.func_151440_a(this.field_146491_f, -100 + p_73864_3_);
|
this.field_146497_i.func_151440_a(this.field_146491_f, -100 + p_73864_3_);
|
||||||
this.field_146491_f = null;
|
this.field_146491_f = null;
|
||||||
KeyBinding.func_74508_b();
|
KeyBinding.func_74508_b();
|
||||||
@@ -105,17 +107,21 @@
|
@@ -105,17 +106,21 @@
|
||||||
{
|
{
|
||||||
if (p_73869_2_ == 1)
|
if (p_73869_2_ == 1)
|
||||||
{
|
{
|
||||||
+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.NONE);
|
+ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, 0);
|
||||||
this.field_146497_i.func_151440_a(this.field_146491_f, 0);
|
this.field_146497_i.func_151440_a(this.field_146491_f, 0);
|
||||||
}
|
}
|
||||||
else if (p_73869_2_ != 0)
|
else if (p_73869_2_ != 0)
|
||||||
{
|
{
|
||||||
+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_) ? net.minecraftforge.client.settings.KeyModifier.NONE : net.minecraftforge.client.settings.KeyModifier.getActiveModifier());
|
+ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), p_73869_2_);
|
||||||
this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_2_);
|
this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_2_);
|
||||||
}
|
}
|
||||||
else if (p_73869_1_ > 0)
|
else if (p_73869_1_ > 0)
|
||||||
{
|
{
|
||||||
+ this.field_146491_f.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(p_73869_2_) ? net.minecraftforge.client.settings.KeyModifier.NONE : net.minecraftforge.client.settings.KeyModifier.getActiveModifier());
|
+ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), p_73869_1_ + 256);
|
||||||
this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_1_ + 256);
|
this.field_146497_i.func_151440_a(this.field_146491_f, p_73869_1_ + 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,12 +39,12 @@
|
||||||
this.field_146491_f = null;
|
this.field_146491_f = null;
|
||||||
this.field_152177_g = Minecraft.func_71386_F();
|
this.field_152177_g = Minecraft.func_71386_F();
|
||||||
KeyBinding.func_74508_b();
|
KeyBinding.func_74508_b();
|
||||||
@@ -135,7 +141,7 @@
|
@@ -135,7 +140,7 @@
|
||||||
|
|
||||||
for (KeyBinding keybinding : this.field_146497_i.field_74324_K)
|
for (KeyBinding keybinding : this.field_146497_i.field_74324_K)
|
||||||
{
|
{
|
||||||
- if (keybinding.func_151463_i() != keybinding.func_151469_h())
|
- if (keybinding.func_151463_i() != keybinding.func_151469_h())
|
||||||
+ if (keybinding.func_151463_i() != keybinding.func_151469_h() || keybinding.getKeyModifier() != keybinding.getKeyModifierDefault())
|
+ if (!keybinding.isSetToDefaultValue())
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
this.field_148281_e = new GuiButton(0, 0, 0, 50, 20, I18n.func_135052_a("controls.reset", new Object[0]));
|
this.field_148281_e = new GuiButton(0, 0, 0, 50, 20, I18n.func_135052_a("controls.reset", new Object[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,20 +121,20 @@
|
@@ -121,23 +121,24 @@
|
||||||
{
|
{
|
||||||
boolean flag = GuiKeyBindingList.this.field_148191_k.field_146491_f == this.field_148282_b;
|
boolean flag = GuiKeyBindingList.this.field_148191_k.field_146491_f == this.field_148282_b;
|
||||||
GuiKeyBindingList.this.field_148189_l.field_71466_p.func_78276_b(this.field_148283_c, p_180790_2_ + 90 - GuiKeyBindingList.this.field_148188_n, p_180790_3_ + p_180790_5_ / 2 - GuiKeyBindingList.this.field_148189_l.field_71466_p.field_78288_b / 2, 16777215);
|
GuiKeyBindingList.this.field_148189_l.field_71466_p.func_78276_b(this.field_148283_c, p_180790_2_ + 90 - GuiKeyBindingList.this.field_148188_n, p_180790_3_ + p_180790_5_ / 2 - GuiKeyBindingList.this.field_148189_l.field_71466_p.field_78288_b / 2, 16777215);
|
||||||
|
@ -26,13 +26,14 @@
|
||||||
+ this.field_148281_e.field_146128_h = p_180790_2_ + 210;
|
+ this.field_148281_e.field_146128_h = p_180790_2_ + 210;
|
||||||
this.field_148281_e.field_146129_i = p_180790_3_;
|
this.field_148281_e.field_146129_i = p_180790_3_;
|
||||||
- this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h();
|
- this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h();
|
||||||
+ this.field_148281_e.field_146124_l = this.field_148282_b.func_151463_i() != this.field_148282_b.func_151469_h() || this.field_148282_b.getKeyModifier() != this.field_148282_b.getKeyModifierDefault();
|
+ this.field_148281_e.field_146124_l = !this.field_148282_b.isSetToDefaultValue();
|
||||||
this.field_148281_e.func_146112_a(GuiKeyBindingList.this.field_148189_l, p_180790_6_, p_180790_7_);
|
this.field_148281_e.func_146112_a(GuiKeyBindingList.this.field_148189_l, p_180790_6_, p_180790_7_);
|
||||||
this.field_148280_d.field_146128_h = p_180790_2_ + 105;
|
this.field_148280_d.field_146128_h = p_180790_2_ + 105;
|
||||||
this.field_148280_d.field_146129_i = p_180790_3_;
|
this.field_148280_d.field_146129_i = p_180790_3_;
|
||||||
- this.field_148280_d.field_146126_j = GameSettings.func_74298_c(this.field_148282_b.func_151463_i());
|
- this.field_148280_d.field_146126_j = GameSettings.func_74298_c(this.field_148282_b.func_151463_i());
|
||||||
+ this.field_148280_d.field_146126_j = this.field_148282_b.getKeyModifier().getLocalizedComboName(GameSettings.func_74298_c(this.field_148282_b.func_151463_i()));
|
+ this.field_148280_d.field_146126_j = this.field_148282_b.getDisplayName();
|
||||||
boolean flag1 = false;
|
boolean flag1 = false;
|
||||||
|
+ boolean keyCodeModifierConflict = true; // less severe form of conflict, like SHIFT conflicting with SHIFT+G
|
||||||
|
|
||||||
if (this.field_148282_b.func_151463_i() != 0)
|
if (this.field_148282_b.func_151463_i() != 0)
|
||||||
{
|
{
|
||||||
|
@ -42,12 +43,25 @@
|
||||||
+ if (keybinding != this.field_148282_b && keybinding.conflicts(this.field_148282_b))
|
+ if (keybinding != this.field_148282_b && keybinding.conflicts(this.field_148282_b))
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
break;
|
- break;
|
||||||
@@ -163,6 +163,7 @@
|
+ keyCodeModifierConflict &= keybinding.hasKeyCodeModifierConflict(this.field_148282_b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -148,7 +149,7 @@
|
||||||
|
}
|
||||||
|
else if (flag1)
|
||||||
|
{
|
||||||
|
- this.field_148280_d.field_146126_j = TextFormatting.RED + this.field_148280_d.field_146126_j;
|
||||||
|
+ this.field_148280_d.field_146126_j = (keyCodeModifierConflict ? TextFormatting.GOLD : TextFormatting.RED) + this.field_148280_d.field_146126_j;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field_148280_d.func_146112_a(GuiKeyBindingList.this.field_148189_l, p_180790_6_, p_180790_7_);
|
||||||
|
@@ -163,6 +164,7 @@
|
||||||
}
|
}
|
||||||
else if (this.field_148281_e.func_146116_c(GuiKeyBindingList.this.field_148189_l, p_148278_2_, p_148278_3_))
|
else if (this.field_148281_e.func_146116_c(GuiKeyBindingList.this.field_148189_l, p_148278_2_, p_148278_3_))
|
||||||
{
|
{
|
||||||
+ this.field_148282_b.setKeyModifier(this.field_148282_b.getKeyModifierDefault());
|
+ this.field_148282_b.setToDefault();
|
||||||
GuiKeyBindingList.this.field_148189_l.field_71474_y.func_151440_a(this.field_148282_b, this.field_148282_b.func_151469_h());
|
GuiKeyBindingList.this.field_148189_l.field_71474_y.func_151440_a(this.field_148282_b, this.field_148282_b.func_151469_h());
|
||||||
KeyBinding.func_74508_b();
|
KeyBinding.func_74508_b();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreenDemo.java
|
||||||
|
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreenDemo.java
|
||||||
|
@@ -73,10 +73,10 @@
|
||||||
|
this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.title", new Object[0]), i, j, 2039583);
|
||||||
|
j = j + 12;
|
||||||
|
GameSettings gamesettings = this.field_146297_k.field_71474_y;
|
||||||
|
- this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.movementShort", new Object[] {GameSettings.func_74298_c(gamesettings.field_74351_w.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74370_x.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74368_y.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74366_z.func_151463_i())}), i, j, 5197647);
|
||||||
|
+ this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.movementShort", new Object[] {gamesettings.field_74351_w.getDisplayName(), gamesettings.field_74370_x.getDisplayName(), gamesettings.field_74368_y.getDisplayName(), gamesettings.field_74366_z.getDisplayName()}), i, j, 5197647);
|
||||||
|
this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.movementMouse", new Object[0]), i, j + 12, 5197647);
|
||||||
|
- this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.jump", new Object[] {GameSettings.func_74298_c(gamesettings.field_74314_A.func_151463_i())}), i, j + 24, 5197647);
|
||||||
|
- this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.inventory", new Object[] {GameSettings.func_74298_c(gamesettings.field_151445_Q.func_151463_i())}), i, j + 36, 5197647);
|
||||||
|
+ this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.jump", new Object[] {gamesettings.field_74314_A.getDisplayName()}), i, j + 24, 5197647);
|
||||||
|
+ this.field_146289_q.func_78276_b(I18n.func_135052_a("demo.help.inventory", new Object[] {gamesettings.field_151445_Q.getDisplayName()}), i, j + 36, 5197647);
|
||||||
|
this.field_146289_q.func_78279_b(I18n.func_135052_a("demo.help.fullWrapped", new Object[0]), i, j + 68, 218, 2039583);
|
||||||
|
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSpectator.java
|
||||||
|
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSpectator.java
|
||||||
|
@@ -109,7 +109,7 @@
|
||||||
|
GlStateManager.func_179131_c(f, f, f, p_175266_4_);
|
||||||
|
p_175266_5_.func_178663_a(f, i);
|
||||||
|
GlStateManager.func_179121_F();
|
||||||
|
- String s = String.valueOf((Object)GameSettings.func_74298_c(this.field_175268_g.field_71474_y.field_151456_ac[p_175266_1_].func_151463_i()));
|
||||||
|
+ String s = String.valueOf(this.field_175268_g.field_71474_y.field_151456_ac[p_175266_1_].getDisplayName());
|
||||||
|
|
||||||
|
if (i > 3 && p_175266_5_.func_178662_A_())
|
||||||
|
{
|
|
@ -34,7 +34,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void func_146284_a(GuiButton p_146284_1_) throws IOException
|
protected void func_146284_a(GuiButton p_146284_1_) throws IOException
|
||||||
@@ -74,6 +87,16 @@
|
@@ -74,12 +87,22 @@
|
||||||
{
|
{
|
||||||
this.field_146297_k.func_147108_a(this.field_146562_a);
|
this.field_146297_k.func_147108_a(this.field_146562_a);
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException
|
||||||
|
{
|
||||||
|
- if (p_73869_2_ == this.field_146297_k.field_71474_y.field_151445_Q.func_151463_i())
|
||||||
|
+ if (this.field_146297_k.field_71474_y.field_151445_Q.isActiveAndMatches(p_73869_2_))
|
||||||
|
{
|
||||||
|
this.field_146297_k.func_147108_a((GuiScreen)null);
|
||||||
|
this.field_146297_k.func_71381_h();
|
||||||
@@ -257,7 +280,9 @@
|
@@ -257,7 +280,9 @@
|
||||||
GlStateManager.func_179143_c(518);
|
GlStateManager.func_179143_c(518);
|
||||||
GlStateManager.func_179094_E();
|
GlStateManager.func_179094_E();
|
||||||
|
|
|
@ -30,6 +30,15 @@
|
||||||
this.func_175175_a(i, j, textureatlassprite, 16, 16);
|
this.func_175175_a(i, j, textureatlassprite, 16, 16);
|
||||||
GlStateManager.func_179145_e();
|
GlStateManager.func_179145_e();
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
|
@@ -316,7 +318,7 @@
|
||||||
|
protected void func_73864_a(int p_73864_1_, int p_73864_2_, int p_73864_3_) throws IOException
|
||||||
|
{
|
||||||
|
super.func_73864_a(p_73864_1_, p_73864_2_, p_73864_3_);
|
||||||
|
- boolean flag = p_73864_3_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i() + 100;
|
||||||
|
+ boolean flag = this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ + 100);
|
||||||
|
Slot slot = this.func_146975_c(p_73864_1_, p_73864_2_);
|
||||||
|
long i = Minecraft.func_71386_F();
|
||||||
|
this.field_146993_M = this.field_146998_K == slot && i - this.field_146997_J < 250L && this.field_146992_L == p_73864_3_;
|
||||||
@@ -327,6 +329,7 @@
|
@@ -327,6 +329,7 @@
|
||||||
int j = this.field_147003_i;
|
int j = this.field_147003_i;
|
||||||
int k = this.field_147009_r;
|
int k = this.field_147009_r;
|
||||||
|
@ -38,6 +47,24 @@
|
||||||
int l = -1;
|
int l = -1;
|
||||||
|
|
||||||
if (slot != null)
|
if (slot != null)
|
||||||
|
@@ -364,7 +367,7 @@
|
||||||
|
{
|
||||||
|
if (this.field_146297_k.field_71439_g.field_71071_by.func_70445_o() == null)
|
||||||
|
{
|
||||||
|
- if (p_73864_3_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i() + 100)
|
||||||
|
+ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ + 100))
|
||||||
|
{
|
||||||
|
this.func_184098_a(slot, l, p_73864_3_, ClickType.CLONE);
|
||||||
|
}
|
||||||
|
@@ -402,7 +405,7 @@
|
||||||
|
{
|
||||||
|
this.field_146987_F = 1;
|
||||||
|
}
|
||||||
|
- else if (p_73864_3_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i() + 100)
|
||||||
|
+ else if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73864_3_ + 100))
|
||||||
|
{
|
||||||
|
this.field_146987_F = 2;
|
||||||
|
}
|
||||||
@@ -464,10 +467,12 @@
|
@@ -464,10 +467,12 @@
|
||||||
|
|
||||||
protected void func_146286_b(int p_146286_1_, int p_146286_2_, int p_146286_3_)
|
protected void func_146286_b(int p_146286_1_, int p_146286_2_, int p_146286_3_)
|
||||||
|
@ -51,6 +78,38 @@
|
||||||
int k = -1;
|
int k = -1;
|
||||||
|
|
||||||
if (slot != null)
|
if (slot != null)
|
||||||
|
@@ -627,7 +632,7 @@
|
||||||
|
|
||||||
|
protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException
|
||||||
|
{
|
||||||
|
- if (p_73869_2_ == 1 || p_73869_2_ == this.field_146297_k.field_71474_y.field_151445_Q.func_151463_i())
|
||||||
|
+ if (p_73869_2_ == 1 || this.field_146297_k.field_71474_y.field_151445_Q.isActiveAndMatches(p_73869_2_))
|
||||||
|
{
|
||||||
|
this.field_146297_k.field_71439_g.func_71053_j();
|
||||||
|
}
|
||||||
|
@@ -636,11 +641,11 @@
|
||||||
|
|
||||||
|
if (this.field_147006_u != null && this.field_147006_u.func_75216_d())
|
||||||
|
{
|
||||||
|
- if (p_73869_2_ == this.field_146297_k.field_71474_y.field_74322_I.func_151463_i())
|
||||||
|
+ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(p_73869_2_))
|
||||||
|
{
|
||||||
|
this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, 0, ClickType.CLONE);
|
||||||
|
}
|
||||||
|
- else if (p_73869_2_ == this.field_146297_k.field_71474_y.field_74316_C.func_151463_i())
|
||||||
|
+ else if (this.field_146297_k.field_71474_y.field_74316_C.isActiveAndMatches(p_73869_2_))
|
||||||
|
{
|
||||||
|
this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, func_146271_m() ? 1 : 0, ClickType.THROW);
|
||||||
|
}
|
||||||
|
@@ -653,7 +658,7 @@
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 9; ++i)
|
||||||
|
{
|
||||||
|
- if (p_146983_1_ == this.field_146297_k.field_71474_y.field_151456_ac[i].func_151463_i())
|
||||||
|
+ if (this.field_146297_k.field_71474_y.field_151456_ac[i].isActiveAndMatches(p_146983_1_))
|
||||||
|
{
|
||||||
|
this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, i, ClickType.SWAP);
|
||||||
|
return true;
|
||||||
@@ -686,4 +691,16 @@
|
@@ -686,4 +691,16 @@
|
||||||
this.field_146297_k.field_71439_g.func_71053_j();
|
this.field_146297_k.field_71439_g.func_71053_j();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,15 @@
|
||||||
EntityTracker.func_187254_a(entitylivingbase, d0, d1, d2);
|
EntityTracker.func_187254_a(entitylivingbase, d0, d1, d2);
|
||||||
entitylivingbase.field_70761_aq = entitylivingbase.field_70759_as = (float)(p_147281_1_.func_149032_n() * 360) / 256.0F;
|
entitylivingbase.field_70761_aq = entitylivingbase.field_70759_as = (float)(p_147281_1_.func_149032_n() * 360) / 256.0F;
|
||||||
Entity[] aentity = entitylivingbase.func_70021_al();
|
Entity[] aentity = entitylivingbase.func_70021_al();
|
||||||
|
@@ -919,7 +926,7 @@
|
||||||
|
|
||||||
|
if (entity1 == this.field_147299_f.field_71439_g && !flag)
|
||||||
|
{
|
||||||
|
- this.field_147299_f.field_71456_v.func_110326_a(I18n.func_135052_a("mount.onboard", new Object[] {GameSettings.func_74298_c(this.field_147299_f.field_71474_y.field_74311_E.func_151463_i())}), false);
|
||||||
|
+ this.field_147299_f.field_71456_v.func_110326_a(I18n.func_135052_a("mount.onboard", new Object[] {this.field_147299_f.field_71474_y.field_74311_E.getDisplayName()}), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1179,6 +1186,10 @@
|
@@ -1179,6 +1186,10 @@
|
||||||
{
|
{
|
||||||
tileentity.func_145839_a(p_147273_1_.func_148857_g());
|
tileentity.func_145839_a(p_147273_1_.func_148857_g());
|
||||||
|
@ -51,6 +60,25 @@
|
||||||
|
|
||||||
if (flag && this.field_147299_f.field_71462_r instanceof GuiCommandBlock)
|
if (flag && this.field_147299_f.field_71462_r instanceof GuiCommandBlock)
|
||||||
{
|
{
|
||||||
|
@@ -1276,15 +1287,15 @@
|
||||||
|
}
|
||||||
|
else if (f == 101.0F)
|
||||||
|
{
|
||||||
|
- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.movement", new Object[] {GameSettings.func_74298_c(gamesettings.field_74351_w.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74370_x.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74368_y.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74366_z.func_151463_i())}));
|
||||||
|
+ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.movement", new Object[] {gamesettings.field_74351_w.getDisplayName(), gamesettings.field_74370_x.getDisplayName(), gamesettings.field_74368_y.getDisplayName(), gamesettings.field_74366_z.getDisplayName()}));
|
||||||
|
}
|
||||||
|
else if (f == 102.0F)
|
||||||
|
{
|
||||||
|
- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.jump", new Object[] {GameSettings.func_74298_c(gamesettings.field_74314_A.func_151463_i())}));
|
||||||
|
+ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.jump", new Object[] {gamesettings.field_74314_A.getDisplayName()}));
|
||||||
|
}
|
||||||
|
else if (f == 103.0F)
|
||||||
|
{
|
||||||
|
- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.inventory", new Object[] {GameSettings.func_74298_c(gamesettings.field_151445_Q.func_151463_i())}));
|
||||||
|
+ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.inventory", new Object[] {gamesettings.field_151445_Q.getDisplayName()}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (i == 6)
|
||||||
@@ -1378,7 +1389,7 @@
|
@@ -1378,7 +1389,7 @@
|
||||||
|
|
||||||
if (entity instanceof EntityLivingBase)
|
if (entity instanceof EntityLivingBase)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
if (astring[0].equals("key_" + keybinding.func_151464_g()))
|
if (astring[0].equals("key_" + keybinding.func_151464_g()))
|
||||||
{
|
{
|
||||||
keybinding.func_151462_b(Integer.parseInt(astring[1]));
|
keybinding.func_151462_b(Integer.parseInt(astring[1]));
|
||||||
+ if (astring.length == 3) keybinding.setKeyModifier(net.minecraftforge.client.settings.KeyModifier.valueOf(astring[2]));
|
+ if (astring.length == 3) keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueOf(astring[2]), Integer.parseInt(astring[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public String func_151466_e()
|
public String func_151466_e()
|
||||||
@@ -158,4 +158,102 @@
|
@@ -158,4 +158,130 @@
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,6 @@
|
||||||
+ private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE;
|
+ private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||||
+ private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
+ private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||||
+ private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL;
|
+ private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL;
|
||||||
+ private boolean allowsKeyModifiers = false;
|
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
|
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
|
||||||
|
@ -88,24 +87,16 @@
|
||||||
+ this.keyConflictContext = keyConflictContext;
|
+ this.keyConflictContext = keyConflictContext;
|
||||||
+ this.keyModifier = keyModifier;
|
+ this.keyModifier = keyModifier;
|
||||||
+ this.keyModifierDefault = keyModifier;
|
+ this.keyModifierDefault = keyModifier;
|
||||||
+ if (keyModifier != net.minecraftforge.client.settings.KeyModifier.NONE)
|
+ if (this.keyModifier.matches(keyCode))
|
||||||
+ setAllowsKeyModifiers();
|
+ {
|
||||||
|
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||||
|
+ }
|
||||||
+ field_74516_a.add(this);
|
+ field_74516_a.add(this);
|
||||||
+ field_74514_b.addKey(keyCode, this);
|
+ field_74514_b.addKey(keyCode, this);
|
||||||
+ field_151473_c.add(category);
|
+ field_151473_c.add(category);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Call this method to let Forge know that your KeyBinding and code can handle players setting modifiers.
|
|
||||||
+ * Handling modifiers is made easy by using {@link KeyBinding#isActiveAndMatches(int)} or {@link KeyBinding#isPressed()}
|
|
||||||
+ * Vanilla code does not handle modifiers, so vanilla keyBinds do not have this set.
|
|
||||||
+ */
|
|
||||||
+ public void setAllowsKeyModifiers()
|
|
||||||
+ {
|
|
||||||
+ this.allowsKeyModifiers = true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
+ * Checks that the key conflict context and modifier are active, and that the keyCode matches this binding.
|
+ * Checks that the key conflict context and modifier are active, and that the keyCode matches this binding.
|
||||||
+ */
|
+ */
|
||||||
+ public boolean isActiveAndMatches(int keyCode)
|
+ public boolean isActiveAndMatches(int keyCode)
|
||||||
|
@ -130,33 +121,70 @@
|
||||||
+
|
+
|
||||||
+ public net.minecraftforge.client.settings.KeyModifier getKeyModifier()
|
+ public net.minecraftforge.client.settings.KeyModifier getKeyModifier()
|
||||||
+ {
|
+ {
|
||||||
+ if (allowsKeyModifiers)
|
+ return keyModifier;
|
||||||
+ {
|
|
||||||
+ return keyModifier;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ return net.minecraftforge.client.settings.KeyModifier.NOT_SUPPORTED;
|
|
||||||
+ }
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void setKeyModifier(net.minecraftforge.client.settings.KeyModifier keyModifier)
|
+ public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, int keyCode)
|
||||||
+ {
|
+ {
|
||||||
|
+ this.field_74512_d = keyCode;
|
||||||
|
+ if (keyModifier.matches(keyCode))
|
||||||
|
+ {
|
||||||
|
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||||
|
+ }
|
||||||
+ field_74514_b.removeKey(this);
|
+ field_74514_b.removeKey(this);
|
||||||
+ this.keyModifier = keyModifier;
|
+ this.keyModifier = keyModifier;
|
||||||
+ field_74514_b.addKey(field_74512_d, this);
|
+ field_74514_b.addKey(keyCode, this);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ public void setToDefault()
|
||||||
|
+ {
|
||||||
|
+ setKeyModifierAndCode(getKeyModifierDefault(), func_151469_h());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isSetToDefaultValue()
|
||||||
|
+ {
|
||||||
|
+ return func_151463_i() == func_151469_h() && getKeyModifier() == getKeyModifierDefault();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Returns true when the other keyBinding conflicts with this one
|
||||||
|
+ */
|
||||||
+ public boolean conflicts(KeyBinding other)
|
+ public boolean conflicts(KeyBinding other)
|
||||||
+ {
|
+ {
|
||||||
+ if (getKeyConflictContext().conflicts(other.getKeyConflictContext()) || other.getKeyConflictContext().conflicts(getKeyConflictContext()))
|
+ if (getKeyConflictContext().conflicts(other.getKeyConflictContext()) || other.getKeyConflictContext().conflicts(getKeyConflictContext()))
|
||||||
+ {
|
+ {
|
||||||
+ if (!allowsKeyModifiers || !other.allowsKeyModifiers || getKeyModifier() == other.getKeyModifier())
|
+ net.minecraftforge.client.settings.KeyModifier keyModifier = getKeyModifier();
|
||||||
|
+ net.minecraftforge.client.settings.KeyModifier otherKeyModifier = other.getKeyModifier();
|
||||||
|
+ if (keyModifier.matches(other.func_151463_i()) || otherKeyModifier.matches(func_151463_i()))
|
||||||
|
+ {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ else if (keyModifier == otherKeyModifier || keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE)
|
||||||
+ {
|
+ {
|
||||||
+ return func_151463_i() == other.func_151463_i();
|
+ return func_151463_i() == other.func_151463_i();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Returns true when one of the bindings' key codes conflicts with the other's modifier.
|
||||||
|
+ */
|
||||||
|
+ public boolean hasKeyCodeModifierConflict(KeyBinding other)
|
||||||
|
+ {
|
||||||
|
+ if (getKeyConflictContext().conflicts(other.getKeyConflictContext()) || other.getKeyConflictContext().conflicts(getKeyConflictContext()))
|
||||||
|
+ {
|
||||||
|
+ if (getKeyModifier().matches(other.func_151463_i()) || other.getKeyModifier().matches(func_151463_i()))
|
||||||
|
+ {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public String getDisplayName()
|
||||||
|
+ {
|
||||||
|
+ return getKeyModifier().getLocalizedComboName(func_151463_i());
|
||||||
|
+ }
|
||||||
+ /****************** Forge End *****************************/
|
+ /****************** Forge End *****************************/
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,12 @@ public class KeyBindingMap
|
||||||
|
|
||||||
public KeyBinding lookupActive(int keyCode)
|
public KeyBinding lookupActive(int keyCode)
|
||||||
{
|
{
|
||||||
KeyModifier activeModifier = KeyModifier.isKeyCodeModifier(keyCode) ? KeyModifier.NONE : KeyModifier.getActiveModifier();
|
KeyModifier activeModifier = KeyModifier.getActiveModifier();
|
||||||
KeyBinding binding = getBinding(keyCode, activeModifier);
|
if (activeModifier.matches(keyCode))
|
||||||
if (binding != null)
|
|
||||||
{
|
{
|
||||||
return binding;
|
activeModifier = KeyModifier.NONE;
|
||||||
}
|
}
|
||||||
return getBinding(keyCode, KeyModifier.NOT_SUPPORTED);
|
return getBinding(keyCode, activeModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyBinding getBinding(int keyCode, KeyModifier keyModifier)
|
private KeyBinding getBinding(int keyCode, KeyModifier keyModifier)
|
||||||
|
|
|
@ -3,12 +3,13 @@ package net.minecraftforge.client.settings;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.client.settings.GameSettings;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
public enum KeyModifier {
|
public enum KeyModifier {
|
||||||
CONTROL {
|
CONTROL {
|
||||||
@Override
|
@Override
|
||||||
protected boolean matches(int keyCode)
|
public boolean matches(int keyCode)
|
||||||
{
|
{
|
||||||
if (Minecraft.isRunningOnMac)
|
if (Minecraft.isRunningOnMac)
|
||||||
{
|
{
|
||||||
|
@ -27,14 +28,15 @@ public enum KeyModifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLocalizedComboName(String keyName)
|
public String getLocalizedComboName(int keyCode)
|
||||||
{
|
{
|
||||||
|
String keyName = GameSettings.getKeyDisplayString(keyCode);
|
||||||
return I18n.format("forge.controlsgui.control", keyName);
|
return I18n.format("forge.controlsgui.control", keyName);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SHIFT {
|
SHIFT {
|
||||||
@Override
|
@Override
|
||||||
protected boolean matches(int keyCode)
|
public boolean matches(int keyCode)
|
||||||
{
|
{
|
||||||
return keyCode == Keyboard.KEY_LSHIFT || keyCode == Keyboard.KEY_RSHIFT;
|
return keyCode == Keyboard.KEY_LSHIFT || keyCode == Keyboard.KEY_RSHIFT;
|
||||||
}
|
}
|
||||||
|
@ -46,14 +48,15 @@ public enum KeyModifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLocalizedComboName(String keyName)
|
public String getLocalizedComboName(int keyCode)
|
||||||
{
|
{
|
||||||
|
String keyName = GameSettings.getKeyDisplayString(keyCode);
|
||||||
return I18n.format("forge.controlsgui.shift", keyName);
|
return I18n.format("forge.controlsgui.shift", keyName);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ALT {
|
ALT {
|
||||||
@Override
|
@Override
|
||||||
protected boolean matches(int keyCode)
|
public boolean matches(int keyCode)
|
||||||
{
|
{
|
||||||
return keyCode == Keyboard.KEY_LMENU || keyCode == Keyboard.KEY_RMENU;
|
return keyCode == Keyboard.KEY_LMENU || keyCode == Keyboard.KEY_RMENU;
|
||||||
}
|
}
|
||||||
|
@ -65,35 +68,17 @@ public enum KeyModifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLocalizedComboName(String keyName)
|
public String getLocalizedComboName(int keyCode)
|
||||||
{
|
{
|
||||||
|
String keyName = GameSettings.getKeyDisplayString(keyCode);
|
||||||
return I18n.format("forge.controlsgui.alt", keyName);
|
return I18n.format("forge.controlsgui.alt", keyName);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NONE {
|
NONE {
|
||||||
@Override
|
@Override
|
||||||
protected boolean matches(int keyCode)
|
public boolean matches(int keyCode)
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isActive()
|
|
||||||
{
|
|
||||||
return !SHIFT.isActive() && !CONTROL.isActive() && !ALT.isActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLocalizedComboName(String keyName)
|
|
||||||
{
|
|
||||||
return keyName;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
NOT_SUPPORTED {
|
|
||||||
@Override
|
|
||||||
protected boolean matches(int keyCode)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,9 +88,9 @@ public enum KeyModifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLocalizedComboName(String keyName)
|
public String getLocalizedComboName(int keyCode)
|
||||||
{
|
{
|
||||||
return keyName;
|
return GameSettings.getKeyDisplayString(keyCode);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -135,9 +120,9 @@ public enum KeyModifier {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract boolean matches(int keyCode);
|
public abstract boolean matches(int keyCode);
|
||||||
|
|
||||||
public abstract boolean isActive();
|
public abstract boolean isActive();
|
||||||
|
|
||||||
public abstract String getLocalizedComboName(String keyName);
|
public abstract String getLocalizedComboName(int keyCode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue