Skip to content

Commit 6c7b3e9

Browse files
author
ozelot379
committed
Title image convert
1 parent eaf5401 commit 6c7b3e9

4 files changed

Lines changed: 48 additions & 1 deletion

File tree

‎CHANGELOG.md‎

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

3+
## [1.11.2]
4+
- Title image convert
5+
36
## [1.11.1]
47
- Search inventory icon
58

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ozelot379/convert-minecraft-java-texture-to-bedrock",
33
"productName": "ConvertMinecraftJavaTextureToBedrock",
4-
"version": "1.11.1",
4+
"version": "1.11.2",
55
"description": "Convert Minecraft Java texture packs to Minecraft Bedrock texture packs",
66
"keywords": [
77
"Minecraft",

‎src/converter/TitleConverter.js‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {AbstractConverter} from "./AbstractConverter";
2+
import Jimp from "jimp";
3+
4+
/**
5+
* Class TitleConverter
6+
*/
7+
class TitleConverter extends AbstractConverter {
8+
/**
9+
* @inheritDoc
10+
*/
11+
async convert() {
12+
for await (const [from, to] of this.getData()) {
13+
if (await this.output.exists(from)) {
14+
this.log.log(`Convert title ${from}`);
15+
16+
const image_from = await this.readImage(from);
17+
18+
const factor = (image_from.getWidth() / 255);
19+
20+
const image = await Jimp.create((273 * factor), (45 * factor));
21+
22+
image.composite(image_from.clone().crop(0, 0, (155 * factor), (45 * factor)), 0, 0);
23+
image.composite(image_from.clone().crop(0, (45 * factor), (119 * factor), (45 * factor)), (154 * factor), 0);
24+
25+
await this.writeImage(to, image);
26+
}
27+
}
28+
29+
return [];
30+
}
31+
32+
/**
33+
* @inheritDoc
34+
*/
35+
static get DATA() {
36+
return [
37+
["textures/gui/title/minecraft.png", "textures/ui/title.png"]
38+
];
39+
}
40+
}
41+
42+
export {TitleConverter};

‎src/converter/converters.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {RenameConverter} from "./RenameConverter";
2424
import {SheepConverter} from "./SheepConverter";
2525
import {SideRotateConverter} from "./SideRotateConverter";
2626
import {SpriteConverter} from "./SpriteConverter";
27+
import {TitleConverter} from "./TitleConverter";
2728
import {VillagerConverter} from "./VillagerConverter";
2829
import {WaterConverter} from "./WaterConverter";
2930
import {WeatherConverter} from "./WeatherConverter";
@@ -51,6 +52,7 @@ const converters = [
5152
new WeatherConverter(),
5253
new OpaqueConverter(),
5354
new WaterConverter(),
55+
new TitleConverter(),
5456
new OverlayToTranslateConverter(),
5557
new ColorizeOverlayConverter(),
5658
new PlaceholderConverter(),

0 commit comments

Comments
 (0)