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


Java Loader類代碼示例

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


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

示例1: IGWSupportNotifier

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
/**
 * 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();
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:26,代碼來源:IGWSupportNotifier.java

示例2: revertToFrozen

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
public static void revertToFrozen()
{
    if (!PersistentRegistry.FROZEN.isPopulated())
    {
        FMLLog.warning("Can't revert to frozen GameData state without freezing first.");
        return;
    }
    else
    {
        FMLLog.fine("Reverting to frozen data state.");
    }
    for (Map.Entry<ResourceLocation, FMLControlledNamespacedRegistry<?>> r : PersistentRegistry.ACTIVE.registries.entrySet())
    {
        final Class<? extends IForgeRegistryEntry> registrySuperType = PersistentRegistry.ACTIVE.getRegistrySuperType(r.getKey());
        loadRegistry(r.getKey(), PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE, registrySuperType);
    }
    // the id mapping has reverted, fire remap events for those that care about id changes
    Loader.instance().fireRemapEvent(ImmutableMap.<ResourceLocation, Integer[]>of(), ImmutableMap.<ResourceLocation, Integer[]>of(), true);

    // the id mapping has reverted, ensure we sync up the object holders
    ObjectHolderRegistry.INSTANCE.applyObjectHolders();
    FMLLog.fine("Frozen state restored.");
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:24,代碼來源:PersistentRegistryManager.java

示例3: detectOptifine

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
private void detectOptifine()
{
    try
    {
        Class<?> optifineConfig = Class.forName("Config", false, Loader.instance().getModClassLoader());
        String optifineVersion = (String) optifineConfig.getField("VERSION").get(null);
        Map<String,Object> dummyOptifineMeta = ImmutableMap.<String,Object>builder().put("name", "Optifine").put("version", optifineVersion).build();
        InputStream optifineModInfoInputStream = getClass().getResourceAsStream("optifinemod.info");
        try
        {
            ModMetadata optifineMetadata = MetadataCollection.from(optifineModInfoInputStream, "optifine").getMetadataForId("optifine", dummyOptifineMeta);
            optifineContainer = new DummyModContainer(optifineMetadata);
            FMLLog.info("Forge Mod Loader has detected optifine %s, enabling compatibility features", optifineContainer.getVersion());
        }
        finally
        {
            IOUtils.closeQuietly(optifineModInfoInputStream);
        }
    }
    catch (Exception e)
    {
        optifineContainer = null;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:25,代碼來源:FMLClientHandler.java

示例4: drawGuiContainerForegroundLayer

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
    super.drawGuiContainerForegroundLayer(x, y);

    boolean igwLoaded = Loader.isModLoaded(ModIds.IGWMOD);
    fontRenderer.drawString(widgetPage + 1 + "/" + (maxPage + 1), 305, 175, 0xFF000000);
    fontRenderer.drawString(I18n.format("gui.programmer.difficulty"), 263, 191, 0xFF000000);

    if (showingWidgetProgress == 0) {
        programmerUnit.renderForeground(x, y, draggingWidget);
    }

    for (IProgWidget widget : visibleSpawnWidgets) {
        if (widget != draggingWidget && x - guiLeft >= widget.getX() && y - guiTop >= widget.getY() && x - guiLeft <= widget.getX() + widget.getWidth() / 2 && y - guiTop <= widget.getY() + widget.getHeight() / 2) {
            List<String> tooltip = new ArrayList<>();
            widget.getTooltip(tooltip);
            if (igwLoaded) tooltip.add(I18n.format("gui.programmer.pressIForInfo"));
            if (tooltip.size() > 0) drawHoveringString(tooltip, x - guiLeft, y - guiTop, fontRenderer);
        }
    }

}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:23,代碼來源:GuiProgrammer.java

示例5: initGui

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
@Override
public void initGui() {
    super.initGui();
    addAnimatedStat("gui.tab.info.ghostSlotInteraction.title", new ItemStack(Blocks.HOPPER), 0xFF00AAFF, true).setText("gui.tab.info.ghostSlotInteraction");
    if (Loader.isModLoaded(ModIds.AE2)) {
        if(logistics.isPlacedOnInterface()) {
             Item item = AEApi.instance().definitions().parts().cableGlass().item(AEColor.TRANSPARENT);
             if(item == null) {
                 Log.warning("AE2 cable couldn't be found!");
                 item = Itemss.LOGISTICS_FRAME_REQUESTER;
             }
             GuiAnimatedStat stat = addAnimatedStat("gui.tab.info.logisticsRequester.aeIntegration.title", new ItemStack(item, 1, 16), 0xFF00AAFF, false);
             List<String> text = new ArrayList<String>();
             for(int i = 0; i < 2; i++)
                 text.add("");
             text.add("gui.tab.info.logisticsRequester.aeIntegration");
             stat.setText(text);
             stat.addWidget(aeIntegration = new GuiCheckBox(1, 16, 13, 0xFF000000, "gui.tab.info.logisticsRequester.aeIntegration.enable"));
         }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:22,代碼來源:GuiLogisticsRequester.java

示例6: update

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
@Override
@Optional.Method(modid = ModIds.AE2)
public void update(){
    super.update();

    if(!world.isRemote) {
        if(needToCheckForInterface) {
            if(Loader.isModLoaded(ModIds.AE2) && aeMode && gridNode == null) {
                needToCheckForInterface = checkForInterface();
            } else {
            	needToCheckForInterface = false;
            }
        }

        Iterator<Map.Entry<TileEntity, Integer>> iterator = providingInventories.entrySet().iterator();
        while(iterator.hasNext()) {
            Map.Entry<TileEntity, Integer> entry = iterator.next();
            if(entry.getValue() == 0 || entry.getKey().isInvalid()) {
                iterator.remove();
            } else {
                entry.setValue(entry.getValue() - 1);
            }
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:26,代碼來源:SemiBlockRequester.java

示例7: preInit

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
public void preInit(FMLPreInitializationEvent event)
{
	// Load configuration from file
	File configDir = event.getModConfigurationDirectory();
	config = new Configuration(new File(configDir.getPath(), "btweagles.cfg"));
	Config.readConfig();

	registerFluids();

	ModEntities.init();

	if (Loader.isModLoaded("thermalexpansion"))
	{
		IntegrationThermal.preInit();
	}
}
 
開發者ID:DarkMorford,項目名稱:BetterThanWeagles,代碼行數:17,代碼來源:CommonProxy.java

示例8: onInit

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
@Mod.EventHandler
public void onInit(FMLInitializationEvent ev) {
    info("Randores is Initializing...",
            "Sending handler message to WAILA.");
    FMLInterModComms.sendMessage("waila", "register", "com.gmail.socraticphoenix.randores.waila.RandoresWailaHandler.callbackRegister");
    if (Loader.isModLoaded("waila")) {
        info("WAILA was found and should have receieved the handler message.");
    } else {
        info("WAILA wasn't found. The handler message will be ignored.");
    }

    info("Registering up GUI handler and world generators...");
    NetworkRegistry.INSTANCE.registerGuiHandler(this, new RandoresGuiHandler());
    GameRegistry.registerWorldGenerator(new RandoresWorldGenerator(), 10);
    GameRegistry.registerWorldGenerator(new RandoresAltarGenerator(), -100);
    info("Registered GUI hander and world generators.", "Calling proxy Initialization...");
    Randores.PROXY.initSided(ev);
    info("Finished Initialization.");
}
 
開發者ID:Randores,項目名稱:Randores2,代碼行數:20,代碼來源:Randores.java

示例9: initGui

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
@Override
public void initGui()
{
    if (!hasCheckedForUpdates)
    {
        if (modButton != null)
        {
            for (ModContainer mod : Loader.instance().getModList())
            {
                Status status = ForgeVersion.getResult(mod).status;
                if (status == Status.OUTDATED || status == Status.BETA_OUTDATED)
                {
                    // TODO: Needs better visualization, maybe stacked icons
                    // drawn in a terrace-like pattern?
                    showNotification = Status.OUTDATED;
                }
            }
        }
        hasCheckedForUpdates = true;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:26,代碼來源:NotificationModUpdateScreen.java

示例10: init

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

    int i = 0;
    NETWORKING = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);
    NETWORKING.registerMessage(MessageReceiveDamage.Handler.class, MessageReceiveDamage.class, ++i, Side.CLIENT);
    NETWORKING.registerMessage(MessageApplyHealingItem.Handler.class, MessageApplyHealingItem.class, ++i , Side.SERVER);
    NETWORKING.registerMessage(MessageReceiveConfiguration.Handler.class, MessageReceiveConfiguration.class, ++i, Side.CLIENT);
    NETWORKING.registerMessage(MessageApplyAbsorption.Handler.class, MessageApplyAbsorption.class, ++i, Side.CLIENT);
    NETWORKING.registerMessage(MessageAddHealth.Handler.class, MessageAddHealth.class, ++i, Side.CLIENT);
    NETWORKING.registerMessage(MessagePlayHurtSound.Handler.class, MessagePlayHurtSound.class, ++i, Side.CLIENT);
    NETWORKING.registerMessage(MessageClientUpdate.Handler.class, MessageClientUpdate.class, ++i, Side.SERVER);
    NETWORKING.registerMessage(MessageResync.Handler.class, MessageResync.class, ++i, Side.CLIENT);
    MessageReceiveConfiguration.validate();

    if (Loader.isModLoaded("morpheus")) {
        enableMorpheusCompat = true;
        logger.info("Morpheus present - enabling compatibility module");
        MorpheusHelper.register();
    }

    RegistryManager.registerDefaults();
    checkEarlyExit();
}
 
開發者ID:ichttt,項目名稱:FirstAid,代碼行數:26,代碼來源:FirstAid.java

示例11: setMissionControlPort

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
/** Set the actual port used for mission control - not persisted, could be different each time the Mod is run.
 * @param port the port currently in use for mission control.
 */
