public static void revertToFrozen() { if (!PersistentRegistry.FROZEN.isPopulated()) { FMLLog.warning("Can't revert to frozen GameData state without freezing first."); return; } else { FMLLog.fine("Reverting to frozen data state."); } for (Map.Entry<ResourceLocation, FMLControlledNamespacedRegistry<?>> r : PersistentRegistry.ACTIVE.registries.entrySet()) { final Class<? extends IForgeRegistryEntry> registrySuperType = PersistentRegistry.ACTIVE.getRegistrySuperType(r.getKey()); loadRegistry(r.getKey(), PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE, registrySuperType); } // the id mapping has reverted, fire remap events for those that care about id changes Loader.instance().fireRemapEvent(ImmutableMap.<ResourceLocation, Integer[]>of(), ImmutableMap.<ResourceLocation, Integer[]>of(), true); // the id mapping has reverted, ensure we sync up the object holders ObjectHolderRegistry.INSTANCE.applyObjectHolders(); FMLLog.fine("Frozen state restored."); }
private void detectOptifine() { try { Class<?> optifineConfig = Class.forName("Config", false, Loader.instance().getModClassLoader()); String optifineVersion = (String) optifineConfig.getField("VERSION").get(null); Map<String,Object> dummyOptifineMeta = ImmutableMap.<String,Object>builder().put("name", "Optifine").put("version", optifineVersion).build(); InputStream optifineModInfoInputStream = getClass().getResourceAsStream("optifinemod.info"); try { ModMetadata optifineMetadata = MetadataCollection.from(optifineModInfoInputStream, "optifine").getMetadataForId("optifine", dummyOptifineMeta); optifineContainer = new DummyModContainer(optifineMetadata); FMLLog.info("Forge Mod Loader has detected optifine %s, enabling compatibility features", optifineContainer.getVersion()); } finally { IOUtils.closeQuietly(optifineModInfoInputStream); } } catch (Exception e) { optifineContainer = null; } }
@Override protected void drawGuiContainerForegroundLayer(int x, int y) { super.drawGuiContainerForegroundLayer(x, y); boolean igwLoaded = Loader.isModLoaded(ModIds.IGWMOD); fontRenderer.drawString(widgetPage + 1 + "/" + (maxPage + 1), 305, 175, 0xFF000000); fontRenderer.drawString(I18n.format("gui.programmer.difficulty"), 263, 191, 0xFF000000); if (showingWidgetProgress == 0) { programmerUnit.renderForeground(x, y, draggingWidget); } for (IProgWidget widget : visibleSpawnWidgets) { if (widget != draggingWidget && x - guiLeft >= widget.getX() && y - guiTop >= widget.getY() && x - guiLeft <= widget.getX() + widget.getWidth() / 2 && y - guiTop <= widget.getY() + widget.getHeight() / 2) { List<String> tooltip = new ArrayList<>(); widget.getTooltip(tooltip); if (igwLoaded) tooltip.add(I18n.format("gui.programmer.pressIForInfo")); if (tooltip.size() > 0) drawHoveringString(tooltip, x - guiLeft, y - guiTop, fontRenderer); } } }
@Override public void initGui() { super.initGui(); addAnimatedStat("gui.tab.info.ghostSlotInteraction.title", new ItemStack(Blocks.HOPPER), 0xFF00AAFF, true).setText("gui.tab.info.ghostSlotInteraction"); if (Loader.isModLoaded(ModIds.AE2)) { if(logistics.isPlacedOnInterface()) { Item item = AEApi.instance().definitions().parts().cableGlass().item(AEColor.TRANSPARENT); if(item == null) { Log.warning("AE2 cable couldn't be found!"); item = Itemss.LOGISTICS_FRAME_REQUESTER; } GuiAnimatedStat stat = addAnimatedStat("gui.tab.info.logisticsRequester.aeIntegration.title", new ItemStack(item, 1, 16), 0xFF00AAFF, false); List<String> text = new ArrayList<String>(); for(int i = 0; i < 2; i++) text.add(""); text.add("gui.tab.info.logisticsRequester.aeIntegration"); stat.setText(text); stat.addWidget(aeIntegration = new GuiCheckBox(1, 16, 13, 0xFF000000, "gui.tab.info.logisticsRequester.aeIntegration.enable")); } } }
/** * 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(); } }
@Override @Optional.Method(modid = ModIds.AE2) public void update(){ super.update(); if(!world.isRemote) { if(needToCheckForInterface) { if(Loader.isModLoaded(ModIds.AE2) && aeMode && gridNode == null) { needToCheckForInterface = checkForInterface(); } else { needToCheckForInterface = false; } } Iterator<Map.Entry<TileEntity, Integer>> iterator = providingInventories.entrySet().iterator(); while(iterator.hasNext()) { Map.Entry<TileEntity, Integer> entry = iterator.next(); if(entry.getValue() == 0 || entry.getKey().isInvalid()) { iterator.remove(); } else { entry.setValue(entry.getValue() - 1); } } } }
public void preInit(FMLPreInitializationEvent event) { // Load configuration from file File configDir = event.getModConfigurationDirectory(); config = new Configuration(new File(configDir.getPath(), "btweagles.cfg")); Config.readConfig(); registerFluids(); ModEntities.init(); if (Loader.isModLoaded("thermalexpansion")) { IntegrationThermal.preInit(); } }
@Mod.EventHandler public void onInit(FMLInitializationEvent ev) { info("Randores is Initializing...", "Sending handler message to WAILA."); FMLInterModComms.sendMessage("waila", "register", "com.gmail.socraticphoenix.randores.waila.RandoresWailaHandler.callbackRegister"); if (Loader.isModLoaded("waila")) { info("WAILA was found and should have receieved the handler message."); } else { info("WAILA wasn't found. The handler message will be ignored."); } info("Registering up GUI handler and world generators..."); NetworkRegistry.INSTANCE.registerGuiHandler(this, new RandoresGuiHandler()); GameRegistry.registerWorldGenerator(new RandoresWorldGenerator(), 10); GameRegistry.registerWorldGenerator(new RandoresAltarGenerator(), -100); info("Registered GUI hander and world generators.", "Calling proxy Initialization..."); Randores.PROXY.initSided(ev); info("Finished Initialization."); }
/** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ @Override public void initGui() { if (!hasCheckedForUpdates) { if (modButton != null) { for (ModContainer mod : Loader.instance().getModList()) { Status status = ForgeVersion.getResult(mod).status; if (status == Status.OUTDATED || status == Status.BETA_OUTDATED) { // TODO: Needs better visualization, maybe stacked icons // drawn in a terrace-like pattern? showNotification = Status.OUTDATED; } } } hasCheckedForUpdates = true; } }
@Mod.EventHandler public void init(FMLInitializationEvent event) { CapabilityExtendedHealthSystem.register(); int i = 0; NETWORKING = NetworkRegistry.INSTANCE.newSimpleChannel(MODID); NETWORKING.registerMessage(MessageReceiveDamage.Handler.class, MessageReceiveDamage.class, ++i, Side.CLIENT); NETWORKING.registerMessage(MessageApplyHealingItem.Handler.class, MessageApplyHealingItem.class, ++i , Side.SERVER); NETWORKING.registerMessage(MessageReceiveConfiguration.Handler.class, MessageReceiveConfiguration.class, ++i, Side.CLIENT); NETWORKING.registerMessage(MessageApplyAbsorption.Handler.class, MessageApplyAbsorption.class, ++i, Side.CLIENT); NETWORKING.registerMessage(MessageAddHealth.Handler.class, MessageAddHealth.class, ++i, Side.CLIENT); NETWORKING.registerMessage(MessagePlayHurtSound.Handler.class, MessagePlayHurtSound.class, ++i, Side.CLIENT); NETWORKING.registerMessage(MessageClientUpdate.Handler.class, MessageClientUpdate.class, ++i, Side.SERVER); NETWORKING.registerMessage(MessageResync.Handler.class, MessageResync.class, ++i, Side.CLIENT); MessageReceiveConfiguration.validate(); if (Loader.isModLoaded("morpheus")) { enableMorpheusCompat = true; logger.info("Morpheus present - enabling compatibility module"); MorpheusHelper.register(); } RegistryManager.registerDefaults(); checkEarlyExit(); }
/** Set the actual port used for mission control - not persisted, could be different each time the Mod is run. * @param port the port currently in use for mission control. */ static public void setMissionControlPort(int port) { if (port != AddressHelper.missionControlPort) { AddressHelper.missionControlPort = port; // Also update our metadata, for displaying to the user: ModMetadata md = Loader.instance().activeModContainer().getMetadata(); if (port != -1) md.description = "Talk to this Mod using port " + EnumChatFormatting.GREEN + port; else md.description = EnumChatFormatting.RED + "ERROR: No mission control port - check configuration"; // See if changing the port should lead to changing the login details: //AuthenticationHelper.update(MalmoMod.instance.getModPermanentConfigFile()); } }
public final T setRegistryName(String name) { if (getRegistryName() != null) throw new IllegalStateException("Attempted to set registry name with existing registry name! New: " + name + " Old: " + getRegistryName()); int index = name.lastIndexOf(':'); String oldPrefix = index == -1 ? "" : name.substring(0, index); name = index == -1 ? name : name.substring(index + 1); ModContainer mc = Loader.instance().activeModContainer(); String prefix = mc == null || (mc instanceof InjectedModContainer && ((InjectedModContainer)mc).wrappedContainer instanceof FMLContainer) ? "minecraft" : mc.getModId().toLowerCase(); if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) { FMLLog.bigWarning("Dangerous alternative prefix `%s` for name `%s`, expected `%s` invalid registry invocation/invalid name?", oldPrefix, name, prefix); prefix = oldPrefix; } this.registryName = new ResourceLocation(prefix, name); return (T)this; }
public void preInit(FMLPreInitializationEvent event) { File directory = event.getModConfigurationDirectory(); config = new Configuration(new File(directory.getPath(), "adventurers_toolbox.cfg")); Config.readConfig(); MinecraftForge.EVENT_BUS.register(new HandpickHarvestHandler()); MinecraftForge.EVENT_BUS.register(new SpecialToolAbilityHandler()); MinecraftForge.EVENT_BUS.register(new HammerHandler()); MinecraftForge.EVENT_BUS.register(new WeaponHandler()); MinecraftForge.EVENT_BUS.register(new WorldHandler()); ModMaterials.init(); Toolbox.logger.log(Level.INFO, "Initialized tool part materials with " + Materials.head_registry.size() + " head materials, " + Materials.haft_registry.size() + " haft materials, " + Materials.handle_registry.size() + " handle materials, and " + Materials.adornment_registry.size() + " adornment materials"); ModEntities.init(); if (Loader.isModLoaded("tconstruct") && Config.ENABLE_TINKERS_COMPAT) { TConstructCompat.preInit(); } }
public void preInit() { creativeTabModularMachinery = new CreativeTabs(ModularMachinery.MODID) { @Override public ItemStack getTabIconItem() { return new ItemStack(BlocksMM.blockController); } }; MachineRegistry.getRegistry().buildRegistry(); RecipeRegistry.getRegistry().buildRegistry(); MinecraftForge.EVENT_BUS.register(new RegistrationBus()); RegistryBlocks.initialize(); RegistryItems.initialize(); NetworkRegistry.INSTANCE.registerGuiHandler(ModularMachinery.MODID, this); if(Loader.isModLoaded("crafttweaker")) { MinecraftForge.EVENT_BUS.register(new ModIntegrationCrafttweaker()); } }
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()]); }
/** * Build an object depending on if a specific target mod is loaded or not. * * Usually would be used to access an object from the other mod. * * @param modId The modId I conditionally want to build an object for * @param className The name of the class I wish to instantiate * @return An optional containing the object if possible, or null if not */ public Optional<?> buildSoftDependProxy(String modId, String className, Object... arguments) { if (Loader.isModLoaded(modId)) { Class<?>[] args = Lists.transform(Lists.newArrayList(arguments),new Function<Object, Class<?>>() { @Nullable @Override public Class<?> apply(@Nullable Object input) { return input.getClass(); } }).toArray(new Class[0]); try { Class<?> clz = Class.forName(className,true,Loader.instance().getModClassLoader()); Constructor<?> ct = clz.getConstructor(args); return Optional.fromNullable(ct.newInstance(arguments)); } catch (Exception e) { FMLLog.getLogger().log(Level.INFO, "An error occurred trying to build a soft depend proxy",e); return Optional.absent(); } } return Optional.absent(); }
@Override protected void keyTyped(char key, int keyCode) throws IOException { super.keyTyped(key, keyCode); if (nameField.isFocused()) { return; } if (Keyboard.KEY_I == keyCode && Loader.isModLoaded(ModIds.IGWMOD)) { onIGWAction(); } if (Keyboard.KEY_R == keyCode) { if (exportButton.getBounds().contains(lastMouseX, lastMouseY)) { NetworkHandler.sendToServer(new PacketGuiButton(0)); } } if (Keyboard.KEY_SPACE == keyCode) { toggleShowWidgets(); } if (Keyboard.KEY_DELETE == keyCode) { IProgWidget widget = programmerUnit.getHoveredWidget(lastMouseX, lastMouseY); if (widget != null) { te.progWidgets.remove(widget); NetworkHandler.sendToServer(new PacketProgrammerUpdate(te)); } } if (Keyboard.KEY_Z == keyCode) { NetworkHandler.sendToServer(new PacketGuiButton(undoButton.id)); } if (Keyboard.KEY_Y == keyCode) { NetworkHandler.sendToServer(new PacketGuiButton(redoButton.id)); } }
private void sendEvent(String name, Object... parms) { if (Loader.isModLoaded(ModIds.COMPUTERCRAFT)) { for (IComputerAccess computer : attachedComputers) { computer.queueEvent(name, parms); } } }
public static void addTooltip(ItemStack stack, World world, List<String> curInfo) { String info = "gui.tooltip." + stack.getUnlocalizedName();//getItem().getUnlocalizedName(); String translatedInfo = I18n.format(info); if (!translatedInfo.equals(info)) { if (PneumaticCraftRepressurized.proxy.isSneakingInGui()) { translatedInfo = TextFormatting.AQUA + translatedInfo; if (!Loader.isModLoaded(ModIds.IGWMOD)) translatedInfo += " \\n \\n" + I18n.format("gui.tab.info.assistIGW"); curInfo.addAll(PneumaticCraftUtils.convertStringIntoList(translatedInfo, 40)); } else { curInfo.add(TextFormatting.AQUA + I18n.format("gui.tooltip.sneakForInfo")); } } }
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); } } }
@SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, World world, List<String> curInfo, ITooltipFlag flag) { if (stack.hasTagCompound() && stack.getTagCompound().hasKey(PneumaticCraftUtils.SAVED_TANKS, Constants.NBT.TAG_COMPOUND)) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag(PneumaticCraftUtils.SAVED_TANKS); for (String s : tag.getKeySet()) { NBTTagCompound tankTag = tag.getCompoundTag(s); FluidTank tank = new FluidTank(tankTag.getInteger("Amount")); tank.readFromNBT(tankTag); FluidStack fluidStack = tank.getFluid(); if (fluidStack != null && fluidStack.amount > 0) { curInfo.add(fluidStack.getFluid().getLocalizedName(fluidStack) + ": " + fluidStack.amount + "mB"); } } } if (PneumaticCraftRepressurized.proxy.isSneakingInGui()) { TileEntity te = createTileEntity(world, getDefaultState()); if (te instanceof TileEntityPneumaticBase) { float pressure = ((TileEntityPneumaticBase) te).dangerPressure; curInfo.add(TextFormatting.YELLOW + I18n.format("gui.tooltip.maxPressure", pressure)); } } String info = "gui.tab.info." + stack.getUnlocalizedName(); String translatedInfo = I18n.format(info); if (!translatedInfo.equals(info)) { if (PneumaticCraftRepressurized.proxy.isSneakingInGui()) { translatedInfo = TextFormatting.AQUA + translatedInfo.substring(2); if (!Loader.isModLoaded(ModIds.IGWMOD)) translatedInfo += " \\n \\n" + I18n.format("gui.tab.info.assistIGW"); curInfo.addAll(PneumaticCraftUtils.convertStringIntoList(translatedInfo, 40)); } else { curInfo.add(TextFormatting.AQUA + I18n.format("gui.tooltip.sneakForInfo")); } } }
@Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, ITooltipFlag advanced) { EnergyHatchSize size = EnergyHatchSize.values()[MathHelper.clamp(stack.getMetadata(), 0, EnergyHatchSize.values().length - 1)]; tooltip.add(TextFormatting.GRAY + I18n.format("tooltip.energyhatch.storage", size.maxEnergy)); tooltip.add(TextFormatting.GRAY + I18n.format("tooltip.energyhatch.in.accept", size.transferLimit)); if(Loader.isModLoaded("ic2")) { tooltip.add(""); tooltip.add(TextFormatting.GRAY + I18n.format("tooltip.energyhatch.ic2.in.voltage", TextFormatting.BLUE + I18n.format("tooltip.energyhatch.ic2.any"))); tooltip.add(TextFormatting.GRAY + I18n.format("tooltip.energyhatch.ic2.in.transfer", TextFormatting.BLUE + I18n.format("tooltip.energyhatch.ic2.any"), TextFormatting.BLUE + I18n.format("tooltip.energyhatch.ic2.powerrate"))); } }
protected static String getCurrentMod() { ModContainer container = Loader.instance().activeModContainer(); if (container == null) { throw new IllegalStateException("Objects MUST be created inside a mod"); } return container.getModId(); }
public static boolean isIc2Available() { if (ic2Available != null) return ic2Available; boolean loaded = Loader.isModLoaded("IC2"); if (Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) { ic2Available = loaded; } return loaded; }
/** * Sets the internal Registry instance. * ONLY IC2 CAN DO THIS!!!!!!! */ public static void setInstance(IRotorRegistry i) { ModContainer mc = Loader.instance().activeModContainer(); if (mc == null || !"IC2".equals(mc.getModId())) { throw new IllegalAccessError("Only IC2 can set the instance"); } else { INSTANCE = i; } }
/** * Sets the internal INetworkManager instance. * ONLY IC2 CAN DO THIS!!!!!!! */ public static void setInstance(INetworkManager server, INetworkManager client) { ModContainer mc = Loader.instance().activeModContainer(); if (mc == null || !"IC2".equals(mc.getModId())) { throw new IllegalAccessError(); } serverInstance = server; clientInstance = client; }
/** * Sets the internal IItemAPI instance. * ONLY IC2 CAN DO THIS!!!!!!! */ public static void setInstance(IItemAPI api) { ModContainer mc = Loader.instance().activeModContainer(); if (mc == null || !"IC2".equals(mc.getModId())) { throw new IllegalAccessError("invoked from "+mc); } instance = api; }
public static void generateCrushedRecipes() { crushedRecipes.put(new ItemStack(Blocks.STONE), new ItemStack(Blocks.COBBLESTONE)); crushedRecipes.put(new ItemStack(Blocks.COBBLESTONE), new ItemStack(Blocks.GRAVEL)); crushedRecipes.put(new ItemStack(Blocks.GRAVEL), new ItemStack(Blocks.SAND)); ItemStack latest = new ItemStack(Blocks.SAND); if (Loader.isModLoaded("exnihilocreatio")) { Block dust = Block.REGISTRY.getObject(new ResourceLocation("exnihilocreatio:block_dust")); crushedRecipes.put(new ItemStack(Blocks.SAND), latest = new ItemStack(dust)); } NonNullList<ItemStack> items = OreDictionary.getOres("itemSilicon"); if (items.size() > 0) crushedRecipes.put(latest, items.get(0)); }
public void preInit(FMLPreInitializationEvent event) { IFRegistries.poke(); CraftingHelper.register(new ResourceLocation(Reference.MOD_ID, "configuration_value"), new ConfigurationConditionFactory()); random = new Random(); FluidsRegistry.registerFluids(); BlockRegistry.poke(); MinecraftForge.EVENT_BUS.register(new BlockRegistry()); MinecraftForge.EVENT_BUS.register(new ItemRegistry()); MinecraftForge.EVENT_BUS.register(new StrawRegistry()); MinecraftForge.EVENT_BUS.register(new MeatFeederTickHandler()); MinecraftForge.EVENT_BUS.register(new MobDeathHandler()); MinecraftForge.EVENT_BUS.register(new WorldTickHandler()); MinecraftForge.EVENT_BUS.register(new PlantRecollectableRegistryHandler()); MinecraftForge.EVENT_BUS.register(new FakePlayerRideEntityHandler()); MinecraftForge.EVENT_BUS.register(new PlantInteractorHarvestDropsHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(IndustrialForegoing.instance, new GuiHandler()); CustomConfiguration.config = new Configuration(event.getSuggestedConfigurationFile()); CustomConfiguration.config.load(); CustomConfiguration.sync(); CustomConfiguration.configValues = new HashMap<>(); CustomConfiguration.configValues.put("useTEFrames", CustomConfiguration.config.getBoolean("useTEFrames", Configuration.CATEGORY_GENERAL, true, "Use Thermal Expansion Machine Frames instead of Tesla Core Lib")); if (Loader.isModLoaded("crafttweaker")) CraftTweakerHelper.register(); EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID, "pink_slime"), EntityPinkSlime.class, "pink_slime", 135135, IndustrialForegoing.instance, 32, 1, false, 10485860, 16777215); PINK_SLIME_LOOT = LootTableList.register(new ResourceLocation(Reference.MOD_ID, "entities/pink_slime")); }
public static void register(){ if (registered) return; registered = true; String mcVersion = Loader.instance().getMinecraftModContainer().getVersion(); MobBlocker.logger.info(mcVersion); if (mcVersion.equals("1.10.2")) { FMLInterModComms.sendMessage("Waila", "register", "maxwell_lt.mobblocker.integration.WailaCompatibility.load"); MobBlocker.logger.info("Sent IMC"); } else FMLInterModComms.sendMessage("waila", "register", "maxwell_lt.mobblocker.integration.WailaCompatibility.load"); }
public void preInit() { if(getName() == null) throw new IllegalArgumentException("name of config file cant be null"); File configFile = new File(Loader.instance().getConfigDir(), HarshenCastle.MODID + "/" + getName() + ".cfg"); config = new Configuration(configFile); syncConfig(); }
public static void initializeCompat() { MC_VERSION = Loader.instance().getMinecraftModContainer().getVersion(); COMMON_CAPABILITIES = isModLoaded("commoncapabilities"); if (MC_VERSION.equals("1.10") || MC_VERSION.equals("1.10.2")) WAILA = isModLoaded("Waila"); // 1.10. else WAILA = isModLoaded("waila"); // 1.11. }
private static boolean isModLoaded(String modname) { if(Loader.isModLoaded(modname)) { LogUtility.info("Found mod " + modname); return true; } return false; }
public static void registerImplementation(IServerHost plugin) { if (Loader.isModLoaded("minetogether")) { Object mod = Loader.instance().getIndexedModList().get("minetogether").getMod(); ((ICreeperHostMod) mod).registerImplementation(plugin); } }
@Optional.Method(modid = "tconstruct") public static void init() { TinkerRegistry.registerMelting(new MeltingRecipe(RecipeMatch.of(ModBlocks.butter, 1000), ModFluids.liquid_butter, 300)); TinkerRegistry.registerBasinCasting(new CastingRecipe(new ItemStack(ModBlocks.butter), ModFluids.liquid_butter, 1000, 60)); if (Loader.isModLoaded("xlfoodmod")) { TinkerRegistry.registerMelting(new MeltingRecipe(RecipeMatch.of(ItemListxlfoodmod.butter, 250), ModFluids.liquid_butter, 200)); TinkerRegistry.registerTableCasting(new CastingRecipe(new ItemStack(ItemListxlfoodmod.butter), RecipeMatch.of(TinkerSmeltery.castIngot), ModFluids.liquid_butter, 250, 15)); } }
@Optional.Method(modid = "immersiveengineering") public static void init() { if (Loader.isModLoaded("mysticalagriculture")) { BelljarHandler.registerBasicItemFertilizer(new ItemStack(ModItems.itemMysticalFertilizer), 2.25f); } }
@Optional.Method(modid = "thermalexpansion") public static void init() { CompressionManager.addFuel("liquid_butter", 64000); CrucibleManager.addRecipe(10000, new ItemStack(ModItems.butter), new FluidStack(ModFluids.liquid_butter, 1000)); if (Loader.isModLoaded("xlfoodmod")) { CrucibleManager.addRecipe(2500, new ItemStack(ItemListxlfoodmod.butter), new FluidStack(ModFluids.liquid_butter, 250)); } }
public void init(FMLInitializationEvent event) { // Register custom loot tables and auxiliaries LootConditionManager.registerCondition(new LootIsModLoaded.Serializer()); LootTableList.register(new ResourceLocation(BetterThanWeagles.MODID, "custom/simple_dungeon_chest")); ModVillagers.registerVillagerTrades(); // Set up integration with other mods if (Loader.isModLoaded("actuallyadditions")) { IntegrationAAdditions.init(); } if (Loader.isModLoaded("immersiveengineering")) { IntegrationIEngineering.init(); } if (Loader.isModLoaded("tconstruct")) { IntegrationTinkers.init(); } if (Loader.isModLoaded("thermalexpansion")) { IntegrationThermal.init(); } }
public static void initializeConfiguration() { File configFile = new File(Loader.instance().getConfigDir(), VillagerInventoryMod.MODID + ".cfg"); config = new Configuration(configFile); config.load(); syncConfig(true, true); }
@Nullable public static ComponentType getByString(String name) { for (ComponentType val : values()) { if(val.name().equalsIgnoreCase(name) && (val.modidRequired == null || Loader.isModLoaded(val.modidRequired))) { return val; } } return null; }