Skip to content

Instantly share code, notes, and snippets.

@comp500
Last active August 10, 2017 14:59
Show Gist options
  • Save comp500/64b6b1ce9374746f8bdce09f83b490c2 to your computer and use it in GitHub Desktop.
Save comp500/64b6b1ce9374746f8bdce09f83b490c2 to your computer and use it in GitHub Desktop.
These files are used to make the FTBUtilities Guide pages for Quark. The features JSON file is downloaded from github and used to make documentation files. To use it, install node.js, put index.js and package.json in a folder, run npm install then node index.js.
quark.guide=Quark
{
"name": "Quark",
"type": "mod",
"authors": ["Vazkii"],
"icon": "quark:textures/misc/icon.png"
}
// This file turns features.json from vazkii.us into FTBUtilities Guide pages
// by comp500, under Unlicense (https://unlicense.org)
// constants (change this to suit your needs)
const imageRoot = "https://raw.githubusercontent.com/Vazkii/Quark/master/web/img/modules/";
const downloadImages = false;
// icons for pages, add more if you want to
// the key for each is the lowercase, spaces removed name of each feature
const pageIcons = {
"automation": "item:minecraft:piston",
"building": "item:minecraft:brick_block",
"decoration": "item:quark:custom_bookshelf",
"management": "item:minecraft:chest",
"tweaks": "item:quark:glass_shards",
"vanity": "item:quark:witch_hat",
"world": "item:quark:biotite_ore",
"misc": "item:quark:slime_bucket"
};
// requires miniget and mkdirp
const fs = require("fs");
const miniget = require("miniget");
const dir = require("mkdirp").sync;
// create array for pages
var pages = [];
console.log("Creating folder");
dir("./quark/guide");
console.log("Downloading features json");
miniget("https://raw.githubusercontent.com/Vazkii/Quark/master/web/features.json", function (err, res, body) {
var parsedFeatures = JSON.parse(body);
Object.keys(parsedFeatures).forEach(function(key) {
pages.push({
"id": key,
"icon": pageIcons[key] ? pageIcons[key] : "",
"lang": parsedFeatures[key].name
});
dir("./quark/guide/" + key);
var index = [
"# " + parsedFeatures[key].name,
parsedFeatures[key].description
];
fs.writeFileSync("./quark/guide/" + key + "/index.json", JSON.stringify(index));
var featurePages = [];
for (var i = 0; i < parsedFeatures[key].features.length; i++) {
var feature = parsedFeatures[key].features[i];
var featureId = feature.name.toLowerCase().replace(/\s/g, "");
featurePages.push({
"id": featureId,
"icon": pageIcons[featureId] ? pageIcons[featureId] : "",
"lang": feature.name
});
dir("./quark/guide/" + key + "/" + featureId);
var featureIndex = [
"# " + feature.name,
];
var descSanitized = feature.description.replace(/<li>/g, "<br>").replace(/(?!<br>)<.*?>/g, "");
featureIndex = featureIndex.concat(descSanitized.split("<br>"));
featureIndex.push(null);
if (downloadImages) {
featureIndex.push({
"id": "image",
"image": "quark:textures/misc/guide/" + feature.image,
"width": 200,
"height": 200
});
} else {
featureIndex.push({
"id": "image",
"image": imageRoot + key + "/" + feature.image,
"width": 200,
"height": 200
});
}
featureIndex.push(null);
featureIndex.push("This feature was introduced in Minecraft 1." + feature.introduced + ".");
if (feature.overlap) {
for (var j = 0; j < feature.overlap.length; j++) {
featureIndex.push("This feature disables itself if the " + feature.overlap[j] + " mod is loaded to prevent content overlap.");
}
}
if (feature.contributor) {
featureIndex.push("This feature was kindly contributed to Quark by " + feature.contributor + ".");
}
fs.writeFileSync("./quark/guide/" + key + "/" + featureId + "/index.json", JSON.stringify(featureIndex));
if (downloadImages) {
dir("./quark/textures/misc/guide");
miniget(imageRoot + key + "/" + feature.image).pipe(fs.createWriteStream("./quark/textures/misc/guide/" + feature.image));
}
}
console.log("Writing " + key + " index");
fs.writeFileSync("./quark/guide/" + key + "/pages.json", JSON.stringify(featurePages));
});
console.log("Writing main index");
fs.writeFileSync("./quark/guide/pages.json", JSON.stringify(pages));
// may still be downloading images after this point
});
[
[{"text":"Quark","bold":true},{"text":" is a mod for Minecraft. It aims to create an experience akin to the \"vanilla\" experience, by having a very simple motto: ","bold":false},{"text":"anything that would be added to Quark could also be added to the default game without compromising its gameplay style. ","italic":true, "bold": false},{"text":"Quark currently has ","italic":false, "bold": false},{"text":"134","bold":true},{"text":" features to spice up your game, all of which fitting the previous motto. ","bold":false}],
null,
["To that end, every feature added to Quark is simple and small. Hence the name of the mod, Quark, as a Quark is a very small thing. Quark is a ", {"text":"Modular", "italic":true}, " mod. Which means that its features are split within various modules. All of the modules can be disabled, and all the features can also be disabled individually if one wants to. Many of the features even have extra configuration options."],
null,
"The mod features ingame configuration via the Mod Options menu. Most features can be toggled from inside the game, others require a world reload, it depends on the changes they make. Any features that add new explicit content, such as items, blocks or entities, will require a reset.",
null,
"## Credits",
{
"id": "list",
"list": [
"wiiv for most of the textures.",
"Rorax for the emote icons.",
"cheeserolls for the biome detection code from Biomes'o'Plenty used for Pathfinder Maps.",
"DylanKaiser for the inventory chest icon.",
"SanAndreasP for the chest textures and most of their code.",
"ZeroLevels for the Iron Plate texture.",
"Noodlor for the variety dungeon structures.",
"Xisumavoid for the sticky piston side texture.",
"/u/Soniop for the realistic world preset.",
"/u/Martwaza for the trapdoor textures.",
"/u/FelitonC and /u/origamidragon412 for the banner textures.",
"/u/kopasz7 for the Midori block textures.",
"/u/robotthunder500 for the Bookshelf textures.",
"/u/darwinpatrick for the Soul Sandstone textures.",
"/u/Nyodex for the original Duskbound Block idea and textures.",
"/u/MushirMickeyJoe for recreation of the pocket edition piston model.",
"/u/CopherSans for the improved bow animation.",
"The creators of all the awesome suggestions I found in /r/MinecraftSuggestions and /r/QuarkMod that I implemented here.",
"And all the awesome people who pull requested features into the mod, credited in their individual cards."
]
},
null,
"## Contact and Donations",
{
"id": "list",
"list": [
{"text":"Quark Subreddit (suggestions should go here, make sure to read the sticky!)", "clickEvent":{"action":"open_url", "value":"https://www.reddit.com/r/quarkmod"}, "color": "blue"},
{"text":"Issues (report your bugs here)", "clickEvent":{"action":"open_url", "value":"https://github.com/Vazkii/Quark/issues"}, "color": "blue"},
{"text":"Source Code", "clickEvent":{"action":"open_url", "value":"https://github.com/Vazkii/Quark"}, "color": "blue"},
{"text":"APIs for Modders", "clickEvent":{"action":"open_url", "value":"https://github.com/Vazkii/Quark/blob/master/modders.md"}, "color": "blue"},
{"text":"Vazkii's Twitter", "clickEvent":{"action":"open_url", "value":"https://twitter.com/Vazkii/"}, "color": "blue"},
{"text":"Vazkii's Patreon", "clickEvent":{"action":"open_url", "value":"https://patreon.com/Vazkii/"}, "color": "blue"},
{"text":"wiiv's Twitter", "clickEvent":{"action":"open_url", "value":"https://twitter.com/wiliv75/"}, "color": "blue"},
{"text":"wiiv's Patreon", "clickEvent":{"action":"open_url", "value":"https://patreon.com/WIIV/"}, "color": "blue"},
{"text":"Donations", "clickEvent":{"action":"open_url", "value":"https://vazkii.us/about-me/supportdonations/"}, "color": "blue"},
{"text":"Email and other Contacts", "clickEvent":{"action":"open_url", "value":"https://vazkii.us/about-me/contact/"}, "color": "blue"},
{"text":"vazkii.us", "clickEvent":{"action":"open_url", "value":"https://vazkii.us/"}, "color": "blue"}
]
}
]
{
"name": "quark-ftbu",
"version": "1.0.0",
"description": "Turns Quark docs to FTBUtilities Guide pages",
"main": "index.js",
"dependencies": {
"miniget": "^1.0.1",
"mkdirp": "^0.5.1"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "comp500",
"license": "Unlicense"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment