mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-28 09:18:45 +00:00
Add texture .png.mcmeta generator
This commit is contained in:
@@ -20,6 +20,7 @@ export interface ConfigGenerator {
|
||||
id: string,
|
||||
url: string,
|
||||
path?: string,
|
||||
ext?: string,
|
||||
noPath?: boolean,
|
||||
tags?: string[],
|
||||
aliases?: string[],
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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))
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user