import { Identifier, ItemStack } from 'deepslate' import { deepClone } from '../../Utils.js' import { ItemDisplay } from '../ItemDisplay.jsx' import { CustomizedInput } from './CustomizedInput.jsx' import type { CustomizedModel, CustomizedOreModel } from './CustomizedModel.js' import { CustomizedOre } from './CustomizedOre.jsx' interface Props { label: string, item?: string, ores: (keyof CustomizedModel)[], model: CustomizedModel, initialModel: CustomizedModel, changeModel: (model: Partial) => void, } export function CustomizedOreGroup({ label, item, ores, model, initialModel, changeModel }: Props) { const isEnabled = ores.every(k => model[k] != undefined) return
{item != undefined && } } value={ores.map(k => model[k])} initial={ores.map(k => initialModel[k])} onChange={() => changeModel(ores.reduce((acc, k) => ({ ...acc, [k]: deepClone(initialModel[k])}), {}))}> / {isEnabled && ores.map(k =>
changeModel({ [k]: v })} initial={initialModel[k] as CustomizedOreModel} />
)}
}