Add assets/items generator and support 24w45a
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

This commit is contained in:
Misode
2024-11-06 21:01:24 +01:00
parent 377c3f1e65
commit 09cbf7b59a
6 changed files with 22 additions and 13 deletions

View File

@@ -157,7 +157,7 @@ export async function fetchPreset(versionId: VersionId, registry: string, id: st
if (id.startsWith('immersive_weathering:')) {
url = `https://raw.githubusercontent.com/AstralOrdana/Immersive-Weathering/main/src/main/resources/data/immersive_weathering/block_growths/${id.slice(21)}.json`
} else {
const type = ['atlases', 'blockstates', 'models', 'font'].includes(registry) ? 'assets' : 'data'
const type = ['atlases', 'blockstates', 'items', 'models', 'font'].includes(registry) ? 'assets' : 'data'
url = `${mcmeta(version, type)}/${type}/minecraft/${registry}/${id}.json`
}
const res = await fetch(url)
@@ -172,7 +172,7 @@ export async function fetchAllPresets(versionId: VersionId, registry: string) {
const version = config.versions.find(v => v.id === versionId)!
await validateCache(version)
try {
const type = ['atlas', 'block_definition', 'model', 'font'].includes(registry) ? 'assets' : 'data'
const type = ['atlas', 'block_definition', 'item_definition', 'model', 'font'].includes(registry) ? 'assets' : 'data'
return new Map<string, unknown>(Object.entries(await cachedFetch(`${mcmeta(version, 'summary')}/${type}/${registry}/data.min.json`)))
} catch (e) {
throw new Error(`Error occurred while fetching all ${registry} presets: ${message(e)}`)