Skip to content

Commit bd7c6b1

Browse files
committed
✨ Add a toast notification for invalid cubes
1 parent bcbb6f8 commit bd7c6b1

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
- [x] Check for references to non-existant functions in merged function tags, and remove them.
111111
- [ ] When applying variants, remove / replace any bones that have / had no elements with textured faces.
112112

113+
- [x] Add a toast notification for when the model has invalid rotations.
113114
# Resource Pack
114115

115116
- [x] Warn the user when they have custom elements in their model, but have disabled the resource pack export.

src/blockbenchTypeMods.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ declare global {
3535
pluginMode: Valuable<boolean>
3636
transparentTexture: Texture
3737

38+
showingInvalidCubeRotations: boolean
39+
3840
variants: Variant[]
3941
textDisplays: TextDisplay[]
4042
vanillaItemDisplays: VanillaItemDisplay[]

src/mods/cubeOutlineMod.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ createBlockbenchMod(
5050
} else if (!cube.rotationInvalid && !isValid) {
5151
cube.mesh.outline.material = ERROR_OUTLINE_MATERIAL
5252
cube.rotationInvalid = true
53+
if (!Project!.showingInvalidCubeRotations) {
54+
Blockbench.showToastNotification({
55+
text: 'Invalid Cube Rotation!\nCubes can only be rotated in 22.5 degree increments (45, 22.5, 0, -22.5, -45) and can only be rotated on a single axis.\nThe offending cubes have been highlighted in red.',
56+
color: 'var(--color-error)',
57+
})
58+
Project!.showingInvalidCubeRotations = true
59+
}
5360
}
5461
}
5562
context.originalUpdateTransform.call(this, cube)

src/systems/minecraft/assetManager.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ export async function checkForAssetsUpdate() {
9393
await updateAssets()
9494
}
9595

96-
console.log('Does file exist?', fs.existsSync(cachedJarFilePath))
97-
console.log('Are assets loaded?', localStorage.getItem('assetsLoaded') === 'true')
98-
9996
await extractAssets()
10097
console.log('Minecraft assets are up to date!')
10198
localStorage.setItem('assetsLoaded', 'true')

0 commit comments

Comments
 (0)