Get project data for worldgen previews

This commit is contained in:
Misode
2024-11-27 06:01:05 +01:00
parent 2bc0fc23d8
commit 1abc28f369
4 changed files with 32 additions and 7 deletions

View File

@@ -2,7 +2,7 @@ import { clampedMap } from 'deepslate'
import type { mat3 } from 'gl-matrix'
import { vec2 } from 'gl-matrix'
import { useCallback, useRef, useState } from 'preact/hooks'
import { useLocale, useProject, useVersion } from '../../contexts/index.js'
import { getWorldgenProjectData, useLocale, useProject, useVersion } from '../../contexts/index.js'
import { useAsync } from '../../hooks/index.js'
import { fetchRegistries } from '../../services/index.js'
import { Store } from '../../Store.js'
@@ -27,7 +27,8 @@ export const NoiseSettingsPreview = ({ docAndNode, shown }: PreviewProps) => {
const { value, error } = useAsync(async () => {
const data = safeJsonParse(text) ?? {}
await DEEPSLATE.loadVersion(version, {}) // TODO: get project data
const projectData = await getWorldgenProjectData(project)
await DEEPSLATE.loadVersion(version, projectData)
const biomeSource = { type: 'fixed', biome }
await DEEPSLATE.loadChunkGenerator(data, biomeSource, seed)
const noiseSettings = DEEPSLATE.getNoiseSettings()