Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-16 04:50:10 +01:00
Properly read unused light data in 1.17->1.16
Some servers for some reason do this
Dieser Commit ist enthalten in:
Ursprung
ef2621c917
Commit
0b3a792a51
@ -247,13 +247,14 @@ public final class BlockItemPacketRewriter1_17 extends BackwardsItemRewriter<Cli
|
|||||||
|
|
||||||
private void writeLightArrays(PacketWrapper wrapper, BitSet bitMask, int cutBitMask,
|
private void writeLightArrays(PacketWrapper wrapper, BitSet bitMask, int cutBitMask,
|
||||||
int startFromSection, int sectionHeight) {
|
int startFromSection, int sectionHeight) {
|
||||||
wrapper.read(Types.VAR_INT); // Length - throw it away
|
int packetContentsLength = wrapper.read(Types.VAR_INT);
|
||||||
|
int read = 0;
|
||||||
List<byte[]> light = new ArrayList<>();
|
List<byte[]> light = new ArrayList<>();
|
||||||
|
|
||||||
// Remove lower bounds
|
// Remove lower bounds
|
||||||
for (int i = 0; i < startFromSection; i++) {
|
for (int i = 0; i < startFromSection; i++) {
|
||||||
if (bitMask.get(i)) {
|
if (bitMask.get(i)) {
|
||||||
|
read++;
|
||||||
wrapper.read(Types.BYTE_ARRAY_PRIMITIVE);
|
wrapper.read(Types.BYTE_ARRAY_PRIMITIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,6 +262,7 @@ public final class BlockItemPacketRewriter1_17 extends BackwardsItemRewriter<Cli
|
|||||||
// Add the important 18 sections
|
// Add the important 18 sections
|
||||||
for (int i = 0; i < 18; i++) {
|
for (int i = 0; i < 18; i++) {
|
||||||
if (isSet(cutBitMask, i)) {
|
if (isSet(cutBitMask, i)) {
|
||||||
|
read++;
|
||||||
light.add(wrapper.read(Types.BYTE_ARRAY_PRIMITIVE));
|
light.add(wrapper.read(Types.BYTE_ARRAY_PRIMITIVE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,6 +270,14 @@ public final class BlockItemPacketRewriter1_17 extends BackwardsItemRewriter<Cli
|
|||||||
// Remove upper bounds
|
// Remove upper bounds
|
||||||
for (int i = startFromSection + 18; i < sectionHeight + 2; i++) {
|
for (int i = startFromSection + 18; i < sectionHeight + 2; i++) {
|
||||||
if (bitMask.get(i)) {
|
if (bitMask.get(i)) {
|
||||||
|
read++;
|
||||||
|
wrapper.read(Types.BYTE_ARRAY_PRIMITIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (read != packetContentsLength) {
|
||||||
|
// Read the rest if the server for some reason sends more than are actually consumed
|
||||||
|
for (int i = read; i < packetContentsLength; i++) {
|
||||||
wrapper.read(Types.BYTE_ARRAY_PRIMITIVE);
|
wrapper.read(Types.BYTE_ARRAY_PRIMITIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren