import React, { useState } from 'react'; import { Icons } from '../components/IconSet'; interface FileBlock { name: string; path: string; language: string; content: string; } const DatapackGenerator: React.FC = () => { const [activeFile, setActiveFile] = useState('menu.mcfunction'); const files: FileBlock[] = [ { name: 'pack.mcmeta', path: 'obsidian_core/pack.mcmeta', language: 'json', content: `{ "pack": { "pack_format": 15, "description": "Obsidian Core - Verwaltung (v2.4 DE)" } }` }, { name: 'load.json', path: 'obsidian_core/data/minecraft/tags/functions/load.json', language: 'json', content: `{ "values": [ "obsidian:load" ] }` }, { name: 'tick.json', path: 'obsidian_core/data/minecraft/tags/functions/tick.json', language: 'json', content: `{ "values": [ "obsidian:system/tick" ] }` }, { name: 'load.mcfunction', path: 'obsidian_core/data/obsidian/functions/load.mcfunction', language: 'mcfunction', content: `# Initialize Scoreboards scoreboard objectives add obs_action trigger scoreboard objectives add obs_id dummy # Initialize Storage data modify storage obsidian:main selected set value {id:"Keine", type:"None"} tellraw @a {"text":"[Obsidian] System geladen. Trigger registriert.","color":"green"}` }, { name: 'tick.mcfunction', path: 'obsidian_core/data/obsidian/functions/system/tick.mcfunction', language: 'mcfunction', content: `# Enable trigger for all players execute as @a run scoreboard players enable @s obs_action # Detect triggers execute as @a[scores={obs_action=1..}] run function obsidian:system/handle_trigger` }, { name: 'menu.mcfunction', path: 'obsidian_core/data/obsidian/functions/ui/menu.mcfunction', language: 'mcfunction', content: `tellraw @s ["",{"text":"\\n=== OBSIDIAN MENÜ ===\\n","color":"dark_aqua","bold":true}] tellraw @s ["",{"text":"Neu erstellen:","color":"gray"}] tellraw @s [{"text":"[+ Stadt] ","color":"gold","clickEvent":{"action":"run_command","value":"/trigger obs_action set 10"},"hoverEvent":{"action":"show_text","value":"Eine neue Stadt gründen"}}] tellraw @s [{"text":" [+ Unternehmung] ","color":"green","clickEvent":{"action":"run_command","value":"/trigger obs_action set 20"},"hoverEvent":{"action":"show_text","value":"Ein neues Unternehmen registrieren"}}] tellraw @s ["",{"text":"\\n\\nZielauswahl:","color":"gray"}] tellraw @s [{"text":"[Wähle per Name] ","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger obs_action set 30"},"hoverEvent":{"action":"show_text","value":"Halte ein Item mit dem exakten Namen um den Eintrag zu wählen."}}] tellraw @s ["",{"text":"\\nAktuell gewählt: ","color":"gray"},{"nbt":"selected.id","storage":"obsidian:main","color":"light_purple"}] # Edit Controls tellraw @s ["",{"text":"Bearbeiten: ","color":"gray"}] tellraw @s [{"text":"[Umbenennen] ","color":"white","clickEvent":{"action":"run_command","value":"/trigger obs_action set 60"},"hoverEvent":{"action":"show_text","value":"Namen des Eintrags ändern"}}] tellraw @s [{"text":"[Beschr. ändern] ","color":"white","clickEvent":{"action":"run_command","value":"/trigger obs_action set 40"},"hoverEvent":{"action":"show_text","value":"Beschreibungstext aktualisieren"}}] tellraw @s [{"text":"[Status ändern] ","color":"white","clickEvent":{"action":"run_command","value":"/trigger obs_action set 50"},"hoverEvent":{"action":"show_text","value":"Wechseln zwischen Aktiv/Rekrutierend/Geschlossen"}}] tellraw @s ["",{"text":"\\n\\n[?] Hilfe","color":"yellow","clickEvent":{"action":"run_command","value":"/trigger obs_action set 9"},"hoverEvent":{"action":"show_text","value":"Spieleranleitung lesen"}}]` }, { name: 'handle_trigger.mcfunction', path: 'obsidian_core/data/obsidian/functions/system/handle_trigger.mcfunction', language: 'mcfunction', content: `# --- HANDLE TRIGGERS --- # 1: Open Menu execute if score @s obs_action matches 1 run function obsidian:ui/menu # 9: Help execute if score @s obs_action matches 9 run function obsidian:ui/help # --- CREATION --- # 10: Prompt City execute if score @s obs_action matches 10 run tellraw @s ["",{"text":"[Neue Stadt] ","color":"gold"},{"text":"Item in Stadt-Name umbenennen. Halten & ","color":"gray"},{"text":"[KLICK]","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/trigger obs_action set 11"}}] # 11: Create City execute if score @s obs_action matches 11 run tellraw @a [{"text":"Neue Stadt gegründet: ","color":"gold"},{"nbt":"SelectedItem.tag.display.Name","entity":"@s"}] execute if score @s obs_action matches 11 run data modify storage obsidian:db Cities append value {name:"New",status:"active"} execute if score @s obs_action matches 11 run data modify storage obsidian:db Cities[-1].name set from entity @s SelectedItem.tag.display.Name # 20: Prompt Venture execute if score @s obs_action matches 20 run tellraw @s ["",{"text":"[Neues Unternehmen] ","color":"green"},{"text":"Item in Firmen-Name umbenennen. Halten & ","color":"gray"},{"text":"[KLICK]","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/trigger obs_action set 21"}}] # 21: Create Venture execute if score @s obs_action matches 21 run tellraw @a [{"text":"Neues Unternehmen registriert: ","color":"green"},{"nbt":"SelectedItem.tag.display.Name","entity":"@s"}] execute if score @s obs_action matches 21 run data modify storage obsidian:db Ventures append value {name:"New",status:"active"} execute if score @s obs_action matches 21 run data modify storage obsidian:db Ventures[-1].name set from entity @s SelectedItem.tag.display.Name # --- SELECTION --- # 30: Select Target execute if score @s obs_action matches 30 run data modify storage obsidian:main selected.id set from entity @s SelectedItem.tag.display.Name execute if score @s obs_action matches 30 run tellraw @s [{"text":"Ziel erfasst: ","color":"aqua"},{"nbt":"selected.id","storage":"obsidian:main"}] # --- EDITING --- # 40/41: Description execute if score @s obs_action matches 40 run tellraw @s ["",{"text":"[Beschr. ändern] ","color":"light_purple"},{"text":"Item in neue Beschreibung umbenennen. Halten & ","color":"gray"},{"text":"[UPDATE]","color":"yellow","bold":true,"clickEvent":{"action":"run_command","value":"/trigger obs_action set 41"}}] execute if score @s obs_action matches 41 run tellraw @a [{"text":"LOG|UPDATE_DESC|","color":"dark_gray"},{"nbt":"selected.id","storage":"obsidian:main"},{"text":"|"},{"nbt":"SelectedItem.tag.display.Name","entity":"@s"}] # 50: Toggle Status (Active -> Recruiting -> Closed) execute if score @s obs_action matches 50 run tellraw @a [{"text":"LOG|CYCLE_STATUS|","color":"dark_gray"},{"nbt":"selected.id","storage":"obsidian:main"}] # 60/61: Rename Entry execute if score @s obs_action matches 60 run tellraw @s ["",{"text":"[Umbenennen] ","color":"red"},{"text":"Item in NEUEN Namen umbenennen. Halten & ","color":"gray"},{"text":"[BESTÄTIGEN]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/trigger obs_action set 61"}}] execute if score @s obs_action matches 61 run tellraw @a [{"text":"LOG|RENAME_ENTRY|","color":"dark_gray"},{"nbt":"selected.id","storage":"obsidian:main"},{"text":"|"},{"nbt":"SelectedItem.tag.display.Name","entity":"@s"}] execute if score @s obs_action matches 61 run data modify storage obsidian:main selected.id set from entity @s SelectedItem.tag.display.Name # Reset scoreboard players set @s obs_action 0 scoreboard players enable @s obs_action` }, { name: 'help.mcfunction', path: 'obsidian_core/data/obsidian/functions/ui/help.mcfunction', language: 'mcfunction', content: `tellraw @s ["",{"text":"\\n=== OBSIDIAN ANLEITUNG ===\\n","color":"dark_aqua","bold":true}] tellraw @s [{"text":"[!] ","color":"yellow"},{"text":"Texteingabe ohne Befehle:","color":"gray"}] tellraw @s [{"text":"\\n1. Item umbenennen: ","color":"white","bold":true},{"text":"Benenne ein Papier (oder Item) im Amboss um (Dein Text).","color":"gray"}] tellraw @s [{"text":"\\n2. Item halten: ","color":"white","bold":true},{"text":"Halte das Item in der Haupthand.","color":"gray"}] tellraw @s [{"text":"\\n3. Aktion klicken: ","color":"white","bold":true},{"text":"Klicke [Bestätigen] oder [Wählen] im Menü.","color":"gray"}] tellraw @s [{"text":"\\nDas System liest den Item-Namen als Eingabe.","color":"gray","italic":true}]` }, { name: 'export.mcfunction', path: 'obsidian_core/data/obsidian/functions/system/export.mcfunction', language: 'mcfunction', content: `# Admin Only Export tellraw @a {"text":"JSON_EXPORT_START|DB_DUMP|", "color":"white"} tellraw @a {"nbt":"Cities","storage":"obsidian:db"} tellraw @a {"nbt":"Ventures","storage":"obsidian:db"}` } ]; const currentFile = files.find(f => f.name === activeFile); return (
{/* Intro Sidebar */}
v2.4 Non-OP (DE) Trigger System

Datapack Generator

Non-OP Management System. Nutzt Item-Umbenennung als sichere Eingabemethode für Spielertexte.

{/* PLAYER GUIDE SECTION */}

Spieler Anleitung

Verteile diese Anleitung an deine Spieler. Da normale Spieler keine Befehle nutzen können, nutzt dieses Pack ein immersives "Item Key" System.

1
Erstellen

Klicke [+ Unternehmung], benenne ein Item zu "Mein Shop", halte es, und klicke den Bestätigungs-Link.

2
Zum Bearbeiten wählen

Halte ein Item mit dem exakten Namen deiner Firma. Klicke [Wähle per Name]. Das Menü visiert nun diesen Eintrag an.

3
Modifizieren

Nutze [Umbenennen] oder [Beschr. ändern]. Du wirst aufgefordert, ein Item zum NEUEN Wert umzubenennen und zu bestätigen.

{/* Admin Note */}
Wichtig: Ich habe load.json hinzugefügt, um sicherzustellen, dass das Scoreboard automatisch erstellt wird. Bitte führe /reload nach der Installation aus.
{/* Code Viewer */}
{/* Tabs */}
{files.map(file => ( ))}
{/* Editor Content */}
{currentFile && (
Dateipfad: {currentFile.path}
                        {currentFile.content}
                    
)}
); }; export default DatapackGenerator;