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


Java Mod類代碼示例

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


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

示例1: init

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{		
	FMLInterModComms.sendRuntimeMessage(MODID, "VersionChecker", "addVersionCheck", VERSION_LINK);
	
	instance = this;		
	proxy.init();
       
       EventHandler eventHandler = new EventHandler();
       MinecraftForge.EVENT_BUS.register(eventHandler);
	
       if(FMLCommonHandler.instance().getEffectiveSide().isClient())
           FMLCommonHandler.instance().bus().register(eventHandler);
       
       //Minecraft.getMinecraft().gameSettings.showInventoryAchievementHint = false;
       Minecraft.getMinecraft().gameSettings.saveOptions();
       
       //Stop space from activating buttons, allowing it to be used for adding keyframes in the timeline.
       InputMap im = (InputMap)UIManager.get("Button.focusInputMap");
       im.put(KeyStroke.getKeyStroke("pressed SPACE"), "none");
       im.put(KeyStroke.getKeyStroke("released SPACE"), "none");
}
 
開發者ID:ObsidianSuite,項目名稱:ObsidianSuite,代碼行數:23,代碼來源:ObsidianAnimator.java

示例2: serverStart

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
@SideOnly(Side.SERVER)
public void serverStart(FMLServerStartingEvent event)
{
    if (INSTANCE == null) INSTANCE = this;
    if (SERVER   == null) SERVER   = event.getServer();
    if (COMMAND  == null) COMMAND  = new WBCommand();

    // Load (or create new) config files
    Config.load(false);

    // our one real command, though it does also have aliases "wb" and "worldborder"
    event.registerServerCommand(COMMAND);

    if ( Config.preventBlockPlace() )
        enableBlockPlaceListener(true);

    if ( Config.preventMobSpawn() )
        enableMobSpawnListener(true);

    if ( Config.getDenyEnderpearl() )
        enableEnderPearlListener(true);

    DynMapFeatures.registerListener();
}
 
開發者ID:abused,項目名稱:World-Border,代碼行數:26,代碼來源:WorldBorder.java

示例3: onPreInit

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void onPreInit(FMLPreInitializationEvent event)
{
    try
    {
        instance = this;
        this.logger = event.getModLog();
        this.conf = new File(Launch.minecraftHome, "authlibloginhelper-accounts.json");
        if (this.conf.createNewFile())
        {
            String path = this.conf.getAbsolutePath();
            this.logger.info("AuthlibLoginHelper: Successfully created " + path);
        }
        MinecraftForge.EVENT_BUS.register(this);
    }
    catch (IOException e)
    {
        throw Throwables.propagate(e);
    }
}
 
開發者ID:ustc-zzzz,項目名稱:AuthlibLoginHelper,代碼行數:21,代碼來源:AuthlibLoginHelper.java

示例4: preInit

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event){
    config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();
    COMPASSX_PROPERTY = config.get("hidden", ConfigValues.COMPASSX_NAME, ConfigValues.COMPASSX_DEFAULT, I18n.format(ConfigValues.COMPASSX_NAME+".tooltip"));
    COMPASSY_PROPERTY = config.get("hidden", ConfigValues.COMPASSY_NAME, ConfigValues.COMPASSY_DEFAULT, I18n.format(ConfigValues.COMPASSY_NAME+".tooltip"));
    TARGETX_PROPERTY = config.get(Configuration.CATEGORY_GENERAL, ConfigValues.TARGETX_NAME, ConfigValues.TARGETX_DEFAULT, I18n.format(ConfigValues.TARGETX_NAME+".tooltip"));
    TARGETZ_PROPERTY = config.get(Configuration.CATEGORY_GENERAL, ConfigValues.TARGETZ_NAME, ConfigValues.TARGETZ_DEFAULT, I18n.format(ConfigValues.TARGETZ_NAME+".tooltip"));
    XALIGNMENT_PROPERTY = config.get("hidden", ConfigValues.XALIGNMENT_NAME, ConfigValues.XALIGNMENT_DEFAULT.name(), I18n.format(ConfigValues.XALIGNMENT_NAME+".tooltip"));
    YALIGNMENT_PROPERTY = config.get("hidden", ConfigValues.YALIGNMENT_NAME, ConfigValues.YALIGNMENT_DEFAULT.name(), I18n.format(ConfigValues.YALIGNMENT_NAME+".tooltip"));
    syncConfig();

    GameRegistry.register(uhccompass);
    ModelLoader.setCustomModelResourceLocation(uhccompass, 0, new ModelResourceLocation(MODID+":uhccompass", "inventory"));

    MinecraftForge.EVENT_BUS.register(new ClientEvents());
    MinecraftForge.EVENT_BUS.register(new RenderEvents());
    MinecraftForge.EVENT_BUS.register(keyHandler = new KeyHandler());
}
 
開發者ID:The-Fireplace-Minecraft-Mods,項目名稱:UHC-Compass,代碼行數:20,代碼來源:UHCCompass.java

