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