Skip to content

Commit 2cb4ef4

Browse files
committed
🛠️ Fix incorrect block model rotations with facing
1 parent 6c084db commit 2cb4ef4

File tree

4 files changed

+8
-21
lines changed

4 files changed

+8
-21
lines changed

src/outliner/vanillaBlockDisplay.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ export const PREVIEW_CONTROLLER = new NodePreviewController(VanillaBlockDisplay,
240240
el.preview_controller.updateTransform(el)
241241
el.mesh.visible = el.visibility
242242
TickUpdates.selection = true
243+
244+
el.ready = true
243245
})
244246
.catch(err => {
245247
console.error(err)
@@ -252,7 +254,6 @@ export const PREVIEW_CONTROLLER = new NodePreviewController(VanillaBlockDisplay,
252254
if (el.error.get()) el.mesh.outline.material = ERROR_OUTLINE_MATERIAL
253255
else el.mesh.outline.material = Canvas.outlineMaterial
254256
}
255-
el.ready = true
256257
})
257258
},
258259
updateTransform(el: VanillaBlockDisplay) {

src/outliner/vanillaItemDisplay.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ import { ResizableOutlinerElement } from './resizableOutlinerElement'
1414
import { TextDisplay } from './textDisplay'
1515
import { VanillaBlockDisplay } from './vanillaBlockDisplay'
1616

17-
const ERROR_OUTLINE_MATERIAL = Canvas.outlineMaterial.clone()
18-
ERROR_OUTLINE_MATERIAL.color.set('#ff0000')
19-
2017
interface VanillaItemDisplayOptions {
2118
name?: string
2219
item?: string
@@ -240,19 +237,14 @@ export const PREVIEW_CONTROLLER = new NodePreviewController(VanillaItemDisplay,
240237
el.preview_controller.updateTransform(el)
241238
el.mesh.visible = el.visibility
242239
TickUpdates.selection = true
240+
241+
el.ready = true
243242
})
244243
.catch(err => {
245244
if (typeof err.message === 'string') {
246245
el.error.set(err.message as string)
247246
}
248247
})
249-
.finally(() => {
250-
if (el.mesh?.outline instanceof THREE.LineSegments) {
251-
if (el.error.get()) el.mesh.outline.material = ERROR_OUTLINE_MATERIAL
252-
else el.mesh.outline.material = Canvas.outlineMaterial
253-
}
254-
el.ready = true
255-
})
256248
},
257249
updateTransform(el: VanillaItemDisplay) {
258250
ResizableOutlinerElement.prototype.preview_controller.updateTransform(el)

src/systems/minecraft/blockModelManager.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,11 @@ const BLACKLISTED_BLOCKS = new Map([
4242
['piglin_wall_head', translate('block_model_manager.mob_head_warning')],
4343
])
4444

45-
const BLACKLISTED_BLOCKSTATES = new Map([
46-
['facing', translate('block_model_manager.facing_warning')],
47-
])
48-
4945
export async function getBlockModel(block: string): Promise<BlockModelMesh | undefined> {
5046
await assetsLoaded()
5147
let result = BLOCK_MODEL_CACHE.get(block)
5248
if (!result) {
49+
// console.warn(`Found no cached item model mesh for '${block}'`)
5350
const parsed = await parseBlock(block)
5451
if (!parsed) return undefined
5552
if (BLACKLISTED_BLOCKS.has(block)) {
@@ -176,9 +173,9 @@ async function generateModelMesh(
176173
}
177174

178175
geometry.translate(-8, -8, -8)
179-
geometry.rotateY(Math.degToRad(180))
180-
if (variant.y) geometry.rotateY(Math.degToRad(variant.y))
176+
// geometry.rotateY(Math.degToRad(180))
181177
if (variant.x) geometry.rotateX(Math.degToRad(variant.x))
178+
if (variant.y) geometry.rotateY(-Math.degToRad(variant.y))
182179
if (variant.isItemModel) {
183180
geometry.translate(0, 8, 0)
184181
} else {
@@ -386,9 +383,6 @@ export async function parseBlockState(block: IParsedBlock): Promise<BlockModelMe
386383
} else if (!block.blockStateRegistryEntry.stateValues[k].includes(v)) {
387384
throw new Error(`Invalid block state value '${v.toString()}' for '${k}'`)
388385
}
389-
if (BLACKLISTED_BLOCKSTATES.has(k)) {
390-
block.states[k] = block.blockStateRegistryEntry.defaultStates[k]
391-
}
392386
}
393387

394388
if (blockstate.variants) {

test_blueprints/armor_stand.ajblueprint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3006,7 +3006,7 @@
30063006
"override": false,
30073007
"length": 0.8,
30083008
"snapping": 20,
3009-
"selected": false,
3009+
"selected": true,
30103010
"saved": false,
30113011
"path": "",
30123012
"anim_time_update": "",

0 commit comments

Comments
 (0)