Skip to content

Commit 2c00275

Browse files
committed
✨ Improve BB 5.0 warning
1 parent 1d6615d commit 2c00275

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

src/index.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,6 @@ EVENTS.EXTRACT_MODS.subscribe(() => {
119119
delete window.AnimatedJava
120120
})
121121

122-
if (!compareVersions('5.0.0', Blockbench.version) /* >= 5.0.0 */) {
123-
Blockbench.showMessageBox({
124-
title: 'Animated Java - Incompatible Blockbench Version',
125-
message: `Animated Java is incompatible with Blockbench versions above 5.0.0. Please downgrade to Blockbench 4.21.6 to continue using this plugin.`,
126-
buttons: ['OK'],
127-
})
128-
throw new Error('Incompatible Blockbench Version')
129-
}
130-
131122
BBPlugin.register(PACKAGE.name, {
132123
title: PACKAGE.title,
133124
author: PACKAGE.author.name,

tools/esbuild.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,34 @@ function createBanner() {
134134
return '│ ' + ' '.repeat(l) + v + ' '.repeat(r) + ' │'
135135
})
136136

137-
const banner = '\n' + [header, ...lines, footer].map(v => `//?? ${v}`).join('\n') + '\n'
137+
const message = `
138+
# Animated Java does not work in Blockbench 5
139+
140+
You will need to install and use Blockbench v4.12.6 to use Animated Java until it is updated to support 5.
141+
142+
## How to install Blockbench v4.12.6
143+
144+
1. Download the portable version of Blockbench 4.12.6 [here](https://github.com/JannisX11/blockbench/releases/download/v4.12.6/Blockbench_4.12.6_portable.exe).
145+
2. Once it's finished downloading, double click the .exe file to run it.
146+
147+
If you're familiar with command line interfaces, you can use [Envbench](https://www.npmjs.com/package/envbench) to install and manage multiple Blockbench versions side by side.
148+
`
149+
150+
const startupCode = `(() => {
151+
if (!compareVersions('5.0.0', Blockbench.version)) {
152+
const message = \`${message}\`;
153+
Blockbench.showMessageBox({title: 'Animated Java - Incompatible Blockbench Version',message,width:600});
154+
requestAnimationFrame(() => Plugins.registered['animated_java'].uninstall());
155+
throw new Error(message);
156+
}
157+
})()`.trim()
158+
159+
const banner =
160+
'\n' +
161+
[header, ...lines, footer].map(v => `//?? ${v}`).join('\n') +
162+
'\n\n' +
163+
startupCode +
164+
'\n'
138165

139166
return {
140167
js: banner,

0 commit comments

Comments
 (0)