当前位置: 首页>>代码示例>>Java>>正文


Java FMLCommonHandler类代码示例

本文整理汇总了Java中cpw.mods.fml.common.FMLCommonHandler的典型用法代码示例。如果您正苦于以下问题:Java FMLCommonHandler类的具体用法?Java FMLCommonHandler怎么用?Java FMLCommonHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FMLCommonHandler类属于cpw.mods.fml.common包,在下文中一共展示了FMLCommonHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent evt) {
	INSTANCE.registerMessage(LobbyPlayerOpenedGuiPacketHandler.class, LobbyPlayerOpenedGuiPacket.class, 0,
			Side.SERVER);

	INSTANCE.registerMessage(LobbyBeginGamePacketHandler.class, LobbyBeginGamePacket.class, 1, Side.SERVER);
	INSTANCE.registerMessage(PacketSyncPlayerPropertiesClientHandler.class, PacketSyncPlayerPropertiesClient.class,
			2, Side.CLIENT);
	INSTANCE.registerMessage(PacketSyncPlayerPropertiesServerHandler.class, PacketSyncPlayerPropertiesServer.class,
			3, Side.SERVER);

	INSTANCE.registerMessage(PacketSyncTileEntityServerHandler.class, PacketSyncTileEntityServer.class, 4,
			Side.SERVER);
	INSTANCE.registerMessage(PacketSyncTileEntityClientHandler.class, PacketSyncTileEntityClient.class, 5,
			Side.CLIENT);

	NetworkRegistry.INSTANCE.registerGuiHandler(PAYDAY.instance, new MGuiHandler());
	GameRegistry.registerBlock(lobbyBlock, "Lobby");
	GameRegistry.registerTileEntity(LobbyTileEntity.class, "lobby_tile_entity");

	FMLCommonHandler.instance().bus().register(eventHandler);
	MinecraftForge.EVENT_BUS.register(eventHandler);
}
 
开发者ID:TominoCZ,项目名称:PAYDAY,代码行数:24,代码来源:PAYDAY.java

示例2: init

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    Configurator.configure(new File("config/" + MODID + ".cfg"));
    GameRegistry.registerWorldGenerator(new Decorator(), 4096);
    FMLCommonHandler.instance().bus().register(this);
    MinecraftForge.EVENT_BUS.register(this);
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:8,代码来源:Structpro.java

示例3: init

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
@Override
public void init(FMLInitializationEvent event)
{
    super.init(event);
    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RFUContent.blockCapacitor), new ItemRendererCapacitor());
    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RFUContent.blockDiode), new ItemRendererDiode());
    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RFUContent.blockResistor), new ItemRendererResistor());
    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RFUContent.blockSwitch), new ItemRendererSwitch());
    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RFUContent.blockInvisTess), new ItemRendererInvisTess());
    //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RFUContent.blockRFMeter), new ItemRendererRFMeter());
    MinecraftForgeClient.registerItemRenderer(RFUContent.itemMaterialTess, new ItemRendererMaterialTess());
    //MinecraftForgeClient.registerItemRenderer(RFUContent.itemMaterialDisplay, new ItemRendererMaterialDisplay());
    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RFUContent.blockTransistor), new ItemRendererTransistor());
    FMLCommonHandler.instance().bus().register(new KeyInputHandler());
    KeyBindings.init();
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:17,代码来源:ClientProxy.java

示例4: initialize

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
@EventHandler
public void initialize(FMLInitializationEvent event)
{
	TerraFirmaCraft.PACKET_PIPELINE.registerPacket(InitClientWorldPacket.class);
	FMLCommonHandler.instance().bus().register(new PlayerTracker());
	MinecraftForge.EVENT_BUS.register(new ChunkEventHandler());
	MinecraftForge.EVENT_BUS.register(new PlayerInteractionHandler());
	MinecraftForge.EVENT_BUS.register(new AnvilCraftingHandler());
	
	if (Loader.isModLoaded("MineTweaker3"))
	{
		MineTweakerAPI.registerClass(ItemHeat.class);
		MineTweakerAPI.registerClass(Loom.class);
		MineTweakerAPI.registerClass(Quern.class);
		MineTweakerAPI.registerClass(Barrel.class);
		MineTweakerAPI.registerClass(Anvil.class);
		MineTweakerAPI.registerClass(Knapping.class);
	}
}
 
开发者ID:StrayWolfe,项目名称:TFC-Tweaker,代码行数:20,代码来源:TFCTweaker.java

