public static ItemStack getItemStackFromConfig( String modid, String category, String name, int stackSize, int metadata, boolean isItem) { Configuration config = configFiles.get(modid); if (config == null) { File configFile = null; if (modid.equalsIgnoreCase("buildcraft")) configFile = new File(Loader.instance().getConfigDir(), "buildcraft/main.conf"); else if (modid.equalsIgnoreCase("EnderIO")) configFile = new File(Loader.instance().getConfigDir(), "enderio/EnderIO.conf"); else configFile = new File(Loader.instance().getConfigDir(), modid + ".cfg"); if (configFile != null && configFile.exists()) { config = new Configuration(configFile); config.load(); configFiles.put(modid, config); } else return null; } if (config.hasKey(category, name)) { int id = config.get(category, name, -1).getInt(); if (isItem && !modid.equals("immibis") && !modid.equals("foundry")) id += 256; if (id > 0 && id < 32768 && Item.itemsList[id] != null) { try { return new ItemStack(Item.itemsList[id], stackSize, metadata); } catch (Exception e) { e.printStackTrace(); return null; } } else return null; } else return null; }
public static void updateGUITicks(BaseModProxy mod, boolean enable, boolean useClock) { ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().getReversedModObjectList().get(mod); if (mlmc == null) { mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer(); } if (mlmc == null) { FMLLog.severe("Attempted to register ModLoader ticking for invalid BaseMod %s", mod); return; } EnumSet<TickType> ticks = mlmc.getGUITickHandler().ticks(); // If we're enabled and we don't want clock ticks we get render ticks if (enable && !useClock) { ticks.add(TickType.RENDER); } else { ticks.remove(TickType.RENDER); } // If we're enabled but we want clock ticks, or we're server side we get world ticks if (enable && useClock) { ticks.add(TickType.CLIENT); ticks.add(TickType.WORLDLOAD); } else { ticks.remove(TickType.CLIENT); ticks.remove(TickType.WORLDLOAD); } }
@Override @SideOnly(Side.CLIENT) // マウスオーバー時の表示情報 public void addInformation(ItemStack item, EntityPlayer player, List list, boolean b) { super.addInformation(item, player, list, b); boolean flag = Loader.isModLoaded("NotEnoughItems") && Loader.isModLoaded("DCsNEIPluginAMT"); if (flag) { list.add(EnumChatFormatting.ITALIC + "Push NEI Usage key : display recipes"); } }
/** * Called to start the whole game off * * @param minecraft The minecraft instance being launched * @param resourcePackList The resource pack list we will populate with mods * @param resourceManager The resource manager */ public void beginMinecraftLoading( Minecraft minecraft, List resourcePackList, ReloadableResourceManager resourceManager) { client = minecraft; this.resourcePackList = resourcePackList; this.resourceManager = resourceManager; this.resourcePackMap = Maps.newHashMap(); if (minecraft.func_71355_q()) { FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now."); haltGame("FML will not run in demo mode", new RuntimeException()); return; } // TextureFXManager.instance().setClient(client); FMLCommonHandler.instance().beginLoading(this); new ModLoaderClientHelper(client); 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(); ModMetadata optifineMetadata = MetadataCollection.from(getClass().getResourceAsStream("optifinemod.info"), "optifine") .getMetadataForId("optifine", dummyOptifineMeta); optifineContainer = new DummyModContainer(optifineMetadata); FMLLog.info( "Forge Mod Loader has detected optifine %s, enabling compatibility features", optifineContainer.getVersion()); } catch (Exception e) { optifineContainer = null; } try { Loader.instance().loadMods(); } catch (WrongMinecraftVersionException wrong) { wrongMC = wrong; } catch (DuplicateModsFoundException dupes) { dupesFound = dupes; } catch (MissingModsException missing) { modsMissing = missing; } catch (ModSortingException sorting) { modSorting = sorting; } catch (CustomModLoadingErrorDisplayException custom) { FMLLog.log( Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt"); customError = custom; } catch (LoaderException le) { haltGame( "There was a severe problem during mod loading that has caused the game to fail", le); return; } }
public static boolean hasMod(String modid, String version) { for (int i = 0; i < Loader.instance().getActiveModList().size(); i++) { ModContainer mod = Loader.instance().getActiveModList().get(i); if ((mod.getModId() + mod.getVersion().replaceFirst("v", "")).matches(modid + version)) { return true; } } return false; }
public void postInit() { if (Loader.isModLoaded("CarpentersBlocks")) { MwChunk.carpenterdata(); } if (Loader.isModLoaded("ForgeMultipart")) { MwChunk.FMPdata(); } MwAPI.registerDataProvider("Slime", new OverlaySlime()); MwAPI.registerDataProvider("Grid", new OverlayGrid()); // MwAPI.registerDataProvider("Checker", new OverlayChecker()); // MwAPI.setCurrentDataProvider("Slime"); }
private static <T extends Item> T registerItem(String modId, T item, String name) { Injector modController = new Injector( new Injector(Loader.instance(), Loader.class).getField("modController"), LoadController.class); Object old = modController.getField("activeContainer"); modController.setField("activeContainer", Loader.instance().getIndexedModList().get(modId)); GameRegistry.registerItem(item, name); modController.setField("activeContainer", old); return item; }
public ForestryModEnvWarningCallable() { this.modIDs = new ArrayList<String>(); if (FMLCommonHandler.instance().getSide() == Side.CLIENT && FMLClientHandler.instance().hasOptifine()) { modIDs.add("Optifine"); } if (Loader.isModLoaded("gregtech_addon")) { modIDs.add("GregTech"); } try { @SuppressWarnings("unused") Class<?> c = Class.forName("org.bukkit.Bukkit"); modIDs.add("Bukkit, MCPC+, or other Bukkit replacement"); } catch (Throwable t) { } // No need to do anything. // Add other bad mods here. if (modIDs.size() > 0) { FMLCommonHandler.instance().registerCrashCallable(this); } }
@SubscribeEvent public void onPost(AddonEvent.Post event) throws Exception { if (!Loader.isModLoaded(ExtraUtilitesLib.MOD_NAME)) return; for (int i = 0; i < ExtraUtilitesLib.PLANKS_1_COUNT; ++i) DogBedRegistry.CASINGS.registerMaterial(ExtraUtilitesLib.PLANKS_1_ID, i); }
public static void addBiomes() { if (Loader.isModLoaded("BuildCraft|Core") && ConfigBC.generateBCBiomes) { BiomeGenBase[] b = BiomeGenBase.getBiomeGenArray(); for (int i = 0; i < 256; i++) { if (b[i] != null) { BiomeGenBase bcBiome = b[i]; String biomeName = b[i].biomeName; String biomeClass = b[i].getBiomeClass().getName(); if (biomeName == "Desert Oil Field" && biomeClass == "buildcraft.energy.worldgen.BiomeGenOilDesert") { if (ConfigBC.generateBCDesertOilField) { bcDesertOilField = new RealisticBiomeBCDesertOilField(bcBiome); BiomeBase.addBiome(bcDesertOilField); BiomeBase.addVillageBiome(bcDesertOilField); } } else if (biomeName == "Ocean Oil Field" && biomeClass == "buildcraft.energy.worldgen.BiomeGenOilOcean") { if (ConfigBC.generateBCOceanOilField) { bcOceanOilField = new RealisticBiomeBCOceanOilField(bcBiome); BiomeBase.addBiome(bcOceanOilField); BiomeBase.addVillageBiome(bcOceanOilField); } } } } } }
private void sendEvent(String name, Object... parms) { if (Loader.isModLoaded(ModIds.COMPUTERCRAFT)) { for (IComputerAccess computer : attachedComputers) { computer.queueEvent(name, parms); } } }
@EventHandler public void postInit(FMLPostInitializationEvent event) { if (Loader.isModLoaded("ForgeMultipart")) { new RegisterParts().init(); CommonProxy.multiPartID = MultipartProxy.config().getTag("block.id").getIntValue(); } }
public static void init() { if (Loader.isModLoaded("ForgeMultipart")) { System.out.print("ForgeMultipart is installed, adding intergration" + '\n'); ForgeMultipart.init(); } if (Loader.isModLoaded("TinkersConstruct")) { // System.out.print("Tinkers Construct is installed, adding intergration" + '\n'); TinkersConstruct.init(); } if (Loader.isModLoaded("Thaumcraft")) { System.out.print("Thaumcraft is installed, adding intergration" + '\n'); Thaumcraft.init(); } }
/** * Called a bit later on during initialization to finish loading mods Also initializes key * bindings */ @SuppressWarnings("deprecation") public void finishMinecraftLoading() { if (modsMissing != null || wrongMC != null || customError != null || dupesFound != null || modSorting != null) { return; } try { Loader.instance().initializeMods(); } catch (CustomModLoadingErrorDisplayException custom) { FMLLog.log( Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt"); customError = custom; return; } catch (LoaderException le) { haltGame( "There was a severe problem during mod loading that has caused the game to fail", le); return; } LanguageRegistry.reloadLanguageTable(); RenderingRegistry.instance() .loadEntityRenderers( (Map<Class<? extends Entity>, Render>) RenderManager.field_78727_a.field_78729_o); loading = false; KeyBindingRegistry.instance().uploadKeyBindingsToGame(client.field_71474_y); }
public static void registerInventoryTabs() { if (!Loader.isModLoaded("TConstruct") || TabRegistry.getTabList().size() < 3) { TabRegistry.registerTab(new InventoryTabVanilla()); } TabRegistry.registerTab(new InventoryTabGalacticraft()); }
@Mod.EventHandler public void init(FMLInitializationEvent event) { IEContent.init(); GameRegistry.registerWorldGenerator(new IEWorldGen(), 0); MinecraftForge.EVENT_BUS.register(new EventHandler()); FMLCommonHandler.instance().bus().register(new EventHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); proxy.init(); Lib.IC2 = Loader.isModLoaded("IC2") && Config.getBoolean("ic2compat"); Lib.GREG = Loader.isModLoaded("gregtech") && Config.getBoolean("gregtechcompat"); Config.setBoolean("ic2Manual", Lib.IC2); Config.setBoolean("gregManual", Lib.GREG); for (IECompatModule compat : IECompatModule.modules) compat.init(); int messageId = 0; packetHandler.registerMessage( MessageMineralListSync.Handler.class, MessageMineralListSync.class, messageId++, Side.CLIENT); packetHandler.registerMessage( MessageTileSync.Handler.class, MessageTileSync.class, messageId++, Side.SERVER); packetHandler.registerMessage( MessageSpeedloaderSync.Handler.class, MessageSpeedloaderSync.class, messageId++, Side.CLIENT); packetHandler.registerMessage( MessageSkyhookSync.Handler.class, MessageSkyhookSync.class, messageId++, Side.CLIENT); packetHandler.registerMessage( MessageMinecartShaderSync.HandlerServer.class, MessageMinecartShaderSync.class, messageId++, Side.SERVER); packetHandler.registerMessage( MessageMinecartShaderSync.HandlerClient.class, MessageMinecartShaderSync.class, messageId++, Side.CLIENT); packetHandler.registerMessage( MessageRequestBlockUpdate.Handler.class, MessageRequestBlockUpdate.class, messageId++, Side.SERVER); }
public void loadRecipes() { CoreProxy.proxy.addCraftingRecipe( new ItemStack(wrenchItem), "I I", " G ", " I ", 'I', "ingotIron", 'G', "gearStone"); CoreProxy.proxy.addCraftingRecipe( new ItemStack(woodenGearItem), " S ", "S S", " S ", 'S', "stickWood"); CoreProxy.proxy.addCraftingRecipe( new ItemStack(stoneGearItem), " I ", "IGI", " I ", 'I', "cobblestone", 'G', "gearWood"); CoreProxy.proxy.addCraftingRecipe( new ItemStack(ironGearItem), " I ", "IGI", " I ", 'I', "ingotIron", 'G', "gearStone"); CoreProxy.proxy.addCraftingRecipe( new ItemStack(goldGearItem), " I ", "IGI", " I ", 'I', "ingotGold", 'G', "gearIron"); CoreProxy.proxy.addCraftingRecipe( new ItemStack(diamondGearItem), " I ", "IGI", " I ", 'I', "gemDiamond", 'G', "gearGold"); CoreProxy.proxy.addCraftingRecipe( new ItemStack(mapLocationItem), "ppp", "pYp", "ppp", 'p', Items.paper, 'Y', "dyeYellow"); CoreProxy.proxy.addCraftingRecipe( new ItemStack(engineBlock, 1, 0), "www", " g ", "GpG", 'w', "plankWood", 'g', "blockGlass", 'G', "gearWood", 'p', Blocks.piston); CoreProxy.proxy.addCraftingRecipe( new ItemStack(paintbrushItem), " iw", " gi", "s ", 's', "stickWood", 'g', "gearWood", 'w', new ItemStack(Blocks.wool, 1, 0), 'i', Items.string); ItemStack anyPaintbrush = new ItemStack(paintbrushItem, 1, OreDictionary.WILDCARD_VALUE); for (int i = 0; i < 16; i++) { ItemStack outputStack = new ItemStack(paintbrushItem); NBTUtils.getItemData(outputStack).setByte("color", (byte) i); CoreProxy.proxy.addShapelessRecipe(outputStack, anyPaintbrush, EnumColor.fromId(i).getDye()); } if (Loader.isModLoaded("BuildCraft|Silicon")) { CoreSiliconRecipes.loadSiliconRecipes(); } else { CoreProxy.proxy.addCraftingRecipe( new ItemStack(listItem), "ppp", "pYp", "ppp", 'p', Items.paper, 'Y', "dyeGreen"); } }
/** * Loads in all the localization files from the Localizations library class */ public static void loadConfig() { config = new TagFile(); InputStream var0 = Harmonion.class.getResourceAsStream("/net/Harmonion/client/lang/default.cfg"); config.readStream(var0); File var1; if (configDir == null) { var1 = Loader.instance().getConfigDir(); var1 = new File(var1, "/Harmonion/"); var1.mkdir(); configDir = var1; configFile = new File(var1, "Harmonion.cfg"); } if (configFile.exists()) { config.readFile(configFile); } config.commentFile("Harmonion Configuration"); String var2; Iterator var4; for (var4 = config.query("blocks.%.%.id").iterator(); var4.hasNext(); reservedIds[config.getInt(var2)] = true) { var2 = (String) var4.next(); } for (var4 = config.query("items.%.%.id").iterator(); var4.hasNext(); reservedIds[config.getInt(var2) + 256] = true) { var2 = (String) var4.next(); } if (hmcTranslateTable == null) { hmcTranslateTable = new Properties(); } try { hmcTranslateTable.load( Harmonion.class.getResourceAsStream("/net/Harmonion/client/lang/Harmonion.lang")); var1 = new File(configDir, "Harmonion.lang"); if (var1.exists()) { FileInputStream var5 = new FileInputStream(var1); hmcTranslateTable.load(var5); } } catch (IOException var3) { var3.printStackTrace(); } var4 = hmcTranslateTable.entrySet().iterator(); while (var4.hasNext()) { Entry var6 = (Entry) var4.next(); LanguageRegistry.instance() .addStringLocalization((String) var6.getKey(), (String) var6.getValue()); } }
@Mod.EventHandler public void init(FMLInitializationEvent event) { IEContent.init(); GameRegistry.registerWorldGenerator(new IEWorldGen(), 0); MinecraftForge.EVENT_BUS.register(new EventHandler()); FMLCommonHandler.instance().bus().register(new EventHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); proxy.init(); Lib.IC2 = Loader.isModLoaded("IC2") && Config.getBoolean("ic2compat"); Lib.GREG = Loader.isModLoaded("gregtech") && Config.getBoolean("gregtechcompat"); for (IECompatModule compat : IECompatModule.modules) compat.init(); packetHandler.registerMessage( MessageMineralListSync.Handler.class, MessageMineralListSync.class, 0, Side.CLIENT); }
/** @deprecated no replacement planned */ @Deprecated public static ModContainer findModOwner(String string) { UniqueIdentifier ui = new UniqueIdentifier(string); if (customOwners.containsKey(ui)) { return customOwners.get(ui); } return Loader.instance().getIndexedModList().get(ui.modId); }
@Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { NewDawnRegistry.registerProvider(new VanillaBiomeProvider()); if (this.thaumcraftSupportEnabled && Loader.isModLoaded("Thaumcraft")) { NewDawnRegistry.registerProvider(new ThaumcraftBiomeProvider()); log.info("Internal Thaumcraft support enabled."); } }
@SubscribeEvent public void onCrashReportEvent(CrashReportEvent event) { if (!diagnostics) return; if (event.getHeader().length() > 0) { return; } Throwable t = event.getThrowable(); if (t instanceof LoaderException || t instanceof InvocationTargetException || t instanceof ReportedException) { t = t.getCause(); } if (t == null) { return; } try { event.setHeader(handleThrowable(t)); } catch (Throwable t2) { // Ignore any errors. We don't want to f**k up the crash reports. } List<ModContainer> mods = Utils.getModsFromStackTrace(event.getThrowable().getStackTrace()); Set<ModContainer> s = Sets.newHashSet(); ModContainer active = Loader.instance().activeModContainer(); if (!mods.isEmpty() || (active != null && !active.getModId().equals("SquidAPI"))) { CrashReportCategory c = event.createCategory("Possibly involved mods"); if (active != null && !active.getModId().equals("SquidAPI")) c.addCrashSection( active.getName(), String.format( "Version: %s. Main class: %s. Source: %s. Url: %s. Checksum: %s.", active.getVersion(), active.getMod().getClass().getName(), active.getSource().getName(), active.getMetadata().url, getChecksum(active.getSource()))); for (ModContainer mod : mods) { if (!s.contains(mod)) { c.addCrashSection( mod.getName(), String.format( "Version: %s. Main class: %s. Source: %s. Url: %s. Checksum: %s.", mod.getVersion(), mod.getMod().getClass().getName(), mod.getSource().getName(), mod.getMetadata().url, getChecksum(mod.getSource()))); s.add(mod); } } } try { if (Utils.isCoolSquid()) { event.setHeader("DRM!!! IT'S DRMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM!!!!!!!!!"); } } catch (Throwable t2) { } }
public static void registerMultiparts() { if (Loader.isModLoaded("ForgeMultipart")) { try { Class clazz = Class.forName("vazkii.botania.common.integration.multipart.MultipartHandler"); clazz.newInstance(); } catch (Throwable e) { } } }
public UpgradeRenderer() { if (!Loader.isModLoaded(Mods.OpenComputers)) { entitledPlayers = null; WHITE = null; return; } entitledPlayers = new HashMap<String, Triple>(); WHITE = new Triple(1, 1, 1); entitledPlayers.put("Vexatos", WHITE); }
@Override protected void onInit() { isAppleCoreLoaded = Loader.isModLoaded(AppleCoreHelper.MODID); try { hasDispatcher = isAppleCoreLoaded && Class.forName("squeek.applecore.api.IAppleCoreDispatcher") != null; } catch (ClassNotFoundException e) { hasDispatcher = false; } }
public void registerKeys() { // Register bindings for (KeyBinding key : this.keys) { if (key != null) ClientRegistry.registerKeyBinding(key); } if (Loader.isModLoaded("notenoughkeys")) Api.registerMod(TConstruct.modID, ArmorControls.keyDescs); // Add mc keys this.keys[4] = ArmorControls.jumpKey; this.keys[5] = ArmorControls.invKey; }
/** @param guiMainMenu */ public GuiModList(GuiScreen mainMenu) { this.mainMenu = mainMenu; this.mods = new ArrayList<ModContainer>(); FMLClientHandler.instance().addSpecialModEntries(mods); for (ModContainer mod : Loader.instance().getModList()) { if (mod.getMetadata() != null && mod.getMetadata().parentMod != null) { continue; } mods.add(mod); } }
public static void init() { biomes_snow = new ArrayList<RealisticBiomeBase>(); biomes_cold = new ArrayList<RealisticBiomeBase>(); biomes_hot = new ArrayList<RealisticBiomeBase>(); biomes_wet = new ArrayList<RealisticBiomeBase>(); biomes_small = new ArrayList<RealisticBiomeBase>(); biomes_test = new ArrayList<RealisticBiomeBase>(); if (Loader.isModLoaded("BiomesOPlenty")) { SupportBOP.init(); } if (Loader.isModLoaded("ExtrabiomesXL")) { SupportEBXL.init(); } if (Loader.isModLoaded("Thaumcraft")) { SupportTC.init(); } }
@Override public void createControls() { controls.add(new GuiMachineProgressControl("progress", block, machine, 46, 6, 96, 51)); GuiPowerOMeter meter = new GuiPowerOMeter("power", block, machine, -23, 34, 78, 15); meter.rotation = 90; controls.add(meter); controls.add(new GuiGearInformation("gear", block, machine, 140, 53, 30, 30)); controls.add(new GuiRedstoneControl(25, 60, 20, 20, 0, machine)); if (Loader.isModLoaded("NotEnoughItems")) controls.add(new SubGuiMachineRecipeControl("recipe", block, 147, 5, 16, 16)); }
public static void init() { if (Loader.isModLoaded("Thaumcraft")) { Totemic.logger.info("Is that thaumcraft I see?"); Totemic.logger.info("This is more like Tech! "); ThaumcraftCompat.init(); } if (Loader.isModLoaded("AWWayofTime")) { Totemic.logger.info("Oh, is this that Blood Magic I spy with my bloody eye?"); Totemic.logger.info("I'll show you real sacrifice!"); } if (Loader.isModLoaded("Ars Magica 2")) { Totemic.logger.info("Ars Magica?"); Totemic.logger.info("Stop doing cheap mobs and talk to me again ;)"); } if (Loader.isModLoaded("Witchery")) { Totemic.logger.info("Oh, so this is that witch craft mod?"); Totemic.logger.info("Try using your VooDoo on me and see if it makes a difference."); } if (Loader.isModLoaded("gregtech_addon")) { Totemic.logger.info("Gregtech is unsupported by Totemic and all of my mods."); } if (Loader.isModLoaded("Optifine")) { Totemic.logger.info("Optifine is unsupported by Totemic and all of my mods."); Totemic.logger.info("It causes alot of problems, if there are any, try removing optifine."); } if (Loader.isModLoaded("Botania")) { Totemic.logger.info("Oh, hey Botania!"); Totemic.logger.info( "Why can't we be friends... why can't we be friends... why can't we be friends! *runs away sobbing*"); } if (Loader.isModLoaded("ForbiddenMagic")) { Totemic.logger.info("Hey there Forbidden magic!"); Totemic.logger.info("We are missing a few important wand cores :("); } }