Skip to content

Commit

Permalink
Fix #301 update deepslate with new special renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Oct 2, 2024
1 parent 75c6628 commit 7754d36
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/previews/BlockStatePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/previews/ModelPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/Resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

Expand Down

0 comments on commit 7754d36

Please sign in to comment.