-
-
Notifications
You must be signed in to change notification settings - Fork 436
Hidden Modpacks
It is possible to create modpacks that only appear if the user enters a special "key."
If you have PHP support, the Modpack Creator can generate a package listing file for you automatically to support this feature. See Creating Modpacks.
Make sure that in launcher.properties
, you configure the packageListUrl
parameter so it has a "%s" that will be replaced with a (URL-encoded) copy of the game key that the user can set in the settings.
For example, if your properties file looked like:
packageListUrl=http://example.com/packages.json?key=%s
And in options, the user set this:
It would load the following URL:
http://example.com/packages.json?key=secret
You can also manually set up the feature with the PHP script provided below. Your website needs PHP scripting support. Dropbox will not work.
The following is an example PHP script that reads the key parameter to show an extra modpack:
<?php
// This file automatically generates packages.json
function getPackageData($pathname) {
$data = json_decode(file_get_contents($pathname));
if (isset($data->name) && isset($data->version)) {
return [
'name' => $data->name,
'title' => isset($data->title) ? $data->title : $data->name,
'version' => $data->version,
'location' => $pathname,
'priority' => 1,
];
} else {
return null;
}
}
$key = isset($_GET['key']) ? $_GET['key'] : "";
$files = glob("*.json");
if ($files === false) {
$files = [];
}
$document = [
'minimumVersion' => 1,
'packages' => [],
];
// Get packages in the same folder
foreach ($files as $file) {
$data = getPackageData($file);
if ($data !== null) {
$document['packages'][] = $data;
}
}
// If the key is 'secret', then add the package from 'private/beta.json'
if ($key == "secret") {
$document['packages'][] = getPackageData("private/beta.json");
}
header("Content-Type: text/plain");
echo json_encode($document, JSON_PRETTY_PRINT);
Need help? See Getting Help.
Tutorial
Launcher Features:
- Fancy Launcher
- Portable Mode
- Hidden Modpacks
- Deploying Server Modpacks
- Launcher Arguments
- Custom JAR (.jar mods)
- Custom Version Manifest
Customization:
- Localization
- News Page Guide
- Custom Microsoft OAuth application
- Using an IDE (Eclipse, IntelliJ)
Additional Reading:
Find the launcher useful?
Donate to obw, the current maintainer:
Donate to sk89q, the original maintainer: