本文整理汇总了Java中cpw.mods.fml.common.ModAPIManager类的典型用法代码示例。如果您正苦于以下问题:Java ModAPIManager类的具体用法?Java ModAPIManager怎么用?Java ModAPIManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModAPIManager类属于cpw.mods.fml.common包,在下文中一共展示了ModAPIManager类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasUsableWrench
import cpw.mods.fml.common.ModAPIManager; //导入依赖的package包/类
/**
* 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;
}
示例2: init
import cpw.mods.fml.common.ModAPIManager; //导入依赖的package包/类
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);
}
示例3: ModSorter
import cpw.mods.fml.common.ModAPIManager; //导入依赖的package包/类
public ModSorter(List<ModContainer> modList, Map<String, ModContainer> nameLookup)
{
HashMap<String, ModContainer> sortingNameLookup = Maps.newHashMap(nameLookup);
ModAPIManager.INSTANCE.injectAPIModContainers(modList, sortingNameLookup);
buildGraph(modList, sortingNameLookup);
}
示例4: transform
import cpw.mods.fml.common.ModAPIManager; //导入依赖的package包/类
@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();
}
示例5: BCPresent
import cpw.mods.fml.common.ModAPIManager; //导入依赖的package包/类
public static boolean BCPresent()
{
return ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|fuels") && MekanismUtils.classExists("buildcraft.api.fuels.BuildcraftFuelRegistry") && MekanismUtils.classExists("buildcraft.api.fuels.IFuel");
}
示例6: register
import cpw.mods.fml.common.ModAPIManager; //导入依赖的package包/类
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());
}
}
示例7: canLoad
import cpw.mods.fml.common.ModAPIManager; //导入依赖的package包/类
@Override
public boolean canLoad() {
final String apiId = getApiId();
return ModAPIManager.INSTANCE.hasAPI(apiId);
}
示例8: transform
import cpw.mods.fml.common.ModAPIManager; //导入依赖的package包/类
@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();
}
示例9: hasWrench
import cpw.mods.fml.common.ModAPIManager; //导入依赖的package包/类
/**
* 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));
}