static public void setMissionControlPort(int port)
{
	if (port != AddressHelper.missionControlPort)
	{
		AddressHelper.missionControlPort = port;
		// Also update our metadata, for displaying to the user:
		ModMetadata md = Loader.instance().activeModContainer().getMetadata();
		if (port != -1)
			md.description = "Talk to this Mod using port " + EnumChatFormatting.GREEN + port;
		else
			md.description = EnumChatFormatting.RED + "ERROR: No mission control port - check configuration";

		// See if changing the port should lead to changing the login details:
		//AuthenticationHelper.update(MalmoMod.instance.getModPermanentConfigFile());
	}
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:20,代碼來源:AddressHelper.java

示例12: setRegistryName

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
public final T setRegistryName(String name)
{
    if (getRegistryName() != null)
        throw new IllegalStateException("Attempted to set registry name with existing registry name! New: " + name + " Old: " + getRegistryName());

    int index = name.lastIndexOf(':');
    String oldPrefix = index == -1 ? "" : name.substring(0, index);
    name = index == -1 ? name : name.substring(index + 1);
    ModContainer mc = Loader.instance().activeModContainer();
    String prefix = mc == null || (mc instanceof InjectedModContainer && ((InjectedModContainer)mc).wrappedContainer instanceof FMLContainer) ? "minecraft" : mc.getModId().toLowerCase();
    if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0)
    {
        FMLLog.bigWarning("Dangerous alternative prefix `%s` for name `%s`, expected `%s` invalid registry invocation/invalid name?", oldPrefix, name, prefix);
        prefix = oldPrefix;
    }
    this.registryName = new ResourceLocation(prefix, name);
    return (T)this;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:19,代碼來源:IForgeRegistryEntry.java

示例13: preInit

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

		File directory = event.getModConfigurationDirectory();
		config = new Configuration(new File(directory.getPath(), "adventurers_toolbox.cfg"));
		Config.readConfig();

		MinecraftForge.EVENT_BUS.register(new HandpickHarvestHandler());
		MinecraftForge.EVENT_BUS.register(new SpecialToolAbilityHandler());
		MinecraftForge.EVENT_BUS.register(new HammerHandler());
		MinecraftForge.EVENT_BUS.register(new WeaponHandler());
		MinecraftForge.EVENT_BUS.register(new WorldHandler());

		ModMaterials.init();
		Toolbox.logger.log(Level.INFO,
				"Initialized tool part materials with " + Materials.head_registry.size() + " head materials, "
						+ Materials.haft_registry.size() + " haft materials, " + Materials.handle_registry.size()
						+ " handle materials, and " + Materials.adornment_registry.size() + " adornment materials");
		ModEntities.init();

		if (Loader.isModLoaded("tconstruct") && Config.ENABLE_TINKERS_COMPAT) {
			TConstructCompat.preInit();
		}
	}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:24,代碼來源:CommonProxy.java

