mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-22 22:45:04 +01:00
Correctly send BGR over the network for map colors
This commit is contained in:
parent
1f167f7cac
commit
29113cea71
2 changed files with 8 additions and 4 deletions
|
@ -285,16 +285,20 @@ public enum MapColor {
|
||||||
alpha = 0; // transparent
|
alpha = 0; // transparent
|
||||||
|
|
||||||
this.value = ((alpha & 0xFF) << 24) |
|
this.value = ((alpha & 0xFF) << 24) |
|
||||||
((red & 0xFF) << 16) |
|
((blue & 0xFF) << 16) |
|
||||||
((green & 0xFF) << 8) |
|
((green & 0xFF) << 8) |
|
||||||
(blue & 0xFF);
|
(red & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MapColor fromId(int id) {
|
public static MapColor fromId(int id) {
|
||||||
return id >= 0 && id < VALUES.length ? VALUES[id] : COLOR_0;
|
return id >= 0 && id < VALUES.length ? VALUES[id] : COLOR_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getARGB() {
|
/**
|
||||||
|
* Get the ABGR value of the color, bedrock uses this over the network
|
||||||
|
* @return the int value of the color
|
||||||
|
*/
|
||||||
|
public int getABGR() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class JavaMapItemDataTranslator extends PacketTranslator<ClientboundMapIt
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (byte colorId : data.getData()) {
|
for (byte colorId : data.getData()) {
|
||||||
colors[idx++] = MapColor.fromId(colorId & 0xFF).getARGB();
|
colors[idx++] = MapColor.fromId(colorId & 0xFF).getABGR();
|
||||||
}
|
}
|
||||||
|
|
||||||
mapItemDataPacket.setColors(colors);
|
mapItemDataPacket.setColors(colors);
|
||||||
|
|
Loading…
Reference in a new issue