mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 07:37:10 +00:00
Add vanilla preset searcher and loader
This commit is contained in:
@@ -7,6 +7,7 @@ const CACHE_FORMAT = 1
|
||||
type VersionConfig = {
|
||||
id: string,
|
||||
mcdata_ref: string,
|
||||
vanilla_datapack_data_ref?: string,
|
||||
vanilla_datapack_summary_ref?: string
|
||||
}
|
||||
|
||||
@@ -136,3 +137,12 @@ const fetchDynamicRegistries = async (target: CollectionRegistry, version: Versi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const fetchPreset = async (version: VersionConfig, registry: string, id: string) => {
|
||||
try {
|
||||
const res = await fetch(`${vanillaDatapackUrl}/${version.vanilla_datapack_data_ref}/data/minecraft/${registry}/${id}.json`)
|
||||
return await res.json()
|
||||
} catch (e) {
|
||||
console.warn(`Error occurred while fetching ${registry} preset ${id}:`, e)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user