Fix #851 add sounds.json generator
Deploy to GitHub Pages / build (push) Waiting to run
Deploy to GitHub Pages / deploy (push) Blocked by required conditions

This commit is contained in:
Misode
2026-05-03 18:31:53 +02:00
parent 9437f25d04
commit ee08910abf
7 changed files with 20 additions and 6 deletions
@@ -24,7 +24,7 @@ export function FileCreation({ docAndNode, gen, method }: Props) {
const { project } = useProject()
const { client } = useSpyglass()
const [fileId, setFileId] = useState(gen.id === 'pack_mcmeta' ? 'pack' : '')
const [fileId, setFileId] = useState(gen.id === 'pack_mcmeta' ? 'pack' : gen.id === 'sounds' ? 'sounds' : '')
const [error, setError] = useState<string>()
const changeFileId = (str: string) => {
@@ -45,7 +45,9 @@ 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}${gen.ext ?? '.json'}`
: gen.id === 'sounds'
? `${projectRoot}assets/${id.namespace}/sounds.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(() => {