use of org.dragonet.protocol.packets.SetEntityDataPacket in project DragonProxy by DragonetMC.
the class PCEntityMetadataPacketTranslator method translate.
public PEPacket[] translate(UpstreamSession session, ServerEntityMetadataPacket packet) {
CachedEntity entity = session.getEntityCache().getByRemoteEID(packet.getEntityId());
if (entity == null) {
if (packet.getEntityId() == session.getEntityCache().getClientEntity().eid)
entity = session.getEntityCache().getClientEntity();
else
return null;
// System.out.println("!!!!!!!!!!!!!!! TRY TO update the player meta from PCEntityMetadataPacketTranslator");
// return null;
}
entity.pcMeta = packet.getMetadata();
if (entity.spawned) {
SetEntityDataPacket pk = new SetEntityDataPacket();
pk.rtid = entity.proxyEid;
pk.meta = EntityMetaTranslator.translateToPE(session, packet.getMetadata(), entity.peType);
session.sendPacket(pk);
} else if (entity.peType == EntityType.PLAYER || entity.peType == EntityType.PAINTING) {
// Do nothing here !
} else
entity.spawn(session);
return null;
}
use of org.dragonet.protocol.packets.SetEntityDataPacket in project DragonProxy by DragonetMC.
the class PCEntitySetPassengerPacketTranslator method setRiding.
// if offset is null, it's a dismount action
private void setRiding(UpstreamSession session, CachedEntity rider, Vector3F offset) {
EntityMetaData peMeta = EntityMetaTranslator.translateToPE(session, rider.pcMeta, rider.peType);
peMeta.setGenericFlag(EntityMetaData.Constants.DATA_FLAG_RIDING, offset != null);
if (offset != null) {
peMeta.set(EntityMetaData.Constants.DATA_RIDER_SEAT_POSITION, new Vector3FMeta(offset));
}
SetEntityDataPacket pk = new SetEntityDataPacket();
pk.rtid = rider.proxyEid;
pk.meta = peMeta;
session.putCachePacket(pk);
}
Aggregations