示例5: postinit

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

	updateMobSpawning();
	updateOreGenStatus();
	
	animals = new ArrayList<>();
	for(ResourceLocation entry:ForgeRegistries.ENTITIES.getKeys()) {
		if(EntityAnimal.class.isAssignableFrom(EntityList.getClass(entry))) {
			animals.add(entry);
		}
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:14,代碼來源:TF2weapons.java

示例6: preInit

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    logger = event.getModLog();
}
 
開發者ID:Kubithorg,項目名稱:KubidibotsStreamDownloaderFromYoutubeAndDisplayerThanksToAForgeMod,代碼行數:5,代碼來源:Streamer.java

示例7: postInit

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
	try {
		removeRecipes();
	} catch (IOException e) {
		e.printStackTrace();
	}
	readDirectory(recipeDir);
}
 
開發者ID:modmuss50,項目名稱:RecipeManipulator,代碼行數:10,代碼來源:RecipeManipulator.java

示例8: construction

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void construction(FMLConstructionEvent event) {
    Arrays.asList(TeslaCoreLibConfig.REGISTER_MACHINE_CASE, TeslaCoreLibConfig.REGISTER_GEARS,
            TeslaCoreLibConfig.REGISTER_GEAR_TYPES + "#" + CoreGearType.IRON.getMaterial(),
            TeslaCoreLibConfig.REGISTER_GEAR_TYPES + "#" + CoreGearType.GOLD.getMaterial(),
            TeslaCoreLibConfig.REGISTER_GEAR_TYPES + "#" + CoreGearType.DIAMOND.getMaterial(),
            TeslaCoreLibConfig.REGISTER_ADDONS,
            TeslaCoreLibConfig.REGISTER_SPEED_ADDONS,
            TeslaCoreLibConfig.REGISTER_ENERGY_ADDONS).forEach(s -> TeslaCoreLibConfig.INSTANCE.setDefaultFlag(s, true));
    TeslaCoreLibConfig.INSTANCE.setDefaultFlag(TeslaCoreLibConfig.ALLOW_ENERGY_DISPLAY_CHANGE, false);
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:12,代碼來源:IndustrialForegoing.java

示例9: clientPreInit

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
/**
 * Given WorldBorder's dependency on dedicated server classes and is designed for
 * use in multiplayer environments, we don't load anything on the client
 */
@Mod.EventHandler
@SideOnly(Side.CLIENT)
public void clientPreInit(FMLPreInitializationEvent event)
{
    Log.error("This mod is intended only for use on servers");
    Log.error("Please consider removing this mod from your installation");
}
 
開發者ID:abused,項目名稱:World-Border,代碼行數:12,代碼來源:WorldBorder.java

示例10: serverPreInit

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void serverPreInit(FMLServerAboutToStartEvent event) {
	// System.out.println("Starting server");
	
	if (!event.getServer().isDedicatedServer())
		for (WeaponData weapon : MapList.nameToData.values())
			ClientProxy.RegisterWeaponData(weapon);
	
	/*if(event.getSide()==Side.SERVER)
		AchievementPage.registerAchievementPage(new TF2Achievements());*/
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:12,代碼來源:TF2weapons.java

示例11: postInit

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
  public void postInit(FMLPostInitializationEvent event) 
  {
  	proxy.postInit(event);
hasLoaded = true;

  }
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:8,代碼來源:HarshenCastle.java

示例12: onServerStop

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void onServerStop(FMLServerStoppedEvent event) {
    logger.debug("Cleaning up");
    PlayerDataManager.capList.clear();
    PlayerDataManager.tutorialDone.clear();
    EventHandler.hitList.clear();
}
 
開發者ID:ichttt,項目名稱:FirstAid,代碼行數:8,代碼來源:FirstAid.java

示例13: serverStarting

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
    if (!CreeperHost.instance.active)
        return;
    event.registerServerCommand(new CommandInvite());
    event.registerServerCommand(new CommandPregen());
    deserializePreload(new File(getSaveFolder(), "pregenData.json"));
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:10,代碼來源:CreeperHostServer.java

示例14: preInit

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e)
{
    if (!CreeperHost.instance.active)
        return;
    MinecraftForge.EVENT_BUS.register(this);
    logger = e.getModLog();
    setupPlayerKicker();
}
 
開發者ID:CreeperHost,項目名稱:CreeperHostGui,代碼行數:10,代碼來源:CreeperHostServer.java

示例15: imcCallback

import net.minecraftforge.fml.common.Mod; //導入依賴的package包/類
@Mod.EventHandler
public void imcCallback(FMLInterModComms.IMCEvent event) {
    for (FMLInterModComms.IMCMessage message : event.getMessages()) {
        if (message.key.equalsIgnoreCase("getMeeCreepsApi")) {
            Optional<Function<IMeeCreepsApi, Void>> value = message.getFunctionValue(IMeeCreepsApi.class, Void.class);
            if (value.isPresent()) {
                value.get().apply(api);
            } else {
                logger.warn("Some mod didn't return a valid result with getMeeCreepsApi!");
            }
        }
    }
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:14,代碼來源:MeeCreeps.java


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