@@ -9,48 +9,13 @@ import { isResourcePackPath } from '../util/minecraftUtil'
99import { translate } from '../util/translation'
1010import { Variant } from '../variants'
1111import { hashAnimations , renderProjectAnimations } from './animationRenderer'
12+ import { exportJSON } from './jsonCompiler'
1213import compileDataPack from './datapackCompiler'
14+ import { IntentionalExportError } from './errors'
1315import resourcepackCompiler from './resourcepackCompiler'
1416import { hashRig , renderRig } from './rigRenderer'
1517import { isCubeValid } from './util'
1618
17- export class IntentionalExportError extends Error {
18- constructor (
19- message : string ,
20- public messageBoxOptions ?: MessageBoxOptions ,
21- public messageBoxCallback ?: Parameters < typeof Blockbench . showMessageBox > [ 1 ]
22- ) {
23- super ( message )
24- this . name = 'IntentionalExportError'
25- }
26- }
27-
28- export class IntentionalExportErrorFromInvalidFile extends IntentionalExportError {
29- constructor ( filePath : string , public originalError : Error ) {
30- const parsed = PathModule . parse ( filePath )
31- super (
32- `Failed to read file <code title="${ filePath } ">${ parsed . base } </code>:\n\n` +
33- '```\n' +
34- originalError +
35- '\n```' ,
36- {
37- commands : {
38- open_file : {
39- text : 'Open File Location' ,
40- icon : 'folder_open' ,
41- } ,
42- } ,
43- } ,
44- button => {
45- if ( button === 'open_file' ) {
46- shell . showItemInFolder ( filePath )
47- }
48- }
49- )
50- this . name = 'IntentionalExportErrorFromInvalidFile'
51- }
52- }
53-
5419export function getExportPaths ( ) {
5520 const aj = Project ! . animated_java
5621
@@ -164,7 +129,7 @@ async function actuallyExportProject({
164129 debugMode,
165130 } )
166131
167- if ( aj . data_pack_export_mode !== 'none' ) {
132+ if ( ! aj . enable_plugin_mode && aj . data_pack_export_mode !== 'none' ) {
168133 await compileDataPack ( [ aj . target_minecraft_version ] , {
169134 rig,
170135 animations,
@@ -175,6 +140,17 @@ async function actuallyExportProject({
175140 } )
176141 }
177142
143+ if ( aj . enable_plugin_mode ) {
144+ PROGRESS_DESCRIPTION . set ( 'Exporting Plugin JSON...' )
145+ exportJSON ( {
146+ rig,
147+ animations,
148+ displayItemPath,
149+ textureExportFolder,
150+ modelExportFolder,
151+ } )
152+ }
153+
178154 Project ! . last_used_export_namespace = aj . export_namespace
179155
180156 if ( forceSave ) saveBlueprint ( )
0 commit comments