Add texture .png.mcmeta generator

This commit is contained in:
Misode
2025-05-20 20:26:02 +02:00
parent ce01e9445a
commit 1c2eccaa71
6 changed files with 13 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ export interface ConfigGenerator {
id: string,
url: string,
path?: string,
ext?: string,
noPath?: boolean,
tags?: string[],
aliases?: string[],

View File

@@ -45,7 +45,7 @@ export function FileCreation({ docAndNode, gen, method }: Props) {
const projectRoot = getProjectRoot(project)
const uri = gen.id === 'pack_mcmeta'
? `${projectRoot}pack.mcmeta`
: `${projectRoot}${pack}/${id.namespace}/${genPath(gen, version)}/${id.path}.json`
: `${projectRoot}${pack}/${id.namespace}/${genPath(gen, version)}/${id.path}${gen.ext ?? '.json'}`
Analytics.saveProjectFile(method)
const text = docAndNode.doc.getText()
client.fs.writeFile(uri, text).then(() => {

View File

@@ -95,7 +95,7 @@ export function ProjectProvider({ children }: { children: ComponentChildren }) {
const { namespace, path } = Identifier.parse(file.id)
const uri = type === 'pack_mcmeta'
? `${projectRoot}data/pack.mcmeta`
: `${projectRoot}data/${namespace}/${type}/${path}.json`
: `${projectRoot}data/${namespace}/${type}/${path}${gen.ext ?? '.json'}`
return SpyglassClient.FS.writeFile(uri, JSON.stringify(file.data, null, 2))
}))
}

View File

@@ -257,7 +257,7 @@ export class SpyglassService {
return `${UNSAVED_URI}pack.mcmeta`
}
const pack = gen.tags?.includes('assets') ? 'assets' : 'data'
return `${UNSAVED_URI}${pack}/draft/${genPath(gen, this.version)}/draft.json`
return `${UNSAVED_URI}${pack}/draft/${genPath(gen, this.version)}/draft${gen.ext}`
}
public watchFile(uri: string, handler: (docAndNode: core.DocAndNode) => void) {

View File

@@ -626,6 +626,14 @@
"tags": ["assets"],
"wiki": "https://minecraft.wiki/w/Model#Item_models"
},
{
"id": "texture_meta",
"url": "assets/texture-meta",
"path": "textures",
"ext": ".png.mcmeta",
"tags": ["assets"],
"wiki": "https://minecraft.wiki/w/Resource_pack#Texture_animation"
},
{
"id": "equipment",
"url": "assets/equipment",

View File

@@ -89,6 +89,7 @@
"generator.lang": "Language",
"generator.loot_table": "Loot Table",
"generator.model": "Model",
"generator.texture_meta": "Texture Metadata",
"generator.neoforge:biome_modifier": "Biome Modifier",
"generator.neoforge:data_map_compostables": "Compostables Data Map",
"generator.neoforge:data_map_furnace_fuels": "Furnace Fuels Data Map",