From 45a62a111e483abebf7079d24fdfb005071e7a34 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 26 Jan 2013 09:22:26 +1100 Subject: [PATCH] Rework entity map to do both directions. --- proxy/src/main/java/net/md_5/bungee/EntityMap.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/EntityMap.java index e4117928..7754474e 100644 --- a/proxy/src/main/java/net/md_5/bungee/EntityMap.java +++ b/proxy/src/main/java/net/md_5/bungee/EntityMap.java @@ -120,9 +120,13 @@ public class EntityMap { // bulk entity for (int pos = 2; pos < packet.length; pos += 4) { - if (oldId == readInt(packet, pos)) + int readId = readInt(packet, pos); + if (readId == oldId) { setInt(packet, pos, newId); + } else if (readId == newId) + { + setInt(packet, pos, oldId); } } } else @@ -132,9 +136,13 @@ public class EntityMap { for (int pos : idArray) { - if (oldId == readInt(packet, pos)) + int readId = readInt(packet, pos); + if (readId == oldId) { setInt(packet, pos, newId); + } else if (readId == newId) + { + setInt(packet, pos, oldId); } } }