Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Market Cleanup #12

Merged
merged 7 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/farmingforblockheads-common.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#List of default presets to disable.
disabledDefaultPresets = []
#List of optional presets to enable.
enabledOptionalPresets = ["minecraft:flowers", "minecraft:mushrooms"]
enabledOptionalPresets = []
#List of names the merchant can have.
merchantNames = ["Swap-O-Matic", "Emerald Muncher", "Weathered Salesperson"]
merchantNames = ["Swap-O-Matic", "Emerald Muncher", "Gold-Digger", "Weathered Salesperson"]
#The range within animals can be fed by the feeding trough.
#Range: > -2147483648
feedingTroughRange = 8
Expand Down
4 changes: 4 additions & 0 deletions kubejs/data/enigmatica/market_presets/market_trades.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"enabled": true,
"payment": { "ingredient": { "item": "minecraft:gold_nugget" }, "count": 3 }
}
4 changes: 4 additions & 0 deletions kubejs/data/occultism/market_presets/market_trades.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"enabled": true,
"payment": { "ingredient": { "item": "occultism:spirit_attuned_gem" }, "count": 1 }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//priority: 1001

const farmingforblockheads_preset_whitelist = [
'minecraft:mushrooms',
'minecraft:saplings',
'minecraft:flowers',
'minecraft:seed_crops',
'minecraft:crops',
'minecraft:seeds'
];
79 changes: 79 additions & 0 deletions kubejs/server_scripts/recipes/farmingforblockheads/market.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
ServerEvents.recipes((event) => {
const id_prefix = 'enigmatica:farmingforblockheads/market/';
const recipes = [
{
category: 'farmingforblockheads:saplings',
preset: 'occultism:market_trades',
result: { count: 1, item: 'occultism:otherworld_sapling' },
id: `${id_prefix}otherworld_sapling`
},
{
category: 'farmingforblockheads:seeds',
result: { count: 1, item: 'occultism:datura_seeds' },
id: `${id_prefix}datura_seeds`
},
{
category: 'farmingforblockheads:seeds',
result: { count: 1, item: 'chococraft:gysahl_green_seeds' },
id: `${id_prefix}gysahl_green_seeds`
},
{
category: 'farmingforblockheads:seeds',
result: { count: 1, item: 'jags:grass_seed' },
id: `${id_prefix}grass_seed`
},
{
category: 'farmingforblockheads:seeds',
result: { count: 1, item: 'minecraft:cocoa_beans' },
id: `${id_prefix}cocoa_beans`
},
{
category: 'farmingforblockheads:saplings',
result: { count: 1, item: 'arts_and_crafts:cork_sapling' },
id: `${id_prefix}cork_sapling`
},
{
category: 'farmingforblockheads:saplings',
result: { count: 1, item: 'minecraft:mangrove_propagule' },
id: `${id_prefix}mangrove_propagule`
},
{
category: 'farmingforblockheads:other',
result: { count: 4, item: 'farmingforblockheads:green_fertilizer' },
id: `${id_prefix}green_fertilizer`
},
{
category: 'farmingforblockheads:other',
result: { count: 4, item: 'farmingforblockheads:red_fertilizer' },
id: `${id_prefix}red_fertilizer`
},
{
category: 'farmingforblockheads:other',
result: { count: 4, item: 'farmingforblockheads:yellow_fertilizer' },
id: `${id_prefix}yellow_fertilizer`
},
{
category: 'farmingforblockheads:other',
result: { count: 12, item: 'minecraft:bone_meal' },
id: `${id_prefix}bone_meal`
}
];

event.forEachRecipe({ type: 'farmingforblockheads:market' }, (r) => {
let recipe = JSON.parse(r.json);
let recipe_id = r.getId();

if (farmingforblockheads_preset_whitelist.includes(recipe.preset)) {
recipe.preset = 'enigmatica:market_trades';
recipe.id = `${id_prefix}${recipe_id.split('market/').pop()}`;
recipes.push(recipe);
}
event.remove({ id: recipe_id });
});

recipes.forEach((recipe) => {
recipe.type = 'farmingforblockheads:market';
if (!recipe.preset) recipe.preset = 'enigmatica:market_trades';
event.custom(recipe).id(recipe.id);
});
});
19 changes: 19 additions & 0 deletions kubejs/server_scripts/recipes/occultism/ritual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ServerEvents.recipes((event) => {
const id_prefix = 'enigmatica:occultism/ritual/';
const recipes = [];

event.forEachRecipe({ type: 'occultism:ritual' }, (r) => {
let recipe = JSON.parse(r.json);
let recipe_id = r.getId();

// Override default craft time for all recipes
recipe.duration = 20;
recipe.id = recipe_id;
recipes.push(recipe);
});

recipes.forEach((recipe) => {
recipe.type = 'occultism:ritual';
event.custom(recipe).id(recipe.id);
});
});