From a8baa7af50117bd6d90fc7b8315f2835e1af4c5c Mon Sep 17 00:00:00 2001 From: Mats Date: Tue, 12 Apr 2016 12:18:51 +0200 Subject: [PATCH] Transform Combat packet (#346) --- .../packets/EntityPackets.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/EntityPackets.java b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/EntityPackets.java index a36aedeba..9dd041fb0 100644 --- a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/EntityPackets.java +++ b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/EntityPackets.java @@ -252,6 +252,24 @@ public class EntityPackets { } }); + // Combat Event Packet + protocol.registerOutgoing(State.PLAY, 0x42, 0x2C, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.VAR_INT); //Event id + + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + if (wrapper.get(Type.VAR_INT, 0) == 2) { // entity dead + wrapper.passthrough(Type.VAR_INT); //Player id + wrapper.passthrough(Type.INT); //Entity id + Protocol1_9TO1_8.FIX_JSON.write(wrapper, wrapper.read(Type.STRING)); + } + } + }); + } + }); /* Packets which do not have any field remapping or handlers */ @@ -261,7 +279,6 @@ public class EntityPackets { protocol.registerOutgoing(State.PLAY, 0x16, 0x27); // Entity Look Packet protocol.registerOutgoing(State.PLAY, 0x14, 0x28); // Entity Packet - protocol.registerOutgoing(State.PLAY, 0x42, 0x2C); // Combat Event Packet protocol.registerOutgoing(State.PLAY, 0x0A, 0x2F); // Use Bed Packet protocol.registerOutgoing(State.PLAY, 0x1E, 0x31); // Remove Entity Effect Packet