Fix inability to attack while holding modifier keys
This commit is contained in:
parent
21d39f6558
commit
bc2b5ad517
3 changed files with 33 additions and 4 deletions
|
@ -53,7 +53,7 @@
|
|||
public boolean func_151470_d()
|
||||
{
|
||||
- return this.field_74513_e;
|
||||
+ return this.field_74513_e && getKeyConflictContext().isActive() && (!allowsKeyModifiers || getKeyModifier().isActive());
|
||||
+ return this.field_74513_e && getKeyConflictContext().isActive() && getKeyModifier().isActive();
|
||||
}
|
||||
|
||||
public String func_151466_e()
|
||||
|
@ -110,7 +110,7 @@
|
|||
+ */
|
||||
+ public boolean isActiveAndMatches(int keyCode)
|
||||
+ {
|
||||
+ return keyCode == this.func_151463_i() && getKeyConflictContext().isActive() && (!allowsKeyModifiers || getKeyModifier().isActive());
|
||||
+ return keyCode == this.func_151463_i() && getKeyConflictContext().isActive() && getKeyModifier().isActive();
|
||||
+ }
|
||||
+
|
||||
+ public void setKeyConflictContext(net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext)
|
||||
|
@ -136,7 +136,7 @@
|
|||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||
+ return net.minecraftforge.client.settings.KeyModifier.NOT_SUPPORTED;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -22,7 +22,17 @@ public class KeyBindingMap
|
|||
public KeyBinding lookupActive(int keyCode)
|
||||
{
|
||||
KeyModifier activeModifier = KeyModifier.isKeyCodeModifier(keyCode) ? KeyModifier.NONE : KeyModifier.getActiveModifier();
|
||||
Collection<KeyBinding> bindings = map.get(activeModifier).lookup(keyCode);
|
||||
KeyBinding binding = getBinding(keyCode, activeModifier);
|
||||
if (binding != null)
|
||||
{
|
||||
return binding;
|
||||
}
|
||||
return getBinding(keyCode, KeyModifier.NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
private KeyBinding getBinding(int keyCode, KeyModifier keyModifier)
|
||||
{
|
||||
Collection<KeyBinding> bindings = map.get(keyModifier).lookup(keyCode);
|
||||
if (bindings != null)
|
||||
{
|
||||
for (KeyBinding binding : bindings)
|
||||
|
|
|
@ -83,6 +83,25 @@ public enum KeyModifier {
|
|||
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
|
||||
public boolean isActive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedComboName(String keyName)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue