Skip to content

Commit

Permalink
fix: fix cobblestone_wall and player head (skull) rendering in prefla…
Browse files Browse the repository at this point in the history
…t versions
  • Loading branch information
zardoy committed Sep 7, 2024
1 parent 1c7fdc2 commit a063a0d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
23 changes: 20 additions & 3 deletions prismarine-viewer/viewer/lib/mesher/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,15 +479,32 @@ export function getSectionGeometry (sx, sy, sz, world: World) {
// cache
let { models } = block
if (block.models === undefined) {
const props = block.getProperties()
try {
// fixme
if (world.preflat) {
if (block.name === 'cobblestone_wall') {
props.up = 'true'
for (const key of ['north', 'south', 'east', 'west']) {
const val = props[key]
if (val === 'false' || val === 'true') {
props[key] = val === 'true' ? 'low' : 'none'
}
}
}
}

models = blockProvider.getAllResolvedModels0_1({
name: block.name,
properties: block.getProperties(),
properties: props,
})!
if (!models.length) models = null
if (!models.length) {
console.debug('[mesher] block to render not found', block.name, props)
models = null
}
} catch (err) {
models ??= erroredBlockModel
console.error(`Critical assets error. Unable to get block model for ${block.name}[${JSON.stringify(block.getProperties())}]: ` + err.message, err.stack)
console.error(`Critical assets error. Unable to get block model for ${block.name}[${JSON.stringify(props)}]: ` + err.message, err.stack)
attr.hadErrors = true
}
}
Expand Down
24 changes: 12 additions & 12 deletions src/preflatMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -925,18 +925,18 @@
"143:11": "oak_button[face=wall,facing=south,powered=true]",
"143:12": "oak_button[face=wall,facing=north,powered=true]",
"143:13": "oak_button[face=floor,facing=north,powered=true]",
"144:0": "undefined[facing=down,nodrop=false]",
"144:1": "undefined[facing=up,nodrop=false]",
"144:2": "undefined[facing=north,nodrop=false]",
"144:3": "undefined[facing=south,nodrop=false]",
"144:4": "undefined[facing=west,nodrop=false]",
"144:5": "undefined[facing=east,nodrop=false]",
"144:8": "undefined[facing=down,nodrop=true]",
"144:9": "undefined[facing=up,nodrop=true]",
"144:10": "undefined[facing=north,nodrop=true]",
"144:11": "undefined[facing=south,nodrop=true]",
"144:12": "undefined[facing=west,nodrop=true]",
"144:13": "undefined[facing=east,nodrop=true]",
"144:0": "player_head[facing=down]",
"144:1": "player_head[facing=up]",
"144:2": "player_head[facing=north]",
"144:3": "player_head[facing=south]",
"144:4": "player_head[facing=west]",
"144:5": "player_head[facing=east]",
"144:8": "player_head[facing=down]",
"144:9": "player_head[facing=up]",
"144:10": "player_head[facing=north]",
"144:11": "player_head[facing=south]",
"144:12": "player_head[facing=west]",
"144:13": "player_head[facing=east]",
"145:0": "anvil[facing=south]",
"145:1": "anvil[facing=west]",
"145:2": "anvil[facing=north]",
Expand Down

0 comments on commit a063a0d

Please sign in to comment.