From 8d3497e7b6efa5b2e4b79a6cbdfbe60b21b13d79 Mon Sep 17 00:00:00 2001 From: Misode Date: Sat, 26 Oct 2024 22:04:48 +0200 Subject: [PATCH] Format data components --- src/app/components/generator/McdocRenderer.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/components/generator/McdocRenderer.tsx b/src/app/components/generator/McdocRenderer.tsx index 873da3a6..f3be2eb6 100644 --- a/src/app/components/generator/McdocRenderer.tsx +++ b/src/app/components/generator/McdocRenderer.tsx @@ -578,7 +578,7 @@ function StructBody({ type: outerType, node, makeEdit, ctx }: StructBodyProps) { return
- +
@@ -936,9 +936,12 @@ function getDefault(type: SimplifiedMcdocType, range: core.Range, ctx: McdocCont return { type: 'json:null', range } } -function formatIdentifier(id: string) { - const formatted = id.replace(/^minecraft:/, '').replaceAll('_', ' ') - return formatted.charAt(0).toUpperCase() + formatted.substring(1) +function formatIdentifier(id: string): string { + if (id.startsWith('!')) { + return '! ' + formatIdentifier(id.substring(1)) + } + const text = id.replace(/^minecraft:/, '').replaceAll('_', ' ') + return text.charAt(0).toUpperCase() + text.substring(1) } function getCategory(type: McdocType) { @@ -968,6 +971,7 @@ const selectRegistries = new Set([ 'chunk_status', 'consume_effect_type', 'creative_mode_tab', + 'data_component_type', 'enchantment_effect_component_type', 'enchantment_entity_effect_type', 'enchantment_level_based_value_type', @@ -979,6 +983,7 @@ const selectRegistries = new Set([ 'frog_variant', 'height_provider_type', 'int_provider_type', + 'item_sub_predicate_type', 'loot_condition_type', 'loot_function_type', 'loot_nbt_provider_type',