Package org.terasology.logic.location

Examples of org.terasology.logic.location.LocationComponent


        if (!blockEvent.isConsumed()) {
            EntityRef newDoor = entityManager.copy(entity);
            newDoor.addComponent(new BlockRegionComponent(Region3i.createBounded(bottomBlockPos, topBlockPos)));
            Vector3f doorCenter = bottomBlockPos.toVector3f();
            doorCenter.y += 0.5f;
            newDoor.addComponent(new LocationComponent(doorCenter));
            DoorComponent newDoorComp = newDoor.getComponent(DoorComponent.class);
            newDoorComp.closedSide = closedSide;
            newDoorComp.openSide = attachSide.reverse();
            newDoorComp.isOpen = false;
            newDoor.saveComponent(newDoorComp);
View Full Code Here


        List<Component> components = Lists.newArrayList();
        for (Component component : prefab.iterateComponents()) {
            Component newComp = componentLibrary.copy(component);
            components.add(newComp);
            if (newComp instanceof LocationComponent) {
                LocationComponent loc = (LocationComponent) newComp;
                loc.setWorldPosition(position);
            }
        }
        components.add(new EntityInfoComponent(prefab.getName(), prefab.isPersisted(), prefab.isAlwaysRelevant()));
        return create(components);
    }
View Full Code Here

        worldProvider.setBlock(regionComp.region.min(), bottomBlock);
        Block topBlock = door.topBlockFamily.getBlockForPlacement(worldProvider, blockEntityRegistry, regionComp.region.max(), newSide, Side.TOP);
        worldProvider.setBlock(regionComp.region.max(), topBlock);
        StaticSound sound = (door.isOpen) ? door.closeSound : door.openSound;
        if (sound != null) {
            LocationComponent loc = entity.getComponent(LocationComponent.class);
            audioManager.playSound(sound, loc.getWorldPosition(), 10, 1);
        }

        door.isOpen = !door.isOpen;
        entity.saveComponent(door);
    }
View Full Code Here

    }

    @ReceiveEvent(components = {RigidBodyComponent.class, LocationComponent.class}, netFilter = RegisterMode.REMOTE_CLIENT)
    public void resynch(PhysicsResynchEvent event, EntityRef entity) {
        logger.debug("Received resynch event");
        LocationComponent loc = entity.getComponent(LocationComponent.class);
        Vector3f delta = new Vector3f(event.getPosition());
        delta.sub(loc.getWorldPosition());
        RigidBody body = physics.getRigidBody(entity);
        body.setVelocity(event.getVelocity(), event.getAngularVelocity());
        body.setTransform(event.getPosition(), event.getRotation());
    }
View Full Code Here

    @Test
    public void createConstructorObjectWithPublicConstructor() throws NoSuchMethodException {
        ReflectFactory reflectFactory = new ByteCodeReflectFactory();
        ObjectConstructor<LocationComponent> constructor = reflectFactory.createConstructor(LocationComponent.class);
        LocationComponent locationComponent = constructor.construct();
        assertNotNull(locationComponent);
    }
View Full Code Here

        FastRandom rand = new FastRandom(0L);
        rawEntityData = Lists.newArrayList();
        for (int i = 0; i < 1000; ++i) {
            List<Component> entityData = Lists.newArrayList();
            if (rand.nextFloat() < 0.75f) {
                entityData.add(new LocationComponent());
            }
            if (rand.nextFloat() < 0.5f) {
                entityData.add(new MeshComponent());
            }
            if (rand.nextFloat() < 0.5f) {
View Full Code Here

    }

    @Override
    public void run() {
        for (EntityRef entity : entityManager.getEntitiesWith(MeshComponent.class, LocationComponent.class)) {
            LocationComponent loc = entity.getComponent(LocationComponent.class);
            MeshComponent meshComp = entity.getComponent(MeshComponent.class);
            loc.getLocalPosition();
        }
    }
View Full Code Here

        FastRandom rand = new FastRandom(0L);
        rawEntityData = Lists.newArrayList();
        for (int i = 0; i < 1000; ++i) {
            List<Component> entityData = Lists.newArrayList();
            if (rand.nextFloat() < 0.75f) {
                entityData.add(new LocationComponent());
            }
            if (rand.nextFloat() < 0.5f) {
                entityData.add(new MeshComponent());
            }
            if (rand.nextFloat() < 0.5f) {
View Full Code Here

        FastRandom rand = new FastRandom(0L);
        rawEntityData = Lists.newArrayList();
        for (int i = 0; i < 1000; ++i) {
            List<Component> entityData = Lists.newArrayList();
            if (rand.nextFloat() < 0.75f) {
                entityData.add(new LocationComponent());
            }
            if (rand.nextFloat() < 0.5f) {
                entityData.add(new MeshComponent());
            }
            if (rand.nextFloat() < 0.5f) {
View Full Code Here

    }

    @Override
    public void run() {
        for (EntityRef entity : entityManager.getEntitiesWith(LocationComponent.class)) {
            LocationComponent loc = entity.getComponent(LocationComponent.class);
            loc.getLocalPosition();
        }
    }
View Full Code Here

TOP

Related Classes of org.terasology.logic.location.LocationComponent

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.