本文整理汇总了Java中cpw.mods.fml.common.Loader类的典型用法代码示例。如果您正苦于以下问题:Java Loader类的具体用法?Java Loader怎么用?Java Loader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Loader类属于cpw.mods.fml.common包,在下文中一共展示了Loader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent event) {
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
ModRecipes.init();
proxy.registerEvents();
proxy.registerEntities();
proxy.registerRenderers();
if (ModEntityList.hasEntitiesWithEggs()) {
ModEntityList.entity_egg = new ItemEntityEgg();
GameRegistry.registerItem(ModEntityList.entity_egg, "entity_egg");
OreDictionary.registerOre("mobEgg", ModEntityList.entity_egg);
}
isTinkersConstructLoaded = Loader.isModLoaded("TConstruct");
}
示例2: initialize
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
@EventHandler
public void initialize(FMLInitializationEvent event)
{
TerraFirmaCraft.PACKET_PIPELINE.registerPacket(InitClientWorldPacket.class);
FMLCommonHandler.instance().bus().register(new PlayerTracker());
MinecraftForge.EVENT_BUS.register(new ChunkEventHandler());
MinecraftForge.EVENT_BUS.register(new PlayerInteractionHandler());
MinecraftForge.EVENT_BUS.register(new AnvilCraftingHandler());
if (Loader.isModLoaded("MineTweaker3"))
{
MineTweakerAPI.registerClass(ItemHeat.class);
MineTweakerAPI.registerClass(Loom.class);
MineTweakerAPI.registerClass(Quern.class);
MineTweakerAPI.registerClass(Barrel.class);
MineTweakerAPI.registerClass(Anvil.class);
MineTweakerAPI.registerClass(Knapping.class);
}
}
示例3: initFlowers
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
public void initFlowers() {
if (ItemWateringCan.flowers != null) {
return;
}
ItemWateringCan.flowers = new ArrayList<ItemStack>();
if (!Loader.isModLoaded("Forestry")) {
return;
}
try {
final Class flowerManager = Class.forName("forestry.api.apiculture.FlowerManager");
final ArrayList<ItemStack> temp = (ArrayList<ItemStack>)flowerManager.getField("plainFlowers").get(null);
ItemWateringCan.flowers.addAll(temp);
}
catch (Exception e) {
e.printStackTrace();
}
}
示例4: nerfNonStandardRecipes
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
@Override
protected void nerfNonStandardRecipes ()
{
if (Loader.isModLoaded(ModIds.ENVIROMINE))
{
nerfEnviromineRecipes();
}
if (Loader.isModLoaded(ModIds.TIC))
{
nerfTConstructRecipes();
}
if (Loader.isModLoaded(ModIds.TISTEELWORKS))
{
nerfTiSteelworksRecipes();
}
}
示例5: SC2RecipeTweaks
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void SC2RecipeTweaks()
{
if(Loader.isModLoaded("steamcraft2"))
{
if(!ConfigSettings.FleshBlockRecipe)
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < recipes.size(); i++)
{
if (recipes.get(i) != null)
{
ItemStack recipeResult = recipes.get(i).getRecipeOutput();
if (recipeResult != null && recipeResult.getItem() == Item.getItemFromBlock(InitBlocks.blockFlesh))
{
recipes.remove(i--);
}
}
}
}
//OreDictionary.registerOre("itemAxe", new ItemStack(InitItems.axeSteam, 1, OreDictionary.WILDCARD_VALUE));
}
}
示例6: init
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
public static void init(FMLInitializationEvent event)
{
if(Loader.isModLoaded("Waila"))
{
new CompatModuleWaila().init(event);
}
if(Loader.isModLoaded("NotEnoughItems"))
{
}
}
示例7: run
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
@Override
public void run()
{
if (!Loader.isModLoaded("Micdoodlecore"))
{
if (ThreadRequirementMissing.threadSide.isServer())
{
FMLCommonHandler.instance().getMinecraftServerInstance().logSevere("===================================================================");
FMLCommonHandler.instance().getMinecraftServerInstance().logSevere("MicdoodleCore not found in mods folder. Galacticraft will not load.");
FMLCommonHandler.instance().getMinecraftServerInstance().logSevere("===================================================================");
}
else
{
ThreadRequirementMissing.openGuiClient();
}
}
}
示例8: setupFluids
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
public void setupFluids()
{
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid(TFCFluids.OLIVEOIL.getName()), new ItemStack(TFPItems.CustomBucketOliveOil), new ItemStack(TFCItems.woodenBucketEmpty));
if(Loader.isModLoaded("BuildCraft|Core"))
{
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid(BuildCraftEnergy.fluidOil.getName()), new ItemStack(TFPItems.CustomBucketOil), new ItemStack(TFCItems.woodenBucketEmpty));
}
if(Loader.isModLoaded("necromancy"))
{
FluidContainerRegistry.registerFluidContainer(new FluidStack(TFPFluids.tfpFluidBlood, 1000), new ItemStack(TFPItems.CustomBucketBlood), new ItemStack(TFCItems.woodenBucketEmpty));
FluidContainerRegistry.registerFluidContainer(new FluidStack(TFPFluids.tfpFluidBlood, 250), ItemGeneric.getItemStackFromName("Jar of Blood"), new ItemStack(TFCItems.glassBottle));
}
if(Loader.isModLoaded("steamcraft2"))
{
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid(TFPFluids.tfpFluidWhaleOil.getName()), new ItemStack(TFPItems.CustomBucketWhaleOil), new ItemStack(TFCItems.woodenBucketEmpty));
}
}
示例9: initRenders
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
@Override
public void initRenders()
{
RenderIds.campfire = RenderingRegistry.getNextAvailableRenderId();
ClientRegistry.bindTileEntitySpecialRenderer(TileCampfire.class, new TileRenderCampfire());
ClientRegistry.bindTileEntitySpecialRenderer(TileHardJug.class, new TileRenderJug());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.hardjug), new ItemRenderJug());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.campfire), new ItemRenderCampfire());
// ClientRegistry.bindTileEntitySpecialRenderer(TileCampfire.class, new TileRenderCampfire());
if(Loader.isModLoaded("NotEnoughItems"))
{
}
}
示例10: drawSlot
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
@Override
protected void drawSlot(int listIndex, int var2, int var3, int var4, Tessellator var5)
{
ModContainer mc=mods.get(listIndex);
if (Loader.instance().getModState(mc)==ModState.DISABLED)
{
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
}
else
{
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF);
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xCCCCCC);
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getMetadata() !=null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , var3 + 22, 0xCCCCCC);
}
}
示例11: buildSoftDependProxy
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
public Object buildSoftDependProxy(String modId, String className)
{
if (Loader.isModLoaded(modId))
{
try
{
Class<?> clz = Class.forName(className,true,Loader.instance().getModClassLoader());
return clz.newInstance();
}
catch (Exception e)
{
Throwables.propagateIfPossible(e);
return null;
}
}
return null;
}
示例12: addPrefix
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
/**
* Prefix the supplied name with the current mod id.
*
* If no mod id can be determined, minecraft will be assumed.
* The prefix is separated with a colon.
*
* If there's already a prefix, it'll be prefixed again if the new prefix
* doesn't match the old prefix, as used by vanilla calls to addObject.
*
* @param name name to prefix.
* @return prefixed name.
*/
private String addPrefix(String name)
{
int index = name.lastIndexOf(':');
String oldPrefix = index == -1 ? "" : name.substring(0, index);
String prefix;
ModContainer mc = Loader.instance().activeModContainer();
if (mc != null)
{
prefix = mc.getModId();
}
else // no mod container, assume minecraft
{
prefix = "minecraft";
}
if (!oldPrefix.equals(prefix))
{
name = prefix + ":" + name;
}
return name;
}
示例13: registerGlobalEntityID
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id)
{
if (EntityList.field_75626_c.containsKey(entityClass))
{
ModContainer activeModContainer = Loader.instance().activeModContainer();
String modId = "unknown";
if (activeModContainer != null)
{
modId = activeModContainer.getModId();
}
else
{
FMLLog.severe("There is a rogue mod failing to register entities from outside the context of mod loading. This is incredibly dangerous and should be stopped.");
}
FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", modId, entityClass);
return;
}
id = instance().validateAndClaimId(id);
EntityList.func_75618_a(entityClass, entityName, id);
}
示例14: loadLocalization
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
/**
* Deprecated for removal in 1.8. Use the assets lang system
*/
@Deprecated
public void loadLocalization(String localizationFile, String lang, boolean isXML)
{
URL urlResource = this.getClass().getResource(localizationFile);
if (urlResource != null)
{
loadLocalization(urlResource, lang, isXML);
}
else
{
ModContainer activeModContainer = Loader.instance().activeModContainer();
if (activeModContainer!=null)
{
FMLLog.log(activeModContainer.getModId(), Level.ERROR, "The language resource %s cannot be located on the classpath. This is a programming error.", localizationFile);
}
else
{
FMLLog.log(Level.ERROR, "The language resource %s cannot be located on the classpath. This is a programming error.", localizationFile);
}
}
}
示例15: ForgeModContainer
import cpw.mods.fml.common.Loader; //导入依赖的package包/类
public ForgeModContainer()
{
super(new ModMetadata());
ModMetadata meta = getMetadata();
meta.modId = "Forge";
meta.name = "Minecraft Forge";
meta.version = String.format("%d.%d.%d.%d", majorVersion, minorVersion, revisionVersion, buildVersion);
meta.credits = "Made possible with help from many people";
meta.authorList = Arrays.asList("LexManos", "Eloraam", "Spacetoad");
meta.description = "Minecraft Forge is a common open source API allowing a broad range of mods " +
"to work cooperatively together. It allows many mods to be created without " +
"them editing the main Minecraft code.";
meta.url = "http://MinecraftForge.net";
meta.updateUrl = "http://MinecraftForge.net/forum/index.php/topic,5.0.html";
meta.screenshots = new String[0];
meta.logoFile = "/forge_logo.png";
config = null;
File cfgFile = new File(Loader.instance().getConfigDir(), "forge.cfg");
config = new Configuration(cfgFile);
syncConfig(true);
}