本文整理匯總了Java中net.minecraftforge.fml.common.Loader.isModLoaded方法的典型用法代碼示例。如果您正苦於以下問題:Java Loader.isModLoaded方法的具體用法?Java Loader.isModLoaded怎麽用?Java Loader.isModLoaded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.fml.common.Loader
的用法示例。
在下文中一共展示了Loader.isModLoaded方法的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();
}
}
示例2: 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()]);
}
示例3: onPostRender
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
@SubscribeEvent
public void onPostRender(RenderWorldLastEvent evt) {
if (!Loader.isModLoaded("baubles")) return;
EntityPlayer thePlayer = Minecraft.getMinecraft().player;
for(EntityPlayer entity : Minecraft.getMinecraft().world.playerEntities) {
IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(entity);
ItemStack scarfStack = baubles.getStackInSlot(BAUBLE_AMULET);
if (scarfStack==null || scarfStack.isEmpty() || scarfStack.getItem()!=ThermionicsItems.SCARF) return;
Scarf scarf = scarfCache.getIfPresent(entity);
if (scarf==null) {
scarf = new Scarf();
scarfCache.put(entity, scarf);
scarf.readFromNBT(scarfStack.getTagCompound());
//System.out.println("Created scarf:"+(scarf.leftScarf.size()+scarf.rightScarf.size())+" nodes.");
} else {
scarf.updateFromNBT(scarfStack.getTagCompound());
//System.out.println("Updated scarf:"+(scarf.leftScarf.size()+scarf.rightScarf.size())+" nodes.");
}
double dx = thePlayer.prevPosX + (thePlayer.posX - thePlayer.prevPosX) * evt.getPartialTicks();
double dy = thePlayer.prevPosY + (thePlayer.posY - thePlayer.prevPosY) * evt.getPartialTicks();
double dz = thePlayer.prevPosZ + (thePlayer.posZ - thePlayer.prevPosZ) * evt.getPartialTicks();
LayerScarf.renderScarf(
dx, dy, dz,
entity, null, scarf, evt.getPartialTicks(),
Minecraft.getMinecraft().world);
}
}
示例4: preInit
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
public void preInit(FMLPreInitializationEvent event)
{
// Handle configuration
File configDir = event.getModConfigurationDirectory();
config = new Configuration(new File(configDir.getPath(), "simplechunks.cfg"));
try
{
config.load();
GeneralConfig.readConfig(config);
}
catch (Exception e)
{
SimpleChunks.logger.error("Error loading config file!", e);
}
finally
{
if (config.hasChanged())
{
config.save();
}
}
// Integrate with other mods
if (Loader.isModLoaded("theoneprobe"))
{
TOPCompat.register();
}
// Register chunkloading callback
ForgeChunkManager.setForcedChunkLoadingCallback(SimpleChunks.instance, new ChunkLoadingHandler());
}
示例5: addInformation
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
tooltip.add(ChatFormatting.ITALIC + "" + ReadableNumberConverter.INSTANCE.toWideReadableForm(getEnergyStored(stack)) + "/" + ReadableNumberConverter.INSTANCE.toWideReadableForm(getMaxEnergyStored(stack)) + " RF");
tooltip.add("Stored Water: " + getFluidStored(stack) / 1000 + "/" + FLUID_CAPACITY / 1000 + " Buckets");
tooltip.add("");
tooltip.add(I18n.format("tooltip.tanaddons.thirstquencher.desc"));
tooltip.add(I18n.format("tooltip.tanaddons.thirstquencher.desc2"));
tooltip.add(I18n.format("tooltip.tanaddons.thirstquencher.desc3"));
if (Loader.isModLoaded(ModGlobals.MODID_BAUBLES)) {
tooltip.add(I18n.format("tooltip.tanaddons.baublesitem", "any"));
}
}
示例6: preInit
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
public static void preInit() {
//Add soulforged steel as a liquid
if (Loader.isModLoaded("betterwithmods")) {
Fluid soulforgedSteel = new Fluid("soulforged_steel", new ResourceLocation("tconstruct:blocks/fluids/molten_metal"), new ResourceLocation("tconstruct:blocks/fluids/molten_metal_flow"));
FluidRegistry.registerFluid(soulforgedSteel);
FluidRegistry.addBucketForFluid(soulforgedSteel);
NBTTagCompound tag = new NBTTagCompound();
tag.setString("fluid", soulforgedSteel.getName());
tag.setString("ore", "SoulforgedSteel");
tag.setBoolean("toolforge", false);
FMLInterModComms.sendMessage("tconstruct", "integrateSmeltery", tag);
}
}
示例7: registerListener
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
public static void registerListener()
{
enabled = Loader.isModLoaded("Dynmap");
if (enabled)
Gateway.register();
else
Log.debug("Dynmap is not available; integration disabled");
}
示例8: registerUpgrades
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
private static void registerUpgrades(IForgeRegistry<Item> registry) {
for (EnumUpgrade upgrade : EnumUpgrade.values()) {
if (upgrade != EnumUpgrade.THAUMCRAFT || Loader.isModLoaded(ModIds.THAUMCRAFT)) {
String upgradeName = upgrade.toString().toLowerCase() + "_upgrade";
Item upgradeItem = new ItemMachineUpgrade(upgradeName, upgrade.ordinal());
registerItem(registry, upgradeItem);
upgrades.put(upgrade, upgradeItem);
}
}
}
示例9: TileEntityBattery
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
public TileEntityBattery() {
//Batteries have a bit of a complicated relationship with their neighbors.
capabilities.registerForSides(CapabilityEnergy.ENERGY, ()->new NoExtractEnergyStorageView(energyStorage),
RelativeDirection.TOP, RelativeDirection.BOTTOM, RelativeDirection.PORT, RelativeDirection.STARBOARD, RelativeDirection.STERN);
capabilities.registerForSides(CapabilityEnergy.ENERGY, ()->new NoReceiveEnergyStorageView(energyStorage),
RelativeDirection.BOW);
capabilities.registerForSides(CapabilityEnergy.ENERGY, ()->energyStorage,
RelativeDirection.WITHIN);
energyStorage.listen(this::markDirty);
if (Loader.isModLoaded("probedataprovider")) {
ProbeDataSupport.registerRFInspector(this, capabilities);
}
}
示例10: isOptifineInstalled
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
public static boolean isOptifineInstalled() {
if(!isOptifineInstalled) {
isOptifineInstalled = Loader.isModLoaded("optifine");
}
return isOptifineInstalled;
}
示例11: addInformation
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
tooltip.add(ChatFormatting.ITALIC + "" + ReadableNumberConverter.INSTANCE.toWideReadableForm(getEnergyStored(stack)) + "/" + ReadableNumberConverter.INSTANCE.toWideReadableForm(getMaxEnergyStored(stack)) + " RF");
tooltip.add("");
tooltip.add(I18n.format("tooltip.tanaddons.ptempregulator.desc"));
tooltip.add(I18n.format("tooltip.tanaddons.ptempregulator.desc2"));
if (Loader.isModLoaded(ModGlobals.MODID_BAUBLES)) {
tooltip.add(I18n.format("tooltip.tanaddons.baublesitem", "any"));
}
}
示例12: isIc2Available
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
public static boolean isIc2Available() {
if (ic2Available != null) return ic2Available;
boolean loaded = Loader.isModLoaded("IC2");
if (Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) {
ic2Available = loaded;
}
return loaded;
}
示例13: init
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
public static void init() {
if (Loader.isModLoaded("probedataprovider")) {
internal = new InternalActual();
PROBE_PRESENT = true;
} else {
internal = new InternalDummy();
}
internal.init();
}
示例14: isLoaded
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
public boolean isLoaded() {
return Loader.isModLoaded(getId());
}
示例15: registerVillagerTrades
import net.minecraftforge.fml.common.Loader; //導入方法依賴的package包/類
public static void registerVillagerTrades()
{
careerKrog.addTrade(1, new VillagerTradeItemForItem(new ItemStack(ModItems.shiny_stone), new EntityVillager.PriceInfo(1, 1),
new ItemStack(Items.LEATHER), new EntityVillager.PriceInfo(2, 2)));
careerKrog.addTrade(1, new VillagerTradeItemForItem(new ItemStack(Items.PAINTING), new EntityVillager.PriceInfo(1, 1),
new ItemStack(Blocks.CACTUS), new EntityVillager.PriceInfo(8, 16)));
careerKrog.addTrade(1, new VillagerTradeItemForItem(new ItemStack(Items.FISHING_ROD), new EntityVillager.PriceInfo(1, 1),
new ItemStack(Items.FISH), new EntityVillager.PriceInfo(5, 8)));
careerKrog.addTrade(2, new VillagerTradeItemForItem(new ItemStack(Items.DYE), new EntityVillager.PriceInfo(5, 10),
new ItemStack(Blocks.VINE), new EntityVillager.PriceInfo(2, 4)));
if (Loader.isModLoaded("tconstruct"))
{
Item arrowhead = Item.REGISTRY.getObject(new ResourceLocation("tconstruct", "arrow_head"));
if (arrowhead != null)
{
NBTTagCompound material = new NBTTagCompound();
material.setString("Material", "obsidian");
ItemStack stack = new ItemStack(arrowhead);
stack.setTagCompound(material);
careerKrog.addTrade(2, new VillagerTradeItemForItem(new ItemStack(Items.COAL, 1, 1), new EntityVillager.PriceInfo(10, 20),
stack, new EntityVillager.PriceInfo(1, 1)));
}
}
if (Loader.isModLoaded("actuallyadditions"))
{
Item crystal = Item.REGISTRY.getObject(new ResourceLocation("actuallyadditions", "item_crystal"));
if (crystal != null)
{
ItemStack starterKit = createChickenSpawnerKit();
careerKrog.addTrade(3, new VillagerTradeItemForItem(new ItemStack(crystal, 1, 4), new EntityVillager.PriceInfo(1, 3),
starterKit, new EntityVillager.PriceInfo(1, 1)));
}
}
careerTorg.addTrade(1, new VillagerTradeItemForItem(new ItemStack(Items.BEEF), new EntityVillager.PriceInfo(1, 3),
new ItemStack(Blocks.SAPLING, 1, 3), new EntityVillager.PriceInfo(1, 3)));
careerTorg.addTrade(1, new VillagerTradeItemForItem(new ItemStack(Items.LEATHER), new EntityVillager.PriceInfo(2, 4),
new ItemStack(Items.MELON_SEEDS), new EntityVillager.PriceInfo(4, 6)));
Block net = Block.REGISTRY.getObject(new ResourceLocation("actuallyadditions", "block_fishing_net"));
if (net != Blocks.AIR)
{
careerTorg.addTrade(2, new VillagerTradeItemForItem(new ItemStack(net), new EntityVillager.PriceInfo(1, 1),
new ItemStack(Items.DYE, 1, 3), new EntityVillager.PriceInfo(24, 36)));
}
if (Loader.isModLoaded("rustic"))
{
NBTTagCompound parrotTag = new NBTTagCompound();
parrotTag.setString("id", "minecraft:parrot");
ItemStack parrotEgg = new ItemStack(Items.SPAWN_EGG, 1);
parrotEgg.setTagInfo("EntityTag", parrotTag);
careerTorg.addTrade(3, new VillagerTradeItemForItem(new ItemStack(rustic.common.items.ModItems.HONEYCOMB), new EntityVillager.PriceInfo(30, 40),
parrotEgg, new EntityVillager.PriceInfo(1, 1)));
}
}