Don't modify the destroy packet and just send our own
This commit is contained in:
parent
afe4022920
commit
6c17603905
@ -71,26 +71,21 @@ public class PacketListenerEntityDestroy extends PacketAdapter {
|
|||||||
|
|
||||||
public void onPre17Packet(PacketEvent event) {
|
public void onPre17Packet(PacketEvent event) {
|
||||||
int[] entityIds = event.getPacket().getIntegerArrays().read(0);
|
int[] entityIds = event.getPacket().getIntegerArrays().read(0);
|
||||||
int[] newEntityIds = entityIds;
|
|
||||||
|
|
||||||
for (int entityId : entityIds) {
|
for (int entityId : entityIds) {
|
||||||
int[] toAdd = getToRemove(event.getPlayer(), entityId);
|
int[] toRemove = getToRemove(event.getPlayer(), entityId);
|
||||||
|
|
||||||
if (toAdd == null) {
|
if (toRemove == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
newEntityIds = Arrays.copyOf(entityIds, entityIds.length + toAdd.length);
|
try {
|
||||||
|
for (PacketContainer container : DisguiseUtilities.getDestroyPackets(toRemove)) {
|
||||||
for (int a = 0; a < toAdd.length; a++) {
|
ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), container);
|
||||||
newEntityIds[newEntityIds.length - (a + 1)] = toAdd[a];
|
}
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entityIds.length == newEntityIds.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.getPacket().getIntegerArrays().write(0, newEntityIds);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user