Add neoforge and immersiveweathering mcdoc

This commit is contained in:
Misode
2024-11-01 00:19:46 +01:00
parent 68eb077c17
commit 00f0c09a34
8 changed files with 320 additions and 46 deletions

View File

@@ -2,7 +2,7 @@ import * as core from '@spyglassmc/core'
import type { JsonNode } from '@spyglassmc/json'
import { JsonArrayNode, JsonObjectNode, JsonStringNode } from '@spyglassmc/json'
import { JsonStringOptions } from '@spyglassmc/json/lib/parser/string.js'
import type { ListType, McdocType, NumericRange, NumericType, PrimitiveArrayType, TupleType, UnionType } from '@spyglassmc/mcdoc'
import type { Attributes, ListType, McdocType, NumericRange, NumericType, PrimitiveArrayType, TupleType, UnionType } from '@spyglassmc/mcdoc'
import type { McdocCheckerContext, SimplifiedMcdocType, SimplifiedMcdocTypeNoUnion, SimplifyValueNode } from '@spyglassmc/mcdoc/lib/runtime/checker/index.js'
import { simplify } from '@spyglassmc/mcdoc/lib/runtime/checker/index.js'
@@ -130,15 +130,16 @@ export function isInlineTuple(type: TupleType) {
return type.items.length <= 4 && type.items.every(isNumericType)
}
export function formatIdentifier(id: string): string {
export function formatIdentifier(id: string, attributes?: Attributes): string {
if (id.startsWith('!')) {
return '! ' + formatIdentifier(id.substring(1))
return '! ' + formatIdentifier(id.substring(1), attributes)
}
const isStarred = attributes?.some(a => a.name === 'starred')
const text = id
.replace(/^minecraft:/, '')
.replaceAll('_', ' ')
.replace(/[a-z][A-Z]+/g, m => m.charAt(0) + ' ' + m.substring(1).toLowerCase())
return text.charAt(0).toUpperCase() + text.substring(1)
return (isStarred ? '✨ ' : '') + text.charAt(0).toUpperCase() + text.substring(1)
}
export function getCategory(type: McdocType) {

View File

@@ -247,7 +247,7 @@ function EnumHead({ type, optional, node, makeEdit }: Props<SimplifiedEnum>) {
{(value === undefined || optional) && <option value={SPECIAL_UNSET}>{locale('unset')}</option>}
{(value !== undefined && !type.values.map(v => v.value).includes(value)) && <option value={value}>{value}</option>}
{type.values.map(value =>
<option value={value.value}>{formatIdentifier(value.identifier)}</option>
<option value={value.value}>{formatIdentifier(value.identifier, value.attributes)}</option>
)}
</select>
}

View File

@@ -33,8 +33,10 @@ export type UnknownFile = {
}
export const FilePatterns = [
'worldgen/[a-z_]+',
'immersive_weathering/[a-z_]+',
'neoforge/[a-z_]+',
'ohthetreesyoullgrow/[a-z_]+',
'worldgen/[a-z_]+',
'tags/worldgen/[a-z_]+',
'tags/[a-z_]+',
'[a-z_]+',

View File

@@ -237,9 +237,11 @@ export class SpyglassService {
category: 'model',
},
// Partner resources
'ohthetreesyoullgrow/configured_feature': {
category: 'ohthetreesyoullgrow:configured_feature',
},
...Object.fromEntries(siteConfig.generators.filter(gen => gen.dependency).map(gen =>
[gen.path, {
category: gen.id,
}]
)),
},
},
lint: {