當前位置: 首頁>>代碼示例>>Java>>正文


Java EventHandler類代碼示例

本文整理匯總了Java中net.minecraftforge.fml.common.Mod.EventHandler的典型用法代碼示例。如果您正苦於以下問題:Java EventHandler類的具體用法?Java EventHandler怎麽用?Java EventHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EventHandler類屬於net.minecraftforge.fml.common.Mod包,在下文中一共展示了EventHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: preInit

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public void preInit(FMLPreInitializationEvent event){
    Configuration config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();

    canBeDeactivated = config.getBoolean("canBeDeactivated", Configuration.CATEGORY_GENERAL, true, "If the wopper can be deactivated using redstone");
    wopperSpeed = config.getInt("speed", Configuration.CATEGORY_GENERAL, 10, 1, 1000, "The amount of ticks that have to pass before the wopper does a movement action again");

    if(config.hasChanged()){
        config.save();
    }

    blockWopper = new BlockWopper("wopper");
    GameRegistry.registerTileEntity(TileEntityWopper.class, MOD_ID+":wopper");

    proxy.preInit();
}
 
開發者ID:Ellpeck,項目名稱:Wopper,代碼行數:18,代碼來源:Wopper.java

示例2: preInit

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public void preInit(FMLPreInitializationEvent e)
{
    LogUtil.logDebug("Starting pre-initialization...");

    configFile = BBConfigFolderLoader.getConfigFile(e);
    configFile.load();
    BBConfig.initialize();
    BBConfig.syncConfig(configFile);
    
    MinecraftForge.EVENT_BUS.register(eventHandler);

    network = NetworkRegistry.INSTANCE.newSimpleChannel("bbchannel");
    network.registerMessage(PacketNetherBrickOvenFuelLevel.PacketHandler.class,
        PacketNetherBrickOvenFuelLevel.class, 0, Side.CLIENT);
    network.registerMessage(PacketCampfireState.PacketHandler.class,
        PacketCampfireState.class, 1, Side.CLIENT);

    RegisterTileEntities.register();
    FuelRegistry.addDefaultFuels();
    ElementRegistry.init();
    proxy.preInit(e);
}
 
開發者ID:einsteinsci,項目名稱:BetterBeginningsReborn,代碼行數:24,代碼來源:ModMain.java

示例3: onServerStopped

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public static void onServerStopped(FMLServerStoppedEvent event)
{
	if (ModConfiguration.halloweenCheckInterval > 0)
	{
		// stop the scheduler
		scheduler.schedule(new Runnable()
		{
			@Override
			public void run()
			{
				handle.cancel(true);
			}

		}, 0, TimeUnit.SECONDS);
	}
}
 
開發者ID:crazysnailboy,項目名稱:Halloween,代碼行數:18,代碼來源:HalloweenMod.java

示例4: preInit

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    logger = event.getModLog();

    config = new Configuration(event.getSuggestedConfigurationFile());
    doConfig();

    int id = 1; // Don't use 0, more easy debug.
    snw = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);

    snw.registerMessage(Request.Handler.class, Request.class, id++, Side.SERVER);
    snw.registerMessage(Data.Handler.class, Data.class, id++, Side.CLIENT);

    proxy.preInit();
}
 
開發者ID:dries007,項目名稱:DebugServerInfo,代碼行數:17,代碼來源:DebugServerInfo.java

示例5: preInit

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
  public void preInit(FMLPreInitializationEvent event){
  	Util.logger = new Logger(event.getModLog());

  	// find the fields we need regardless of obs
  	OpenGuiWrapper.findFields();

  	// register event handlers
  	MinecraftForge.EVENT_BUS.register(new Registrar());
  	MinecraftForge.EVENT_BUS.register(new VersionTracker());
  	MinecraftForge.EVENT_BUS.register(PlayerWorldSyncServer.INSTANCE);

// setup networking
  	RemoteGuiNetworkManager.INSTANCE.preInit(event);

  	VersionTracker.register(new UniversalRemoteVersionProvider());

  	proxy.preInit(event);

  	// fix broken config issues
  	UniversalRemoteConfiguration.validateConfig();
  }
 
