当前位置: 首页>>代码示例>>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;未经允许,请勿转载。