From 6f763eac6591527a48081eedf90e00fb69851017 Mon Sep 17 00:00:00 2001 From: OliviaTheVampire Date: Mon, 22 Jan 2024 19:55:32 +0100 Subject: [PATCH] WIP --- src/app/partners/Obsidian.ts | 158 +++++++++++++++++++------------ src/app/partners/locales/en.json | 81 ++++++++++------ 2 files changed, 151 insertions(+), 88 deletions(-) diff --git a/src/app/partners/Obsidian.ts b/src/app/partners/Obsidian.ts index ca6f59e34..e060e4472 100644 --- a/src/app/partners/Obsidian.ts +++ b/src/app/partners/Obsidian.ts @@ -1,5 +1,5 @@ import type { CollectionRegistry, SchemaRegistry } from '@mcschema/core' -import { BooleanNode, Case, ListNode, MapNode, Mod, NumberNode, ObjectNode, Opt, Reference as RawReference, StringNode as RawStringNode, Switch } from '@mcschema/core' +import { BooleanNode, Case, ChoiceNode, ListNode, MapNode, Mod, NumberNode, ObjectNode, Opt, Reference as RawReference, StringNode as RawStringNode, Switch } from '@mcschema/core' const ID = 'obsidian' @@ -10,50 +10,65 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg // ITEMS schemas.register(`${ID}:item`, Mod(ObjectNode({ information: Opt(Reference(`${ID}:item_information`)), - display: Opt(ObjectNode({ + rendering: Opt(ObjectNode({ model: Opt(Reference(`${ID}:model`)), - item_model: Opt(Reference(`${ID}:model`)), - lore: Opt(ListNode( - ObjectNode({ - text: Reference(`${ID}:name_information`), - }), - )), + item_model: Opt(Reference(`${ID}:model`)) })), + lore: Opt(Reference(`${ID}:tooltip_information`)), use_action: Opt(ObjectNode({ action: Opt(StringNode({ enum: ['none', 'eat', 'drink', 'block', 'bow', 'spear', 'crossbow', 'spyglass'] })), right_click_action: Opt(StringNode({ enum: ['open_gui', 'run_command', 'open_url']})) , command: Opt(StringNode()), url: Opt(StringNode()), gui_size: Opt(NumberNode({ integer: true, min: 1, max: 6 })), - gui_title: Opt(Reference(`${ID}:name_information`)), + gui_title: Opt(Reference(`${ID}:name`)), })), }, { context: `${ID}:item` }), { default: () => ({}), })) - schemas.register(`${ID}:item_information`, ObjectNode({ - rarity: Opt(StringNode({ enum: ['common', 'uncommon', 'rare', 'epic']})), + schemas.register(`${ID}:item_settings`, ObjectNode({ + base_item_settings: Opt(Reference(`${ID}:item_settings`)), creative_tab: Opt(StringNode()), max_stack_size: Opt(NumberNode({ integer: true, min: 1 })), - name: Opt(Reference(`${ID}:name_information`)), + durability: Opt(NumberNode({ integer: true })), + rarity: Opt(StringNode({ enum: ['common', 'uncommon', 'rare', 'epic']})), + fireproof: Opt(BooleanNode()), + is_fuel: Opt(BooleanNode()), + fuel_duration: Opt(NumberNode({ integer: true, min: 1 })), has_enchantment_glint: Opt(BooleanNode()), is_enchantable: Opt(BooleanNode()), enchantability: Opt(NumberNode({ integer: true })), - use_duration: Opt(NumberNode({ integer: true })), can_place_block: Opt(BooleanNode()), placable_block: Opt(StringNode({ validator: 'resource', params: { pool: 'block' } })), wearable: Opt(BooleanNode()), - default_color: Opt(NumberNode({ color: true })), wearable_slot: Opt(StringNode()), + dyeable: Opt(BooleanNode()), + default_color: Opt(NumberNode({ color: true })), custom_render_mode: Opt(BooleanNode()), render_mode_models: Opt(ListNode( ObjectNode({ - model: Reference('model_identifier'), + model: Reference('model'), modes: ListNode(StringNode()), }) )), + conversion: Opt(Reference(`${ID}:conversion`)) + }, { context: `${ID}:item_settings` })) + + schemas.register(`${ID}:conversion`, ObjectNode({ + from: ListNode(StringNode()), + to: StringNode() + })) + + schemas.register(`${ID}:item_information`, ObjectNode({ + name: Reference(`${ID}:name`), + item_properties: Reference(`${ID}:item_settings`) }, { context: `${ID}:item_information` })) + schemas.register(`${ID}:tooltip_information`, ObjectNode({ + text: Reference(`${ID}:name`) + }, { context: `${ID}:tooltip_information` })) + schemas.register(`${ID}:item_model`, ObjectNode({ textures: Opt(MapNode( StringNode(), @@ -63,18 +78,9 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg }, { context: `${ID}:item_model` })) schemas.register(`${ID}:block`, Mod(ObjectNode({ + description: Opt(Reference(`${ID}:description`)), block_type: Opt(StringNode({ enum: `${ID}:block_type`})), information: Opt(Reference(`${ID}:block_information`)), - display: Opt(ObjectNode({ - model: Opt(Reference(`${ID}:model`)), - item_model: Opt(Reference(`${ID}:model`)), - block_model: Opt(Reference(`${ID}:model`)), - lore: ListNode( - ObjectNode({ - text: Reference(`${ID}:item_name_information`), - }), - ), - })), additional_information: Opt(ObjectNode({ extraBlocksName: Opt(StringNode()), slab: Opt(BooleanNode()), @@ -115,6 +121,7 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg })), })), })), + lore: Opt(Reference(`${ID}:tooltip_information`)), functions: Opt(ObjectNode({ random_tick: Opt(Reference(`${ID}:function`)), scheduled_tick: Opt(Reference(`${ID}:function`)), @@ -160,7 +167,6 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg }) ), })), - cake_slices: Opt(NumberNode({integer: true, min: 1})), campfire_properties: Opt(ObjectNode({ emits_particles: Opt(BooleanNode()), fire_damage: Opt(NumberNode({ integer: true })), @@ -182,7 +188,7 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg slab: Opt(BooleanNode()), blocks: Opt(ListNode( ObjectNode({ - name: Opt(Reference(`${ID}:name_information`)), + name: Opt(Reference(`${ID}:name`)), display: Opt(Reference(`${ID}:model`)), }) )), @@ -206,45 +212,77 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg height: Opt(NumberNode({ integer: true })), })), placable_feature: Opt(StringNode({ validator: 'resource', params: { pool: '$worldgen/configured_feature' } })), + rendering: Opt(ObjectNode({ + model: Opt(Reference(`${ID}:model`)), + item_model: Opt(Reference(`${ID}:model`)), + block_model: Opt(Reference(`${ID}:model`)), + })) }, { context: `${ID}:block` }), { default: () => ({}), })) schemas.register(`${ID}:block_information`, ObjectNode({ - rarity: Opt(StringNode({ enum: ['common', 'uncommon', 'rare', 'epic']})), - creative_tab: Opt(StringNode()), + name: Opt(Reference(`${ID}:name`)), + block_set_type: Opt(StringNode()), + wood_type: Opt(StringNode()), + parent_block: Opt(StringNode()), + cake_slices: Opt(NumberNode({integer: true, min: 1})), + has_item: Opt(BooleanNode()), + wooden_button: Opt(BooleanNode()), + block_properties: Opt(ChoiceNode([ + { + type: 'string', + node: StringNode(), + change: () => undefined, + }, + { + type: 'object', + node: Reference(`${ID}:block_settings`), + change: () => ({ blah: 1 }), + } + ], { choiceContext: 'tag.list' })), + item_properties: Opt(ChoiceNode([ + { + type: 'string', + node: StringNode(), + change: () => undefined, + }, + { + type: 'object', + node: Reference(`${ID}:item_settings`), + change: () => ({ blah: 1 }), + } + ], { choiceContext: 'tag.list' })), + }, { context: `${ID}:block_information` })) + + schemas.register(`${ID}:block_settings`, ObjectNode({ + sound_group: Opt(Reference(`${ID}:sound_group`)), collidable: Opt(BooleanNode()), - max_stack_size: Opt(NumberNode({ integer: true, min: 1 })), - name: Opt(Reference(`${ID}:name_information`)), - vanilla_sound_group: Opt(StringNode()), - custom_sound_group: Opt(Reference(`${ID}:sound_group`)), - vanilla_material: Opt(StringNode()), - custom_material: Opt(Reference(`${ID}:material`)), - has_glint: Opt(BooleanNode()), - is_enchantable: Opt(BooleanNode()), - enchantability: Opt(NumberNode({ integer: true })), - fireproof: Opt(BooleanNode()), + hardness: Opt(NumberNode({ min: 1 })), + resistance: Opt(NumberNode({ min: 1 })), + randomTicks: Opt(BooleanNode()), + instant_break: Opt(BooleanNode()), + slipperiness: Opt(NumberNode({ min: 1 })), + velocity_modifier: Opt(NumberNode({ min: 1 })), + jump_velocity_modifier: Opt(NumberNode({ min: 1 })), + luminance: Opt(NumberNode({ integer: true, min: 1 })), + is_emissive: Opt(BooleanNode()), translucent: Opt(BooleanNode()), dynamic_boundaries: Opt(BooleanNode()), - has_item: Opt(BooleanNode()), - dyeable: Opt(BooleanNode()), - defaultColor: Opt(NumberNode({ color: true })), - wearable: Opt(BooleanNode()), - wearble_slot: Opt(StringNode()), - custom_render_mode: Opt(BooleanNode()), - render_mode_models: Opt(ListNode( - ObjectNode({ - model: Reference('model_identifier'), - modes: ListNode(StringNode()), - }) - )), - }, { context: `${ID}:block_information` })) + push_reaction: Opt(StringNode()), + map_color: Opt(StringNode()), + }, { context: `${ID}:block_settings` })) schemas.register(`${ID}:block_y_offset`, ObjectNode({ type: Opt(StringNode({enum: ['fixed', 'above_bottom', 'below_top', 'bottom', 'top']})), offset: Opt(NumberNode({ integer: true })), })) + schemas.register(`${ID}:description`, ObjectNode({ + identifier: StringNode(), + register_to_creative_menu: Opt(BooleanNode()), + })) + schemas.register(`${ID}:function`, ObjectNode({ predicate: Opt(Reference(`${ID}:predicate`)), function_type: StringNode({ enum: ['NONE', 'REQUIRES_SHIFTING', 'REQUIRES_ITEM', 'REQUIRES_SHIFTING_AND_ITEM'] }), @@ -302,10 +340,10 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg }, { context: `${ID}:material` })) // COMMON - schemas.register(`${ID}:name_information`, ObjectNode({ + schemas.register(`${ID}:name`, ObjectNode({ id: StringNode(), text: Opt(StringNode()), - type: Opt(StringNode({ enum: ['literal', 'translatable'] })), + textType: Opt(StringNode({ enum: ['literal', 'translatable'] })), translated: Opt(MapNode( StringNode(), StringNode(), @@ -314,7 +352,7 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg formatting: Opt(ListNode(StringNode())), })) - schemas.register(`${ID}:display_information`, ObjectNode({ + schemas.register(`${ID}:rendering`, ObjectNode({ // TODO })) @@ -386,8 +424,8 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg // COLLECTIONS collections.register(`${ID}:block_type`, [ 'BLOCK', - 'HORIZONTAL_FACING_BLOCK', - 'ROTATABLE_BLOCK', + 'HORIZONTAL_DIRECTIONAL', + 'DIRECTIONAL', 'CAMPFIRE', 'STAIRS', 'SLAB', @@ -397,8 +435,7 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg 'CAKE', 'BED', 'TRAPDOOR', - 'METAL_DOOR', - 'WOODEN_DOOR', + 'DOOR', 'LOG', 'STEM', 'WOOD', @@ -412,8 +449,7 @@ export function initObsidian(schemas: SchemaRegistry, collections: CollectionReg 'LEAVES', 'LADDER', 'PATH', - 'WOODEN_BUTTON', - 'STONE_BUTTON', + 'BUTTON', 'DOUBLE_PLANT', 'HORIZONTAL_FACING_DOUBLE_PLANT', 'HANGING_DOUBLE_LEAVES', diff --git a/src/app/partners/locales/en.json b/src/app/partners/locales/en.json index 0fac55f00..7675b0f98 100644 --- a/src/app/partners/locales/en.json +++ b/src/app/partners/locales/en.json @@ -75,21 +75,7 @@ "lithostitched:modifier_predicate_type.lithostitched:true": "True", "obsidian:item.information": "Item Information", - "obsidian:item_information.rarity": "Rarity", - "obsidian:item_information.creative_tab": "Creative Tab", - "obsidian:item_information.max_stack_size": "Max Stack Size", - "obsidian:item_information.name": "Item Name", - "obsidian:item_information.has_enchantment_glint": "Has Enchantment Glint", - "obsidian:item_information.is_enchantable": "Is Enchantable", - "obsidian:item_information.enchantability": "Enchantability", - "obsidian:item_information.use_duration": "Item Duration", - "obsidian:item_information.can_place_block": "Can Place Block", - "obsidian:item_information.placable_block": "Placable Block", - "obsidian:item_information.wearable": "Wearable", - "obsidian:item_information.default_color": "Default Color", - "obsidian:item_information.wearable_slot": "Wearable Slot", - "obsidian:item_information.custom_render_mode": "Has display-based models", - "obsidian:item_information.render_mode_models": "Display-based Models", + "obsidian:item_information.name": "Name", "obsidian:item.display": "Display", "obsidian:item.display.model": "Model", "obsidian:item.display.item_model": "Item Model", @@ -102,19 +88,44 @@ "obsidian:item.use_action.gui_size": "GUI Size", "obsidian:item.use_action.gui_title": "GUI Title", + "obsidian:item_settings.base_item_settings": "Parent Item Settings", + "obsidian:item_settings.creative_tab": "Creative Tab", + "obsidian:item_settings.max_stack_size": "Max Stack Size", + "obsidian:item_settings.durability": "Durability", + "obsidian:item_settings.rarity": "Rarity", + "obsidian:item_settings.fireproof": "Fireproof", + "obsidian:item_settings.is_fuel": "Is Fuel", + "obsidian:item_settings.fuel_duration": "Fuel Duration", + "obsidian:item_settings.has_enchantment_glint": "Has Enchantment Glint", + "obsidian:item_settings.is_enchantable": "Is Enchantable", + "obsidian:item_settings.enchantability": "Enchantability", + "obsidian:item_settings.can_place_block": "Can Place Block", + "obsidian:item_settings.placable_block": "Placable Block", + "obsidian:item_settings.wearable": "Wearable", + "obsidian:item_settings.default_color": "Default Color", + "obsidian:item_settings.dyeable": "Dyeable", + "obsidian:item_settings.wearable_slot": "Wearable Slot", + "obsidian:item_settings.custom_render_mode": "Has display-based models", + "obsidian:item_settings.render_mode_models": "Display-based Models", + "obsidian:item_settings.conversion": "Conversion", + "obsidian:item_settings.conversion.from": "Input", + "obsidian:item_settings.conversion.to": "Result", + "obsidian:block.block_type": "Block Type", "obsidian:block.information": "Block Information", "obsidian:block_information.rarity": "Rarity", "obsidian:block_information.creative_tab": "Creative Tab", "obsidian:block_information.max_stack_size": "Max Stack Size", - "obsidian:block_information.name": "Item Name", - "obsidian:block_information.sound_group_type": "Sound Group Type", - "obsidian:block_information.vanilla_sound_group": "Vanilla Sound Group", - "obsidian:block_information.custom_sound_group": "Custom Sound Group", - "obsidian:block_information.material_type": "Material Type", - "obsidian:block_information.vanilla_material": "Vanilla Material", - "obsidian:block_information.custom_material": "Custom Material", - "obsidian:block.display": "Display", + "obsidian:block_information.name": "Name", + "obsidian:block_information.name.id": "Block Identifier", + "obsidian:block_information.name.text": "Block Name", + "obsidian:block_information.name.textType": "Block Name Type", + "obsidian:block_information.name.translated": "Translated Names", + "obsidian:block_information.name.color": "Name Color", + "obsidian:block_information.name.formatting": "Name Formatting", + "obsidian:block_information.block_properties": "Block Properties", + "obsidian:block_information.item_properties": "Item Properties", + "obsidian:block.rendering": "Rendering", "obsidian:block.additional_information": "Additional Information", "obsidian:block.ore_information": "Ore Information", "obsidian:block.food_information": "Food Information", @@ -128,10 +139,26 @@ "obsidian:block.is_multi_block": "Is Multi-Block", "obsidian:block.multiblock_information": "Multiblock Information", "obsidian:block.placable_feature": "Placable Feature", - "obsidian:block.display.model": "Model", - "obsidian:block.display.item_model": "Item Model", - "obsidian:block.display.block_model": "Block Model", - "obsidian:block.display.lore": "Lore", + "obsidian:block.rendering.model": "Model", + "obsidian:block.rendering.item_model": "Item Model", + "obsidian:block.rendering.block_model": "Block Model", + "obsidian:block.rendering.lore": "Lore", + + "obsidian:block_settings.sound_group": "Sound Group", + "obsidian:block_settings.collidable": "Collidable", + "obsidian:block_settings.hardness": "Hardness", + "obsidian:block_settings.resistance": "Resistance", + "obsidian:block_settings.randomTicks": "Ticks Randomly", + "obsidian:block_settings.instant_break": "Breaks Instantly", + "obsidian:block_settings.slipperiness": "Slipperiness", + "obsidian:block_settings.velocity_modifier": "Velocity Modifier", + "obsidian:block_settings.jump_velocity_modifier": "Jump Velocity Modifier", + "obsidian:block_settings.luminance": "Luminance", + "obsidian:block_settings.is_emissive": "Is Emissive", + "obsidian:block_settings.translucent": "Translucent", + "obsidian:block_settings.dynamic_boundaries": "Dynamic Boundaries", + "obsidian:block_settings.push_reaction": "Push Reaction", + "obsidian:block_settings.map_color": "Map Color", "ohthetreesyoullgrow:feature.ohthetreesyoullgrow:tree_from_nbt_v1": "Tree from NBT v1", "ohthetreesyoullgrow.configured_feature.type": "Type",