mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 23:27:09 +00:00
Fix #301 update deepslate with new special renderers
This commit is contained in:
@@ -18,7 +18,7 @@ export const BlockStatePreview = ({ data, shown }: PreviewProps) => {
|
||||
const { value: resources } = useAsync(async () => {
|
||||
if (!shown) return AsyncCancel
|
||||
const resources = await getResources(version)
|
||||
const definition = BlockDefinition.fromJson(PREVIEW_ID.toString(), DataModel.unwrapLists(data))
|
||||
const definition = BlockDefinition.fromJson(DataModel.unwrapLists(data))
|
||||
const wrapper = new ResourceWrapper(resources, {
|
||||
getBlockDefinition(id) {
|
||||
if (id.equals(PREVIEW_ID)) return definition
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { PreviewProps } from './index.js'
|
||||
import { InteractiveCanvas3D } from './InteractiveCanvas3D.jsx'
|
||||
|
||||
const PREVIEW_ID = Identifier.parse('misode:preview')
|
||||
const PREVIEW_DEFINITION = new BlockDefinition(PREVIEW_ID, { '': { model: PREVIEW_ID.toString() }}, undefined)
|
||||
const PREVIEW_DEFINITION = new BlockDefinition({ '': { model: PREVIEW_ID.toString() }}, undefined)
|
||||
|
||||
export const ModelPreview = ({ data, shown }: PreviewProps) => {
|
||||
const { version } = useVersion()
|
||||
@@ -19,7 +19,7 @@ export const ModelPreview = ({ data, shown }: PreviewProps) => {
|
||||
const { value: resources } = useAsync(async () => {
|
||||
if (!shown) return AsyncCancel
|
||||
const resources = await getResources(version)
|
||||
const model = BlockModel.fromJson(PREVIEW_ID.toString(), DataModel.unwrapLists(data))
|
||||
const model = BlockModel.fromJson(DataModel.unwrapLists(data))
|
||||
model.flatten(resources)
|
||||
const wrapper = new ResourceWrapper(resources, {
|
||||
getBlockDefinition(id) {
|
||||
|
||||
@@ -98,14 +98,14 @@ export class ResourceManager implements Resources {
|
||||
|
||||
private loadBlockModels(models: Map<string, unknown>) {
|
||||
[...models.entries()].forEach(([id, model]) => {
|
||||
this.blockModels[Identifier.create(id).toString()] = BlockModel.fromJson(id, model)
|
||||
this.blockModels[Identifier.create(id).toString()] = BlockModel.fromJson(model)
|
||||
})
|
||||
Object.values(this.blockModels).forEach(m => m.flatten(this))
|
||||
}
|
||||
|
||||
private loadBlockDefinitions(definitions: Map<string, unknown>) {
|
||||
[...definitions.entries()].forEach(([id, definition]) => {
|
||||
this.blockDefinitions[Identifier.create(id).toString()] = BlockDefinition.fromJson(id, definition)
|
||||
this.blockDefinitions[Identifier.create(id).toString()] = BlockDefinition.fromJson(definition)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user