Examples of ClientComponent


Examples of org.terasology.network.ClientComponent

        return name;
    }

    @Override
    public Color getColor() {
        ClientComponent clientComp = getEntity().getComponent(ClientComponent.class);
        if (clientComp != null) {
            ColorComponent colorComp = clientComp.clientInfo.getComponent(ColorComponent.class);
            if (colorComp != null) {
                return colorComp.color;
            }
View Full Code Here

Examples of org.terasology.network.ClientComponent

    }

    public void setColor(Color color) {
        this.color = color;

        ClientComponent client = getEntity().getComponent(ClientComponent.class);
        if (client != null) {
            ColorComponent colorInfo = client.clientInfo.getComponent(ColorComponent.class);
            if (colorInfo != null) {
                colorInfo.color = color;
                client.clientInfo.saveComponent(colorInfo);
View Full Code Here

Examples of org.terasology.network.ClientComponent

    }

    public void setName(String name) {
        this.name = name;
        ClientComponent client = getEntity().getComponent(ClientComponent.class);
        if (client != null) {
            DisplayNameComponent displayInfo = client.clientInfo.getComponent(DisplayNameComponent.class);
            if (displayInfo != null) {
                displayInfo.name = name;
                client.clientInfo.saveComponent(displayInfo);
View Full Code Here

Examples of org.terasology.network.ClientComponent

        }
    }

    @ReceiveEvent
    public void onPlaySound(PlaySoundForOwnerEvent playSoundEvent, EntityRef entity) {
        ClientComponent clientComponent = networkSystem.getOwnerEntity(entity).getComponent(ClientComponent.class);
        if (clientComponent != null && !clientComponent.local) {
            return;
        }
        audioManager.playSound(playSoundEvent.getSound(), playSoundEvent.getVolume(), AudioManager.PRIORITY_HIGH);
    }
View Full Code Here

Examples of org.terasology.network.ClientComponent

    private void spawnPlayer(EntityRef clientEntity, Vector3i initialSpawnPosition) {

        Vector3i spawnPos = getSafeSpawnPosition(initialSpawnPosition);

        ClientComponent client = clientEntity.getComponent(ClientComponent.class);
        if (client != null) {
            PlayerFactory playerFactory = new PlayerFactory(entityManager);
            EntityRef playerCharacter = playerFactory.newInstance(new Vector3f(spawnPos.x, spawnPos.y + 1.5f, spawnPos.z), clientEntity);
            Location.attachChild(playerCharacter, clientEntity, new Vector3f(), new Quat4f(0, 0, 0, 1));
View Full Code Here

Examples of org.terasology.network.ClientComponent

        if (character == null) {
            spawnPlayer(entity, getSafeSpawnPosition());
        } else {
            Client clientListener = networkSystem.getOwner(entity);
            updateRelevanceEntity(entity, clientListener.getViewDistance().getChunkDistance());
            ClientComponent client = entity.getComponent(ClientComponent.class);
            client.character = character;
            entity.saveComponent(client);

            CharacterComponent characterComp = character.getComponent(CharacterComponent.class);
            if (characterComp != null) {
View Full Code Here

Examples of org.terasology.network.ClientComponent

        removeRelevanceEntity(entity);
    }

    @ReceiveEvent(components = {ClientComponent.class})
    public void onRespawnRequest(RespawnRequestEvent event, EntityRef entity) {
        ClientComponent client = entity.getComponent(ClientComponent.class);
        if (!client.character.exists()) {
            Vector3i pos = Vector3i.zero();
            if (worldProvider.isBlockRelevant(pos)) {
                spawnPlayer(entity, getSafeSpawnPosition());
            } else {
View Full Code Here

Examples of org.terasology.network.ClientComponent

        if (characterComponent == null) {
            return "?";
        }
        EntityRef controller = characterComponent.controller;

        ClientComponent clientComponent =  controller.getComponent(ClientComponent.class);
        if (characterComponent == null) {
            return "?";
        }
        EntityRef clientInfo = clientComponent.clientInfo;
View Full Code Here

Examples of org.terasology.network.ClientComponent

    }

    @ReceiveEvent(components = {CharacterComponent.class, CharacterMovementComponent.class, LocationComponent.class})
    public void onDestroy(final BeforeDeactivateComponent event, final EntityRef entity) {
        CharacterComponent character = entity.getComponent(CharacterComponent.class);
        ClientComponent controller = character.controller.getComponent(ClientComponent.class);
        if (controller != null && controller.local) {
            predictedState = null;
            authoritiveState = null;
            inputs.clear();
        }
View Full Code Here

Examples of org.terasology.network.ClientComponent

        ComponentSystemManager componentSystemManager = CoreRegistry.get(ComponentSystemManager.class);
        for (UpdateSubscriberSystem updater : componentSystemManager.iterateUpdateSubscribers()) {
            updater.update(0.0f);
        }
        LocalPlayer localPlayer = CoreRegistry.get(LocalPlayer.class);
        ClientComponent client = localPlayer.getClientEntity().getComponent(ClientComponent.class);
        if (client != null && client.character.exists()) {
            worldRenderer.setPlayer(CoreRegistry.get(LocalPlayer.class));
            return true;
        } else {
            worldRenderer.getChunkProvider().completeUpdate();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.