use of net.minecraft.client.options.KeyBinding in project StationAPI by ModificationStation.
the class OptionListener method registerKeyBindings.
@Environment(EnvType.CLIENT)
@EventListener
public void registerKeyBindings(KeyBindingRegisterEvent event) {
testBind = new KeyBinding("key.sltest.testBind", 21);
event.keyBindings.add(testBind);
}
use of net.minecraft.client.options.KeyBinding in project SpeedRunIGT by RedLime.
the class SpeedRunIGT method onInitializeClient.
@Override
public void onInitializeClient() {
MOD_VERSION = (FabricLoader.getInstance().getModContainer(SpeedRunIGT.MOD_ID).isPresent() ? FabricLoader.getInstance().getModContainer(SpeedRunIGT.MOD_ID).get().getMetadata().getVersion().getFriendlyString() : "Unknown+Unknown");
// init default option buttons
SpeedRunOption.addOptionButtonFactories(new OptionButtonsImpl().createOptionButtons().toArray(new OptionButtonFactory[0]));
// init default categories
new CategoryRegistryImpl().registerCategories().forEach(RunCategory::registerCategory);
// Registry API's
for (EntrypointContainer<SpeedRunIGTApi> entryPoint : FabricLoader.getInstance().getEntrypointContainers("speedrunigt", SpeedRunIGTApi.class)) {
SpeedRunIGTApi api = entryPoint.getEntrypoint();
// Registry single option button
OptionButtonFactory singleFactory = api.createOptionButton();
if (singleFactory != null)
SpeedRunOption.addOptionButtonFactories(singleFactory);
// Registry multiple option buttons
Collection<OptionButtonFactory> multipleFactory = api.createOptionButtons();
if (multipleFactory != null)
SpeedRunOption.addOptionButtonFactories(multipleFactory.toArray(new OptionButtonFactory[0]));
// Registry single category
RunCategory singleCategory = api.registerCategory();
if (singleCategory != null)
RunCategory.registerCategory(singleCategory);
// Registry multiple categories
Collection<RunCategory> multipleCategories = api.registerCategories();
if (multipleCategories != null)
multipleCategories.forEach(RunCategory::registerCategory);
API_PROVIDERS.add(entryPoint.getProvider());
}
// Options initialize
SpeedRunOption.init();
// Translate initialize
try {
TranslateHelper.init();
} catch (Throwable e) {
e.printStackTrace();
}
// Key Bindings initialize
timerResetKeyBinding = KeyBindingRegistry.registerKeyBinding(new KeyBinding("speedrunigt.controls.start_timer", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_U, "speedrunigt.title.options"));
timerStopKeyBinding = KeyBindingRegistry.registerKeyBinding(new KeyBinding("speedrunigt.controls.stop_timer", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_I, "speedrunigt.title.options"));
// End initializing
isInitialized = true;
// Update checking
SpeedRunIGTInfoScreen.checkUpdate();
// Add default fonts
FontUtils.copyDefaultFonts();
}
Aggregations