diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java index dec8c1d2c..9f25ba209 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java @@ -240,10 +240,44 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol { } }); - // TODO UPDATE BLOCK ENTITY? - 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, 0x46, 0x48); registerOutgoing(State.PLAY, 0x47, 0x49); diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/packets/WorldPackets.java index 36a6fbb8f..a6ead6f6c 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/packets/WorldPackets.java @@ -18,18 +18,6 @@ import java.util.List; public class WorldPackets { public static void register(Protocol protocol) { // 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 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); // Chunk Data @@ -122,4 +110,5 @@ public class WorldPackets { return 1; } } + }