Search in sources :

Example 1 with ClientComponentFieldCheck

use of org.terasology.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) BlockComponent(org.terasology.world.block.BlockComponent) NetworkComponent(org.terasology.network.NetworkComponent) Component(org.terasology.entitySystem.Component) EntityRef(org.terasology.entitySystem.entity.EntityRef) ClientComponentFieldCheck(org.terasology.network.serialization.ClientComponentFieldCheck)

Aggregations

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