Search in sources :

Example 1 with RemoveEntityPacket

use of org.dragonet.protocol.packets.RemoveEntityPacket in project DragonProxy by DragonetMC.

the class PCDestroyEntitiesPacketTranslator method translate.

public PEPacket[] translate(UpstreamSession session, ServerEntityDestroyPacket packet) {
    PEPacket[] ret = new PEPacket[packet.getEntityIds().length];
    for (int i = 0; i < ret.length; i++) {
        CachedEntity e = session.getEntityCache().removeByRemoteEID(packet.getEntityIds()[i]);
        if (e == null) {
            continue;
        }
        ret[i] = new RemoveEntityPacket();
        ((RemoveEntityPacket) ret[i]).eid = e.proxyEid;
    }
    return ret;
}
Also used : RemoveEntityPacket(org.dragonet.protocol.packets.RemoveEntityPacket) CachedEntity(org.dragonet.proxy.network.cache.CachedEntity) PEPacket(org.dragonet.protocol.PEPacket)

Aggregations

PEPacket (org.dragonet.protocol.PEPacket)1 RemoveEntityPacket (org.dragonet.protocol.packets.RemoveEntityPacket)1 CachedEntity (org.dragonet.proxy.network.cache.CachedEntity)1