Description
JavaScript models allows mods and resource packs to define models in JavaScript. This is a terrible idea.
Is this mod safe to use?
No.
Does this allow resource packs to execute arbitrary code?
Yes.
Should you use this mod?
Probably not.
Why does this mod exist?
To be used responsibly.
Usage
.json models are overriden if a .js file with the same name exists.
A JavaScript model will be evaluated when models are loaded using Nashorn. The script must write a model object to module.exports. The exported object is then parsed like a regular .json model. Like so:
module.exports = {
parent: "item/handheld",
textures: {
"layer0": "items/stick"
}
};
.js files may import other .js files or .json files. File paths are absolute and are prefixed with their domain ("minecraft" if unspecified). Like so:
var common = require("rp:common.js");
var stick = require("minecraft:models/item/stick.json");
var apple = require("minecraft:models/item/apple.json");
module.exports = common.isAprilFools() ? stick : apple;


