net.minecraftforge.client.ClientCommandHandler Java Examples

The following examples show how to use net.minecraftforge.client.ClientCommandHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SkyblockAddons.java    From SkyblockAddons with MIT License 6 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent e) {
    MinecraftForge.EVENT_BUS.register(new NetworkListener());
    MinecraftForge.EVENT_BUS.register(playerListener);
    MinecraftForge.EVENT_BUS.register(guiScreenListener);
    MinecraftForge.EVENT_BUS.register(renderListener);
    MinecraftForge.EVENT_BUS.register(scheduler);
    MinecraftForge.EVENT_BUS.register(newScheduler);

    ClientCommandHandler.instance.registerCommand(new SkyblockAddonsCommand());

    addKeybinds(new SkyblockKeyBinding("open_settings", Keyboard.KEY_NONE, Message.SETTING_SETTINGS),
            new SkyblockKeyBinding( "edit_gui", Keyboard.KEY_NONE, Message.SETTING_EDIT_LOCATIONS),
            new SkyblockKeyBinding( "lock_slot", Keyboard.KEY_L, Message.SETTING_LOCK_SLOT),
            new SkyblockKeyBinding( "freeze_backpack", Keyboard.KEY_F, Message.SETTING_FREEZE_BACKPACK_PREVIEW));
}
 
Example #2
Source File: I18nUpdateMod.java    From I18nUpdateMod with MIT License 6 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    // 国际化检查
    if (I18nConfig.internationalization.openI18n && !isChinese()) {
        return;
    }

    // 命令注册
    ClientCommandHandler.instance.registerCommand(new CmdNotice());
    ClientCommandHandler.instance.registerCommand(new CmdReport());
    ClientCommandHandler.instance.registerCommand(new CmdReload());
    ClientCommandHandler.instance.registerCommand(new CmdGetLangpack());
    ClientCommandHandler.instance.registerCommand(new CmdUpload());
    ClientCommandHandler.instance.registerCommand(new CmdToken());

    // 热键注册
    if (!I18nConfig.key.closedKey) {
        MinecraftForge.EVENT_BUS.register(new HotKeyHandler());
    }
}
 
Example #3
Source File: BakaDanmaku.java    From BakaDanmaku with MIT License 6 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    // 装载各大平台的弹幕线程
    DanmakuThreadFactory.setDanmakuThread("bilibili", new BilibiliDanmakuThread());
    DanmakuThreadFactory.setDanmakuThread("douyu", new DouyuDanmakuThread());
    DanmakuThreadFactory.setDanmakuThread("chushou", new ChushouDanmakuThread());

    // 注册开启,关闭弹幕事件处理器
    MinecraftForge.EVENT_BUS.register(StartStopHandler.class);

    // 注册聊天事件处理器
    MinecraftForge.EVENT_BUS.register(ChatMsgHandler.class);

    // 注册屏幕信息事件处理器
    // TODO: MinecraftForge.EVENT_BUS.register(ScreenMsgHandler.class);

    // 客户端命令注册
    ClientCommandHandler.instance.registerCommand(new CommandBakaDM());
}
 
Example #4
Source File: IGWSupportNotifier.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Needs to be instantiated somewhere in your mod's loading stage.
 */
public IGWSupportNotifier(){
    if(FMLCommonHandler.instance().getSide() == Side.CLIENT && !Loader.isModLoaded("IGWMod")) {
        File dir = new File(".", "config");
        Configuration config = new Configuration(new File(dir, "IGWMod.cfg"));
        config.load();

        if(config.get(Configuration.CATEGORY_GENERAL, "enable_missing_notification", true, "When enabled, this will notify players when IGW-Mod is not installed even though mods add support.").getBoolean()) {
            ModContainer mc = Loader.instance().activeModContainer();
            String modid = mc.getModId();
            List<ModContainer> loadedMods = Loader.instance().getActiveModList();
            for(ModContainer container : loadedMods) {
                if(container.getModId().equals(modid)) {
                    supportingMod = container.getName();
                    FMLCommonHandler.instance().bus().register(this);
                    ClientCommandHandler.instance.registerCommand(new CommandDownloadIGW());
                    break;
                }
            }
        }
        config.save();
    }
}
 
Example #5
Source File: IGWSupportNotifier.java    From IGW-mod with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Needs to be instantiated somewhere in your mod's loading stage.
 */
public IGWSupportNotifier(){
    if(FMLCommonHandler.instance().getSide() == Side.CLIENT && !Loader.isModLoaded("IGWMod")) {
        File dir = new File(".", "config");
        Configuration config = new Configuration(new File(dir, "IGWMod.cfg"));
        config.load();

        if(config.get(Configuration.CATEGORY_GENERAL, "enable_missing_notification", true, "When enabled, this will notify players when IGW-Mod is not installed even though mods add support.").getBoolean()) {
            ModContainer mc = Loader.instance().activeModContainer();
            String modid = mc.getModId();
            List<ModContainer> loadedMods = Loader.instance().getActiveModList();
            for(ModContainer container : loadedMods) {
                if(container.getModId().equals(modid)) {
                    supportingMod = container.getName();
                    MinecraftForge.EVENT_BUS.register(this);
                    ClientCommandHandler.instance.registerCommand(new CommandDownloadIGW());
                    break;
                }
            }
        }
        config.save();
    }
}
 
