Java 类cpw.mods.fml.common.ModAPIManager 实例源码

项目:SolarFlux    文件:Utils.java   
/**
 * Returns true if the player has a usable wrench equipped.
 */
public static boolean hasUsableWrench(EntityPlayer pPlayer, int pX, int pY, int pZ) {
    ItemStack tool = pPlayer.getCurrentEquippedItem();
    if (tool != null) {
        if (ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools") && tool.getItem() instanceof IToolWrench && ((IToolWrench) tool.getItem())
                .canWrench(pPlayer, pX, pY, pZ)) {
            return true;
        }
    }
    return false;
}
项目:RefinedRelocation    文件:Mods.java   
public static void init() {
    IS_IRON_CHEST_LOADED = Loader.isModLoaded(IRON_CHEST_ID);
    IS_JABBA_LOADED = Loader.isModLoaded(JABBA_ID);
    IS_EE3_LOADED = Loader.isModLoaded(EE3_ID);
    IS_BC_TRANSPORT_API_LOADED = ModAPIManager.INSTANCE.hasAPI(BC_TRANS_API_ID);
    IS_COFH_TRANSPORT_API_LOADED = ModAPIManager.INSTANCE.hasAPI(COFH_TRANSPORT_API_ID);
    IS_COFH_ENERGY_API_LOADED = ModAPIManager.INSTANCE.hasAPI(COFH_ENERGY_API_ID);
    IS_IC2_LOADED = Loader.isModLoaded(IC2_ID);
    IS_FMP_LOADED = !Settings.FORCE_NON_FMP_RELOCATORS && Loader.isModLoaded(FMP_ID);
    IS_WAILA_LOADED = Loader.isModLoaded(WAILA_ID);
    IS_AE2_LOADED = Loader.isModLoaded(AE2_ID);
}
项目:TRHS_Club_Mod_2016    文件:ModSorter.java   
public ModSorter(List<ModContainer> modList, Map<String, ModContainer> nameLookup)
{
    HashMap<String, ModContainer> sortingNameLookup = Maps.newHashMap(nameLookup);
    ModAPIManager.INSTANCE.injectAPIModContainers(modList, sortingNameLookup);
    buildGraph(modList, sortingNameLookup);
}
项目:TRHS_Club_Mod_2016    文件:ModAPITransformer.java   
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass)
{
    String lookupName = name;
    if(name.endsWith("$class"))
    {
        lookupName = name.substring(0, name.length() - 6);
    }
    if (optionals == null || !optionals.containsKey(lookupName))
    {
        return basicClass;
    }
    ClassNode classNode = new ClassNode();
    ClassReader classReader = new ClassReader(basicClass);
    classReader.accept(classNode, 0);

    if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - found optionals for class %s - processing", name);
    for (ASMData optional : optionals.get(lookupName))
    {
        String modId = (String) optional.getAnnotationInfo().get("modid");

        if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
        {
            if (logDebugInfo) FMLRelaunchLog.finer("Optional removal skipped - mod present %s", modId);
            continue;
        }
        if (logDebugInfo) FMLRelaunchLog.finer("Optional on %s triggered - mod missing %s", name, modId);

        if (optional.getAnnotationInfo().containsKey("iface"))
        {
            Boolean stripRefs = (Boolean)optional.getAnnotationInfo().get("striprefs");
            if (stripRefs == null) stripRefs = Boolean.FALSE;
            stripInterface(classNode,(String)optional.getAnnotationInfo().get("iface"), stripRefs);
        }
        else
        {
            stripMethod(classNode, (String)optional.getObjectName());
        }

    }
    if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - class %s processed", name);

    ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    classNode.accept(writer);
    return writer.toByteArray();
}
项目:CauldronGit    文件:ModSorter.java   
public ModSorter(List<ModContainer> modList, Map<String, ModContainer> nameLookup)
{
    HashMap<String, ModContainer> sortingNameLookup = Maps.newHashMap(nameLookup);
    ModAPIManager.INSTANCE.injectAPIModContainers(modList, sortingNameLookup);
    buildGraph(modList, sortingNameLookup);
}
项目:CauldronGit    文件:ModAPITransformer.java   
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass)
{
    String lookupName = name;
    if(name.endsWith("$class"))
    {
        lookupName = name.substring(0, name.length() - 6);
    }
    if (optionals == null || !optionals.containsKey(lookupName))
    {
        return basicClass;
    }
    ClassNode classNode = new ClassNode();
    ClassReader classReader = new ClassReader(basicClass);
    classReader.accept(classNode, 0);

    if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - found optionals for class %s - processing", name);
    for (ASMData optional : optionals.get(lookupName))
    {
        String modId = (String) optional.getAnnotationInfo().get("modid");

        if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
        {
            if (logDebugInfo) FMLRelaunchLog.finer("Optional removal skipped - mod present %s", modId);
            continue;
        }
        if (logDebugInfo) FMLRelaunchLog.finer("Optional on %s triggered - mod missing %s", name, modId);

        if (optional.getAnnotationInfo().containsKey("iface"))
        {
            Boolean stripRefs = (Boolean)optional.getAnnotationInfo().get("striprefs");
            if (stripRefs == null) stripRefs = Boolean.FALSE;
            stripInterface(classNode,(String)optional.getAnnotationInfo().get("iface"), stripRefs);
        }
        else
        {
            stripMethod(classNode, (String)optional.getObjectName());
        }

    }
    if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - class %s processed", name);

    ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    classNode.accept(writer);
    return writer.toByteArray();
}
项目:vsminecraft    文件:FuelHandler.java   
public static boolean BCPresent()
{
    return ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|fuels") && MekanismUtils.classExists("buildcraft.api.fuels.BuildcraftFuelRegistry") && MekanismUtils.classExists("buildcraft.api.fuels.IFuel");
}
项目:EnderIOAddons    文件:InfiniteWaterSourceStopper.java   
public static void register() {
  MinecraftForge.EVENT_BUS.register(instance);
  for (ModContainer modContainer : ModAPIManager.INSTANCE.getAPIList()) {
    Log.info(modContainer.getModId() + " version " + modContainer.getVersion() + " from " + modContainer.getSource().getName());
  }
}
项目:OpenPeripheral-Integration    文件:ApiIntegrationModule.java   
@Override
public boolean canLoad() {
    final String apiId = getApiId();
    return ModAPIManager.INSTANCE.hasAPI(apiId);
}
项目:Cauldron    文件:ModSorter.java   
public ModSorter(List<ModContainer> modList, Map<String, ModContainer> nameLookup)
{
    HashMap<String, ModContainer> sortingNameLookup = Maps.newHashMap(nameLookup);
    ModAPIManager.INSTANCE.injectAPIModContainers(modList, sortingNameLookup);
    buildGraph(modList, sortingNameLookup);
}
项目:Cauldron    文件:ModAPITransformer.java   
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass)
{
    String lookupName = name;
    if(name.endsWith("$class"))
    {
        lookupName = name.substring(0, name.length() - 6);
    }
    if (optionals == null || !optionals.containsKey(lookupName))
    {
        return basicClass;
    }
    ClassNode classNode = new ClassNode();
    ClassReader classReader = new ClassReader(basicClass);
    classReader.accept(classNode, 0);

    if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - found optionals for class %s - processing", name);
    for (ASMData optional : optionals.get(lookupName))
    {
        String modId = (String) optional.getAnnotationInfo().get("modid");

        if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
        {
            if (logDebugInfo) FMLRelaunchLog.finer("Optional removal skipped - mod present %s", modId);
            continue;
        }
        if (logDebugInfo) FMLRelaunchLog.finer("Optional on %s triggered - mod missing %s", name, modId);

        if (optional.getAnnotationInfo().containsKey("iface"))
        {
            Boolean stripRefs = (Boolean)optional.getAnnotationInfo().get("striprefs");
            if (stripRefs == null) stripRefs = Boolean.FALSE;
            stripInterface(classNode,(String)optional.getAnnotationInfo().get("iface"), stripRefs);
        }
        else
        {
            stripMethod(classNode, (String)optional.getObjectName());
        }

    }
    if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - class %s processed", name);

    ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    classNode.accept(writer);
    return writer.toByteArray();
}
项目:Cauldron    文件:ModSorter.java   
public ModSorter(List<ModContainer> modList, Map<String, ModContainer> nameLookup)
{
    HashMap<String, ModContainer> sortingNameLookup = Maps.newHashMap(nameLookup);
    ModAPIManager.INSTANCE.injectAPIModContainers(modList, sortingNameLookup);
    buildGraph(modList, sortingNameLookup);
}
项目:Cauldron    文件:ModAPITransformer.java   
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass)
{
    String lookupName = name;
    if(name.endsWith("$class"))
    {
        lookupName = name.substring(0, name.length() - 6);
    }
    if (optionals == null || !optionals.containsKey(lookupName))
    {
        return basicClass;
    }
    ClassNode classNode = new ClassNode();
    ClassReader classReader = new ClassReader(basicClass);
    classReader.accept(classNode, 0);

    if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - found optionals for class %s - processing", name);
    for (ASMData optional : optionals.get(lookupName))
    {
        String modId = (String) optional.getAnnotationInfo().get("modid");

        if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
        {
            if (logDebugInfo) FMLRelaunchLog.finer("Optional removal skipped - mod present %s", modId);
            continue;
        }
        if (logDebugInfo) FMLRelaunchLog.finer("Optional on %s triggered - mod missing %s", name, modId);

        if (optional.getAnnotationInfo().containsKey("iface"))
        {
            Boolean stripRefs = (Boolean)optional.getAnnotationInfo().get("striprefs");
            if (stripRefs == null) stripRefs = Boolean.FALSE;
            stripInterface(classNode,(String)optional.getAnnotationInfo().get("iface"), stripRefs);
        }
        else
        {
            stripMethod(classNode, (String)optional.getObjectName());
        }

    }
    if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - class %s processed", name);

    ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    classNode.accept(writer);
    return writer.toByteArray();
}
项目:Cauldron    文件:ModSorter.java   
public ModSorter(List<ModContainer> modList, Map<String, ModContainer> nameLookup)
{
    HashMap<String, ModContainer> sortingNameLookup = Maps.newHashMap(nameLookup);
    ModAPIManager.INSTANCE.injectAPIModContainers(modList, sortingNameLookup);
    buildGraph(modList, sortingNameLookup);
}
项目:Cauldron    文件:ModAPITransformer.java   
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass)
{
    String lookupName = name;
    if(name.endsWith("$class"))
    {
        lookupName = name.substring(0, name.length() - 6);
    }
    if (optionals == null || !optionals.containsKey(lookupName))
    {
        return basicClass;
    }
    ClassNode classNode = new ClassNode();
    ClassReader classReader = new ClassReader(basicClass);
    classReader.accept(classNode, 0);

    if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - found optionals for class %s - processing", name);
    for (ASMData optional : optionals.get(lookupName))
    {
        String modId = (String) optional.getAnnotationInfo().get("modid");

        if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
        {
            if (logDebugInfo) FMLRelaunchLog.finer("Optional removal skipped - mod present %s", modId);
            continue;
        }
        if (logDebugInfo) FMLRelaunchLog.finer("Optional on %s triggered - mod missing %s", name, modId);

        if (optional.getAnnotationInfo().containsKey("iface"))
        {
            Boolean stripRefs = (Boolean)optional.getAnnotationInfo().get("striprefs");
            if (stripRefs == null) stripRefs = Boolean.FALSE;
            stripInterface(classNode,(String)optional.getAnnotationInfo().get("iface"), stripRefs);
        }
        else
        {
            stripMethod(classNode, (String)optional.getObjectName());
        }

    }
    if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - class %s processed", name);

    ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    classNode.accept(writer);
    return writer.toByteArray();
}
项目:RuneCraftery    文件:ModSorter.java   
public ModSorter(List<ModContainer> modList, Map<String, ModContainer> nameLookup)
{
    HashMap<String, ModContainer> sortingNameLookup = Maps.newHashMap(nameLookup);
    ModAPIManager.INSTANCE.injectAPIModContainers(modList, sortingNameLookup);
    buildGraph(modList, sortingNameLookup);
}
项目:RuneCraftery    文件:ModAPITransformer.java   
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass)
{
    if (optionals == null || !optionals.containsKey(name))
    {
        return basicClass;
    }
    ClassNode classNode = new ClassNode();
    ClassReader classReader = new ClassReader(basicClass);
    classReader.accept(classNode, 0);

    if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - found optionals for class %s - processing", name);
    for (ASMData optional : optionals.get(name))
    {
        String modId = (String) optional.getAnnotationInfo().get("modid");

        if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
        {
            if (logDebugInfo) FMLRelaunchLog.finest("Optional removal skipped - mod present %s", modId);
            continue;
        }
        if (logDebugInfo) FMLRelaunchLog.finest("Optional on %s triggered - mod missing %s", name, modId);

        if (optional.getAnnotationInfo().containsKey("iface"))
        {
            Boolean stripRefs = (Boolean)optional.getAnnotationInfo().get("striprefs");
            if (stripRefs == null) stripRefs = Boolean.FALSE;
            stripInterface(classNode,(String)optional.getAnnotationInfo().get("iface"), stripRefs);
        }
        else
        {
            stripMethod(classNode, (String)optional.getObjectName());
        }

    }
    if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - class %s processed", name);

    ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    classNode.accept(writer);
    return writer.toByteArray();
}
项目:RuneCraftery    文件:ModSorter.java   
public ModSorter(List<ModContainer> modList, Map<String, ModContainer> nameLookup)
{
    HashMap<String, ModContainer> sortingNameLookup = Maps.newHashMap(nameLookup);
    ModAPIManager.INSTANCE.injectAPIModContainers(modList, sortingNameLookup);
    buildGraph(modList, sortingNameLookup);
}
项目:RuneCraftery    文件:ModAPITransformer.java   
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass)
{
    if (optionals == null || !optionals.containsKey(name))
    {
        return basicClass;
    }
    ClassNode classNode = new ClassNode();
    ClassReader classReader = new ClassReader(basicClass);
    classReader.accept(classNode, 0);

    if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - found optionals for class %s - processing", name);
    for (ASMData optional : optionals.get(name))
    {
        String modId = (String) optional.getAnnotationInfo().get("modid");

        if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
        {
            if (logDebugInfo) FMLRelaunchLog.finest("Optional removal skipped - mod present %s", modId);
            continue;
        }
        if (logDebugInfo) FMLRelaunchLog.finest("Optional on %s triggered - mod missing %s", name, modId);

        if (optional.getAnnotationInfo().containsKey("iface"))
        {
            Boolean stripRefs = (Boolean)optional.getAnnotationInfo().get("striprefs");
            if (stripRefs == null) stripRefs = Boolean.FALSE;
            stripInterface(classNode,(String)optional.getAnnotationInfo().get("iface"), stripRefs);
        }
        else
        {
            stripMethod(classNode, (String)optional.getObjectName());
        }

    }
    if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - class %s processed", name);

    ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    classNode.accept(writer);
    return writer.toByteArray();
}
项目:BetterNutritionMod    文件:ModSorter.java   
public ModSorter(List<ModContainer> modList, Map<String, ModContainer> nameLookup)
{
    HashMap<String, ModContainer> sortingNameLookup = Maps.newHashMap(nameLookup);
    ModAPIManager.INSTANCE.injectAPIModContainers(modList, sortingNameLookup);
    buildGraph(modList, sortingNameLookup);
}
项目:BetterNutritionMod    文件:ModAPITransformer.java   
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass)
{
    if (optionals == null || !optionals.containsKey(name))
    {
        return basicClass;
    }
    ClassNode classNode = new ClassNode();
    ClassReader classReader = new ClassReader(basicClass);
    classReader.accept(classNode, 0);

    if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - found optionals for class %s - processing", name);
    for (ASMData optional : optionals.get(name))
    {
        String modId = (String) optional.getAnnotationInfo().get("modid");

        if (Loader.isModLoaded(modId) || ModAPIManager.INSTANCE.hasAPI(modId))
        {
            if (logDebugInfo) FMLRelaunchLog.finest("Optional removal skipped - mod present %s", modId);
            continue;
        }
        if (logDebugInfo) FMLRelaunchLog.finest("Optional on %s triggered - mod missing %s", name, modId);

        if (optional.getAnnotationInfo().containsKey("iface"))
        {
            Boolean stripRefs = (Boolean)optional.getAnnotationInfo().get("striprefs");
            if (stripRefs == null) stripRefs = Boolean.FALSE;
            stripInterface(classNode,(String)optional.getAnnotationInfo().get("iface"), stripRefs);
        }
        else
        {
            stripMethod(classNode, (String)optional.getObjectName());
        }

    }
    if (logDebugInfo) FMLRelaunchLog.finest("Optional removal - class %s processed", name);

    ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    classNode.accept(writer);
    return writer.toByteArray();
}
项目:rfwindmill    文件:Util.java   
/**
 * Checks if the player is currently wielding a Buildcraft-compatible wrench
 * @param pPlayer Player who might be holding the wrench
 * @param pX X coordinate of the position trying to be wrenched
 * @param pY Y coordinate of the position trying to be wrenched
 * @param pZ Z coordinate of the position trying to be wrenched
 * @return {@code true} if the player can wrench and {@code false} otherwise
 */
public static boolean hasWrench(EntityPlayer pPlayer, int pX, int pY, int pZ) {
    ItemStack tool = pPlayer.getCurrentEquippedItem();
    return tool != null && (ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools") &&
                (tool.getItem() instanceof IToolWrench) &&
                ((IToolWrench)tool.getItem()).canWrench(pPlayer, pX, pY, pZ));
}