Make map data type read consistent

This commit is contained in:
KennyTV 2020-06-30 17:09:46 +02:00
parent 87afb84a4d
commit f5bb30559d
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 5 additions and 6 deletions

View File

@ -57,8 +57,8 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
if (columns <= 0) return;
short rows = wrapper.passthrough(Type.UNSIGNED_BYTE);
wrapper.passthrough(Type.BYTE); //X
wrapper.passthrough(Type.BYTE); //Z
wrapper.passthrough(Type.UNSIGNED_BYTE); // X
wrapper.passthrough(Type.UNSIGNED_BYTE); // Z
byte[] data = wrapper.read(Type.BYTE_ARRAY_PRIMITIVE);
for (int i = 0; i < data.length; i++) {
short color = (short) (data[i] & 0xFF);

View File

@ -231,16 +231,15 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
short columns = wrapper.passthrough(Type.UNSIGNED_BYTE);
if (columns < 1) return;
wrapper.passthrough(Type.BYTE); // Rows
wrapper.passthrough(Type.BYTE); // X
wrapper.passthrough(Type.BYTE); // Z
wrapper.passthrough(Type.UNSIGNED_BYTE); // Rows
wrapper.passthrough(Type.UNSIGNED_BYTE); // X
wrapper.passthrough(Type.UNSIGNED_BYTE); // Z
byte[] data = wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE);
for (int i = 0; i < data.length; i++) {
int color = data[i] & 0xFF;
int mappedColor = MapColorRewriter.getMappedColor(color);
if (mappedColor != -1) {
data[i] = (byte) mappedColor;
System.out.println(color + " -> " + mappedColor);
}
}
});