Package org.terasology.math

Examples of org.terasology.math.Vector3i


        public final Vector3i pos;

        public EntryEvent(ChunkMonitorDisplay display, Vector3i pos, ChunkMonitorEntry entry) {
            super(display);
            this.entry = entry;
            this.pos = pos == null ? null : new Vector3i(pos);
        }
View Full Code Here


        EntityBuilder builder = entityManager.newBuilder("engine:smokeExplosion");
        builder.getComponent(LocationComponent.class).setWorldPosition(origin);
        builder.build();

        Vector3i blockPos = new Vector3i();
        for (int i = 0; i < 64; i++) {
            Vector3f direction = random.nextVector3f(1.0f);
            Vector3f impulse = new Vector3f(direction);
            impulse.scale(150);

            for (int j = 0; j < 4; j++) {
                Vector3f target = new Vector3f(origin);

                target.x += direction.x * j;
                target.y += direction.y * j;
                target.z += direction.z * j;
                blockPos.set((int) target.x, (int) target.y, (int) target.z);
                Block currentBlock = worldProvider.getBlock(blockPos);

                /* PHYSICS */
                if (currentBlock.isDestructible()) {
                    blockEntityRegistry.getEntityAt(blockPos).send(new DoDamageEvent(1000, EngineDamageTypes.EXPLOSIVE.get()));
View Full Code Here

        this.y = y;
        this.z = z;
    }

    public ImmutableBlockLocation move(Side side) {
        final Vector3i directionVector = side.getVector3i();
        return new ImmutableBlockLocation(x+directionVector.x, y+directionVector.y, z+directionVector.z);
    }
View Full Code Here

        final Vector3i directionVector = side.getVector3i();
        return new ImmutableBlockLocation(x+directionVector.x, y+directionVector.y, z+directionVector.z);
    }

    public Vector3i toVector3i() {
        return new Vector3i(x, y, z);
    }
View Full Code Here

        Vector3f dir = new Vector3f(event.getDirection());
        dir.scale(4.0f);
        Vector3f origin = new Vector3f(event.getOrigin());
        origin.add(dir);
        Vector3i blockPos = new Vector3i();

        int particleEffects = 0;
        int blockCounter = MAX_DESTROYED_BLOCKS;
        for (int s = 0; s <= 512; s++) {
            origin.add(dir);
            if (!worldProvider.isBlockRelevant(origin)) {
                break;
            }

            for (int i = 0; i < 64; i++) {
                Vector3f direction = random.nextVector3f(1.0f);
                Vector3f impulse = new Vector3f(direction);
                impulse.scale(200);

                for (int j = 0; j < 3; j++) {
                    Vector3f target = new Vector3f(origin);

                    target.x += direction.x * j;
                    target.y += direction.y * j;
                    target.z += direction.z * j;

                    blockPos.set((int) target.x, (int) target.y, (int) target.z);

                    Block currentBlock = worldProvider.getBlock(blockPos);

                    if (currentBlock.isDestructible()) {
                        if (particleEffects < MAX_PARTICLE_EFFECTS) {
View Full Code Here

    public void renderOverlay() {
        // TODO: Don't render if not in first person?
        // Display the block the player is aiming at
        if (config.getRendering().isRenderPlacingBox()) {
            EntityRef target = cameraTargetSystem.getTarget();
            Vector3i blockPos = cameraTargetSystem.getTargetBlockPosition();
            AABB aabb = null;
            BlockComponent blockComp = target.getComponent(BlockComponent.class);
            BlockRegionComponent blockRegion = target.getComponent(BlockRegionComponent.class);
            if (blockComp != null || blockRegion != null) {
                Block block = worldProvider.getBlock(blockPos);
View Full Code Here

        Camera camera = CoreRegistry.get(WorldRenderer.class).getActiveCamera();

        Physics physicsRenderer = CoreRegistry.get(Physics.class);
        HitResult hitInfo = physicsRenderer.rayTrace(new Vector3f(camera.getPosition()), new Vector3f(camera.getViewingDirection()), TARGET_DISTANCE, filter);
        updateFocalDistance(hitInfo, delta);
        Vector3i newBlockPos = null;

        EntityRef newTarget = EntityRef.NULL;
        if (hitInfo.isHit()) {
            newTarget = hitInfo.getEntity();
            hitPosition = hitInfo.getHitPoint();
            hitNormal = hitInfo.getHitNormal();
            if (hitInfo.isWorldHit()) {
                newBlockPos = new Vector3i(hitInfo.getBlockPosition());
            }
        }
        if (!Objects.equal(target, newTarget) || lostTarget) {
            EntityRef oldTarget = target;
            oldTarget.send(new CameraOutEvent());
View Full Code Here

        return "";
    }

    public Vector3i getTargetBlockPosition() {
        if (targetBlockPos != null) {
            return new Vector3i(targetBlockPos);
        }
        return new Vector3i(hitPosition, 0.5f);
    }
View Full Code Here

public final class NetMessageUtil {
    private NetMessageUtil() {
    }

    public static Vector3i convert(NetData.Vector3iData data) {
        return new Vector3i(data.getX(), data.getY(), data.getZ());
    }
View Full Code Here

    @Test
    public void unblockedSunlightRegenPropagation() {
        Chunk chunk = new ChunkImpl(0, 0, 0);
        InternalLightProcessor.generateInternalLighting(chunk);

        for (Vector3i pos : Region3i.createFromMinAndSize(Vector3i.zero(), new Vector3i(ChunkConstants.SIZE_X, ChunkConstants.SIZE_Y, ChunkConstants.SIZE_Z))) {
            byte expectedRegen = (byte) Math.min(ChunkConstants.SIZE_Y - pos.y - 1, ChunkConstants.MAX_SUNLIGHT_REGEN);
            assertEquals(expectedRegen, chunk.getSunlightRegen(pos));
        }
    }
View Full Code Here

TOP

Related Classes of org.terasology.math.Vector3i

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.