開發者ID:orbwoi,項目名稱:UniversalRemote,代碼行數:23,代碼來源:UniversalRemote.java

示例6: onInit

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public void onInit(FMLInitializationEvent e) {
	proxy.init();
	//TODO: When smores has ore voting stabilized, update and re-enable this
	//NBTTagCompound oresTag = new NBTTagCompound();
	//oresTag.setBoolean("oreCopper", true);
	//oresTag.setBoolean("ingotCopper", true);
	//oresTag.setBoolean("dustCopper", true);
	//oresTag.setBoolean("gearCopper", true);
	//oresTag.setBoolean("plateCopper", true);
	//FMLInterModComms.sendMessage("smores", "recipeVote", oresTag);
	
	//Thermionics machines are *unusually* safe for charset to carry around
	FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.FIREBOX.getRegistryName());
	FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.OVEN.getRegistryName());
	FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.BATTERY_LEAD.getRegistryName()); //Avoid creative battery carry!
	FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.HAMMER_MILL.getRegistryName());
	FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.MOTOR_CONVECTION.getRegistryName());
	FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.SERGER.getRegistryName());
}
 
開發者ID:elytra,項目名稱:Thermionics,代碼行數:21,代碼來源:Thermionics.java

示例7: init

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public void init(FMLInitializationEvent e) {
    proxy.init(e);

    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Cat", SoundEvents.RECORD_CAT,         183000000));
    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Blocks", SoundEvents.RECORD_BLOCKS,   327000000));
    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Chirp", SoundEvents.RECORD_CHIRP,     183000000));
    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Far", SoundEvents.RECORD_FAR,         152400000));
    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Mall", SoundEvents.RECORD_MALL,       190200000));
    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Mellohi", SoundEvents.RECORD_MELLOHI, 81600000));
    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Stal", SoundEvents.RECORD_STAL,       138000000));
    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Strad", SoundEvents.RECORD_STRAD,     184800000));
    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Wait", SoundEvents.RECORD_WAIT,       214800000));
    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Ward", SoundEvents.RECORD_WARD,       246600000));
    //ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - 11",    SoundEvents.RECORD_11,        66600000));
    ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - 13", SoundEvents.RECORD_13,           154800000));
}
 
開發者ID:lukas2005,項目名稱:Device-Mod-Apps,代碼行數:18,代碼來源:Main.java

示例8: preInit

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
  public void preInit(FMLPreInitializationEvent event)
  {
  
NetworkRegistry.INSTANCE.registerGuiHandler(Elicitation.instance, new GuiHandler());
Items.setup();
  }
 
開發者ID:Kalman98,項目名稱:Elicitation,代碼行數:8,代碼來源:Elicitation.java

示例9: serverLoad

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
  public void serverLoad(FMLServerStartingEvent event)
  {
this.worldDir = event.getServer().getFolderName();	// Hand me that world name

_SaveData save = SaveHandler.loadFactionsFromFile(Main.configDir, Main.worldDir);

if (save == null)
{
	save = new _SaveData();	// Init
}

TerritoryHandler.setSaveData(save);
  }
 
開發者ID:Domochevsky,項目名稱:minecraft-territorialdealings,代碼行數:15,代碼來源:Main.java

示例10: afterModsLoaded

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public void afterModsLoaded(FMLPostInitializationEvent event)
{
	if (Loader.isModLoaded(Compats.IC2)) {
    	ItemsCG.loadRecipes();
	}
}
 
開發者ID:TwilightWingsStudio,項目名稱:CompositeGear,代碼行數:8,代碼來源:CompositeGear.java

示例11: load

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public void load(FMLPreInitializationEvent event)
{
	modLog = event.getModLog();
	ConfigurationCG.init(event.getSuggestedConfigurationFile());

	if (proxy.isClient()) {
    	getIC2Tab();
	}

	ItemsCG.load();
}
 
開發者ID:TwilightWingsStudio,項目名稱:CompositeGear,代碼行數:13,代碼來源:CompositeGear.java

