Skip to content

Commit ef814b7

Browse files
author
ozelot379
committed
v4.0.0
1 parent 5880722 commit ef814b7

75 files changed

Lines changed: 257 additions & 1687 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [4.0.0]
4+
- Remove convert piglin
5+
- Fix banner pattern black
6+
- Fix banner pattern preview max size
7+
- Fix banner illager pattern
8+
- Warn for partially missing sprite images (For instance banner pattern, painting and particle), because may they will be transparent in the result
9+
- Separate base api
10+
311
## [3.6.1]
412
- Fix root folder in sub folder in some wrong texture packs
513
- Fix rename files in local folder to not exists folder

‎README.md‎

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -24,80 +24,19 @@ Add it as a dependency to your `package.json`
2424
yarn add @ozelot379/convert-minecraft-java-texture-to-bedrock-api
2525
```
2626

27-
Import it in your code
27+
You can convert your texture packs like
2828

2929
```javascript
30-
import {ConsoleLog, ConvertJavaTextureToBedrockApi, Input, LocalFileInputEntry, LocalFileOutput} from "@ozelot379/convert-minecraft-java-texture-to-bedrock-api";
31-
```
32-
33-
You can now convert your texture packs
34-
35-
```javascript
36-
let output;
37-
try {
38-
output = await new ConvertJavaTextureToBedrockApi(input, output, log, options).convert();
39-
} catch (err) {
40-
41-
}
42-
```
43-
44-
### Input
45-
46-
| Import | Description |
47-
|--------|-------------|
48-
| `Input` | The input consists on one input entry (Common) |
49-
| `ArrayInput` | The input consists on multiple input entries (For instance a selected folder with multiple `FileInputEntry`) |
50-
| `AbstractInput` | Base input |
51-
52-
### Input entry
53-
54-
| Import | For type |
55-
|--------|----------|
56-
| `BufferInputEntry` | - `ArrayBuffer`<br>- `Blob`<br>- `Buffer`<br>- `Uint8Array` |
57-
| `FileInputEntry` | `File` |
58-
| `LocalFileInputEntry` | Local file |
59-
| `LocalFolderInputEntry` | Local folder |
60-
| `AbstractInputEntry` | Base input entry |
61-
62-
### Output
63-
64-
| Import | For type |
65-
|--------|----------|
66-
| `ArrayBufferOutput` | `ArrayBuffer` |
67-
| `BlobOutput` | `Blob` |
68-
| `BufferOutput` | `Buffer` |
69-
| `FileBlobOutput` | `File` |
70-
| `LocalFileOutput` | Local file |
71-
| `LocalFolderOutput` | Local folder |
72-
| `Uint8ArrayOutput` | `Uint8Array` |
73-
| `AbstractOutput` | Base output |
74-
75-
### Log
76-
77-
| Import | Description |
78-
|--------|-------------|
79-
| `ConsoleLog` | Log to console |
80-
| `SlientLog` | Disable log |
81-
| `AbstractLog` | Base log |
82-
83-
### Options
84-
85-
| Key | Type | Default | Description |
86-
|-----|------|---------|-------------|
87-
| `experimental` | `bool` | `false` | Enable experimental conversions |
88-
89-
### Example
90-
91-
```javascript
92-
import {ConsoleLog, ConvertJavaTextureToBedrockApi, Input, LocalFileInputEntry, LocalFileOutput} from "@ozelot379/convert-minecraft-java-texture-to-bedrock-api";
30+
import {ConsoleLog, Input, LocalFileInputEntry, LocalFileOutput} from "@ozelot379/convert-base-api";
31+
import {ConvertJavaTextureToBedrockApi} from "@ozelot379/convert-minecraft-java-texture-to-bedrock-api";
9332

