mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-30 01:32:44 +00:00
Close #236 add tag generators
This commit is contained in:
@@ -19,6 +19,7 @@ export function App() {
|
|||||||
<Router onChange={changeRoute}>
|
<Router onChange={changeRoute}>
|
||||||
<Home path="/" />
|
<Home path="/" />
|
||||||
<Category path="/worldgen" category="worldgen" />
|
<Category path="/worldgen" category="worldgen" />
|
||||||
|
<Category path="/tags" category="tags" />
|
||||||
<Category path="/assets" category="assets" />
|
<Category path="/assets" category="assets" />
|
||||||
<Partners path="/partners" />
|
<Partners path="/partners" />
|
||||||
<Sounds path="/sounds" />
|
<Sounds path="/sounds" />
|
||||||
|
|||||||
@@ -129,7 +129,8 @@ export function getFilePath(file: ProjectFile) {
|
|||||||
}
|
}
|
||||||
const gen = config.generators.find(g => g.id === file.type)
|
const gen = config.generators.find(g => g.id === file.type)
|
||||||
if (!gen) {
|
if (!gen) {
|
||||||
throw new Error(`Cannot find generator of type ${file.type}`)
|
console.error(`Cannot find generator of type ${file.type}`)
|
||||||
|
return undefined
|
||||||
}
|
}
|
||||||
return `data/${namespace}/${gen.path ?? gen.id}/${id}`
|
return `data/${namespace}/${gen.path ?? gen.id}/${id}`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export function Home({}: Props) {
|
|||||||
{config.generators.filter(g => !g.category).map(g =>
|
{config.generators.filter(g => !g.category).map(g =>
|
||||||
<ToolCard title={locale(g.id)} link={cleanUrl(g.url)} />
|
<ToolCard title={locale(g.id)} link={cleanUrl(g.url)} />
|
||||||
)}
|
)}
|
||||||
|
<ToolCard title={locale('tags')} link="/tags/" />
|
||||||
<ToolCard title={locale('worldgen')} link="/worldgen/" />
|
<ToolCard title={locale('worldgen')} link="/worldgen/" />
|
||||||
</ToolCard>
|
</ToolCard>
|
||||||
<ToolCard title="Resource packs">
|
<ToolCard title="Resource packs">
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ export function Project({}: Props) {
|
|||||||
const { locale } = useLocale()
|
const { locale } = useLocale()
|
||||||
const { project, openFile } = useProject()
|
const { project, openFile } = useProject()
|
||||||
useTitle(locale('title.project', project.name))
|
useTitle(locale('title.project', project.name))
|
||||||
const entries = useMemo(() => project.files.map(getFilePath), project.files)
|
const entries = useMemo(() => project.files.flatMap(f => {
|
||||||
|
const path = getFilePath(f)
|
||||||
|
return path ? [path] : []
|
||||||
|
}), project.files)
|
||||||
|
|
||||||
const selectFile = useCallback((entry: string) => {
|
const selectFile = useCallback((entry: string) => {
|
||||||
const [, namespace, type, ...id] = entry.split('/')
|
const [, namespace, type, ...id] = entry.split('/')
|
||||||
|
|||||||
@@ -253,6 +253,50 @@
|
|||||||
"schema": "flat_level_generator_preset",
|
"schema": "flat_level_generator_preset",
|
||||||
"minVersion": "1.19"
|
"minVersion": "1.19"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "tag/block",
|
||||||
|
"url": "tags/block",
|
||||||
|
"category": "tags",
|
||||||
|
"path": "tags/blocks",
|
||||||
|
"schema": "block_tag"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "tag/entity_type",
|
||||||
|
"url": "tags/entity-type",
|
||||||
|
"category": "tags",
|
||||||
|
"path": "tags/entity_types",
|
||||||
|
"schema": "entity_type_tag"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "tag/fluid",
|
||||||
|
"url": "tags/fluid",
|
||||||
|
"category": "tags",
|
||||||
|
"path": "tags/fluids",
|
||||||
|
"schema": "fluid_tag"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "tag/game_event",
|
||||||
|
"url": "tags/game-event",
|
||||||
|
"category": "tags",
|
||||||
|
"path": "tags/game_events",
|
||||||
|
"schema": "game_event_tag",
|
||||||
|
"minVersion": "1.17"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "tag/item",
|
||||||
|
"url": "tags/item",
|
||||||
|
"category": "tags",
|
||||||
|
"path": "tags/items",
|
||||||
|
"schema": "item_tag"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "tag/worldgen/biome",
|
||||||
|
"url": "tags/biome",
|
||||||
|
"category": "tags",
|
||||||
|
"path": "tags/worldgen/biome",
|
||||||
|
"schema": "biome_tag",
|
||||||
|
"minVersion": "1.18.2"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "block_definition",
|
"id": "block_definition",
|
||||||
"url": "assets/blockstate",
|
"url": "assets/blockstate",
|
||||||
|
|||||||
@@ -80,6 +80,13 @@
|
|||||||
"settings.fields.name": "Name",
|
"settings.fields.name": "Name",
|
||||||
"share": "Share",
|
"share": "Share",
|
||||||
"theme": "Theme",
|
"theme": "Theme",
|
||||||
|
"tag/block": "Block Tag",
|
||||||
|
"tag/entity_type": "Entity Type Tag",
|
||||||
|
"tag/fluid": "Fluid Tag",
|
||||||
|
"tag/game_event": "Game Event Tag",
|
||||||
|
"tag/item": "Item Tag",
|
||||||
|
"tag/worldgen/biome": "Biome Tag",
|
||||||
|
"tags": "Tags",
|
||||||
"theme.dark": "Dark",
|
"theme.dark": "Dark",
|
||||||
"theme.light": "Light",
|
"theme.light": "Light",
|
||||||
"theme.system": "System",
|
"theme.system": "System",
|
||||||
|
|||||||
Reference in New Issue
Block a user