Better handling of pack.mcmeta in projects

This commit is contained in:
Misode
2022-06-14 17:27:59 +02:00
parent 9cb323e80c
commit cbef6ef41b
3 changed files with 5 additions and 4 deletions

View File

@@ -101,7 +101,7 @@ export function ProjectProvider({ children }: { children: ComponentChildren }) {
if (!edits.id) { // remove
updateProject({ files: project.files.filter(f => f.type !== type || f.id !== id) })
} else {
const newId = edits.id.includes(':') ? edits.id : `${project.namespace ?? 'minecraft'}:${edits.id}`
const newId = type === 'pack_mcmeta' ? 'pack' : edits.id.includes(':') ? edits.id : `${project.namespace ?? 'minecraft'}:${edits.id}`
const exists = project.files.some(f => f.type === type && f.id === newId)
if (!id) { // create
if (exists) return false