Well-rounded Minecraft 1.18.2 modpack featuring Tech, Magic, Exploration and Decoration content. Made with love. 💚
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

243 lines
8.3 KiB

// priority: 0
onEvent("recipes", event => {
event.stonecutting("2x minecraft:stick", "#minecraft:planks");
event.stonecutting("2x minecraft:bowl" , "#minecraft:planks");
event.stonecutting("tconstruct:pattern", "#minecraft:planks");
let COSTS = {
// Logs
wood: { log: 1 },
stripped_log: { log: 1 },
stripped_wood: { log: 1, wood: 1, stripped_log: 1, },
// Items from Logs
planks: { any_log: 4 },
boat: { any_log: 1 },
beam: { any_log: 1 },
palisade: { any_log: 4 },
post: { log: 4, wood: 4 },
stripped_post: { any_log: 4 },
// Items from Planks
stairs: { planks: 1 },
slab: { planks: 2 },
ladder: { planks: 2 },
door: { planks: 1 },
trapdoor: { planks: 1 },
fence: { planks: 1 },
fence_gate: { planks: 1 },
button: { planks: 4 },
pressure_plate: { planks: 2 },
sign: { planks: 1 },
support: { planks: 1 },
seat: { planks: 1 },
vertical_planks: { planks: 1, any_log: 4 },
vertical_slab: { planks: 2 },
chair: { planks: 1 },
table: { planks: 1 },
shelf: { planks: 1 },
bench: { planks: 2 },
backpack_shelf: { planks: 2 },
banister: { planks: 2 },
};
let WOOD_TYPES = {
minecraft: [ "oak", "spruce", "birch", "jungle", "acacia", "dark_oak", "crimson", "warped" ],
biomesoplenty: [ "cherry", "dead", "fir", "hellbark", "jacaranda", "magic", "mahogany", "palm", "redwood", "umbran", "willow" ],
twilightforest: [ "twilight_oak", "canopy", "mangrove", "dark", "time", "transformation", "mining", "sorting" ],
quark: [ "azalea", "blossom" ],
};
let DEFAULT_FORMAT = {
DEFAULT: "{MOD}:{WOOD}_{TYPE}",
any_log: "#{MOD}:{WOOD}_logs",
stripped_log: "{MOD}:stripped_{WOOD}_log",
stripped_wood: "{MOD}:stripped_{WOOD}_wood",
stripped_post: "{MOD}:stripped_{WOOD}_post",
vertical_planks: "{MOD}:vertical_{WOOD}_planks",
};
let DEFINITIONS = {
minecraft: [
{
woods: WOOD_TYPES.minecraft,
types: [ "planks", "stairs", "slab", "door", "trapdoor", "fence", "fence_gate", "sign", "button", "pressure_plate" ],
},
{
woods: [ "oak", "spruce", "birch", "jungle", "acacia", "dark_oak" ],
types: [ "any_log", "log", "wood", "stripped_log", "stripped_wood", "boat" ],
},
{
woods: [ "crimson", "warped" ],
types: [ "any_log", "log", "wood", "stripped_log", "stripped_wood" ],
format: {
any_log: "#{MOD}:{WOOD}_stems",
log: "{MOD}:{WOOD}_stem",
wood: "{MOD}:{WOOD}_hyphae",
stripped_log: "{MOD}:stripped_{WOOD}_stem",
stripped_wood: "{MOD}:stripped_{WOOD}_hyphae",
},
},
{
woods: [ "oak" ],
types: [ "ladder" ],
format: { ladder: "{MOD}:{TYPE}" },
},
],
decorative_blocks: [
{
woods: WOOD_TYPES.minecraft,
types: [ "beam", "palisade", "support", "seat" ],
},
],
quark: [
{
woods: WOOD_TYPES.quark,
types: [
"any_log", "log", "wood", "stripped_log", "stripped_wood",
"planks", "stairs", "slab", "door", "trapdoor", "fence", "fence_gate",
"sign", "button", "pressure_plate", "boat",
"vertical_planks", "vertical_slab", "post", "stripped_post",
],
format: {
stairs: "{MOD}:{WOOD}_planks_{TYPE}",
slab: "{MOD}:{WOOD}_planks_{TYPE}",
vertical_slab: "{MOD}:{WOOD}_planks_{TYPE}",
},
},
{
woods: WOOD_TYPES.minecraft,
types: [ "vertical_planks", "post", "stripped_post" ],
},
{
woods: WOOD_TYPES.minecraft.concat(WOOD_TYPES.quark).filter(wood => wood != "oak"),
types: [ "ladder" ],
},
],
adorn: [
{
woods: WOOD_TYPES.minecraft,
types: [ "chair", "table", "shelf", "bench" ],
},
{
woods: WOOD_TYPES.biomesoplenty,
types: [ "chair", "table", "shelf", "bench" ],
format: { DEFAULT: "{MOD}:biomesoplenty/{WOOD}_{TYPE}" },
},
],
backpacked: [
{
woods: WOOD_TYPES.minecraft,
types: [ "backpack_shelf" ],
},
],
biomesoplenty: [
{
woods: WOOD_TYPES.biomesoplenty,
types: [
"any_log", "log", "wood", "stripped_log", "stripped_wood",
"planks", "stairs", "slab", "door", "trapdoor", "fence", "fence_gate",
"sign", "button", "pressure_plate", "boat",
],
}
],
compatoplenty: [
{
woods: WOOD_TYPES.biomesoplenty,
types: [ "vertical_planks", "vertical_slab", "post", "stripped_post", "ladder" ],
},
],
twilightforest: [
{
woods: WOOD_TYPES.twilightforest,
types: [
"any_log", "log", "wood", "stripped_log", "stripped_wood",
"planks", "stairs", "slab", "door", "trapdoor", "fence", "fence_gate",
"button", "pressure_plate",
],
},
{
woods: WOOD_TYPES.twilightforest.filter(wood => wood != "dark"),
types: [ "sign" ],
},
{
woods: WOOD_TYPES.minecraft.concat(WOOD_TYPES.twilightforest).filter(wood => wood != "dark"),
types: [ "banister" ],
},
{
woods: [ "dark" ],
types: [ "sign", "banister" ],
format: { DEFAULT: "{MOD}:darkwood_{TYPE}" },
},
],
malum: [
{
woods: [ "runewood", "soulwood" ],
types: [
"any_log", "log", "wood", "stripped_log", "stripped_wood",
"planks", "door", "trapdoor", "fence", "fence_gate",
"sign", "boat", "vertical_planks", "beam",
],
format: {
wood: "{MOD}:{WOOD}",
stripped_wood: "{MOD}:stripped_{WOOD}",
},
},
{
woods: [ "runewood", "soulwood" ],
types: [ "stairs", "slab", "fence", "fence_gate", "button", "pressure_plate" ],
format: { DEFAULT: "{MOD}:{WOOD}_planks_{TYPE}" },
},
],
};
let items = { };
// Collect all definitions into "items".
// { oak: { planks: "minecraft:oak_planks", ... }, ... }
for (let mod in DEFINITIONS) {
for (let { woods, types, format } of DEFINITIONS[mod]) {
format = Object.assign({ }, DEFAULT_FORMAT, format);
for (let wood of woods) {
let items_by_wood = items[wood] = items[wood] || { };
for (let type of types) {
let item = (format[type] || format.DEFAULT)
.replace("{MOD}", mod)
.replace("{WOOD}", wood)
.replace("{TYPE}", type);
items_by_wood[type] = item;
}
}
}
}
// Register stonecutting recipes based on "COSTS".
for (let wood in items) {
for (let [type, item] of Object.entries(items[wood])) {
for (let [input, result_count] of Object.entries(COSTS[type] || { })) {
let o = `${result_count}x ${item}`;
let i = items[wood] && items[wood][input];
// console.log(`${wood} ${type} :: ${i} => ${o}`);
if (i != null) event.stonecutting(o, i);
else console.error(`Can't create ${wood} ${type} recipe for ${item} since input wasn't found`);
}
}
}
// Additional Malum wood blocks
for (let wood of [ "runewood", "soulwood" ]) {
event.stonecutting(`4x malum:${wood}_panel`, `#malum:${wood}_logs`);
event.stonecutting(`4x malum:${wood}_tiles`, `#malum:${wood}_logs`);
event.stonecutting(`malum:${wood}_panel`, `malum:${wood}_planks`);
event.stonecutting(`malum:${wood}_tiles`, `malum:${wood}_planks`);
event.stonecutting(`malum:${wood}_tiles`, `malum:${wood}_panel`);
event.stonecutting(`2x malum:vertical_${wood}_planks_slab`, `malum:vertical_${wood}_planks`);
event.stonecutting(`2x malum:${wood}_panel_slab`, `malum:${wood}_panel`);
event.stonecutting(`2x malum:${wood}_tiles_slab`, `malum:${wood}_tiles`);
event.stonecutting(`malum:vertical_${wood}_planks_stairs`, `malum:vertical_${wood}_planks`);
event.stonecutting(`malum:${wood}_panel_stairs`, `malum:${wood}_panel`);
event.stonecutting(`malum:${wood}_tiles_stairs`, `malum:${wood}_tiles`);
event.stonecutting(`malum:solid_${wood}_trapdoor`, `malum:${wood}_planks`);
}
});