3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 00:00:33 +01:00

Process player info entries with 1.16->1.15 color correction

Dieser Commit ist enthalten in:
KennyTV 2020-07-30 15:43:34 +02:00
Ursprung fd529ce967
Commit 1afdf0fb81
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -142,6 +142,45 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
});
}
});
protocol.registerOutgoing(ClientboundPackets1_16.PLAYER_INFO, new PacketRemapper() {
@Override
public void registerMap() {
handler(packetWrapper -> {
int action = packetWrapper.passthrough(Type.VAR_INT);
int playerCount = packetWrapper.passthrough(Type.VAR_INT);
for (int i = 0; i < playerCount; i++) {
packetWrapper.passthrough(Type.UUID);
if (action == 0) { // Add
packetWrapper.passthrough(Type.STRING);
int properties = packetWrapper.passthrough(Type.VAR_INT);
for (int j = 0; j < properties; j++) {
packetWrapper.passthrough(Type.STRING);
packetWrapper.passthrough(Type.STRING);
if (packetWrapper.passthrough(Type.BOOLEAN)) {
packetWrapper.passthrough(Type.STRING);
}
}
packetWrapper.passthrough(Type.VAR_INT);
packetWrapper.passthrough(Type.VAR_INT);
if (packetWrapper.passthrough(Type.BOOLEAN)) {
// Display Name
protocol.getTranslatableRewriter().processText(packetWrapper.passthrough(Type.COMPONENT));
}
} else if (action == 1) { // Update Game Mode
packetWrapper.passthrough(Type.VAR_INT);
} else if (action == 2) { // Update Ping
packetWrapper.passthrough(Type.VAR_INT);
} else if (action == 3) { // Update Display Name
if (packetWrapper.passthrough(Type.BOOLEAN)) {
// Display name
protocol.getTranslatableRewriter().processText(packetWrapper.passthrough(Type.COMPONENT));
}
} // 4 = Remove Player
}
});
}
});
}
@Override