Search in sources :

Example 1 with ClientComponentFieldCheck

use of org.terasology.engine.network.serialization.ClientComponentFieldCheck in project Terasology by MovingBlocks.

the class ServerImpl method sendEntities.

private void sendEntities(NetData.NetMessage.Builder message) {
    TIntIterator dirtyIterator = netDirty.iterator();
    while (dirtyIterator.hasNext()) {
        int netId = dirtyIterator.next();
        EntityRef entity = networkSystem.getEntity(netId);
        if (isOwned(entity)) {
            Set<Class<? extends Component>> emptyComponentClassSet = Collections.emptySet();
            EntityData.PackedEntity entityData = entitySerializer.serialize(entity, emptyComponentClassSet, changedComponents.get(netId), emptyComponentClassSet, new ClientComponentFieldCheck());
            if (entityData != null) {
                message.addUpdateEntity(NetData.UpdateEntityMessage.newBuilder().setEntity(entityData).setNetId(netId));
            }
        }
    }
    netDirty.clear();
}
Also used : TIntIterator(gnu.trove.iterator.TIntIterator) EntityData(org.terasology.protobuf.EntityData) Component(org.terasology.gestalt.entitysystem.component.Component) NetworkComponent(org.terasology.engine.network.NetworkComponent) BlockComponent(org.terasology.engine.world.block.BlockComponent) EntityRef(org.terasology.engine.entitySystem.entity.EntityRef) ClientComponentFieldCheck(org.terasology.engine.network.serialization.ClientComponentFieldCheck)

Aggregations

TIntIterator (gnu.trove.iterator.TIntIterator)1 EntityRef (org.terasology.engine.entitySystem.entity.EntityRef)1 NetworkComponent (org.terasology.engine.network.NetworkComponent)1 ClientComponentFieldCheck (org.terasology.engine.network.serialization.ClientComponentFieldCheck)1 BlockComponent (org.terasology.engine.world.block.BlockComponent)1 Component (org.terasology.gestalt.entitysystem.component.Component)1 EntityData (org.terasology.protobuf.EntityData)1