Package org.terasology.logic.characters

Examples of org.terasology.logic.characters.CharacterComponent


            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) {
                characterComp.controller = entity;
                character.saveComponent(characterComp);
                character.setOwner(entity);
                Location.attachChild(character, entity, new Vector3f(), new Quat4f(0, 0, 0, 1));
View Full Code Here


        containerInventory = find("container", InventoryGrid.class);
        containerInventory.bindTargetEntity(new ReadOnlyBinding<EntityRef>() {
            @Override
            public EntityRef get() {
                EntityRef characterEntity = localPlayer.getCharacterEntity();
                CharacterComponent characterComponent = characterEntity.getComponent(CharacterComponent.class);
                return characterComponent.predictedInteractionTarget;
            }
        });
    }
View Full Code Here

    private EntityRef previousInteractionTarget;

    protected EntityRef getInteractionTarget() {
        EntityRef characterEntity = localPlayer.getCharacterEntity();
        CharacterComponent characterComponent = characterEntity.getComponent(CharacterComponent.class);

        if (previousInteractionTarget != characterComponent.predictedInteractionTarget && characterComponent.predictedInteractionTarget != null) {
            previousInteractionTarget = characterComponent.predictedInteractionTarget;
            initializeWithInteractionTarget(previousInteractionTarget);
        }
View Full Code Here

        EntityRef playerEntity= localPlayer.getCharacterEntity();
        InventoryComponent playerInventory = playerEntity.getComponent(InventoryComponent.class);
        if (playerInventory == null) {
            return;
        }
        CharacterComponent characterComponent = playerEntity.getComponent(CharacterComponent.class);
        if (characterComponent == null) {
            logger.error("Character entity of player had no character component");
            return;
        }
        int totalSlotCount = playerInventory.itemSlots.size();
View Full Code Here

            });

            bindItem(new ReadOnlyBinding<EntityRef>() {
                @Override
                public EntityRef get() {
                    CharacterComponent charComp = localPlayer.getCharacterEntity().getComponent(CharacterComponent.class);
                    if (charComp != null) {
                        return InventoryUtils.getItemAt(charComp.movingItem, 0);
                    }
                    return EntityRef.NULL;
                }
View Full Code Here

            this.localPlayer = localPlayer;
        }

        @Override
        public Boolean get() {
            CharacterComponent component = localPlayer.getCharacterEntity().getComponent(CharacterComponent.class);
            return component != null && component.selectedItem == slot;
        }
View Full Code Here

        if (debugLine3 != null) {
            debugLine3.bindText(new ReadOnlyBinding<String>() {
                @Override
                public String get() {
                    Vector3f pos = localPlayer.getPosition();
                    CharacterComponent character = localPlayer.getCharacterEntity().getComponent(CharacterComponent.class);
                    float yaw = (character != null) ? character.yaw : 0;
                    Vector3i chunkPos = TeraMath.calcChunkPos((int) pos.x, (int) pos.y, (int) pos.z);
                    return String.format(Locale.US, "Pos (%.2f, %.2f, %.2f), Chunk (%d, %d, %d), Yaw %.2f", pos.x, pos.y, pos.z, chunkPos.x, chunkPos.y, chunkPos.z, yaw);
                }
            });
View Full Code Here

TOP

Related Classes of org.terasology.logic.characters.CharacterComponent

Copyright © 2018 www.massapicom. 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.