Skip to content

Commit 8fa2189

Browse files
author
ozelot379
committed
Fix crosshair
1 parent eb28014 commit 8fa2189

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Convert dialog, inventory and recipe book ui
55
- Improve error handling
66
- Possible bugs fixed in:
7+
- Fix crosshair
78
- Fix dye
89
- Fix enchanted item glint
910
- Fix grass block

‎src/converter/IconsConverter.js‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import {AbstractConverter} from "./AbstractConverter";
2+
3+
/**
4+
* Class IconsConverter
5+
*/
6+
class IconsConverter extends AbstractConverter {
7+
/**
8+
* @inheritDoc
9+
*/
10+
async convert() {
11+
const from = this.data;
12+
13+
if (!await this.output.exists(from)) {
14+
return [];
15+
}
16+
17+
this.log.log(`Convert icons ${from}`);
18+
19+
const image = await this.readImage(from);
20+
21+
image.scan(0, 0, image.getWidth(), image.getHeight(), (x, y, idx) => {
22+
if (image.bitmap.data[idx + 3] === 0) {
23+
image.bitmap.data[idx] = 0;
24+
image.bitmap.data[idx + 1] = 0;
25+
image.bitmap.data[idx + 2] = 0;
26+
}
27+
});
28+
29+
this.writeImage(from, image);
30+
31+
return [];
32+
}
33+
34+
/**
35+
* @inheritDoc
36+
*/
37+
static get DEFAULT_CONVERTER_DATA() {
38+
return [
39+
"textures/gui/icons.png"
40+
];
41+
}
42+
}
43+
44+
export {IconsConverter};

‎src/converter/converters.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {FishHookConverter} from "./FishingConverter";
2121
import {FireworksConverter} from "./FireworksConverter";
2222
import {FoxConverter} from "./FoxConverter";
2323
import {HorseConverter} from "./HorseConverter";
24+
import {IconsConverter} from "./IconsConverter";
2425
import {MapIconsConverter} from "./MapIconsConverter";
2526
import {MetadataConverter} from "./MetadataConverter";
2627
import {NineSliceConverter} from "./NineSliceConverter";
@@ -59,6 +60,7 @@ const converters = [
5960
...FishHookConverter.getDefaultConverters(),
6061
...FoxConverter.getDefaultConverters(),
6162
...HorseConverter.getDefaultConverters(),
63+
...IconsConverter.getDefaultConverters(),
6264
...MapIconsConverter.getDefaultConverters(),
6365
...PistonArmConverter.getDefaultConverters(),
6466
...RedstoneDustConverter.getDefaultConverters(),

0 commit comments

Comments
 (0)