Java 类net.minecraftforge.fml.common.ModAPIManager 实例源码

项目:Aura-Cascade    文件:AuraBlock.java   
@Override
public ArrayList<Object> getSpecialParameters() {
    //This was typed to Object from no-type.
    ArrayList<Object> result = new ArrayList<Object>();
    result.add("pump");
    result.add("conserve");

    result.add("craftingCenter");

    result.add("craftingPedestal");

    result.add("pumpAlt");

    result.add("pumpProjectile");
    result.add("pumpFall");
    result.add("pumpLight");
    result.add("pumpRedstone");
    result.add("pumpProjectileAlt");
    result.add("pumpFallAlt");
    result.add("pumpCreative");
    result.add("pumpLightAlt");
    result.add("pumpRedstoneAlt");


    if (ModAPIManager.INSTANCE.hasAPI("CoFHAPI|energy")) {
        result.add("flux");
    }
    return result;
}
项目:FloodLights    文件:ModCompatibility.java   
private void checkForMods() {
    IC2Loaded = Loader.isModLoaded("IC2");
    IGWModLoaded = Loader.isModLoaded("IGWMod");
    BCLoaded = ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools");
    CofhCoreLoaded = ModAPIManager.INSTANCE.hasAPI("CoFHAPI|item");
    NEILoaded = Loader.isModLoaded("NotEnoughItems");
    JEILoaded = Loader.isModLoaded("JEI");
    EnderIOLoaded = Loader.isModLoaded("EnderIO");
    ColoredLightCoreLoaded = Loader.isModLoaded("coloredlightcore");
    ACLoaded = Loader.isModLoaded("AgriCraft");
}
项目:EnderIO    文件:TEUtil.java   
public static void init(@Nonnull FMLPostInitializationEvent event) {
  if (ModAPIManager.INSTANCE.hasAPI("cofhapi|item")) {
    // Add support for TE wrench
    try {
      Class.forName("crazypants.enderio.base.integration.te.TEToolProvider").newInstance();
    } catch (Exception e) {
      Log.warn("Could not find Thermal Expansion Wrench definition. Wrench integration with it may fail");
    }
  }
}
项目:CustomWorldGen    文件: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);
}
项目:CustomWorldGen    文件: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, 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();
}
项目:MoarCarts    文件:RFModule.java   
@Override
public boolean areRequirementsMet()
{
    return ModAPIManager.INSTANCE.hasAPI("CoFHAPI|energy");
}
项目:Aura-Cascade    文件:AuraBlock.java   
@Override
public List<String> getTooltipData(World world, EntityPlayer player, BlockPos pos) {
    List<String> result = new ArrayList<String>();
    TileEntity tileEntity = world.getTileEntity(pos);
    if (tileEntity instanceof AuraTile) {

        if (tileEntity instanceof AuraTileCapacitor) {
            AuraTileCapacitor capacitor = (AuraTileCapacitor) tileEntity;
            result.add("Max Storage: " + capacitor.storageValues[capacitor.storageValueIndex]);

        }
        result.add("Aura Stored: ");
        result.add("Aura: " + ((AuraTile) tileEntity).storage);


    } else {
        result.add("No Aura");
    }
    if (tileEntity instanceof AuraTileCapacitor) {
        if (((AuraTileCapacitor) tileEntity).ticksDisabled > 0) {
            result.add("Time until functional: " + ((AuraTileCapacitor) tileEntity).ticksDisabled / 20);
        }
    }
    if (tileEntity instanceof AuraTilePumpBase) {
        result.add("Time left: " + ((AuraTilePumpBase) tileEntity).pumpPower + " seconds");
        result.add("Power: " + ((AuraTilePumpBase) tileEntity).pumpSpeed + " power per second");
        if (((AuraTilePumpBase) tileEntity).isAlternator()) {
            AuraTilePumpBase altPump = (AuraTilePumpBase) tileEntity;
            int power = (int) (altPump.pumpSpeed * altPump.getAlternatingFactor());
            result.add("Phase Power: " + power);
        }
    }

    if (ModAPIManager.INSTANCE.hasAPI("CoFHAPI|energy")) {
        if (tileEntity instanceof AuraTileRF) {
            AuraTileRF auraTileRF = (AuraTileRF) tileEntity;
            result.add("RF/t Output: " + auraTileRF.lastPower * Config.powerFactor);
        }

    } else if (tileEntity instanceof CraftingCenterTile) {
        CraftingCenterTile tile = (CraftingCenterTile) tileEntity;
        if (tile.getRecipe() != null) {
            result.add("Making: " + tile.getRecipe().result.getDisplayName());
            for (EnumFacing direction : CraftingCenterTile.pedestalRelativeLocations) {
                AuraTilePedestal pedestal = (AuraTilePedestal) world.getTileEntity(pos.offset(direction));
                if (tile.getRecipe() != null) {
                    result.add("    Power received:" + pedestal.powerReceived + "/" + tile.getRecipe().getAuraFromItem(pedestal.itemStack));
                } else {
                    AuraCascade.log.warn("Invalid recipe when checking crafting center");
                }
            }
        } else {
            result.add("No Valid Recipe Selected");
        }

    }
    return result;
}
项目:EnderIO    文件:EnderIOCrashCallable.java   
private List<String> collectData() {
  List<String> result = new ArrayList<String>();
  if (FMLCommonHandler.instance().getSide() == Side.CLIENT && FMLClientHandler.instance().hasOptifine()) {
    result.add(" * Optifine is installed. This is NOT supported.");
  }
  if (EnderIO.proxy.isDedicatedServer()) {
    if (!FMLServerHandler.instance().getServer().isServerInOnlineMode() && System.getProperty("INDEV") == null) {
      Log.warn("@Devs: See github for dev env setup; set INDEV if needed.");
      result.add(" * Offline mode for dedicated servers is NOT supported by Ender IO.");
    }
  }

  for (ModContainer modContainer : ModAPIManager.INSTANCE.getAPIList()) {
    String apiVersionString = modContainer.getVersion();
    if (apiVersionString == null) {
      apiVersionString = "";
    }
    // if ("appliedenergistics2|API".equals(modContainer.getModId())) {
    // if ("rv1".equals(apiVersionString) || "rv2".equals(apiVersionString) || "rv3".equals(apiVersionString)) {
    // result.add(" * An unsupportted old AE2 API is installed (" + apiVersionString + " from "
    // + modContainer.getSource().getName() + ").");
    // result.add(" Ender IO was build against API version rv4 and will NOT work with older versions.");
    // } else if (!"rv4".equals(apiVersionString)) {
    // result.add(" * An unknown AE2 API is installed (" + apiVersionString + " from "
    // + modContainer.getSource().getName() + ").");
    // result.add(" Ender IO was build against API version rv4 and may or may not work with a newer version.");
    // }
    // } else
    if (modContainer.getModId() != null && modContainer.getModId().startsWith("EnderIOAPI")) {
      if (!EnderIOAPIProps.VERSION.equals(apiVersionString)) {
        result.add(" * Another mod is shipping a version of our API that doesn't match our version (" + apiVersionString
            + " from " + modContainer.getSource().getName() + "). That may not actually work.");
      } else if (modContainer.getSource().getName() != null
          && (!modContainer.getSource().getName().startsWith("EnderIO") && !modContainer.getSource().getName().startsWith("enderio") && !modContainer
              .getSource().getName().equals("bin"))) {
        result.add(" * Our API got loaded from " + modContainer.getSource().getName() + ". That's unexpected.");
      }
    }
  }

  String badBrand = null;
  for (String brand : FMLCommonHandler.instance().getModName().split(",")) {
    if (brand != null && !brand.equals("fml") && !brand.equals("forge")) {
      if (badBrand == null) {
        badBrand = brand;
      } else {
        badBrand += ", " + brand;
      }
    }
  }
  if (badBrand != null) {
    result.add("An unsupported base software is installed: '" + badBrand + "'. This is NOT supported.");
  }
  return result;
}