private KeyHook create ( KeyBinding key ) { if ( key != null && key instanceof KeyHook ) { return ( KeyHook ) key ; // Don't create a KeyHook to replace this KeyBinding, since that has already been done at some point. // (Minecraft keeps a pointer to every KeyBinding that gets created, and they never get destroyed - so we don't want to create // any more than necessary.) } return new KeyHook ( key . getKeyDescription ( ) , key . getKeyCode ( ) , key . getKeyCategory ( ) ) ; }
Helper function to create a KeyHook object for a given KeyBinding object .