mirror of
https://github.com/misode/misode.github.io.git
synced 2026-05-05 07:01:48 +00:00
🔥 Nuke all mcschema related code
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { DataModel } from '@mcschema/core'
|
||||
import { BlockDefinition, BlockModel, Identifier, Structure, StructureRenderer } from 'deepslate/render'
|
||||
import type { mat4 } from 'gl-matrix'
|
||||
import { useCallback, useRef } from 'preact/hooks'
|
||||
@@ -12,22 +11,22 @@ import { InteractiveCanvas3D } from './InteractiveCanvas3D.jsx'
|
||||
const PREVIEW_ID = Identifier.parse('misode:preview')
|
||||
const PREVIEW_DEFINITION = new BlockDefinition({ '': { model: PREVIEW_ID.toString() }}, undefined)
|
||||
|
||||
export const ModelPreview = ({ data, shown }: PreviewProps) => {
|
||||
export const ModelPreview = ({ model, shown }: PreviewProps) => {
|
||||
const { version } = useVersion()
|
||||
const serializedData = JSON.stringify(data)
|
||||
const serializedData = JSON.stringify(model.data)
|
||||
|
||||
const { value: resources } = useAsync(async () => {
|
||||
if (!shown) return AsyncCancel
|
||||
const resources = await getResources(version)
|
||||
const model = BlockModel.fromJson(DataModel.unwrapLists(data))
|
||||
model.flatten(resources)
|
||||
const blockModel = BlockModel.fromJson(model.data)
|
||||
blockModel.flatten(resources)
|
||||
const wrapper = new ResourceWrapper(resources, {
|
||||
getBlockDefinition(id) {
|
||||
if (id.equals(PREVIEW_ID)) return PREVIEW_DEFINITION
|
||||
return null
|
||||
},
|
||||
getBlockModel(id) {
|
||||
if (id.equals(PREVIEW_ID)) return model
|
||||
if (id.equals(PREVIEW_ID)) return blockModel
|
||||
return null
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user