From 3602c5087b4b8286284059329489f83cef3dc593 Mon Sep 17 00:00:00 2001 From: Myles Date: Fri, 1 Apr 2016 18:13:23 +0100 Subject: [PATCH] Don't send a meta data packet when list is empty. #288 --- .../protocol1_9to1_8/packets/EntityPackets.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 b7a8d9c04..50826eb0b 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 @@ -201,6 +201,16 @@ public class EntityPackets { tracker.handleMetadata(entityID, metadataList); } }); + + // Cancel packet if list empty + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + List metadataList = wrapper.get(Protocol1_9TO1_8.METADATA_LIST, 0); + if(metadataList.size() == 0) + wrapper.cancel(); + } + }); } });