示例5: lookupForgeRevision

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
public static int lookupForgeRevision() {
    if (sForgeRevision != 0) return sForgeRevision;
    int revision = Integer.parseInt(System.getProperty("uranium.forgeRevision", "0"));
    if (revision != 0) return sForgeRevision = revision;
    try {
        Properties p = new Properties();
        p.load(Uranium.class
                .getResourceAsStream("/fmlversion.properties"));
        revision = Integer.parseInt(String.valueOf(p.getProperty(
                "fmlbuild.build.number", "0")));
    } catch (Exception e) {
    }
    if (revision == 0) {
        ULog.get().warning("Uranium: could not parse forge revision, critical error");
        FMLCommonHandler.instance().exitJava(1, false);
    }
    return sForgeRevision = revision;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:19,代码来源:Uranium.java

示例6: startSubmitting

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
/**
 * Starts the Scheduler which submits our data every 30 minutes.
 */
private void startSubmitting() {
    final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags
    timer.scheduleAtFixedRate(new TimerTask() {
        @Override
        public void run() {
            // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler
            // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;)
            FMLCommonHandler.instance().getMinecraftServerInstance().processQueue.add(new Runnable() {
                @Override
                public void run() {
                    submitData();
                }
            });
        }
    }, 1000*60*5, 1000*60*30);
    // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start
    // WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted!
    // WARNING: Just don't do it!
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:23,代码来源:BMetrics.java

示例7: postPlugin

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
/**
 * 发送服务器数据到统计网页
 */
private void postPlugin() throws IOException {
    // 服务器数据获取
    final String pluginname = Uranium.name;
    final String tmposarch = System.getProperty("os.arch");

    final Map<String, Object> data = new HashMap();
    data.put("guid", guid);
    data.put("server_version", Bukkit.getVersion());
    data.put("server_port", Bukkit.getServer().getPort());
    data.put("server_tps", FMLCommonHandler.instance().getMinecraftServerInstance().recentTps[1]);
    data.put("plugin_version", Uranium.getCurrentVersion());
    data.put("players_online", Bukkit.getServer().getOnlinePlayers().size());
    data.put("os_name", System.getProperty("os.name"));
    data.put("os_arch", tmposarch.equalsIgnoreCase("amd64") ? "x86_64" : tmposarch);
    data.put("os_version", System.getProperty("os.version"));
    data.put("os_usemem", (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024);
    data.put("os_cores", Runtime.getRuntime().availableProcessors());
    data.put("auth_mode", Bukkit.getServer().getOnlineMode() ? 1 : 0);
    data.put("java_version", System.getProperty("java.version"));

    final String jsondata = "Info=" + JSONValue.toJSONString(data);

    final String url = String.format("http://api.yumc.pw/I/P/S/V/%s/P/%s", REVISION, URLEncoder.encode(pluginname, "UTF-8"));
    print("Plugin: " + pluginname + " Send Data To CityCraft Data Center");
    print("Address: " + url);
    print("Data: " + jsondata);
    // 发送数据
    final JSONObject result = (JSONObject) JSONValue.parse(postData(url, jsondata));
    print("Plugin: " + pluginname + " Recover Data From CityCraft Data Center: " + result.get("info"));
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:34,代码来源:YUMCStatistics.java

示例8: clientConnectedtoServer

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
@SubscribeEvent
public void clientConnectedtoServer(FMLNetworkEvent.ServerConnectionFromClientEvent event)
{
    if (!CreeperHost.instance.active)
        return;
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    if (server == null || server.isSinglePlayer() || discoverMode != Discoverability.PUBLIC)
        return;

    INetHandlerPlayServer handler = event.handler;
    if (handler instanceof NetHandlerPlayServer)
    {
        EntityPlayerMP entity = ((NetHandlerPlayServer) handler).playerEntity;
        playersJoined.add(entity.getUniqueID());
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:17,代码来源:CreeperHostServer.java

示例9: inviteUser

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
private void inviteUser(GameProfile profile)
{
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    Gson gson = new Gson();
    UserListWhitelist whitelistedPlayers = server.getConfigurationManager().func_152599_k();
    final ArrayList<String> tempHash = new ArrayList<String>();
    String name = profile.getName().toLowerCase();

    try
    {
        MessageDigest digest = MessageDigest.getInstance("SHA-256");

        byte[] hash = digest.digest(whitelistedPlayers.func_152706_a(name).getId().toString().getBytes(Charset.forName("UTF-8")));

        tempHash.add((new HexBinaryAdapter()).marshal(hash));
    }
    catch (NoSuchAlgorithmException e)
    {
        e.printStackTrace();
    }

    CreeperHostServer.InviteClass invite = new CreeperHostServer.InviteClass();
    invite.hash = tempHash;
    invite.id = CreeperHostServer.updateID;
    Util.putWebResponse("https://api.creeper.host/serverlist/invite", gson.toJson(invite), true, true);
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:27,代码来源:CommandInvite.java

示例10: removeUser

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
private void removeUser(GameProfile profile)
{
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    Gson gson = new Gson();
    final ArrayList<String> tempHash = new ArrayList<String>();

    try
    {
        MessageDigest digest = MessageDigest.getInstance("SHA-256");

        byte[] hash = digest.digest(profile.getId().toString().getBytes(Charset.forName("UTF-8")));

        tempHash.add((new HexBinaryAdapter()).marshal(hash));
    }
    catch (NoSuchAlgorithmException e)
    {
        e.printStackTrace();
    }

    CreeperHostServer.InviteClass invite = new CreeperHostServer.InviteClass();
    invite.hash = tempHash;
    invite.id = CreeperHostServer.updateID;
    CreeperHostServer.logger.debug("Sending " + gson.toJson(invite) + " to revoke endpoint");
    String resp = Util.putWebResponse("https://api.creeper.host/serverlist/revokeinvite", gson.toJson(invite), true, true);
    CreeperHostServer.logger.debug("Response from revoke endpoint " + resp);
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:27,代码来源:CommandInvite.java

示例11: click

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
private void click(boolean state) {
    if (Wrapper.currentScreen() != null) {
        clickInventory(0, state);
        return;
    }

    if (inventoryOnly.getValue()) return;

    try {
        MouseEvent event = new MouseEvent();
        int key = Wrapper.getKeyCode(Wrapper.keybindAttack());
        ReflectionUtil.setField("button", event, Wrapper.convertKeyToLWJGL(key));
        ReflectionUtil.setField("buttonstate", event, state);
        //calling the event for CPSMod compatibility.
        boolean thingy = MinecraftForge.EVENT_BUS.post(event);
        Wrapper.keybinding_setKeybindState(key, state);
        if (state)
            Wrapper.keybinding_onTick(key);
        if (!thingy)
            FMLCommonHandler.instance().fireMouseInput();
    } catch (Exception ex) {
    }
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:24,代码来源:ModuleAutoclicker.java

示例12: initialize

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
@EventHandler
public void initialize(FMLInitializationEvent e)
{
	// Register packets in the TFC PacketPipeline
	TerraFirmaCraft.PACKET_PIPELINE.registerPacket(InitClientWorldPacket.class);
	
	// Register the player tracker
	FMLCommonHandler.instance().bus().register(new ModPlayerTracker());
	
	// Register the tool classes
	proxy.registerToolClasses();

	// Register Crafting Handler
	FMLCommonHandler.instance().bus().register(new CraftingHandler());

	// Register the Chunk Load/Save Handler
	MinecraftForge.EVENT_BUS.register(new ChunkEventHandler());
	
	// Register all the render stuff for the client
	proxy.registerRenderInformation();

       FluidList.registerFluidContainers();
       
	ModRecipes.initialise();
	
	// Register WAILA classes
	proxy.registerWailaClasses();
	proxy.hideNEIItems();		
}
 
开发者ID:Wahazar,项目名称:TFCPrimitiveTech,代码行数:30,代码来源:TFCPrimitiveTech.java

示例13: init

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
	proxy.registerNetworkStuff();
	NetworkRegistry.INSTANCE.registerGuiHandler(this, new TechnicalGuiHandler());
	TechnicalItem.removeVanillaRecipes();
	Recipes.init();
	FMLCommonHandler.instance().bus().register(new EventListener());
	radioactivityPotion = (new PotionTechnical(radioactivityPotionId, true, 0)).setIconIndex(0, 0).setPotionName("potion.radioactivityPotion");
	TechnicalAchievement.init();
	AchievementPage.registerAchievementPage(technicalAchievementPage);
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:12,代码来源:Technical.java

示例14: init

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent event) {
	long time = System.nanoTime();
	ContentRegistry.init();
	FMLCommonHandler.instance().bus().register(this);
	NetworkRegistry.INSTANCE.registerGuiHandler(OpenSensors.instance, new GUIHandler());
	logger.info("Finished init in %d ms", (System.nanoTime() - time) / 1000000);
}
 
开发者ID:PC-Logix,项目名称:OpenSensors,代码行数:9,代码来源:OpenSensors.java

示例15: init

import cpw.mods.fml.common.FMLCommonHandler; //导入依赖的package包/类
@Override
public void init(FMLInitializationEvent event) {
	MinecraftForge.EVENT_BUS.register(ThaumOresMod.events);
	FMLCommonHandler.instance().bus().register(ThaumOresMod.events);
	if (TOConfig.generalAngryPigs)
		ReactionUtils.addBlockToPigAngryList(TOBlocks.netherrackInfusedOre, OreDictionary.WILDCARD_VALUE);
}
 
开发者ID:MJaroslav,项目名称:ThaumOres,代码行数:8,代码来源:TOWorld.java


注:本文中的cpw.mods.fml.common.FMLCommonHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。