Skip to content

Commit dfc4412

Browse files
author
ozelot379
committed
Fix convert water
1 parent c9cefca commit dfc4412

4 files changed

Lines changed: 52 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.6.4]
4+
- Fix convert water
5+
36
## [1.6.3]
47
- Fix `publish` script
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.6.3",
4+
"version": "1.6.4",
55
"description": "CLI version for convert Minecraft Java texture packs to Minecraft Bedrock texture packs",
66
"keywords": [
77
"Minecraft",

‎src/Converter/WaterConverter.js‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import AbstractConverter from "./AbstractConverter";
2+
import Utils from "../Utils/Utils";
3+
4+
/**
5+
* Class WaterConverter
6+
*/
7+
class WaterConverter extends AbstractConverter {
8+
/**
9+
* @inheritDoc
10+
*/
11+
async convert() {
12+
for await (const [from, to, to_small_size] of this.getData()) {
13+
if (await this.output.exists(from)) {
14+
Utils.log(`Convert water ${from}`);
15+
16+
const image = await this.readImage(from);
17+
18+
image.grayscale(); // Fix cauldron water (Some texture packs still using a colored water texture but it's just a grayscale texture)
19+
20+
if (image.getWidth() === to_small_size) {
21+
image.scale(2, "nearestNeighbor"); // Bedrock version has doubled pixels as the Java version
22+
}
23+
24+
await this.writeImage(to, image);
25+
}
26+
}
27+
28+
return [];
29+
}
30+
31+
/**
32+
* @inheritDoc
33+
*/
34+
async* getData() {
35+
const data = [
36+
["textures/blocks/water_flow_grey.png", "textures/blocks/water_flow_grey.png", 16],
37+
["textures/blocks/water_still_grey.png", "textures/blocks/water_still_grey.png", 8]
38+
];
39+
40+
for (const date of data) {
41+
yield date;
42+
}
43+
}
44+
}
45+
46+
export default WaterConverter;

‎src/Converter/index.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import SheepConverter from "./SheepConverter";
2525
import SideRotateConverter from "./SideRotateConverter";
2626
import SpriteConverter from "./SpriteConverter";
2727
import VillagerConverter from "./VillagerConverter";
28+
import WaterConverter from "./WaterConverter";
2829
import WeatherConverter from "./WeatherConverter";
2930

3031
/**
@@ -73,6 +74,7 @@ const converters = [
7374
[VillagerConverter, []],
7475
[WeatherConverter, []],
7576
[OpaqueConverter, []],
77+
[WaterConverter, []],
7678
[OverlayToTranslateConverter, []],
7779
[ColorizeOverlayConverter, []],
7880
[PlaceholderConverter, []],

0 commit comments

Comments
 (0)