Example #6
Source File: WailaNBT.java    From wailanbt with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Mod.EventHandler
public void init(@SuppressWarnings("UnusedParameters") FMLInitializationEvent event) {
    FMLInterModComms.sendMessage("Waila", "register", "me.exz.wailanbt.handler.BlockHandler.callbackRegister");
    FMLInterModComms.sendMessage("Waila", "register", "me.exz.wailanbt.handler.EntityHandler.callbackRegister");
    ClientCommandHandler.instance.registerCommand(new CommandReload());
    ClientCommandHandler.instance.registerCommand(new CommandName());
    ClientCommandHandler.instance.registerCommand(new CommandEntity());
    MinecraftForge.EVENT_BUS.register(new ConfigEvent());
}
 
Example #7
Source File: OpenClientProxy.java    From OpenModsLib with MIT License 5 votes vote down vote up
@Override
public void preInit() {
	ClientCommandHandler.instance.registerCommand(new CommandConfig("om_config_c", false));
	ClientCommandHandler.instance.registerCommand(new CommandSource("om_source_c", false, OpenMods.instance.getCollector()));
	ClientCommandHandler.instance.registerCommand(new CommandGlDebug());

	if (LibConfig.enableCalculatorCommands) {
		final ICommandComponent commandRoot = new CommandCalcFactory(new File(getMinecraftDir(), "scripts")).getRoot();
		ClientCommandHandler.instance.registerCommand(new CommandCalc(commandRoot, "config"));
		ClientCommandHandler.instance.registerCommand(new CommandCalc(commandRoot, "eval", "="));
		ClientCommandHandler.instance.registerCommand(new CommandCalc(commandRoot, "fun"));
		ClientCommandHandler.instance.registerCommand(new CommandCalc(commandRoot, "let"));
		ClientCommandHandler.instance.registerCommand(new CommandCalc(commandRoot, "execute"));
	}

	RenderUtils.registerFogUpdater();

	MinecraftForge.EVENT_BUS.register(new BlockSelectionHandler());

	ModelLoaderRegistry.registerLoader(MappedModelLoader.builder()
			.put("with-dependencies", ModelWithDependencies.EMPTY)
			.put("multi-layer", MultiLayerModel.EMPTY)
			.put("variantmodel", VariantModel.EMPTY_MODEL)
			.put("textureditem", TexturedItemModel.INSTANCE)
			.put("stateitem", ItemStateModel.EMPTY)
			.put("eval", EvalModel.EMPTY)
			.put("eval-expand", EvalExpandModel.EMPTY)
			.put("perspective-aware", PerspectiveAwareModel.EMPTY)
			.build(OpenMods.MODID));

	((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(hitboxManager);

	FramebufferBlitter.setup();
}
 
Example #8
Source File: MediaMod.java    From MediaMod with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Fired when Minecraft is starting
 *
 * @param event - FMLInitializationEvent
 * @see FMLInitializationEvent
 */
@EventHandler
public void init(FMLInitializationEvent event) {
    LOGGER.info("MediaMod starting...");

    // Register event subscribers and commands
    MinecraftForge.EVENT_BUS.register(this);
    MinecraftForge.EVENT_BUS.register(PlayerOverlay.INSTANCE);
    MinecraftForge.EVENT_BUS.register(PlayerMessager.INSTANCE);

    ClientCommandHandler.instance.registerCommand(new MediaModCommand());
    //ClientCommandHandler.instance.registerCommand(new MediaModUpdateCommand());

    File MEDIAMOD_DIRECTORY = new File(FMLClientHandler.instance().getClient().mcDataDir, "mediamod");
    if (!MEDIAMOD_DIRECTORY.exists()) {
        LOGGER.info("Creating necessary directories and files for first launch...");
        boolean mkdir = MEDIAMOD_DIRECTORY.mkdir();

        if (mkdir) {
            LOGGER.info("Created necessary directories and files!");
        } else {
            LOGGER.fatal("Failed to create necessary directories and files!");
        }
    }

    LOGGER.info("Checking if MediaMod is up-to-date...");
    VersionChecker.checkVersion();

    if (VersionChecker.INSTANCE.IS_LATEST_VERSION) {
        LOGGER.info("MediaMod is up-to-date!");
    } else {
        LOGGER.warn("MediaMod is NOT up-to-date! Latest Version: v" + VersionChecker.INSTANCE.LATEST_VERSION_INFO.latestVersionS + " Your Version: v" + Metadata.VERSION);
    }

    try {
        this.coreMod.register();
    } catch (IOException e) {
        LOGGER.warn("Failed to register with analytics! " + e.getMessage());
    }

    LOGGER.info("Loading Configuration...");
    Settings.loadConfig();

    // Load Media Handlers
    ServiceHandler serviceHandler = ServiceHandler.INSTANCE;
    serviceHandler.registerHandler(new BrowserHandler());
    serviceHandler.registerHandler(new SpotifyHandler());

    // Initialize the handlers
    serviceHandler.initializeHandlers();
}
 
Example #9
Source File: YouTubeChatMock.java    From youtube-chat-for-minecraft with Apache License 2.0 4 votes vote down vote up
public static void register() {
  ClientCommandHandler.instance.registerCommand(new YouTubeChatMock());
}
 
Example #10
Source File: ClientProxy.java    From OmniOcular with Apache License 2.0 4 votes vote down vote up
@Override
public void registerClientCommand() {
    ClientCommandHandler.instance.registerCommand(new CommandItemName());
    ClientCommandHandler.instance.registerCommand(new CommandEntityName());
}