示例12: preInit

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public void preInit (FMLPreInitializationEvent event) {
    
    CapabilityManager.INSTANCE.register(ITeslaConsumer.class, new CapabilityTeslaConsumer<ITeslaConsumer>(), BaseTeslaContainer.class);
    CapabilityManager.INSTANCE.register(ITeslaProducer.class, new CapabilityTeslaProducer<ITeslaProducer>(), BaseTeslaContainer.class);
    CapabilityManager.INSTANCE.register(ITeslaHolder.class, new CapabilityTeslaHolder<ITeslaHolder>(), BaseTeslaContainer.class);
}
 
開發者ID:Herobone,項目名稱:HeroUtils,代碼行數:8,代碼來源:Tesla.java

示例13: preInit

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
    public void preInit(FMLPreInitializationEvent e) {
        proxy.preInit(e);

        ModConfig.initConfig(e.getSuggestedConfigurationFile());

        try {
//            github = new GitHubBuilder().fromCredentials()/*.withOAuthToken("f6710197d10c01c77b8f5a1574c10ee0b57f5e6b", "[email protected]")
//                    */.build();

            gson = new GsonBuilder()
                    .serializeNulls()
                    .setPrettyPrinting()
                    .create();

//            ArrayList<AppStoreAppInfo> list = Main.gson.fromJson("[\n" +
//                    "  {\n" +
//                    "    \"name\": \"Mineuim Web Browser\",\n" +
//                    "    \"shortDescription\": \"A web browser in mc!\",\n" +
//                    "    \"description\": \"\",\n" +
//                    "    \"category\": \"INTERNET\",\n" +
//                    "    \"urls\": []\n" +
//                    "  }\n" +
//                    "]", new TypeToken<List<AppStoreAppInfo>>(){}.getType());
//            System.out.println(list.get(0));
//
//            ArrayList<AppStoreAppInfo> info = new ArrayList<>();
//            info.add(new AppStoreAppInfo("Mineuim Web Browser", "A web browser in mc!", "", AppCategory.INTERNET, new ArrayList<>()));
//            System.out.println(gson.toJson(info));
            //new ApplicationUnofficialAppStore().init();
        } catch (Exception e1) {
            e1.printStackTrace();
        }

        if (!modDataDir.exists()) modDataDir.mkdirs();
    }
 
開發者ID:lukas2005,項目名稱:Device-Mod-Apps,代碼行數:37,代碼來源:Main.java

示例14: serverStarting

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
	PacketHandler.NETWORKINSTANCE.registerMessage(PacketGetWorker.Handler.class, PacketGetWorker.class,
			PacketHandler.nextID(), Side.SERVER);
	PacketHandler.NETWORKINSTANCE.registerMessage(PacketReturnWorker.Handler.class, PacketReturnWorker.class,
			PacketHandler.nextID(), Side.CLIENT);
	event.registerServerCommand(new MainCmd());
	event.registerServerCommand(new GamemodeCmd());
}
 
開發者ID:IvanSteklow,項目名稱:VanillaExtras,代碼行數:10,代碼來源:ModCore.java

示例15: preInit

import net.minecraftforge.fml.common.Mod.EventHandler; //導入依賴的package包/類
@EventHandler
public void preInit (FMLPreInitializationEvent event) {

    // Packets
    NETWORK.register(PacketStage.class, Side.CLIENT);
    NETWORK.register(PacketStageAll.class, Side.CLIENT);
    NETWORK.register(PacketRequestClientSync.class, Side.SERVER);

    CapabilityManager.INSTANCE.register(IStageData.class, new Storage(), DefaultStageData.class);
    MinecraftForge.EVENT_BUS.register(new PlayerDataHandler());
    BookshelfRegistry.addCommand(COMMAND);
    BookshelfRegistry.addGameRule(GAME_RULE_SHARE_STAGES);
}
 
開發者ID:Darkhax-Minecraft,項目名稱:Game-Stages,代碼行數:14,代碼來源:GameStages.java


注:本文中的net.minecraftforge.fml.common.Mod.EventHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。