mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 07:10:41 +00:00
Fix #301 update deepslate with new special renderers
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@@ -30,7 +30,7 @@
|
||||
"brace": "^0.11.1",
|
||||
"buffer": "^6.0.3",
|
||||
"comment-json": "^4.1.1",
|
||||
"deepslate": "^0.21.0",
|
||||
"deepslate": "^0.22.0",
|
||||
"deepslate-1.18": "npm:deepslate@0.9.0-beta.9",
|
||||
"deepslate-1.18.2": "npm:deepslate@0.9.0",
|
||||
"deepslate-1.20.4": "npm:deepslate@0.20.1",
|
||||
@@ -1629,9 +1629,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/deepslate": {
|
||||
"version": "0.21.0",
|
||||
"resolved": "https://registry.npmjs.org/deepslate/-/deepslate-0.21.0.tgz",
|
||||
"integrity": "sha512-Km1JotTlko37L81N3fKfxEerHwVhF3+c+sCUMF3X6gxNHsiG0RSjRpNY63pxuRahxsmyuOyFjgQhQKH2hd2alg==",
|
||||
"version": "0.22.0",
|
||||
"resolved": "https://registry.npmjs.org/deepslate/-/deepslate-0.22.0.tgz",
|
||||
"integrity": "sha512-vxbwrWRhYrxRifGmzlVOAOYTYWFTpVLp4pmx9w0Cxryo2YDoIceb5AwjnxQO5eUuFri4tBY42KFiuzrnUA1V9g==",
|
||||
"dependencies": {
|
||||
"gl-matrix": "^3.3.0",
|
||||
"md5": "^2.3.0",
|
||||
@@ -5465,9 +5465,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"deepslate": {
|
||||
"version": "0.21.0",
|
||||
"resolved": "https://registry.npmjs.org/deepslate/-/deepslate-0.21.0.tgz",
|
||||
"integrity": "sha512-Km1JotTlko37L81N3fKfxEerHwVhF3+c+sCUMF3X6gxNHsiG0RSjRpNY63pxuRahxsmyuOyFjgQhQKH2hd2alg==",
|
||||
"version": "0.22.0",
|
||||
"resolved": "https://registry.npmjs.org/deepslate/-/deepslate-0.22.0.tgz",
|
||||
"integrity": "sha512-vxbwrWRhYrxRifGmzlVOAOYTYWFTpVLp4pmx9w0Cxryo2YDoIceb5AwjnxQO5eUuFri4tBY42KFiuzrnUA1V9g==",
|
||||
"requires": {
|
||||
"gl-matrix": "^3.3.0",
|
||||
"md5": "^2.3.0",
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"deepslate-1.18": "npm:deepslate@0.9.0-beta.9",
|
||||
"deepslate-1.18.2": "npm:deepslate@0.9.0",
|
||||
"deepslate-1.20.4": "npm:deepslate@0.20.1",
|
||||
"deepslate": "^0.21.0",
|
||||
"deepslate": "^0.22.0",
|
||||
"highlight.js": "^11.5.1",
|
||||
"howler": "^2.2.3",
|
||||
"js-yaml": "^3.14.1",
|
||||
|
||||
@@ -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