示例14: preInit

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
public void preInit() {
    creativeTabModularMachinery = new CreativeTabs(ModularMachinery.MODID) {
        @Override
        public ItemStack getTabIconItem() {
            return new ItemStack(BlocksMM.blockController);
        }
    };

    MachineRegistry.getRegistry().buildRegistry();
    RecipeRegistry.getRegistry().buildRegistry();
    MinecraftForge.EVENT_BUS.register(new RegistrationBus());

    RegistryBlocks.initialize();
    RegistryItems.initialize();

    NetworkRegistry.INSTANCE.registerGuiHandler(ModularMachinery.MODID, this);

    if(Loader.isModLoaded("crafttweaker")) {
        MinecraftForge.EVENT_BUS.register(new ModIntegrationCrafttweaker());
    }
}
 
開發者ID:HellFirePvP,項目名稱:ModularMachinery,代碼行數:22,代碼來源:CommonProxy.java

示例15: buildValidItemsArray

import net.minecraftforge.fml.common.Loader; //導入依賴的package包/類
private static void buildValidItemsArray()
{
	List<Item> valid_items = new ArrayList<Item>();

	valid_items.add(Items.POTIONITEM);
	valid_items.add(Items.SPLASH_POTION);
	valid_items.add(Items.LINGERING_POTION);
	valid_items.add(Items.TIPPED_ARROW);

	if (Loader.isModLoaded("potioncore"))
	{
		valid_items.add(Item.getByNameOrId("potioncore:custom_potion"));
		valid_items.add(Item.getByNameOrId("potioncore:custom_arrow"));
	}

	VALID_ITEMS = valid_items.toArray(new Item[valid_items.size()]);
}
 
開發者ID:crazysnailboy,項目名稱:CombinedPotions,代碼行數:18,代碼來源:RecipeCombinedPotions2.java


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