diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java index 748aea1dda..8eac5816b1 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java @@ -66,10 +66,10 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId) break; case 0x40 /* Attach Entity : PacketPlayOutMount */: DefinedPacket.skipVarInt( packet ); - readerIndexAfterPID = packet.readerIndex(); - // Fall through on purpose to int array of IDs + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, packet.readerIndex() ); + break; case 0x30 /* Destroy Entities : PacketPlayOutEntityDestroy */: - EntityMap_1_8.rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */: EntityMap_1_9.rewriteSpawnObject( wrapper, oldId, newId ); diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java index 3f3a13c3dc..fa9adec126 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java @@ -66,10 +66,10 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId) break; case 0x40 /* Attach Entity : PacketPlayOutMount */: DefinedPacket.skipVarInt( packet ); - readerIndexAfterPID = packet.readerIndex(); - // Fall through on purpose to int array of IDs + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, packet.readerIndex() ); + break; case 0x30 /* Destroy Entities : PacketPlayOutEntityDestroy */: - EntityMap_1_8.rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */: EntityMap_1_9.rewriteSpawnObject( wrapper, oldId, newId ); diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12.java index f3ea2417f5..cbb75c4f34 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12.java @@ -66,10 +66,10 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId) break; case 0x42 /* Attach Entity : PacketPlayOutMount */: DefinedPacket.skipVarInt( packet ); - readerIndexAfterPID = packet.readerIndex(); - // Fall through on purpose to int array of IDs + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, packet.readerIndex() ); + break; case 0x31 /* Destroy Entities : PacketPlayOutEntityDestroy */: - EntityMap_1_8.rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */: EntityMap_1_9.rewriteSpawnObject( wrapper, oldId, newId ); diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java index 6d18d0c245..cf86a62b80 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_12_1.java @@ -66,10 +66,10 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId) break; case 0x43 /* Attach Entity : PacketPlayOutMount */: DefinedPacket.skipVarInt( packet ); - readerIndexAfterPID = packet.readerIndex(); - // Fall through on purpose to int array of IDs + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, packet.readerIndex() ); + break; case 0x32 /* Destroy Entities : PacketPlayOutEntityDestroy */: - EntityMap_1_8.rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */: EntityMap_1_9.rewriteSpawnObject( wrapper, oldId, newId ); diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java index 98384d2bbb..9d4e985409 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java @@ -66,10 +66,10 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId, int break; case 0x46 /* Set Passengers : PacketPlayOutMount */: DefinedPacket.skipVarInt( packet ); - readerIndexAfterPID = packet.readerIndex(); - // Fall through on purpose to int array of IDs + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, packet.readerIndex() ); + break; case 0x35 /* Destroy Entities : PacketPlayOutEntityDestroy */: - EntityMap_1_8.rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */: EntityMap_1_9.rewriteSpawnObject( wrapper, oldId, newId ); diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_14.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_14.java index 846537205c..26d7f85fdf 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_14.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_14.java @@ -65,10 +65,10 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId, int break; case 0x4A /* Set Passengers : PacketPlayOutMount */: DefinedPacket.skipVarInt( packet ); - readerIndexAfterPID = packet.readerIndex(); - // Fall through on purpose to int array of IDs + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, packet.readerIndex() ); + break; case 0x37 /* Destroy Entities : PacketPlayOutEntityDestroy */: - EntityMap_1_8.rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */: rewriteSpawnObject( wrapper, oldId, newId, 2, 101, 71 ); diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_15.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_15.java index 4c8ab4129f..336df6a24d 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_15.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_15.java @@ -65,10 +65,10 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId, int break; case 0x4B /* Set Passengers : PacketPlayOutMount */: DefinedPacket.skipVarInt( packet ); - readerIndexAfterPID = packet.readerIndex(); - // Fall through on purpose to int array of IDs + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, packet.readerIndex() ); + break; case 0x38 /* Destroy Entities : PacketPlayOutEntityDestroy */: - EntityMap_1_8.rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */: EntityMap_1_14.rewriteSpawnObject( wrapper, oldId, newId, 2, 102, 72 ); diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16.java index f39a697f58..419fde84d7 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16.java @@ -65,10 +65,10 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId, int break; case 0x4B /* Set Passengers : PacketPlayOutMount */: DefinedPacket.skipVarInt( packet ); - readerIndexAfterPID = packet.readerIndex(); - // Fall through on purpose to int array of IDs + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, packet.readerIndex() ); + break; case 0x37 /* Destroy Entities : PacketPlayOutEntityDestroy */: - EntityMap_1_8.rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */: EntityMap_1_14.rewriteSpawnObject( wrapper, oldId, newId, 2, 102, 72 ); diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java index 1d86445acd..61ce724092 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java @@ -69,7 +69,7 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId) rewriteVarInt( wrapper, oldId, newId, packet.readerIndex() ); break; case 0x13 /* Destroy Entities */: - rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x0E /* Spawn Object */: DefinedPacket.skipVarInt( packet ); @@ -171,12 +171,14 @@ public static void rewriteSpawnPlayerUuid(PacketWrapper wrapper, int readerIndex } } - public static void rewriteDestroyEntities(PacketWrapper wrapper, int oldId, int newId, int readerIndexAfterPID) + public static void rewriteEntityIdArray(PacketWrapper wrapper, int oldId, int newId, int readerIndexAfterPID) { if ( oldId == newId ) { return; } + // we don't do it conditionally if we changed something as this packet is not + // hard to compress again if we didn't do changes wrapper.destroyCompressed(); ByteBuf packet = wrapper.buf; diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java index 7f5eec535a..7ed6a1e7b7 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java @@ -66,10 +66,10 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId) break; case 0x40 /* Attach Entity : PacketPlayOutMount */: DefinedPacket.skipVarInt( packet ); - readerIndexAfterPID = packet.readerIndex(); - // Fall through on purpose to int array of IDs + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, packet.readerIndex() ); + break; case 0x30 /* Destroy Entities : PacketPlayOutEntityDestroy */: - EntityMap_1_8.rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */: rewriteSpawnObject( wrapper, oldId, newId ); diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java index abf1bc6648..8a769c4414 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java @@ -66,10 +66,10 @@ public void rewriteClientbound(PacketWrapper wrapper, int oldId, int newId) break; case 0x40 /* Attach Entity : PacketPlayOutMount */: DefinedPacket.skipVarInt( packet ); - readerIndexAfterPID = packet.readerIndex(); - // Fall through on purpose to int array of IDs + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, packet.readerIndex() ); + break; case 0x30 /* Destroy Entities : PacketPlayOutEntityDestroy */: - EntityMap_1_8.rewriteDestroyEntities( wrapper, oldId, newId, readerIndexAfterPID ); + EntityMap_1_8.rewriteEntityIdArray( wrapper, oldId, newId, readerIndexAfterPID ); break; case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */: EntityMap_1_9.rewriteSpawnObject( wrapper, oldId, newId );