9433
(async () => {
9534
let output;
9635

9736
try {
9837
output = await new ConvertJavaTextureToBedrockApi(new Input(new LocalFileInputEntry("input/java_texture_pack.zip")), new LocalFileOutput("output/bedrock_texture_pack.mcpack"), new ConsoleLog()).convert();
9938
} catch (err) {
100-
console.log(err);
39+
console.err(err);
10140

10241
return;
10342
}
@@ -106,6 +45,8 @@ import {ConsoleLog, ConvertJavaTextureToBedrockApi, Input, LocalFileInputEntry,
10645
})();
10746
```
10847

48+
More infos at https://github.com/ozelot379/ConvertBaseApi#user-content-description
49+
10950
## Extras (for texture pack creators)
11051

11152
### UUID

‎package.json‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@ozelot379/convert-minecraft-java-texture-to-bedrock-api",
33
"type": "module",
44
"productName": "ConvertJavaTextureToBedrockApi",
5-
"version": "3.6.1",
5+
"version": "4.0.0",
66
"description": "API for convert Minecraft Java texture packs to Bedrock texture packs",
77
"keywords": [
88
"Minecraft",
@@ -23,11 +23,8 @@
2323
},
2424
"homepage": "https://github.com/ozelot379/ConvertJavaTextureToBedrockApi#readme",
2525
"dependencies": {
26-
"@ozelot379/jimp-plugins": "1.2.6",
27-
"jimp": "0.9.8",
28-
"jszip": "3.4.0",
29-
"tga": "1.0.3",
30-
"uuid": "3.4.0"
26+
"@ozelot379/convert-base-api": "1.0.0",
27+
"uuid": "8.3.0"
3128
},
3229
"devDependencies": {},
3330
"engines": {

‎src/ConvertJavaTextureToBedrockApi.mjs‎

Lines changed: 8 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,30 @@
1-
import {AbstractInput} from "./input/AbstractInput.mjs";
2-
import {AbstractLog} from "./log/AbstractLog.mjs";
3-
import {AbstractOutput} from "./output/AbstractOutput.mjs";
4-
import {addAdditionalConverters, getConverters} from "./converter/converters.mjs";
5-
import {Options} from "./Options.mjs";
1+
import {AbstractBaseApi} from "@ozelot379/convert-base-api";
2+
import {converters} from "./converter/index.mjs";
63

74
/**
85
* Class ConvertJavaTextureToBedrockApi
96
*/
10-
class ConvertJavaTextureToBedrockApi {
7+
class ConvertJavaTextureToBedrockApi extends AbstractBaseApi {
118
/**
12-
* ConvertJavaTextureToBedrockApi constructor
13-
*
14-
* @param {AbstractInput} input
15-
* @param {AbstractOutput} output
16-
* @param {AbstractLog} log
17-
* @param {Options} options
18-
*/
19-
constructor(input, output, log, options = {}) {
20-
/**
21-
* @type {AbstractInput}
22-
*
23-
* @protected
24-
*/
25-
this.input = input;
26-
/**
27-
* @type {AbstractOutput}
28-
*
29-
* @protected
30-
*/
31-
this.output = output;
32-
/**
33-
* @type {AbstractLog}
34-
*
35-
* @protected
36-
*/
37-
this.log = log;
38-
/**
39-
* @type {AsyncIterableIterator<AbstractConverter>}
40-
*
41-
* @protected
42-
*/
43-
this.converters = getConverters();
44-
/**
45-
* @type {Options}
46-
*
47-
* @protected
48-
*/
49-
this.options = {
50-
...new Options(),
51-
...options
52-
};
53-
}
54-
55-
/**
56-
* @returns {Promise<*>}
9+
* @inheritDoc
5710
*/
5811
async convert() {
59-
this.log.log("Start conversion");
60-
6112
if (this.options.experimental) {
6213
this.log.warn(`EXPERIMENTAL CONVERSIONS ENABLED!`)
6314
}
6415

65-
await this.handleInput();
66-
67-
await this.handleConverters();
68-
69-
const output = await this.handleOutput();
70-
71-
this.log.log("Conversion finished");
16+
const output = await super.convert();
7217

7318
this.log.log("Please reopen Minecraft after selecting the converted texture pack, because in the current version it seems to be a bug to reload the texture cache (Otherwise it's possible that you will have a mix between your previous and new texture pack, which can lead to appearance bugs that would not occur)");
7419

7520
return output;
7621
}
7722

7823
/**
79-
* @returns {Promise<void>}
80-
*
81-
* @protected
82-
*/
83-
async handleInput() {
84-
await this.output._init(this.input, this.log, this.options);
85-
86-
for await (const entry of this.input.getEntries()) {
87-
await entry._init(this.log, this.options);
88-
89-
await this.output.applyInputEntry(entry);
90-
}
91-
}
92-
93-
/**
94-
* @returns {Promise<void>}
95-
*
96-
* @protected
97-
*/
98-
async handleConverters() {
99-
for await (const converter of this.converters) {
100-
await converter._init(this.input, this.output, this.log, this.options);
101-
102-
await addAdditionalConverters(...await converter.convert());
103-
}
104-
}
105-
106-
/**
107-
* @returns {Promise<*>}
108-
*
109-
* @protected
24+
* @inheritDoc
11025
*/
111-
async handleOutput() {
112-
return this.output.generate();
26+
async getInitConverters() {
27+
return converters;
11328
}
11429
}
11530

‎src/Options.mjs‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)