use of net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding in project fabric by FabricMC.
the class KeyBindingRegistryImpl method process.
public KeyBinding[] process(KeyBinding[] keysAll) {
List<KeyBinding> newKeysAll = new ArrayList<>();
for (KeyBinding binding : keysAll) {
if (!(binding instanceof FabricKeyBinding)) {
newKeysAll.add(binding);
}
}
newKeysAll.addAll(fabricKeyBindingList);
return newKeysAll.toArray(new KeyBinding[0]);
}
use of net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding in project fabric by FabricMC.
the class KeyBindingRegistryImpl method register.
@Override
public boolean register(FabricKeyBinding binding) {
for (KeyBinding exBinding : fabricKeyBindingList) {
if (exBinding == binding) {
return false;
} else if (exBinding.getId().equals(binding.getId())) {
throw new RuntimeException("Attempted to register two key bindings with equal ID: " + binding.getId() + "!");
}
}
if (!hasCategory(binding.getCategory())) {
LOGGER.warn("Tried to register key binding with unregistered category '" + binding.getCategory() + "' - please use addCategory to ensure intended category ordering!");
addCategory(binding.getCategory());
}
fabricKeyBindingList.add(binding);
return true;
}
Aggregations