Skip to content

Commit 1c2ecca

Browse files
committed
Add texture .png.mcmeta generator
1 parent ce01e94 commit 1c2ecca

File tree

6 files changed

+13
-3
lines changed

6 files changed

+13
-3
lines changed

src/app/Config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface ConfigGenerator {
2020
id: string,
2121
url: string,
2222
path?: string,
23+
ext?: string,
2324
noPath?: boolean,
2425
tags?: string[],
2526
aliases?: string[],

src/app/components/generator/FileCreation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function FileCreation({ docAndNode, gen, method }: Props) {
4545
const projectRoot = getProjectRoot(project)
4646
const uri = gen.id === 'pack_mcmeta'
4747
? `${projectRoot}pack.mcmeta`
48-
: `${projectRoot}${pack}/${id.namespace}/${genPath(gen, version)}/${id.path}.json`
48+
: `${projectRoot}${pack}/${id.namespace}/${genPath(gen, version)}/${id.path}${gen.ext ?? '.json'}`
4949
Analytics.saveProjectFile(method)
5050
const text = docAndNode.doc.getText()
5151
client.fs.writeFile(uri, text).then(() => {

src/app/contexts/Project.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function ProjectProvider({ children }: { children: ComponentChildren }) {
9595
const { namespace, path } = Identifier.parse(file.id)
9696
const uri = type === 'pack_mcmeta'
9797
? `${projectRoot}data/pack.mcmeta`
98-
: `${projectRoot}data/${namespace}/${type}/${path}.json`
98+
: `${projectRoot}data/${namespace}/${type}/${path}${gen.ext ?? '.json'}`
9999
return SpyglassClient.FS.writeFile(uri, JSON.stringify(file.data, null, 2))
100100
}))
101101
}

src/app/services/Spyglass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export class SpyglassService {
257257
return `${UNSAVED_URI}pack.mcmeta`
258258
}
259259
const pack = gen.tags?.includes('assets') ? 'assets' : 'data'
260-
return `${UNSAVED_URI}${pack}/draft/${genPath(gen, this.version)}/draft.json`
260+
return `${UNSAVED_URI}${pack}/draft/${genPath(gen, this.version)}/draft${gen.ext}`
261261
}
262262

263263
public watchFile(uri: string, handler: (docAndNode: core.DocAndNode) => void) {

src/config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,14 @@
626626
"tags": ["assets"],
627627
"wiki": "https://minecraft.wiki/w/Model#Item_models"
628628
},
629+
{
630+
"id": "texture_meta",
631+
"url": "assets/texture-meta",
632+
"path": "textures",
633+
"ext": ".png.mcmeta",
634+
"tags": ["assets"],
635+
"wiki": "https://minecraft.wiki/w/Resource_pack#Texture_animation"
636+
},
629637
{
630638
"id": "equipment",
631639
"url": "assets/equipment",

src/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"generator.lang": "Language",
9090
"generator.loot_table": "Loot Table",
9191
"generator.model": "Model",
92+
"generator.texture_meta": "Texture Metadata",
9293
"generator.neoforge:biome_modifier": "Biome Modifier",
9394
"generator.neoforge:data_map_compostables": "Compostables Data Map",
9495
"generator.neoforge:data_map_furnace_fuels": "Furnace Fuels Data Map",

0 commit comments

Comments
 (0)