예제 #1
0
 /// <summary>
 /// Method that calculates if this Keybinding conflicts with another Keybinding.
 /// </summary>
 public bool ConflictsWith(MinecraftKeyBinding other)
 {
     // Replicated version of MC's "conflicts" method in "KeyBinding.java".
     if (ContextConflicts(other.context) || other.ContextConflicts(context))
     {
         if (ModifierMatchesKeyCode(other.keyCode) || other.ModifierMatchesKeyCode(keyCode))
         {
             return(true);
         }
         else if (keyCode == other.keyCode)
         {
             return(modifier == other.modifier || (ContextConflicts("IN_GAME") && (modifier == "NONE" || other.modifier == "NONE")));
         }
     }
     return(false);
 }
예제 #2
0
 /// <summary>
 /// Method that calculates if this Keybinding conflicts with another Keybinding as a modifier-only
 /// conflict (shown in orange in Minecraft settings GUI).
 /// </summary>
 public bool ModifierConflictsWith(MinecraftKeyBinding other)
 {
     // Replicated version of MC's "hasKeyCodeModifierConflict" method in "KeyBinding.java".
     return((ContextConflicts(other.context) || other.ContextConflicts(context)) &&
            (ModifierMatchesKeyCode(other.keyCode) || other.ModifierMatchesKeyCode(keyCode)));
 }