From c0493de4df9ec5c7d128042b4b7919059797f406 Mon Sep 17 00:00:00 2001 From: Myles Date: Sun, 27 Mar 2016 14:57:13 +0100 Subject: [PATCH] Does not fix armour issue completely but improves right click armour items (it's still bugged, working on it) --- .../listeners/ArmorListener.java | 20 +++++++++---------- .../packets/WorldPackets.java | 7 +++++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/listeners/ArmorListener.java b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/listeners/ArmorListener.java index bb509a3eb..762bf61f5 100644 --- a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/listeners/ArmorListener.java +++ b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/listeners/ArmorListener.java @@ -79,18 +79,16 @@ public class ArmorListener implements Listener { public void onInteract(PlayerInteractEvent e) { if (e.getItem() != null) { if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) { - if (ArmorType.isArmor(e.getMaterial())) { - final Player player = e.getPlayer(); - // Due to odd bugs it's 3 ticks later - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - if (ViaVersion.getInstance().isPorted(player)) { - sendArmorUpdate(player); - } + final Player player = e.getPlayer(); + // Due to odd bugs it's 3 ticks later + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + @Override + public void run() { + if (ViaVersion.getInstance().isPorted(player)) { + sendArmorUpdate(player); } - }, 3L); - } + } + }, 3L); } } } diff --git a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java index c4c0df9d5..c5b0c12da 100644 --- a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java +++ b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java @@ -14,6 +14,7 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.remapper.ValueCreator; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.packets.State; +import us.myles.ViaVersion.protocols.protocol1_9to1_8.ArmorType; import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8; import us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds.SoundEffect; import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.ClientChunks; @@ -317,9 +318,11 @@ public class WorldPackets { // Projectiles special = special || m == Material.BOW; special = special || m == Material.SNOW_BALL || m == Material.EGG || m == Material.EXP_BOTTLE || m == Material.ENDER_PEARL || m == Material.EYE_OF_ENDER; + // Armour + special = special || ArmorType.isArmor(m); // Don't send data if special - if (special) { - wrapper.set(Type.POSITION, 0, new Position(-1L, 255L, -1L)); + if (special && m != Material.AIR) { + wrapper.set(Type.POSITION, 0, new Position(-1L, -1L, -1L)); wrapper.set(Type.BYTE, 0, (byte) -1); } EntityTracker tracker = wrapper.user().get(EntityTracker.class);