diff --git a/src/app/components/ErrorPanel.tsx b/src/app/components/ErrorPanel.tsx index e14062d1..4517f41c 100644 --- a/src/app/components/ErrorPanel.tsx +++ b/src/app/components/ErrorPanel.tsx @@ -1,19 +1,20 @@ import type { ComponentChildren } from 'preact' import { getCurrentUrl } from 'preact-router' import { useEffect, useMemo, useState } from 'preact/hooks' -import { useVersion } from '../contexts/Version.jsx' -import { latestVersion } from '../services/DataFetcher.js' import { Store } from '../Store.js' import { getGenerator } from '../Utils.js' +import { useVersion } from '../contexts/Version.jsx' +import { latestVersion } from '../services/DataFetcher.js' import { Octicon } from './index.js' type ErrorPanelProps = { error: string | Error, reportable?: boolean, onDismiss?: () => unknown, + body?: string, children?: ComponentChildren, } -export function ErrorPanel({ error, reportable, onDismiss, children }: ErrorPanelProps) { +export function ErrorPanel({ error, reportable, onDismiss, body: body_, children }: ErrorPanelProps) { const { version } = useVersion() const [stackVisible, setStackVisible] = useState(false) const [stack, setStack] = useState(undefined) @@ -54,9 +55,12 @@ export function ErrorPanel({ error, reportable, onDismiss, children }: ErrorPane if (source) { body += `\n### Generator JSON\n
\n
\n${JSON.stringify(source, null, 2)}\n
\n
\n` } + if (body_) { + body += body_ + } url += `&body=${encodeURIComponent(body)}` return url - }, [error, version, stack, source, gen?.id]) + }, [error, body_, version, stack, source, gen?.id]) return
{onDismiss &&
{Octicon.x}
} diff --git a/src/app/components/customized/CustomizedGenerator.ts b/src/app/components/customized/CustomizedGenerator.ts index 101ff8f8..52efb253 100644 --- a/src/app/components/customized/CustomizedGenerator.ts +++ b/src/app/components/customized/CustomizedGenerator.ts @@ -261,7 +261,7 @@ function generateOreFeatures(ctx: Context) { } else { const placed = deepClone(ctx.vanilla['worldgen/placed_feature'].get(name)) if (value.tries !== initial.tries) { - const modifier = placed.placement.find((m: any) => m.type === 'minecraft:count' || m.type === 'rarity_filter') + const modifier = placed.placement.find((m: any) => m.type === 'minecraft:count' || m.type === 'minecraft:rarity_filter') if (Number.isInteger(value.tries)) { modifier.type = 'minecraft:count', modifier.count = value.tries diff --git a/src/app/pages/Customized.tsx b/src/app/pages/Customized.tsx index e97533f1..62c2a353 100644 --- a/src/app/pages/Customized.tsx +++ b/src/app/pages/Customized.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useErrorBoundary, useMemo, useRef, useState } from 'preact/hooks' import config from '../Config.js' -import { writeZip } from '../Utils.js' +import { deepClone, deepEqual, writeZip } from '../Utils.js' import { BasicSettings } from '../components/customized/BasicSettings.jsx' import { generateCustomized } from '../components/customized/CustomizedGenerator.js' import { CustomizedModel } from '../components/customized/CustomizedModel.js' @@ -89,8 +89,21 @@ export function Customized({}: Props) {
- {error && setError(null)} />} + {error && setError(null)} body={`\n### Customized settings\n
\n
\n${JSON.stringify(getDiffModel(model, initialModel), null, 2)}\n
\n
\n`} />}