diff --git a/src/app/components/Octicon.tsx b/src/app/components/Octicon.tsx index 68acfd40..2adb2d03 100644 --- a/src/app/components/Octicon.tsx +++ b/src/app/components/Octicon.tsx @@ -37,6 +37,7 @@ export const Octicon = { lock: , mark_github: , moon: , + mortar_board: , package: , pencil: , play: , diff --git a/src/app/pages/Customized.tsx b/src/app/pages/Customized.tsx index 62c2a353..763a1c72 100644 --- a/src/app/pages/Customized.tsx +++ b/src/app/pages/Customized.tsx @@ -6,7 +6,7 @@ import { generateCustomized } from '../components/customized/CustomizedGenerator import { CustomizedModel } from '../components/customized/CustomizedModel.js' import { OresSettings } from '../components/customized/OresSettings.jsx' import { StructuresSettings } from '../components/customized/StructuresSettings.jsx' -import { Btn, ErrorPanel, Footer, VersionSwitcher } from '../components/index.js' +import { Btn, ErrorPanel, Footer, Octicon, VersionSwitcher } from '../components/index.js' import { useLocale, useTitle } from '../contexts/index.js' import { useSearchParam } from '../hooks/index.js' import { stringifySource } from '../services/Source.js' @@ -43,9 +43,17 @@ export function Customized({}: Props) { const initialModel = useMemo(() => { return CustomizedModel.getDefault(version) }, [version]) + const isModified = useMemo(() => { + return !deepEqual(model, initialModel) + }, [model, initialModel]) + + const reset = useCallback(() => { + setModel(deepClone(initialModel)) + }, [initialModel]) const download = useRef(null) const [error, setError] = useState(null) + const [hasDownloaded, setHasDownloaded] = useState(false) const generate = useCallback(async () => { if (!download.current) return try { @@ -63,6 +71,7 @@ export function Customized({}: Props) { download.current.setAttribute('href', url) download.current.setAttribute('download', 'customized.zip') download.current.click() + setHasDownloaded(true) setError(null) } catch (e) { if (e instanceof Error) { @@ -86,10 +95,24 @@ export function Customized({}: Props) { {tab === 'ores' && }
- + + {isModified && }
{error && setError(null)} body={`\n### Customized settings\n
\n
\n${JSON.stringify(getDiffModel(model, initialModel), null, 2)}\n
\n
\n`} />} + {hasDownloaded &&
+

+ {Octicon.mortar_board} + What now? +

+
    +
  1. After launching Minecraft, create a new singleplayer world.
  2. +
  3. Select the "More" tab at the top.
  4. +
  5. Click on "Data Packs" and drag the downloaded zip file onto the game window.
  6. +
  7. Move the imported data pack to the right panel and click on "Done".
  8. +
  9. A message will warn about the use of experimental world settings. Click on "Proceed".
  10. +
+
}