Rework entity map to do both directions.

This commit is contained in:
md_5 2013-01-26 09:22:26 +11:00
parent 769e2e2148
commit 45a62a111e

View File

@ -120,9 +120,13 @@ public class EntityMap
{ // bulk entity { // bulk entity
for (int pos = 2; pos < packet.length; pos += 4) 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); setInt(packet, pos, newId);
} else if (readId == newId)
{
setInt(packet, pos, oldId);
} }
} }
} else } else
@ -132,9 +136,13 @@ public class EntityMap
{ {
for (int pos : idArray) for (int pos : idArray)
{ {
if (oldId == readInt(packet, pos)) int readId = readInt(packet, pos);
if (readId == oldId)
{ {
setInt(packet, pos, newId); setInt(packet, pos, newId);
} else if (readId == newId)
{
setInt(packet, pos, oldId);
} }
} }
} }