@@ -9,7 +9,7 @@ It supports currently the follow Minecraft versions:
99
1010Currently it supports blocks, items, entities, paintings, particles and map icons textures
1111
12- Supported formats are mcpack archives, zip archives or directories
12+ Supported formats are zip archives or folders
1313
1414This library is inspired by the no longer continued [ PCTexture2PE] ( https://github.com/rodrigojxd/PCTexture2PE )
1515
@@ -41,7 +41,7 @@ ConvertMinecraftJavaTextureToBedrock -i input/java_texture_pack.zip -o output/be
4141| ---------------| -------------------------------|
4242| -i (Required) | Input folder or archive path |
4343| -o (Required) | Output folder or archive path |
44- | -l | Verbose log (Default ` true ` ) |
44+ | -l | Show log (Default ` true ` ) |
4545
4646## Direct in your code
4747Add it as a dependency to your ` package.json `
@@ -52,33 +52,80 @@ yarn add @ozelot379/convert-minecraft-java-texture-to-bedrock
5252
5353Import it in your code, if you use webpack
5454``` javascript
55- import ConvertMinecraftJavaTextureToBedrock from " @ozelot379/convert-minecraft-java-texture-to-bedrock" ;
55+ import ConvertMinecraftJavaTextureToBedrock , { ConsoleLog , Input , LocalFileInputEntry , LocalFileOutput } from " @ozelot379/convert-minecraft-java-texture-to-bedrock" ;
5656```
5757or require it if you use native NodeJs
5858``` javascript
59- const ConvertMinecraftJavaTextureToBedrock = require (" @ozelot379/convert-minecraft-java-texture-to-bedrock" ). default ;
59+ const {default : ConvertMinecraftJavaTextureToBedrock , ConsoleLog , Input , LocalFileInputEntry , LocalFileOutput } = require (" @ozelot379/convert-minecraft-java-texture-to-bedrock" );
6060```
6161
6262You can now convert your texture packs in an ` async function `
6363``` javascript
64- let outputPath ;
64+ let output ;
6565try {
66- outputPath = await ConvertMinecraftJavaTextureToBedrock (input, output/* , "options" */ );
66+ output = await new ConvertMinecraftJavaTextureToBedrock (input, output, log). convert ( );
6767} catch (err) {
6868
6969}
7070```
71- or handle the ` Promise ` direct
71+ or self handle the ` Promise `
7272``` javascript
73- ConvertMinecraftJavaTextureToBedrock (input, output/* , "options" */ ). then ((outputPath ) => {}).catch ((err ) => {});
73+ new ConvertMinecraftJavaTextureToBedrock (input, output, log). convert (). then ((output ) => {}).catch ((err ) => {});
7474```
7575
76- | Parameter | Description |
77- | ---------------------| ------------------------------------------------|
78- | input (Required) | - Folder or archive path (` string ` )<br >- Archive (` Buffer ` )<br >- ` Array ` with archive (` Buffer ` ) and filename (` string ` ) |
79- | output (Required) | - Folder or archive path (` string ` )<br >- Archive (` Buffer ` ) |
80- | options.verbose | Verbose log (Default ` true ` ) |
81- | options.logCallback | Custom log callback (Default is ` console.log ` ) |
76+ ### Input
77+ | Import | Description |
78+ | -----------------| -------------|
79+ | ` Input ` | The input consists on one input entry (Common) |
80+ | ` ArrayInput ` | The input consists on multiple input entries (For instance a selected folder with multiple ` FileInputEntry ` ) |
81+ | ` AbstractInput ` | Base input |
82+
83+ ### Input entry
84+ | Import | For type |
85+ | -------------------------| --------------------|
86+ | ` BufferInputEntry ` | <ul ><li >` ArrayBuffer ` </li ><li >` Blob ` </li ><li >` Buffer ` </li ><li >` Uint8Array ` </li ></ul > |
87+ | ` FileInputEntry ` | ` File ` |
88+ | ` LocalFileInputEntry ` | Local file |
89+ | ` LocalFolderInputEntry ` | Local folder |
90+ | ` AbstractInputEntry ` | Base input entry |
91+
92+ ### Output
93+ | Import | For type |
94+ | ---------------------| ---------------|
95+ | ` ArrayBufferOutput ` | ` ArrayBuffer ` |
96+ | ` BlobOutput ` | ` Blob ` |
97+ | ` BufferOutput ` | ` Buffer ` |
98+ | ` FileBlobOutput ` | ` File ` |
99+ | ` LocalFileOutput ` | Local file |
100+ | ` LocalFolderOutput ` | Local folder |
101+ | ` Uint8ArrayOutput ` | ` Uint8Array ` |
102+ | ` AbstractOutput ` | Base output |
103+
104+ ### Log
105+ | Import | Description |
106+ | ---------------| ----------------|
107+ | ` ConsoleLog ` | Log to console |
108+ | ` SlientLog ` | Disable log |
109+ | ` AbstractLog ` | Base log |
110+
111+ ### Example
112+ ``` javascript
113+ import ConvertMinecraftJavaTextureToBedrock , {ConsoleLog , Input , LocalFileInputEntry , LocalFileOutput } from " @ozelot379/convert-minecraft-java-texture-to-bedrock" ;
114+
115+ (async () => {
116+ let output;
117+
118+ try {
119+ output = await new ConvertMinecraftJavaTextureToBedrock (new Input (new LocalFileInputEntry (" input/java_texture_pack.zip" )), new LocalFileOutput (" output/bedrock_texture_pack.mcpack" ), new ConsoleLog ()).convert ();
120+ } catch (err) {
121+ console .log (err);
122+
123+ return ;
124+ }
125+
126+ console .log (` Output: ${ output} ` );
127+ })();
128+ ```
82129
83130## Known issues
84131- Convert horse textures is very tricky and may buggy
@@ -90,7 +137,7 @@ ConvertMinecraftJavaTextureToBedrock(input, output/*, "options"*/).then((outputP
90137You can create the ` bedrock_uuid_header ` and ` bedrock_uuid_module ` files in your input, to keep the same uuid on repeating conversions - otherwise, random uuids are generated each time and you need to reselect the texture pack again in the game
91138
92139## Custom textures
93- You can put custom textures in a ` bedrock_textures ` directory in your input
140+ You can put custom textures in a ` bedrock_textures ` folder in your input
94141
95142For instance for textures, that can not be converted or are not converted correctly
96143
0 commit comments