Search in sources :

Example 1 with AnimatePacket

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

the class PCAnimationPacketTranslator method translate.

public PEPacket[] translate(UpstreamSession session, ServerEntityAnimationPacket packet) {
    CachedEntity entity = session.getEntityCache().getByRemoteEID(packet.getEntityId());
    if (entity == null) {
        return null;
    }
    AnimatePacket pk = new AnimatePacket();
    switch(packet.getAnimation()) {
        case CRITICAL_HIT:
            pk.action = AnimatePacket.ACTION_CRITICAL_HIT;
            break;
        case DAMAGE:
            break;
        case EAT_FOOD:
            break;
        case ENCHANTMENT_CRITICAL_HIT:
            break;
        case LEAVE_BED:
            pk.action = AnimatePacket.ANIMATION_LEAVE_BED;
            break;
        case SWING_ARM:
            pk.action = AnimatePacket.ANIMATION_SWING_ARM;
    }
    pk.eid = entity.proxyEid;
    return new PEPacket[] { pk };
}
Also used : CachedEntity(org.dragonet.proxy.network.cache.CachedEntity) AnimatePacket(org.dragonet.protocol.packets.AnimatePacket) PEPacket(org.dragonet.protocol.PEPacket)

Aggregations

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