3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Handle team packet changes

Dieser Commit ist enthalten in:
Matsv 2018-01-05 15:50:01 +01:00
Ursprung c43e702ed9
Commit ba70dae9ad
2 geänderte Dateien mit 39 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -240,10 +240,44 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
} }
}); });
// TODO UPDATE BLOCK ENTITY?
registerOutgoing(State.PLAY, 0x43, 0x45); registerOutgoing(State.PLAY, 0x43, 0x45);
registerOutgoing(State.PLAY, 0x44, 0x46); // Team packet
registerOutgoing(State.PLAY, 0x44, 0x46, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Team Name
map(Type.BYTE); // 1 - Mode
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
byte action = wrapper.get(Type.BYTE, 0);
if (action == 0 || action == 2) {
wrapper.passthrough(Type.STRING); // Display Name
wrapper.read(Type.STRING); // Prefix !REMOVED! TODO alternative or drop?
wrapper.read(Type.STRING); // Suffix !REMOVED!
wrapper.passthrough(Type.BYTE); // Flags
wrapper.passthrough(Type.STRING); // Name Tag Visibility
wrapper.passthrough(Type.STRING); // Collision rule
// Handle new colors
byte color = wrapper.read(Type.BYTE);
if (color == -1) // -1 is no longer active, use white instead
wrapper.write(Type.VAR_INT, 15);
else
wrapper.write(Type.VAR_INT, (int) color);
}
}
});
}
});
registerOutgoing(State.PLAY, 0x45, 0x47); registerOutgoing(State.PLAY, 0x45, 0x47);
registerOutgoing(State.PLAY, 0x46, 0x48); registerOutgoing(State.PLAY, 0x46, 0x48);
registerOutgoing(State.PLAY, 0x47, 0x49); registerOutgoing(State.PLAY, 0x47, 0x49);

Datei anzeigen

@ -18,18 +18,6 @@ import java.util.List;
public class WorldPackets { public class WorldPackets {
public static void register(Protocol protocol) { public static void register(Protocol protocol) {
// Outgoing packets // Outgoing packets
protocol.registerOutgoing(State.PLAY, 0x9, 0x9, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) {
wrapper.cancel();
}
});
}
});
// Block Change // Block Change
protocol.registerOutgoing(State.PLAY, 0xB, 0xB, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0xB, 0xB, new PacketRemapper() {
@ -65,7 +53,7 @@ public class WorldPackets {
} }
}); });
// Named Sound Effect // Named Sound Effect TODO String -> Identifier? Check if identifier is present?
protocol.registerOutgoing(State.PLAY, 0x19, 0x1A); protocol.registerOutgoing(State.PLAY, 0x19, 0x1A);
// Chunk Data // Chunk Data
@ -122,4 +110,5 @@ public class WorldPackets {
return 1; return 1;
} }
} }
} }