File tree 8 files changed +202
-2
lines changed
8 files changed +202
-2
lines changed Original file line number Diff line number Diff line change
1
+ <script lang =" ts" >
2
+ import { closeIncompatabilityPopup } from ' ../interface/popup/incompatabilityPopup'
3
+ import { translate } from ' ../util/translation'
4
+
5
+ export let plugins: BBPlugin []
6
+
7
+ let disabledPlugins: BBPlugin [] = []
8
+
9
+ function disablePlugin(plugin : BBPlugin ) {
10
+ plugin .toggleDisabled ()
11
+ plugins .remove (plugin )
12
+ disabledPlugins .push (plugin )
13
+ disabledPlugins = disabledPlugins
14
+ if (plugins .length === 0 ) {
15
+ closeIncompatabilityPopup ()
16
+ }
17
+ }
18
+ </script >
19
+
20
+ <p >
21
+ {@html translate (' popup.incompatability_popup.description' ).replaceAll (' \n ' , ' <br />' )}
22
+ </p >
23
+ <ul >
24
+ {#each plugins as plugin }
25
+ <li >
26
+ {#if plugin .hasImageIcon ()}
27
+ <img src ={plugin .getIcon ()} alt =" " />
28
+ {/if }
29
+ {plugin .title }
30
+ {#key disabledPlugins }
31
+ {#if ! disabledPlugins .includes (plugin )}
32
+ <button on:click ={() => disablePlugin (plugin )}>
33
+ <i class =" material-icons icon" >bedtime</i >
34
+ {translate (' popup.incompatability_popup.disable_button' )}
35
+ </button >
36
+ {/if }
37
+ {/ key }
38
+ </li >
39
+ {/each }
40
+ </ul >
41
+
42
+ <style >
43
+ ul {
44
+ margin-top : 1em ;
45
+ }
46
+ li {
47
+ display : flex ;
48
+ align-items : center ;
49
+ justify-content : flex-start ;
50
+ font-size : 24px ;
51
+ margin-bottom : 16px ;
52
+ }
53
+ img {
54
+ width : 64px ;
55
+ margin-right : 16px ;
56
+ }
57
+ button {
58
+ margin-left : auto ;
59
+ font-size : 16px ;
60
+ height : 64px ;
61
+ display : flex ;
62
+ flex-direction : column ;
63
+ align-items : center ;
64
+ justify-content : center ;
65
+ }
66
+ i {
67
+ font-size : 32px ;
68
+ max-width : min-content ;
69
+ }
70
+ </style >
Original file line number Diff line number Diff line change
1
+ <script lang =" ts" >
2
+ import { isIncompatiblePlugin } from ' ../interface/popup/incompatabilityPopup'
3
+ import { Valuable } from ' ../util/stores'
4
+ import { translate } from ' ../util/translation'
5
+
6
+ export let selectedPlugin: Valuable <BBPlugin | null >
7
+ </script >
8
+
9
+ {#if $selectedPlugin && isIncompatiblePlugin ($selectedPlugin )}
10
+ <div >
11
+ <i class =" material-icons icon" >warning</i >
12
+ {translate (' dialog.incompatability_notice' )}
13
+ </div >
14
+ {/if }
15
+
16
+ <style >
17
+ div {
18
+ display : flex ;
19
+ align-items : center ;
20
+ gap : 4px ;
21
+ background-color : var (--color-warning );
22
+ color : var (--color-accent_text );
23
+ padding : 4px 8px ;
24
+ width : fit-content ;
25
+ border-radius : 6px ;
26
+ font-weight : 600 ;
27
+ margin-top : 8px ;
28
+ }
29
+ </style >
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import { openInstallPopup } from './interface/popup/installed'
44
44
import { cleanupExportedFiles } from './systems/cleaner'
45
45
import mcbFiles from './systems/datapackCompiler/mcbFiles'
46
46
import { openChangelogDialog } from './interface/changelogDialog'
47
+ import { checkForIncompatabilities } from './interface/popup/incompatabilityPopup'
47
48
48
49
// @ts -ignore
49
50
globalThis . AnimatedJava = {
@@ -87,10 +88,13 @@ globalThis.AnimatedJava = {
87
88
cleanupExportedFiles,
88
89
mcbFiles,
89
90
openChangelogDialog,
91
+ checkForIncompatabilities,
90
92
} ,
91
93
}
92
94
93
95
requestAnimationFrame ( ( ) => {
96
+ if ( checkForIncompatabilities ( ) ) return
97
+
94
98
const lastVersion = localStorage . getItem ( 'animated-java-last-version' )
95
99
if ( lastVersion !== PACKAGE . version ) {
96
100
localStorage . setItem ( 'animated-java-last-version' , PACKAGE . version )
Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ import './panel/vanillaBlockDisplayElement'
17
17
import './panel/vanillaItemDisplayElement'
18
18
import './panel/variants'
19
19
20
+ import './popup/animatedJavaLoading'
21
+ import './popup/blueprintLoading'
22
+ import './popup/incompatabilityPopup'
23
+ import './popup/installed'
24
+
20
25
import './importAJModelLoader'
21
26
import './animatedJavaBarItem'
22
27
import './keyframeEasings'
Original file line number Diff line number Diff line change
1
+ import IncompatabilityPopup from '../../components/incompatabilityPopup.svelte'
2
+ import { PACKAGE } from '../../constants'
3
+ import { SvelteDialog } from '../../util/svelteDialog'
4
+ import { translate } from '../../util/translation'
5
+
6
+ const INCOMPATABLE_PLUGINS = [ 'animation_utils' ]
7
+
8
+ let currentInstance : SvelteDialog < IncompatabilityPopup , any > | null = null
9
+
10
+ export function openIncompatabilityPopup ( plugins : BBPlugin [ ] ) {
11
+ currentInstance = new SvelteDialog ( {
12
+ id : `${ PACKAGE . name } :incompatabilityPopup` ,
13
+ title : translate ( 'popup.incompatability_popup.title' ) ,
14
+ width : 700 ,
15
+ component : IncompatabilityPopup ,
16
+ props : { plugins } ,
17
+ preventKeybinds : true ,
18
+ buttons : [ ] ,
19
+ } ) . show ( )
20
+ }
21
+
22
+ export function closeIncompatabilityPopup ( ) {
23
+ if ( currentInstance ) {
24
+ currentInstance . hide ( )
25
+ currentInstance . delete ( )
26
+ currentInstance = null
27
+ }
28
+ }
29
+
30
+ export function isIncompatiblePlugin ( plugin : BBPlugin ) : boolean {
31
+ return INCOMPATABLE_PLUGINS . includes ( plugin . id )
32
+ }
33
+
34
+ export function checkForIncompatabilities ( ) {
35
+ const plugins : BBPlugin [ ] = [ ]
36
+ for ( const plugin of Plugins . all ) {
37
+ if ( ! plugin . installed || plugin . disabled || ! isIncompatiblePlugin ( plugin ) ) {
38
+ continue
39
+ }
40
+ plugins . push ( plugin )
41
+ }
42
+ if ( plugins . length > 0 ) {
43
+ openIncompatabilityPopup ( plugins )
44
+ return true
45
+ }
46
+ return false
47
+ }
Original file line number Diff line number Diff line change @@ -22,8 +22,15 @@ animated_java.popup.loading.offline: |-
22
22
Animated Java Failed to Connect!
23
23
Some features may be unavailable.
24
24
25
- animated_java.dialog.installed_popup.title : Thank you for installing!
26
- animated_java.dialog.installed_popup.close_button : Let's Get Animating!
25
+ animated_java.popup.installed_popup.title : Thank you for installing!
26
+ animated_java.popup.installed_popup.close_button : Let's Get Animating!
27
+
28
+ animated_java.popup.incompatability_popup.title : Incompatible Plugin Detected!
29
+ animated_java.popup.incompatability_popup.description : |-
30
+ Animated Java has detected incompatible plugin(s)!
31
+ Please disable / uninstall the following plugin(s) and restart Blockbench to use Animated Java:
32
+ animated_java.popup.incompatability_popup.disable_button : Disable Plugin
33
+ animated_java.dialog.incompatability_notice : This plugin is not compatible with Animated Java!
27
34
28
35
# ## Dialogs
29
36
animated_java.dialog.reset : Reset to Default
Original file line number Diff line number Diff line change @@ -28,3 +28,4 @@ import './saveProjectAsActionMod'
28
28
import './showDefaultPoseMod'
29
29
import './variantPreviewCubeFaceMod'
30
30
import './cameraNameMod'
31
+ import './pluginsDialogMod'
Original file line number Diff line number Diff line change
1
+ import IncompatiblePluginNotice from '../components/incompatiblePluginNotice.svelte'
2
+ import { PACKAGE } from '../constants'
3
+ import { injectSvelteCompomponentMod } from '../util/injectSvelteComponent'
4
+ import { createBlockbenchMod } from '../util/moddingTools'
5
+ import { Valuable } from '../util/stores'
6
+
7
+ const SELECTED_PLUGIN = new Valuable < BBPlugin | null > ( null )
8
+
9
+ injectSvelteCompomponentMod ( {
10
+ component : IncompatiblePluginNotice ,
11
+ props : {
12
+ selectedPlugin : SELECTED_PLUGIN ,
13
+ } ,
14
+ elementSelector ( ) {
15
+ return document . querySelector ( '.plugin_browser_page_header' )
16
+ } ,
17
+ } )
18
+
19
+ createBlockbenchMod (
20
+ `${ PACKAGE . name } :pluginsDialogMod` ,
21
+ {
22
+ originalSelect : Plugins . dialog . component . methods . selectPlugin ,
23
+ } ,
24
+ context => {
25
+ Plugins . dialog . component . methods . selectPlugin = function ( this , plugin : BBPlugin ) {
26
+ const result = context . originalSelect . call ( this , plugin )
27
+ SELECTED_PLUGIN . set ( plugin )
28
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
29
+ return result
30
+ }
31
+
32
+ return context
33
+ } ,
34
+ context => {
35
+ Plugins . dialog . component . methods . selectPlugin = context . originalSelect
36
+ }
37
+ )
You can’t perform that action at this time.
0 commit comments