Search in sources :

Example 1 with SpawnExperienceOrb

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

the class PCSpawnExpOrbPacketTranslator method translate.

public PEPacket[] translate(UpstreamSession session, ServerSpawnExpOrbPacket packet) {
    CachedEntity entity = session.getEntityCache().newEntity(packet);
    if (entity == null)
        return null;
    if (session.isSpawned()) {
        SpawnExperienceOrb spawnXpOrb = new SpawnExperienceOrb();
        spawnXpOrb.position = new Vector3F((float) entity.x, (float) entity.y + entity.peType.getOffset(), (float) entity.z);
        spawnXpOrb.count = packet.getExp();
        entity.spawned = true;
        session.sendPacket(spawnXpOrb);
    }
    return null;
}
Also used : CachedEntity(org.dragonet.proxy.network.cache.CachedEntity) SpawnExperienceOrb(org.dragonet.protocol.packets.SpawnExperienceOrb) Vector3F(org.dragonet.common.maths.Vector3F)

Aggregations

Vector3F (org.dragonet.common.maths.Vector3F)1 SpawnExperienceOrb (org.dragonet.protocol.packets.SpawnExperienceOrb)1 CachedEntity (org.dragonet.proxy.network.cache.CachedEntity)1