-
Notifications
You must be signed in to change notification settings - Fork 51
feat: add custom ore generation script and Akite ore #519
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
base: dev
Are you sure you want to change the base?
Conversation
|
For checking out the current ore spawn rates I recommend using the Advanced XRay mod. |
All of that could use |
Automating in what way? |
|
Example: ServerEvents.generateData('before_mods', event => {
for (const [entry, ore] of Object.entries(global.customOres)) {
let oreVariants = {
stone: `${entry}_ore`,
deepslate: `deepslate_${entry}_ore`,
nether: `nether_${entry}_ore`,
end: `end_${entry}_ore`,
};
for (const [variant, oreId] of Object.entries(oreVariants)) {
if (!ore.worldGen[variant]) continue; // Skip if the variant is not present
let size = ore.worldGen.size ?? 2;
let discardChance = ore.worldGen.discardChance ?? 0.1;
createOreGen(oreId, size, discardChance);
}
}
function createOreGen(oreId, size, discardChance) {
event.json(`craftoria:worldgen/configured_feature/${oreId}`, {
type: 'minecraft:ore',
config: {
targets: [
{
target: {
predicate_type: 'minecraft:tag_match',
tag: 'minecraft:stone_ore_replaceables',
},
state: {
Name: `craftoria:${oreId}`,
},
},
],
size: size,
discard_chance_on_air_exposure: discardChance,
},
});
}
}); |
|
Oh nice aa34246, I was a bit scared of using LootJS because I haven't use it in a bit. Way nicer than loot tables with JSON |
The current configured feature is as simple as it can get, for akite. For more complex configured features this wouldn't cut it, and especially with ores with multiple block states(you used the stone replaceables instead of deepslate, and for all the other ore variants :P). If this could be expanded on that'd be alright imo |
|
Definetely could be expanded, but also, it's just nicer to not have to make a json file for each thing that gets added. |
|
We can squash to reduce the amount of commits if needed😌 |
2cf251a to
3e1943b
Compare
3e1943b to
0d7b30a
Compare
Add dynamic ore/dust/nugget/block/ingot generation with recipes Implement loot table auto-generation with silk touch/fortune support Add `HarvestLevel` enum and use it across global scripts Blacklist Akite ore from AA's vertical digger Co-authored-by: Phantom <33400200+WhitePhant0m@users.noreply.github.com>
This pull request introduces a script that can automatically generate ores, dusts, nuggets, blocks, ingots, and their associated recipes from a single configuration object.
It also adds the first custom ore: Akite. Akite is configured with loot tables and a very rare spawn rate, it only spawns in ancient cities and can only be mined with a netherite pickaxe.
This ore could be used for some end-game recipes, due to it's rarity(the amount of ancient cities in a world is limited, that's why). Right now it doesn't have any usage.
Currently, all custom ores are blacklisted from the Digital Miner by default, and this behavior isn't configurable yet.
The
OreProcessing.jsscript automatically creates Mekanism and Occultism crushing/enriching recipes to convert raw materials or ores into dusts. It also generates smelting recipes to convert ores, dusts, or raw materials into ingots. This applies to all ore variants (stone, deepslate, nether, and end).Adding a new ore is straightforward. It requires a configured feature, a placed feature, a loot table, textures for at least the ore, ingot, dust(for ore processing), and an entry in the
customOresglobal object. This object defines the ore’s name, which variants to generate, what derivates to generate(e.g. nugget, smelted ore block), and the required harvest level to mine it.Some functionality is still missing, for example, recipes for converting nuggets to and from ingots (e.g., 9 nuggets → 1 ingot) haven’t been implemented yet. I didn’t consider it essential at this stage, but it can be added easily when needed.
Added a
HarvestLevelenum now used across all global scriptsEDIT: Forgot to mention. This method, using configured features, placed features, and biome modifiers all in JSON files (datapack), is currently the only way to generate custom ores in KubeJS for 1.21. There's no
WorldgenEventslike in 1.20.1 or similar yet, though Lat plans to create an addon for it afaik.