mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2025-01-20 21:31:31 +01:00
Make map data type read consistent
This commit is contained in:
parent
87afb84a4d
commit
f5bb30559d
@ -57,8 +57,8 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
if (columns <= 0) return;
|
if (columns <= 0) return;
|
||||||
|
|
||||||
short rows = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
short rows = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||||
wrapper.passthrough(Type.BYTE); //X
|
wrapper.passthrough(Type.UNSIGNED_BYTE); // X
|
||||||
wrapper.passthrough(Type.BYTE); //Z
|
wrapper.passthrough(Type.UNSIGNED_BYTE); // Z
|
||||||
byte[] data = wrapper.read(Type.BYTE_ARRAY_PRIMITIVE);
|
byte[] data = wrapper.read(Type.BYTE_ARRAY_PRIMITIVE);
|
||||||
for (int i = 0; i < data.length; i++) {
|
for (int i = 0; i < data.length; i++) {
|
||||||
short color = (short) (data[i] & 0xFF);
|
short color = (short) (data[i] & 0xFF);
|
||||||
|
@ -231,16 +231,15 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
short columns = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
short columns = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||||
if (columns < 1) return;
|
if (columns < 1) return;
|
||||||
|
|
||||||
wrapper.passthrough(Type.BYTE); // Rows
|
wrapper.passthrough(Type.UNSIGNED_BYTE); // Rows
|
||||||
wrapper.passthrough(Type.BYTE); // X
|
wrapper.passthrough(Type.UNSIGNED_BYTE); // X
|
||||||
wrapper.passthrough(Type.BYTE); // Z
|
wrapper.passthrough(Type.UNSIGNED_BYTE); // Z
|
||||||
byte[] data = wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE);
|
byte[] data = wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE);
|
||||||
for (int i = 0; i < data.length; i++) {
|
for (int i = 0; i < data.length; i++) {
|
||||||
int color = data[i] & 0xFF;
|
int color = data[i] & 0xFF;
|
||||||
int mappedColor = MapColorRewriter.getMappedColor(color);
|
int mappedColor = MapColorRewriter.getMappedColor(color);
|
||||||
if (mappedColor != -1) {
|
if (mappedColor != -1) {
|
||||||
data[i] = (byte) mappedColor;
|
data[i] = (byte) mappedColor;
|
||||||
System.out.println(color + " -> " + mappedColor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user